From ba87225d9cb60e25d83da07ba6026772850f681f Mon Sep 17 00:00:00 2001 From: Michael Edgar Date: Fri, 6 Sep 2024 09:01:37 -0400 Subject: [PATCH] [CI] Increase playwright retries, remove waits for `networkidle` state (#1027) * [CI] Increase number of retries for playwright tests in CI environment Signed-off-by: Michael Edgar * fix: remove use of `page.waitForLoadState("networkidle")` in UI tests Signed-off-by: Michael Edgar --------- Signed-off-by: Michael Edgar --- ui/tests/playwright/BrokerPropertyPage.test.tsx | 1 - ui/tests/playwright/BrokersPage.test.tsx | 1 - ui/tests/playwright/ConsumerGroupsPage.test.tsx | 4 +++- ui/tests/playwright/ConsumerPage.test.tsx | 1 - ui/tests/playwright/MessagesPage.test.tsx | 1 - ui/tests/playwright/PartitionsPage.test.tsx | 1 - ui/tests/playwright/TopicConsumers.test.tsx | 1 - ui/tests/playwright/playwright.config.ts | 2 +- 8 files changed, 4 insertions(+), 8 deletions(-) diff --git a/ui/tests/playwright/BrokerPropertyPage.test.tsx b/ui/tests/playwright/BrokerPropertyPage.test.tsx index 6e309a586..68ecbb804 100644 --- a/ui/tests/playwright/BrokerPropertyPage.test.tsx +++ b/ui/tests/playwright/BrokerPropertyPage.test.tsx @@ -10,7 +10,6 @@ test("Brokers property page", async ({page}) => { await page.waitForSelector('text="Clear all filters"',{ timeout: 500000 }); }) await test.step("Brokers page should display properties", async () => { - await page.waitForLoadState("networkidle"); const dataRows = await page.locator('table[aria-label="Node configuration"] tbody tr').count(); expect(dataRows).toBeGreaterThan(0); const dataCells = await page.locator('table[aria-label="Node configuration"] tbody tr td').evaluateAll((tds) => diff --git a/ui/tests/playwright/BrokersPage.test.tsx b/ui/tests/playwright/BrokersPage.test.tsx index ac404e090..e2494e360 100644 --- a/ui/tests/playwright/BrokersPage.test.tsx +++ b/ui/tests/playwright/BrokersPage.test.tsx @@ -8,7 +8,6 @@ test("Brokers page", async ({page}) => { await page.waitForSelector('text="Rack"', { timeout: 500000 }); }) await test.step("Brokers page should display table", async () => { - await page.waitForLoadState("networkidle"); expect(await page.innerText("body")).toContain("Brokers"); expect(await page.innerText("body")).toContain( "Partitions distribution (% of total)", diff --git a/ui/tests/playwright/ConsumerGroupsPage.test.tsx b/ui/tests/playwright/ConsumerGroupsPage.test.tsx index 92b7412bb..ad1ee9dc2 100644 --- a/ui/tests/playwright/ConsumerGroupsPage.test.tsx +++ b/ui/tests/playwright/ConsumerGroupsPage.test.tsx @@ -10,7 +10,9 @@ test("Consumer groups page", async ({ page }) => { }); }); await test.step("Consumer groups page should display table", async () => { - await page.waitForLoadState("networkidle"); + await page.waitForFunction(() => { + return document.querySelectorAll('table[aria-label="Consumer groups"] tbody tr').length > 0; + }); expect(await page.innerText("body")).toContain("Consumer group name"); expect(await page.innerText("body")).toContain("State"); expect(await page.innerText("body")).toContain("Overall lag"); diff --git a/ui/tests/playwright/ConsumerPage.test.tsx b/ui/tests/playwright/ConsumerPage.test.tsx index a835101e0..cac9a0a28 100644 --- a/ui/tests/playwright/ConsumerPage.test.tsx +++ b/ui/tests/playwright/ConsumerPage.test.tsx @@ -9,7 +9,6 @@ test("Consumer page", async ({page}) => { await page.waitForSelector('text="Member ID"', { timeout: 500000 }); }) await test.step("Consumer page should display table", async () => { - await page.waitForLoadState("networkidle"); expect(await page.innerText("body")).toContain("Member ID"); expect(await page.innerText("body")).toContain("Overall lag"); expect(await page.innerText("body")).toContain("Assigned partitions"); diff --git a/ui/tests/playwright/MessagesPage.test.tsx b/ui/tests/playwright/MessagesPage.test.tsx index 363237c16..540c97175 100644 --- a/ui/tests/playwright/MessagesPage.test.tsx +++ b/ui/tests/playwright/MessagesPage.test.tsx @@ -10,7 +10,6 @@ test("Messages page", async ({page}) => { await expect(page.getByText("Last updated").or(page.getByText("No messages data"))).toBeVisible(); }) await test.step("Messages page should display table", async () => { - await page.waitForLoadState("networkidle"); if (await page.getByText("No messages data").isVisible()) { expect(await page.innerText("body")).toContain("Data will appear shortly after we receive produced messages."); return; diff --git a/ui/tests/playwright/PartitionsPage.test.tsx b/ui/tests/playwright/PartitionsPage.test.tsx index ff74c4996..1d20e1099 100644 --- a/ui/tests/playwright/PartitionsPage.test.tsx +++ b/ui/tests/playwright/PartitionsPage.test.tsx @@ -13,7 +13,6 @@ test("Partitions page", async ({page}) => { }) await test.step("Partitions page should display table", async () => { - await page.waitForLoadState("networkidle"); expect(await page.innerText("body")).toContain("Partition ID"); expect(await page.innerText("body")).toContain("Status"); expect(await page.innerText("body")).toContain("Replicas"); diff --git a/ui/tests/playwright/TopicConsumers.test.tsx b/ui/tests/playwright/TopicConsumers.test.tsx index 8890f530e..2da03794a 100644 --- a/ui/tests/playwright/TopicConsumers.test.tsx +++ b/ui/tests/playwright/TopicConsumers.test.tsx @@ -12,7 +12,6 @@ test("Topics consumers", async ({page}) => { await expect(page.getByText("Consumer group name").or(page.getByText("No consumer groups"))).toBeVisible(); }) await test.step("Topics consumers page should display table", async () => { - await page.waitForLoadState("networkidle"); expect(await page.innerText("body")).toContain("Consumer group name"); expect(await page.innerText("body")).toContain("Overall lag"); expect(await page.innerText("body")).toContain("State"); diff --git a/ui/tests/playwright/playwright.config.ts b/ui/tests/playwright/playwright.config.ts index 63b63cc19..3b541c39a 100644 --- a/ui/tests/playwright/playwright.config.ts +++ b/ui/tests/playwright/playwright.config.ts @@ -2,7 +2,7 @@ import { defineConfig, devices } from "playwright/test"; export default defineConfig({ // Retry on CI only. - retries: process.env.CI_CLUSTER ? 2 : 0, + retries: process.env.CI_CLUSTER ? 5 : 0, // Opt out of parallel tests on CI. workers: process.env.CI_CLUSTER ? 1 : undefined,