Skip to content

Commit

Permalink
Fix linter err
Browse files Browse the repository at this point in the history
  • Loading branch information
musienko-maxim committed Nov 12, 2024
1 parent 9d0a1ba commit 3f7cf76
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 25 deletions.
19 changes: 9 additions & 10 deletions tests/e2e/pageobjects/openshift/OcpMainPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { Logger } from '../../utils/Logger';
import { TIMEOUT_CONSTANTS } from '../../constants/TIMEOUT_CONSTANTS';
import { OcpImportFromGitPage } from './OcpImportFromGitPage';
import { e2eContainer } from '../../configs/inversify.config';
import {BrowserTabsUtil} from "../../utils/BrowserTabsUtil";
import { BrowserTabsUtil } from '../../utils/BrowserTabsUtil';

@injectable()
export class OcpMainPage {
Expand Down Expand Up @@ -85,6 +85,14 @@ export class OcpMainPage {
await this.driverHelper.waitAndClick(this.getProjectDropdownItemLocator(projectName));
}

async clickOnAppLauncherAndDevSpaceItem(): Promise<void> {
Logger.debug('click on app launcher menu');
const parentGUID: string = await this.browserTabsUtil.getCurrentWindowHandle();
await this.driverHelper.waitAndClick(By.css('nav[data-test-id="application-launcher"]'));
await this.driverHelper.waitAndClick(By.xpath('//span[contains(.,"Red Hat OpenShift Dev Spaces")]'));
await this.browserTabsUtil.waitAndSwitchToAnotherWindow(parentGUID, TIMEOUT_CONSTANTS.TS_SELENIUM_LOAD_PAGE_TIMEOUT);
}

private getRoleLocator(role: string): By {
return By.xpath(`//a//*[text()="${role}"]`);
}
Expand All @@ -98,7 +106,6 @@ export class OcpMainPage {

await this.driverHelper.waitAndClick(this.getRoleLocator(role));
}

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

Expand All @@ -110,12 +117,4 @@ export class OcpMainPage {
Logger.debug('welcome tour modal dialog was not located');
}
}
async clickOnAppLauncherAndDevSpaceItem(): Promise<void> {
Logger.debug('click on app launcher menu');
const parentGUID: string = await this.browserTabsUtil.getCurrentWindowHandle();
await this.driverHelper.waitAndClick(By.css('nav[data-test-id=\'application-launcher\']'));
await this.driverHelper.waitAndClick(By.xpath('//span[contains(.,\'Red Hat OpenShift Dev Spaces\')]'));
await this.browserTabsUtil.waitAndSwitchToAnotherWindow(parentGUID, TIMEOUT_CONSTANTS.TS_SELENIUM_LOAD_PAGE_TIMEOUT);

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { LoginTests } from '../../tests-library/LoginTests';
import { e2eContainer } from '../../configs/inversify.config';
import { CLASSES } from '../../configs/inversify.types';
import { WorkspaceHandlingTests } from '../../tests-library/WorkspaceHandlingTests';
import { DriverHelper } from '../../utils/DriverHelper';
import { ProjectAndFileTests } from '../../tests-library/ProjectAndFileTests';
import { expect } from 'chai';
import { OcpMainPage } from '../../pageobjects/openshift/OcpMainPage';
Expand All @@ -26,22 +25,21 @@ import { BASE_TEST_CONSTANTS } from '../../constants/BASE_TEST_CONSTANTS';
import { BrowserTabsUtil } from '../../utils/BrowserTabsUtil';
import { Dashboard } from '../../pageobjects/dashboard/Dashboard';
import { TIMEOUT_CONSTANTS } from '../../constants/TIMEOUT_CONSTANTS';
import {Logger} from "../../utils/Logger";
import {ShellExecutor} from "../../utils/ShellExecutor";
import {ShellString} from "shelljs";
import { Logger } from '../../utils/Logger';
import { ShellExecutor } from '../../utils/ShellExecutor';
import { ShellString } from 'shelljs';

suite(`DevConsole Integration ${BASE_TEST_CONSTANTS.TEST_ENVIRONMENT}`, function (): void {
let ocpImportPage: OcpImportFromGitPage;
let ocpApplicationPage: OcpApplicationPage;
let parentGUID=''
let parentGUID: string = '';
const projectAndFileTests: ProjectAndFileTests = e2eContainer.get(CLASSES.ProjectAndFileTests);
const dashboard: Dashboard = e2eContainer.get(CLASSES.Dashboard);
const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests);
const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
const shellExecutor: ShellExecutor = e2eContainer.get(CLASSES.ShellExecutor);
const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil);
const ocpMainPage: OcpMainPage = e2eContainer.get(CLASSES.OcpMainPage);
const driverHelper: DriverHelper = e2eContainer.get(CLASSES.DriverHelper);
const kubernetesCommandLineToolsExecutor: KubernetesCommandLineToolsExecutor = e2eContainer.get(
CLASSES.KubernetesCommandLineToolsExecutor
);
Expand All @@ -54,7 +52,7 @@ suite(`DevConsole Integration ${BASE_TEST_CONSTANTS.TEST_ENVIRONMENT}`, function
suiteSetup('Create new empty project using ocp', function (): void {
kubernetesCommandLineToolsExecutor.loginToOcp();
// delete the test project on a cluster if it has not been deleted properly in the previous run
const expectedProject :ShellString = shellExecutor.executeCommand(`oc get project ${projectName}`);
const expectedProject: ShellString = shellExecutor.executeCommand(`oc get project ${projectName}`);
if (expectedProject.stderr.length === 0) {
kubernetesCommandLineToolsExecutor.deleteProject(projectName);
}
Expand All @@ -63,8 +61,6 @@ suite(`DevConsole Integration ${BASE_TEST_CONSTANTS.TEST_ENVIRONMENT}`, function

loginTests.loginIntoOcpConsole();



test('Select test project and Developer role on DevConsole', async function (): Promise<void> {
parentGUID = await browserTabsUtil.getCurrentWindowHandle();
await ocpMainPage.selectDeveloperRole();
Expand Down Expand Up @@ -120,27 +116,25 @@ suite(`DevConsole Integration ${BASE_TEST_CONSTANTS.TEST_ENVIRONMENT}`, function
).not.undefined;
});

test ('Check redirection to DevSpaces from App launcher', async function (): Promise<void> {
test('Check redirection to DevSpaces from App launcher', async function (): Promise<void> {
await browserTabsUtil.switchToWindow(parentGUID);
await browserTabsUtil.closeAllTabsExceptCurrent();
await ocpMainPage.clickOnAppLauncherAndDevSpaceItem();
await loginTests.loginIntoChe();
await dashboard.waitPage()
await dashboard.waitPage();
});

suiteTeardown('Delete project using ocp', function (): void {
kubernetesCommandLineToolsExecutor.workspaceName =
WorkspaceHandlingTests.getWorkspaceName() !== '' ? WorkspaceHandlingTests.getWorkspaceName() : 'spring-music';
try {
kubernetesCommandLineToolsExecutor.deleteDevWorkspace();
}
catch (err) {
} catch (err) {
Logger.error(`Error while deleting workspace: ${err}`);
}
try {
kubernetesCommandLineToolsExecutor.deleteProject(projectName);
}
catch (err) {
} catch (err) {
Logger.error(`Cannot delete the project: ${err}`);
}
});
Expand Down

0 comments on commit 3f7cf76

Please sign in to comment.