Skip to content

Commit

Permalink
Revert "Rewrite test userstory for WTO under admin (#22748)"
Browse files Browse the repository at this point in the history
This reverts commit 66ed29f.
  • Loading branch information
dmytro-ndp committed Jan 11, 2024
1 parent 0929c9c commit e2e5c7f
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 230 deletions.
3 changes: 1 addition & 2 deletions tests/e2e/configs/inversify.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ import { Main as Generator } from '@eclipse-che/che-devworkspace-generator/lib/m
import { ContainerTerminal, KubernetesCommandLineToolsExecutor } from '../utils/KubernetesCommandLineToolsExecutor';
import { ShellExecutor } from '../utils/ShellExecutor';
import { UserPreferences } from '../pageobjects/dashboard/UserPreferences';
import { WebTerminalPage } from "../pageobjects/webterminal/WebTerminalPage";

const e2eContainer: Container = new Container({ defaultScope: 'Transient', skipBaseClassChecks: true });

Expand Down Expand Up @@ -86,8 +85,8 @@ e2eContainer.bind<DevfilesRegistryHelper>(CLASSES.DevfilesRegistryHelper).to(Dev
e2eContainer.bind<KubernetesCommandLineToolsExecutor>(CLASSES.KubernetesCommandLineToolsExecutor).to(KubernetesCommandLineToolsExecutor);
e2eContainer.bind<ShellExecutor>(CLASSES.ShellExecutor).to(ShellExecutor);
e2eContainer.bind<ContainerTerminal>(CLASSES.ContainerTerminal).to(ContainerTerminal);
e2eContainer.bind<WebTerminalPage>(CLASSES.WebTerminalPage).to(WebTerminalPage);
e2eContainer.bind<UserPreferences>(CLASSES.UserPreferences).to(UserPreferences);

e2eContainer.bind<Generator>(EXTERNAL_CLASSES.Generator).to(Generator);
e2eContainer.bind<LocatorLoader>(EXTERNAL_CLASSES.LocatorLoader).to(LocatorLoader);

Expand Down
3 changes: 1 addition & 2 deletions tests/e2e/configs/inversify.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ const CLASSES: any = {
KubernetesCommandLineToolsExecutor: 'KubernetesCommandLineToolsExecutor',
ShellExecutor: 'ShellExecutor',
ContainerTerminal: 'ContainerTerminal',
UserPreferences: 'UserPreferences',
WebTerminalPage: 'WebTerminalPage'
UserPreferences: 'UserPreferences'
};

const EXTERNAL_CLASSES: any = {
Expand Down
16 changes: 6 additions & 10 deletions tests/e2e/constants/REPORTER_CONSTANTS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { MOCHA_CONSTANTS } from './MOCHA_CONSTANTS';

export const REPORTER_CONSTANTS: {
DELETE_SCREENCAST_IF_TEST_PASS: boolean;
RP_ENDPOINT(): string | undefined;
RP_ENDPOINT(): string;
RP_IS_LOCAL_SERVER: boolean;
REPORTERS_ENABLED(): string;
RP_API_KEY: string;
Expand Down Expand Up @@ -124,18 +124,14 @@ export const REPORTER_CONSTANTS: {
/**
* url with endpoints where ReportPortal is
*/
RP_ENDPOINT: (): string | undefined => {
if (process.env.RP_ENDPOINTRP_IS_LOCAL_SERVER) {
return 'http://localhost:8080/api/v1';
}
if (process.env.RP_ENDPOINT !== '') {
return process.env.RP_ENDPOINT;
}
return 'https://reportportal-crw.apps.ocp-c1.prod.psi.redhat.com/api/v1';
RP_ENDPOINT: (): string => {
return process.env.RP_ENDPOINT || REPORTER_CONSTANTS.RP_IS_LOCAL_SERVER
? 'http://localhost:8080/api/v1'
: 'https://reportportal-crw.apps.ocp-c1.prod.psi.redhat.com/api/v1';
},

/**
* use personal project to save launch, if false launch will be sent to devspaces or che project, true by default
* use personal project to save launch, if false launch will be send to devspaces or che project, true by default
*/
RP_USE_PERSONAL: process.env.RP_USE_PERSONAL !== 'false',

Expand Down
2 changes: 0 additions & 2 deletions tests/e2e/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export * from './utils/workspace/TestWorkspaceUtil';
export * from './utils/workspace/WorkspaceStatus';
export * from './pageobjects/dashboard/CreateWorkspace';
export * from './pageobjects/dashboard/Dashboard';
export * from './pageobjects/dashboard/UserPreferences';
export * from './pageobjects/dashboard/workspace-details/WorkspaceDetails';
export * from './pageobjects/dashboard/Workspaces';
export * from './pageobjects/git-providers/OauthPage';
Expand All @@ -41,7 +40,6 @@ export * from './pageobjects/login/openshift/RegularUserOcpCheLoginPage';
export * from './pageobjects/openshift/OcpApplicationPage';
export * from './pageobjects/openshift/OcpImportFromGitPage';
export * from './pageobjects/openshift/OcpMainPage';
export * from './pageobjects/webterminal/WebTerminalPage';
export * from './tests-library/LoginTests';
export * from './tests-library/ProjectAndFileTests';
export * from './tests-library/WorkspaceHandlingTests';
Expand Down
19 changes: 19 additions & 0 deletions tests/e2e/pageobjects/openshift/OcpMainPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ export class OcpMainPage {
private static readonly SELECT_PROJECT_DROPDOWN: By = By.xpath('//div[@class="co-namespace-dropdown"]//button');
private static readonly PROJECT_FILTER_INPUT: By = By.xpath('//*[@data-test="dropdown-text-filter"]');
private static readonly SKIP_TOUR_BUTTON: By = By.xpath('//*[text()="Skip tour"]');
private static readonly WEB_TERMINAL_BUTTON: By = By.xpath('//button[@data-quickstart-id="qs-masthead-cloudshell"]');
private static readonly WEB_TERMINAL_PAGE: By = By.xpath('//*[@class="xterm-helper-textarea"]');
private static readonly START_WT_COMMAND_LINE_TERMINAL_BUTTON: By = By.xpath('//*[@data-test-id="submit-button"]');

constructor(
@inject(CLASSES.DriverHelper)
Expand Down Expand Up @@ -82,6 +85,22 @@ export class OcpMainPage {
await this.driverHelper.waitAndClick(this.getProjectDropdownItemLocator(projectName));
}

async openWebTerminal(): Promise<void> {
Logger.debug();

await this.waitOpenMainPage();
await this.driverHelper.waitAndClick(OcpMainPage.WEB_TERMINAL_BUTTON);
await this.driverHelper.waitAndClick(OcpMainPage.START_WT_COMMAND_LINE_TERMINAL_BUTTON);
await this.driverHelper.waitPresence(OcpMainPage.WEB_TERMINAL_PAGE, TIMEOUT_CONSTANTS.TS_WAIT_LOADER_ABSENCE_TIMEOUT);
}

async typeToWebTerminal(text: string): Promise<void> {
Logger.debug();

await this.driverHelper.waitPresence(OcpMainPage.WEB_TERMINAL_PAGE, TIMEOUT_CONSTANTS.TS_IDE_LOAD_TIMEOUT);
await this.driverHelper.typeToInvisible(OcpMainPage.WEB_TERMINAL_PAGE, text);
}

private getRoleLocator(role: string): By {
return By.xpath(`//a//*[text()="${role}"]`);
}
Expand Down
119 changes: 0 additions & 119 deletions tests/e2e/pageobjects/webterminal/WebTerminalPage.ts

This file was deleted.

4 changes: 1 addition & 3 deletions tests/e2e/specs/web-terminal/WebTerminalTest.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@ import { BASE_TEST_CONSTANTS } from '../../constants/BASE_TEST_CONSTANTS';
import { KubernetesCommandLineToolsExecutor } from '../../utils/KubernetesCommandLineToolsExecutor';
import { ShellExecutor } from '../../utils/ShellExecutor';
import { expect } from 'chai';
import { WebTerminalPage } from '../../pageobjects/webterminal/WebTerminalPage';

suite(`Login to Openshift console and start WebTerminal ${BASE_TEST_CONSTANTS.TEST_ENVIRONMENT}`, function (): void {
const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests);
const webTerminal: WebTerminalPage = e2eContainer.get(CLASSES.WebTerminalPage);
const ocpMainPage: OcpMainPage = e2eContainer.get(CLASSES.OcpMainPage);
const kubernetesCommandLineToolsExecutor: KubernetesCommandLineToolsExecutor = e2eContainer.get(
CLASSES.KubernetesCommandLineToolsExecutor
Expand All @@ -35,7 +33,7 @@ suite(`Login to Openshift console and start WebTerminal ${BASE_TEST_CONSTANTS.TE

test('Open Web Terminal', async function (): Promise<void> {
await ocpMainPage.waitOpenMainPage();
await webTerminal.openWebTerminal();
await ocpMainPage.openWebTerminal();
});

test('Check username is correct', function (): void {
Expand Down
92 changes: 0 additions & 92 deletions tests/e2e/specs/web-terminal/WebTerminalUnderAdmin.spec.ts

This file was deleted.

0 comments on commit e2e5c7f

Please sign in to comment.