Skip to content

Commit

Permalink
update dismiss dialog for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Naseem77 committed Jan 8, 2025
1 parent 79957c4 commit 4cfd40d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
8 changes: 0 additions & 8 deletions e2e/logic/POM/graphPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ export class graphPage extends BasePage {
return this.page.locator("//div[@role='dialog']//form//button[@title='Create your Graph']");
}

private get dissmissDialogCheckbox(): Locator {
return this.page.locator("//div[p[text()=\"Don't show this again\"]]//button");
}

private get exportDataBtn(): Locator {
return this.page.getByRole("button", { name : "Export Data"});
}
Expand Down Expand Up @@ -125,8 +121,4 @@ export class graphPage extends BasePage {
await this.confirmGraphDeleteBtn.click()
}

async dismissDialogAtStart(): Promise<void>{
await this.dissmissDialogCheckbox.click();
await this.page.mouse.click(10, 10);
}
}
9 changes: 9 additions & 0 deletions e2e/logic/POM/loginPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ export class LoginPage extends BasePage {
return this.page.locator("//input[@id='Password']");
}

private get dissmissDialogCheckbox(): Locator {
return this.page.locator("//div[p[text()=\"Don't show this again\"]]//button");
}

async clickOnConnect(): Promise<void> {
await this.connectBtn.click();
await waitForURL(this.page, urls.graphUrl);
Expand All @@ -28,4 +32,9 @@ export class LoginPage extends BasePage {
await waitForURL(this.page, urls.graphUrl);
}

async dismissDialogAtStart(): Promise<void>{
await this.dissmissDialogCheckbox.click();
await this.page.mouse.click(10, 10);
}

}
2 changes: 2 additions & 0 deletions e2e/tests/auth.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ setup("admin authentication", async () => {
const browserWrapper = new BrowserWrapper();
const loginPage = await browserWrapper.createNewPage(LoginPage, urls.loginUrl);
await loginPage.clickOnConnect();
await loginPage.dismissDialogAtStart();
const context = browserWrapper.getContext();
await context!.storageState({ path: adminAuthFile });

Expand All @@ -37,6 +38,7 @@ userRoles.forEach(({ name, file, userName }) => {
const browserWrapper = new BrowserWrapper();
const loginPage = await browserWrapper.createNewPage(LoginPage, urls.loginUrl);
await loginPage.connectWithCredentials(userName, user.password);
await loginPage.dismissDialogAtStart();
const context = browserWrapper.getContext();
await context!.storageState({ path: file });
} catch (error) {
Expand Down
1 change: 0 additions & 1 deletion e2e/tests/graph.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ test.describe('Graph Tests', () => {
test.beforeAll(async () => {
browser = new BrowserWrapper();
const graph = await browser.createNewPage(graphPage, urls.graphUrl)
await graph.dismissDialogAtStart();
await graph.removeAllGraphs();
})

Expand Down

0 comments on commit 4cfd40d

Please sign in to comment.