Skip to content

Commit

Permalink
fix: wait dashboard after login
Browse files Browse the repository at this point in the history
Signed-off-by: mdolhalo <[email protected]>
  • Loading branch information
mdolhalo committed Apr 26, 2023
1 parent f0ed977 commit b0028ce
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
6 changes: 4 additions & 2 deletions tests/e2e/pageobjects/openshift/OcpImportFromGitPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ export class OcpImportFromGitPage {
async clickOnAdvancedOptionsButton(): Promise<void> {
Logger.debug(`${this.constructor.name}.${this.clickOnAdvancedOptionsButton.name}`);

await this.driverHelper.waitAndClick(By.xpath('//*[text()="Show advanced Git options"]//ancestor::button'), this.TIMEOUT);
if (!(await this.driverHelper.isVisible(By.xpath('//*[text()="Hide advanced Git options"]')))) {
await this.driverHelper.waitAndClick(By.xpath('//*[text()="Show advanced Git options"]//ancestor::button'), this.TIMEOUT);
}
}

async enterGitReference(gitReference: string): Promise<void> {
Expand All @@ -48,7 +50,7 @@ export class OcpImportFromGitPage {
async selectBuilderImageImportStrategy(): Promise<void> {
Logger.debug(`${this.constructor.name}.${this.selectBuilderImageImportStrategy.name}`);

await this.driverHelper.waitPresence(By.xpath('//*[text()="Multiple import strategies detected"]'), this.TIMEOUT);
await this.driverHelper.waitPresence(By.xpath('//*[text()="Import is not possible."]'), this.TIMEOUT);
await this.driverHelper.waitAndClick(By.xpath('//*[text()="Edit Import Strategy"]//ancestor::button'), this.TIMEOUT);
await this.driverHelper.waitAndClick(By.xpath('//*[text()="Builder Image"]//parent::div//parent::div'), this.TIMEOUT);
}
Expand Down
16 changes: 8 additions & 8 deletions tests/e2e/pageobjects/openshift/OcpMainPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,31 +33,31 @@ export class OcpMainPage {
@inject(CLASSES.BrowserTabsUtil) private readonly browserTabsUtil: BrowserTabsUtil) { }

async waitOpenMainPage(): Promise<void> {
Logger.debug('OcpLoginPage.waitOpenShiftLoginWelcomePage');
Logger.debug(`${this.constructor.name}.${this.waitOpenMainPage.name}`);

await this.driverHelper.waitVisibility(OcpMainPage.MAIN_PAGE_HEADER_LOCATOR, TimeoutConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT);
}

async clickOnSelectRoleButton(): Promise<void> {
Logger.debug('OcpLoginPage.clickOnLoginProviderTitle');
Logger.debug(`${this.constructor.name}.${this.clickOnSelectRoleButton.name}`);

await this.driverHelper.waitAndClick(OcpMainPage.SELECT_ROLE_BUTTON_LOCATOR);
}

async clickAddToProjectButton(): Promise<void> {
Logger.debug('OcpLoginPage.clickOnLoginProviderTitle');
Logger.debug(`${this.constructor.name}.${this.clickAddToProjectButton.name}`);

await this.driverHelper.waitAndClick(OcpMainPage.ADD_BUTTON_LOCATOR);
}

async selectDeveloperRose(): Promise<void> {
Logger.debug('OcpLoginPage.clickOnLoginProviderTitle');
async selectDeveloperRole(): Promise<void> {
Logger.debug(`${this.constructor.name}.${this.selectDeveloperRole.name}`);

await this.driverHelper.waitAndClick(this.getRoleLocator('Developer'));
}

async selectImportFromGitMethod(): Promise<OcpImportFromGitPage> {
Logger.debug('OcpLoginPage.clickOnLoginProviderTitle');
Logger.debug(`${this.constructor.name}.${this.selectImportFromGitMethod.name}`);

await this.driverHelper.waitAndClick(OcpMainPage.IMPORT_FROM_GIT_ITEM_LOCATOR);
return e2eContainer.get(CLASSES.OcpImportFromGitPage);
Expand All @@ -66,13 +66,13 @@ export class OcpMainPage {
async openImportFromGitPage(): Promise<OcpImportFromGitPage> {
await this.waitOpenMainPage();
await this.clickOnSelectRoleButton();
await this.selectDeveloperRose();
await this.selectDeveloperRole();
await this.clickAddToProjectButton();
return await this.selectImportFromGitMethod();
}

async selectProject(projectName: string): Promise<void> {
Logger.debug('OcpLoginPage.clickOnLoginProviderTitle');
Logger.debug(`${this.constructor.name}.${this.selectProject.name}`);

await this.driverHelper.waitAndClick(OcpMainPage.SELECT_PROJECT_DROPDOWN_LOCATOR);
await this.driverHelper.enterValue(OcpMainPage.PROJECT_FILTER_INPUT_LOCATOR, projectName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ suite(`DevConsole Integration`, async function (): Promise<void> {
});

test('Fill and submit import data', async function (): Promise<void> {
this.retries(5);
await driverHelper.refreshPage();
ocpApplicationPage = await ocpImportPage.fitAndSubmitConfiguration(gitImportRepo, gitImportReference, projectLabel);
});

Expand Down

0 comments on commit b0028ce

Please sign in to comment.