Skip to content

Commit 9c56162

Browse files
authored
test(notification): wait for page to load (#2248)
* test(notification): wait for page to load * use waitForLoad
1 parent a59601a commit 9c56162

File tree

1 file changed

+8
-21
lines changed

1 file changed

+8
-21
lines changed

workspaces/backstage/e2e-tests/support/pages/notifications.ts

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,15 @@ export class NotificationPage {
1212

1313
async clickNotificationsNavBarItem() {
1414
await this.uiHelper.openSidebar("Notifications");
15-
await expect(
16-
this.page.getByTestId("loading-indicator").getByRole("img"),
17-
).toHaveCount(0);
15+
await this.uiHelper.verifyHeading("Notifications");
16+
await this.uiHelper.waitForLoad();
1817
}
1918

2019
async notificationContains(text: string | RegExp) {
2120
await this.page.getByLabel("rows").click();
2221
// always expand the notifications table to show as many notifications as possible
2322
await this.page.getByRole("option", { name: "20" }).click();
24-
await expect(
25-
this.page.getByTestId("loading-indicator").getByRole("img"),
26-
).toHaveCount(0);
23+
await this.uiHelper.waitForLoad();
2724
const row = this.page.locator(`tr`, { hasText: text }).first();
2825
await expect(row).toHaveCount(1);
2926
}
@@ -38,9 +35,7 @@ export class NotificationPage {
3835
await expect(
3936
this.page.getByRole("table").filter({ hasText: "Rows per page" }),
4037
).toBeVisible();
41-
await expect(
42-
this.page.getByTestId("loading-indicator").getByRole("img"),
43-
).toHaveCount(0);
38+
await this.uiHelper.waitForLoad();
4439
}
4540

4641
async saveSelected() {
@@ -49,17 +44,13 @@ export class NotificationPage {
4944
.getByTitle("Save selected for later")
5045
.getByRole("button")
5146
.click();
52-
await expect(
53-
this.page.getByTestId("loading-indicator").getByRole("img"),
54-
).toHaveCount(0);
47+
await this.uiHelper.waitForLoad();
5548
}
5649

5750
async viewSaved() {
5851
await this.page.getByLabel("View").click();
5952
await this.page.getByRole("option", { name: "Saved" }).click();
60-
await expect(
61-
this.page.getByTestId("loading-indicator").getByRole("img"),
62-
).toHaveCount(0);
53+
await this.uiHelper.waitForLoad();
6354
}
6455

6556
async markNotificationAsRead(text: string) {
@@ -77,18 +68,14 @@ export class NotificationPage {
7768
await this.page
7869
.getByRole("option", { name: "Read notifications", exact: true })
7970
.click();
80-
await expect(
81-
this.page.getByTestId("loading-indicator").getByRole("img"),
82-
).toHaveCount(0);
71+
await this.uiHelper.waitForLoad();
8372
}
8473

8574
async viewUnRead() {
8675
await this.page.getByLabel("View").click();
8776
await this.page
8877
.getByRole("option", { name: "Unread notifications", exact: true })
8978
.click();
90-
await expect(
91-
this.page.getByTestId("loading-indicator").getByRole("img"),
92-
).toHaveCount(0);
79+
await this.uiHelper.waitForLoad();
9380
}
9481
}

0 commit comments

Comments
 (0)