diff --git a/playwright/spa-helpers.ts b/playwright/spa-helpers.ts index 46c414c97..24869141f 100644 --- a/playwright/spa-helpers.ts +++ b/playwright/spa-helpers.ts @@ -125,21 +125,10 @@ async function expectVideoTilesCount(page: Page, count: number): Promise { }); // There should be `count` video elements, visible and autoplaying - await expect(page.locator("video")).toHaveCount(count); - - await expect(async () => { - const videoBlockCount = await page - .locator("video") - .evaluateAll( - (videos: Element[]) => - videos.filter( - (v: Element) => window.getComputedStyle(v).display === "block", - ).length, - ); - expect(videoBlockCount).toBe(count); - }).toPass({ - timeout: 10000, - }); + await expect(page.locator("video").filter({ visible: true })).toHaveCount( + count, + { timeout: 10000 }, + ); } export const SpaHelpers = { diff --git a/playwright/widget/test-helpers.ts b/playwright/widget/test-helpers.ts index 471c4a8f4..3f0bbeed4 100644 --- a/playwright/widget/test-helpers.ts +++ b/playwright/widget/test-helpers.ts @@ -385,11 +385,9 @@ export class TestHelpers { frame: FrameLocator, count: number, ): Promise { - await expect( - frame - .getByRole("img") - .and(frame.locator("video")) - .filter({ visible: true }), - ).toHaveCount(count, { timeout: 10000 }); + await expect(frame.locator("video").filter({ visible: true })).toHaveCount( + count, + { timeout: 10000 }, + ); } }