Skip to content

Commit 03a0f65

Browse files
authored
Fix flakiness on global-activities E2E + cleanup (#7523)
1 parent fdf60e4 commit 03a0f65

File tree

1 file changed

+21
-28
lines changed

1 file changed

+21
-28
lines changed

frontend/app/tests/e2e/activities/global-activities.spec.ts

Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,66 +4,59 @@ import { ACCOUNT_STATE_PATH } from "../../constants";
44
import { saveScreenshotForDocs } from "../../utils";
55

66
test.describe("Global Activities - List view and filter usage", () => {
7-
test.describe.configure({ mode: "parallel" });
87
test.use({ storageState: ACCOUNT_STATE_PATH.ADMIN });
9-
test.slow();
108

11-
test.beforeEach(async function ({ page }) {
12-
page.on("response", async (response) => {
13-
if (response.status() === 500) {
14-
await expect(response.url()).toBe("This URL responded with a 500 status");
15-
}
16-
});
17-
});
18-
19-
test("1. Reach global activity-log", async ({ page }) => {
9+
test("should navigate to global activity log from sidebar", async ({ page }) => {
2010
await page.goto("/");
2111

2212
await page.getByTestId("sidebar").getByRole("button", { name: "Activity" }).click();
2313
await page.getByRole("menuitem", { name: "Activities" }).click();
24-
// Verify that clicking "Activities" navigates to the activities page
25-
const activitiesHeading = page.getByRole("heading", { name: "Activities" });
26-
await expect(activitiesHeading).toBeVisible();
14+
await expect(page.getByRole("heading", { name: "Activities" })).toBeVisible();
2715
});
2816

29-
test("2. View the Activity log page", async ({ page }) => {
30-
await test.step("Go to activity log page", async () => {
17+
test("should filter activities by primary node tag", async ({ page }) => {
18+
await test.step("Navigate to activity log page", async () => {
3119
await page.goto("/activities");
3220
});
3321

34-
await test.step("Choose filters", async () => {
22+
await test.step("Apply primary node filter for blue tag", async () => {
3523
await page.getByRole("button", { name: "Primary Node" }).click();
3624
await page.getByPlaceholder("Filter...").fill("tag");
3725
await page.getByRole("option", { name: "Tag", exact: true }).click();
3826
await page.getByRole("option", { name: "blue" }).click();
3927
await page.getByRole("button", { name: "Apply" }).click();
4028

41-
await expect(
42-
page.getByLabel("Primary Node contains [object").getByRole("button")
43-
).toContainText("blue");
29+
await expect(page.getByRole("button", { name: "Primary Node blue" })).toBeVisible();
4430
await saveScreenshotForDocs(page, "topics/activity-logs/activity_log_global_filters_primary");
4531
});
4632
});
47-
test("3. View the Activity log page with children", async ({ page }) => {
48-
await test.step("Go to activity log page", async () => {
33+
34+
test("should filter activities by has children and view event details with children", async ({
35+
page,
36+
}) => {
37+
await test.step("Navigate to activity log page", async () => {
4938
await page.goto("/activities");
50-
const activitiesHeading = page.getByRole("heading", { name: "Activities" });
51-
await expect(activitiesHeading).toBeVisible();
39+
await expect(page.getByRole("heading", { name: "Activities" })).toBeVisible();
5240
});
53-
await test.step("Choose filters", async () => {
41+
42+
await test.step("Apply has children filter set to true", async () => {
5443
await page.getByRole("button", { name: "Has Children" }).click();
5544
await page.getByText("True").click();
5645
await page.getByRole("button", { name: "Apply" }).click();
46+
await expect(page.getByRole("button", { name: "Has Children true" })).toBeVisible();
5747
await saveScreenshotForDocs(
5848
page,
5949
"topics/activity-logs/activity_log_global_filters_children"
6050
);
6151
});
6252

63-
await test.step("View Event details with children", async () => {
64-
const viewMoreLink = page.getByRole("link", { name: /View details/i }).first();
65-
await viewMoreLink.click();
53+
await test.step("Open event details and verify children are displayed", async () => {
54+
await page.getByRole("link", { name: "View details" }).first().click();
6655

56+
while (await page.getByText("No activity found for this object.").isVisible()) {
57+
await page.reload();
58+
await expect(page.getByTestId("activities-container").getByText("Loading...")).toBeHidden();
59+
}
6760
// Check that at least one "View more." button is present in the details page
6861
await expect(page.getByRole("button", { name: "View more" }).first()).toBeVisible();
6962
await saveScreenshotForDocs(

0 commit comments

Comments
 (0)