Skip to content

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.

Fix flaky Playwright CI tests (#2378)

Olga Bulat9471728b4686
diff --git a/.eslintrc.js b/.eslintrc.js
index 2df9e9132..197ddc8c7 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -185,7 +185,6 @@ module.exports = {
"tsdoc/syntax": "error",
},
},
- // Overrides for unit tests
{
env: { jest: true },
files: ["frontend/test/unit/**"],
@@ -213,21 +212,6 @@ module.exports = {
],
},
},
- // Overrides for Playwright tests
- {
- files: ["frontend/test/{playwright,storybook}/**/*.spec.{ts,js}"],
- rules: {
- "no-restricted-syntax": [
- "error",
- {
- selector:
- "ImportDeclaration[source.value='@playwright/test']:has(ImportSpecifier[local.name='test'])",
- message:
- "Do not import 'test' from '@playwright/test'. Use 'import { test } from '~~/test/playwright/utils/test-fixture' instead, which mocks Openverse provider APIs and the analytics server.",
- },
- ],
- },
- },
{
files: ["automations/js/src/**"],
rules: {
diff --git a/frontend/.remake/component-storybook-test/remake-fileName.spec.ts b/frontend/.remake/component-storybook-test/remake-fileName.spec.ts
index 5668f361a..8e9eb589a 100644
--- a/frontend/.remake/component-storybook-test/remake-fileName.spec.ts
+++ b/frontend/.remake/component-storybook-test/remake-fileName.spec.ts
@@ -1,4 +1,4 @@
-import { test } from "~~/test/playwright/utils/test-fixture"
+import { test } from "@playwright/test"
import breakpoints from "~~/test/playwright/utils/breakpoints"
diff --git a/frontend/test/playwright/e2e/all-results-keyboard.spec.ts b/frontend/test/playwright/e2e/all-results-keyboard.spec.ts
index 57df48e15..ab1eb3855 100644
--- a/frontend/test/playwright/e2e/all-results-keyboard.spec.ts
+++ b/frontend/test/playwright/e2e/all-results-keyboard.spec.ts
@@ -1,6 +1,4 @@
-import { expect, Page } from "@playwright/test"
-
-import { test } from "~~/test/playwright/utils/test-fixture"
+import { test, expect, Page } from "@playwright/test"
import audio from "~~/test/playwright/utils/audio"
diff --git a/frontend/test/playwright/e2e/attribution.spec.ts b/frontend/test/playwright/e2e/attribution.spec.ts
index cb1687107..c6a4e50f2 100644
--- a/frontend/test/playwright/e2e/attribution.spec.ts
+++ b/frontend/test/playwright/e2e/attribution.spec.ts
@@ -1,6 +1,4 @@
-import { expect } from "@playwright/test"
-
-import { test } from "~~/test/playwright/utils/test-fixture"
+import { test, expect } from "@playwright/test"
import { turnOnAnalytics } from "~~/test/playwright/utils/navigation"
diff --git a/frontend/test/playwright/e2e/audio-detail.spec.ts b/frontend/test/playwright/e2e/audio-detail.spec.ts
index 48714133e..a9ff89b56 100644
--- a/frontend/test/playwright/e2e/audio-detail.spec.ts
+++ b/frontend/test/playwright/e2e/audio-detail.spec.ts
@@ -1,6 +1,6 @@
-import { expect, Page } from "@playwright/test"
+import { test, expect, Page } from "@playwright/test"
-import { test } from "~~/test/playwright/utils/test-fixture"
+import { mockProviderApis } from "~~/test/playwright/utils/route"
const goToCustomAudioPage = async (page: Page) => {
// Test in a custom audio detail page, it should apply the same for any audio.
@@ -15,6 +15,10 @@ const showsErrorPage = async (page: Page) => {
test.describe.configure({ mode: "parallel" })
+test.beforeEach(async ({ context }) => {
+ await mockProviderApis(context)
+})
+
test("shows the data that is only available in single result, not search response", async ({
page,
}) => {
diff --git a/frontend/test/playwright/e2e/external-sources.spec.ts b/frontend/test/playwright/e2e/external-sources.spec.ts
index 8caf73301..9592a7969 100644
--- a/frontend/test/playwright/e2e/external-sources.spec.ts
+++ b/frontend/test/playwright/e2e/external-sources.spec.ts
@@ -1,6 +1,4 @@
-import { expect } from "@playwright/test"
-
-import { test } from "~~/test/playwright/utils/test-fixture"
+import { test, expect } from "@playwright/test"
import { goToSearchTerm, setCookies } from "~~/test/playwright/utils/navigation"
diff --git a/frontend/test/playwright/e2e/filters-sidebar-keyboard.spec.ts b/frontend/test/playwright/e2e/filters-sidebar-keyboard.spec.ts
index 83daf638b..e991ae554 100644
--- a/frontend/test/playwright/e2e/filters-sidebar-keyboard.spec.ts
+++ b/frontend/test/playwright/e2e/filters-sidebar-keyboard.spec.ts
@@ -1,6 +1,4 @@
-import { expect, Page } from "@playwright/test"
-
-import { test } from "~~/test/playwright/utils/test-fixture"
+import { test, expect, Page } from "@playwright/test"
import {
LanguageDirection,
diff --git a/frontend/test/playwright/e2e/filters.spec.ts b/frontend/test/playwright/e2e/filters.spec.ts
index a35eab94e..f16adc345 100644
--- a/frontend/test/playwright/e2e/filters.spec.ts
+++ b/frontend/test/playwright/e2e/filters.spec.ts
@@ -1,6 +1,4 @@
-import { expect, Page } from "@playwright/test"
-
-import { test } from "~~/test/playwright/utils/test-fixture"
+import { test, expect, Page } from "@playwright/test"
import {
assertCheckboxStatus,
@@ -10,6 +8,8 @@ import {
filters,
} from "~~/test/playwright/utils/navigation"
+import { mockProviderApis } from "~~/test/playwright/utils/route"
+
import breakpoints from "~~/test/playwright/utils/breakpoints"
import {
@@ -42,6 +42,9 @@ const FILTER_COUNTS = {
}
breakpoints.describeMobileAndDesktop(() => {
+ test.beforeEach(async ({ context }) => {
+ await mockProviderApis(context)
+ })
for (const searchType of supportedSearchTypes) {
test(`correct total number of filters is displayed for ${searchType}`, async ({
page,
diff --git a/frontend/test/playwright/e2e/global-audio.spec.ts b/frontend/test/playwright/e2e/global-audio.spec.ts
index dd74e6290..01a0e7bed 100644
--- a/frontend/test/playwright/e2e/global-audio.spec.ts
+++ b/frontend/test/playwright/e2e/global-audio.spec.ts
@@ -1,6 +1,4 @@
-import { expect } from "@playwright/test"
-
-import { test } from "~~/test/playwright/utils/test-fixture"
+import { expect, test } from "@playwright/test"
import { sleep, t } from "~~/test/playwright/utils/navigation"
import breakpoints from "~~/test/playwright/utils/breakpoints"
diff --git a/frontend/test/playwright/e2e/header-internal.spec.ts b/frontend/test/playwright/e2e/header-internal.spec.ts
index f60b55771..71fa4e143 100644
--- a/frontend/test/playwright/e2e/header-internal.spec.ts
+++ b/frontend/test/playwright/e2e/header-internal.spec.ts
@@ -1,6 +1,4 @@
-import { expect, Page } from "@playwright/test"
-
-import { test } from "~~/test/playwright/utils/test-fixture"
+import { test, expect, Page } from "@playwright/test"
import {
isDialogOpen,
diff --git a/frontend/test/playwright/e2e/homepage.spec.ts b/frontend/test/playwright/e2e/homepage.spec.ts
index 2165d9106..1d5c60283 100644
--- a/frontend/test/playwright/e2e/homepage.spec.ts
+++ b/frontend/test/playwright/e2e/homepage.spec.ts
@@ -1,13 +1,16 @@
-import { expect, Page } from "@playwright/test"
-
-import { test } from "~~/test/playwright/utils/test-fixture"
+import { expect, Page, test } from "@playwright/test"
+import { mockProviderApis } from "~~/test/playwright/utils/route"
import { goToSearchTerm, t } from "~~/test/playwright/utils/navigation"
import { searchPath, supportedSearchTypes } from "~/constants/media"
test.describe.configure({ mode: "parallel" })
+test.beforeEach(async ({ context }) => {
+ await mockProviderApis(context)
+})
+
for (const searchType of supportedSearchTypes) {
test(`can change type and search for ${searchType} from homepage`, async ({
page,
diff --git a/frontend/test/playwright/e2e/image-detail.spec.ts b/frontend/test/playwright/e2e/image-detail.spec.ts
index 010ba78a8..7b3de2828 100644
--- a/frontend/test/playwright/e2e/image-detail.spec.ts
+++ b/frontend/test/playwright/e2e/image-detail.spec.ts
@@ -1,7 +1,6 @@
-import { expect, Page } from "@playwright/test"
-
-import { test } from "~~/test/playwright/utils/test-fixture"
+import { test, expect, Page } from "@playwright/test"
+import { mockProviderApis } from "~~/test/playwright/utils/route"
import { t } from "~~/test/playwright/utils/navigation"
const goToCustomImagePage = async (page: Page) => {
@@ -17,6 +16,10 @@ const showsErrorPage = async (page: Page) => {
test.describe.configure({ mode: "parallel" })
+test.beforeEach(async ({ context }) => {
+ await mockProviderApis(context)
+})
+
test("shows the author and title of the image", async ({ page }) => {
await goToCustomImagePage(page)
const author = page.locator('a[aria-label^="author"]')
diff --git a/frontend/test/playwright/e2e/load-more.spec.ts b/frontend/test/playwright/e2e/load-more.spec.ts
index b5c6dcb3c..63bf8d341 100644
--- a/frontend/test/playwright/e2e/load-more.spec.ts
+++ b/frontend/test/playwright/e2e/load-more.spec.ts
@@ -1,12 +1,11 @@
-import { expect, Page } from "@playwright/test"
-
-import { test } from "~~/test/playwright/utils/test-fixture"
+import { expect, Page, test } from "@playwright/test"
import {
goToSearchTerm,
renderModes,
t,
} from "~~/test/playwright/utils/navigation"
+import { mockProviderApis } from "~~/test/playwright/utils/route"
import { AUDIO, IMAGE, SupportedMediaType } from "~/constants/media"
@@ -40,6 +39,10 @@ const openSingleMediaView = async (
*/
test.describe("Load more button", () => {
+ test.beforeEach(async ({ context }) => {
+ await mockProviderApis(context)
+ })
+
test("Clicking sends 2 requests on All view with enough results", async ({
page,
}) => {
diff --git a/frontend/test/playwright/e2e/migration-banner.spec.ts b/frontend/test/playwright/e2e/migration-banner.spec.ts
index 64acb31ba..95f8c2719 100644
--- a/frontend/test/playwright/e2e/migration-banner.spec.ts
+++ b/frontend/test/playwright/e2e/migration-banner.spec.ts
@@ -1,6 +1,4 @@
-import { expect } from "@playwright/test"
-
-import { test } from "~~/test/playwright/utils/test-fixture"
+import { test, expect } from "@playwright/test"
import { t } from "~~/test/playwright/utils/navigation"
diff --git a/frontend/test/playwright/e2e/mobile-menu.spec.ts b/frontend/test/playwright/e2e/mobile-menu.spec.ts
index c153e86b7..60117cd40 100644
--- a/frontend/test/playwright/e2e/mobile-menu.spec.ts
+++ b/frontend/test/playwright/e2e/mobile-menu.spec.ts
@@ -1,6 +1,4 @@
-import { expect } from "@playwright/test"
-
-import { test } from "~~/test/playwright/utils/test-fixture"
+import { test, expect } from "@playwright/test"
import {
goToSearchTerm,
diff --git a/frontend/test/playwright/e2e/recent-searches.spec.ts b/frontend/test/playwright/e2e/recent-searches.spec.ts
index c43d0708c..316f3fb11 100644
--- a/frontend/test/playwright/e2e/recent-searches.spec.ts
+++ b/frontend/test/playwright/e2e/recent-searches.spec.ts
@@ -1,6 +1,4 @@
-import { expect, type Page } from "@playwright/test"
-
-import { test } from "~~/test/playwright/utils/test-fixture"
+import { expect, test, type Page } from "@playwright/test"
import { searchFromHeader } from "~~/test/playwright/utils/navigation"
diff --git a/frontend/test/playwright/e2e/redirect-queryless-searches.spec.ts b/frontend/test/playwright/e2e/redirect-queryless-searches.spec.ts
index 28cffc4fa..a6fc32281 100644
--- a/frontend/test/playwright/e2e/redirect-queryless-searches.spec.ts
+++ b/frontend/test/playwright/e2e/redirect-queryless-searches.spec.ts
@@ -3,9 +3,7 @@
* redirect to the homepage.
*/
-import { expect } from "@playwright/test"
-
-import { test } from "~~/test/playwright/utils/test-fixture"
+import { test, expect } from "@playwright/test"
import { searchTypes, searchPath } from "~/constants/media"
diff --git a/frontend/test/playwright/e2e/report-media.spec.ts b/frontend/test/playwright/e2e/report-media.spec.ts
index 46a5757eb..eb2393a7c 100644
--- a/frontend/test/playwright/e2e/report-media.spec.ts
+++ b/frontend/test/playwright/e2e/report-media.spec.ts
@@ -1,7 +1,6 @@
-import { expect, Page, BrowserContext } from "@playwright/test"
-
-import { test } from "~~/test/playwright/utils/test-fixture"
+import { test, expect, Page, BrowserContext } from "@playwright/test"
+import { mockProviderApis } from "~~/test/playwright/utils/route"
import {
goToSearchTerm,
openFirstResult,
@@ -81,6 +80,10 @@ const submitOtherReport = async (page: Page, context: BrowserContext) => {
return expect(response.status()).toBe(200)
}
+test.beforeEach(async ({ context }) => {
+ await mockProviderApis(context)
+})
+
const reports = {
dmca: submitDmcaReport,
mature: submitMatureContentReport,
diff --git a/frontend/test/playwright/e2e/search-navigation.spec.ts b/frontend/test/playwright/e2e/search-navigation.spec.ts
index 2ebb2af2d..fe5f047ee 100644
--- a/frontend/test/playwright/e2e/search-navigation.spec.ts
+++ b/frontend/test/playwright/e2e/search-navigation.spec.ts
@@ -1,6 +1,4 @@
-import { expect, Page } from "@playwright/test"
-
-import { test } from "~~/test/playwright/utils/test-fixture"
+import { expect, Page, test } from "@playwright/test"
import {
goToSearchTerm,
@@ -9,7 +7,7 @@ import {
openFirstResult,
t,
} from "~~/test/playwright/utils/navigation"
-
+import { mockProviderApis } from "~~/test/playwright/utils/route"
import breakpoints from "~~/test/playwright/utils/breakpoints"
import { AUDIO, IMAGE, SupportedMediaType } from "~/constants/media"
@@ -23,6 +21,10 @@ const getContentLink = async (page: Page, mediaType: SupportedMediaType) => {
test.describe("search history navigation", () => {
breakpoints.describeMobileAndDesktop(() => {
+ test.beforeEach(async ({ context }) => {
+ await mockProviderApis(context)
+ })
+
test("should update search results when back navigation changes filters", async ({
page,
}) => {
diff --git a/frontend/test/playwright/e2e/search-query-client.spec.ts b/frontend/test/playwright/e2e/search-query-client.spec.ts
index d01ff793c..88d51495e 100644
--- a/frontend/test/playwright/e2e/search-query-client.spec.ts
+++ b/frontend/test/playwright/e2e/search-query-client.spec.ts
@@ -1,12 +1,11 @@
-import { expect } from "@playwright/test"
-
-import { test } from "~~/test/playwright/utils/test-fixture"
+import { expect, test } from "@playwright/test"
import {
changeSearchType,
goToSearchTerm,
searchFromHeader,
} from "~~/test/playwright/utils/navigation"
+import { mockProviderApis } from "~~/test/playwright/utils/route"
import breakpoints from "~~/test/playwright/utils/breakpoints"
@@ -28,6 +27,10 @@ test.describe.configure({ mode: "parallel" })
test.describe("search query on CSR", () => {
breakpoints.describeMobileAndDesktop(() => {
+ test.beforeEach(async ({ context }) => {
+ await mockProviderApis(context)
+ })
+
test("q query parameter is set as the search term", async ({ page }) => {
await goToSearchTerm(page, "cat", { mode: "CSR" })
diff --git a/frontend/test/playwright/e2e/search-query-server.spec.ts b/frontend/test/playwright/e2e/search-query-server.spec.ts
index 45f5c6eca..cae7deadb 100644
--- a/frontend/test/playwright/e2e/search-query-server.spec.ts
+++ b/frontend/test/playwright/e2e/search-query-server.spec.ts
@@ -1,6 +1,4 @@
-import { expect } from "@playwright/test"
-
-import { test } from "~~/test/playwright/utils/test-fixture"
+import { test, expect } from "@playwright/test"
import {
assertCheckboxStatus,
@@ -9,6 +7,7 @@ import {
goToSearchTerm,
searchTypeNames,
} from "~~/test/playwright/utils/navigation"
+import { mockProviderApis } from "~~/test/playwright/utils/route"
import breakpoints from "~~/test/playwright/utils/breakpoints"
@@ -30,6 +29,10 @@ test.describe.configure({ mode: "parallel" })
test.describe("search query on SSR", () => {
breakpoints.describeMobileAndDesktop(() => {
+ test.beforeEach(async ({ context }) => {
+ await mockProviderApis(context)
+ })
+
test("q query parameter is set as the search term", async ({ page }) => {
await goToSearchTerm(page, "cat", {
query: "license=cc0&license_type=commercial&searchBy=creator",
diff --git a/frontend/test/playwright/e2e/search-types.spec.ts b/frontend/test/playwright/e2e/search-types.spec.ts
index 1b347af5c..c31be9de6 100644
--- a/frontend/test/playwright/e2e/search-types.spec.ts
+++ b/frontend/test/playwright/e2e/search-types.spec.ts
@@ -1,11 +1,10 @@
-import { expect, Page } from "@playwright/test"
-
-import { test } from "~~/test/playwright/utils/test-fixture"
+import { test, expect, Page } from "@playwright/test"
import {
changeSearchType,
goToSearchTerm,
} from "~~/test/playwright/utils/navigation"
+import { mockProviderApis } from "~~/test/playwright/utils/route"
import breakpoints from "~~/test/playwright/utils/breakpoints"
import { searchPath } from "~/constants/media"
@@ -96,6 +95,10 @@ async function checkSearchResult(page: Page, searchType: SearchTypeConfig) {
test.describe("search types", () => {
breakpoints.describeMobileAndDesktop(() => {
+ test.beforeEach(async ({ context }) => {
+ await mockProviderApis(context)
+ })
+
for (const searchType of searchTypes) {
test(`Can open ${searchType.name} search page on SSR`, async ({
page,
diff --git a/frontend/test/playwright/e2e/search.spec.ts b/frontend/test/playwright/e2e/search.spec.ts
index 6ce2a59fa..678c74765 100644
--- a/frontend/test/playwright/e2e/search.spec.ts
+++ b/frontend/test/playwright/e2e/search.spec.ts
@@ -6,10 +6,9 @@
* When pending: does not show 'No images', Safer Browsing, search rating or error message
* On error: shows error message
*/
-import { expect } from "@playwright/test"
-
-import { test } from "~~/test/playwright/utils/test-fixture"
+import { expect, test } from "@playwright/test"
+import { mockProviderApis } from "~~/test/playwright/utils/route"
import {
goToSearchTerm,
scrollToBottom,
@@ -18,6 +17,10 @@ import {
test.describe.configure({ mode: "parallel" })
+test.beforeEach(async ({ context }) => {
+ await mockProviderApis(context)
+})
+
test("shows no results page when no results", async ({ page }) => {
await page.goto("/search/image?q=243f6a8885a308d3")
await expect(page.locator(".error-section")).toBeVisible()
diff --git a/frontend/test/playwright/e2e/translation-banner.spec.ts b/frontend/test/playwright/e2e/translation-banner.spec.ts
index 79b976263..7f849ca73 100644
--- a/frontend/test/playwright/e2e/translation-banner.spec.ts
+++ b/frontend/test/playwright/e2e/translation-banner.spec.ts
@@ -1,6 +1,4 @@
-import { expect } from "@playwright/test"
-
-import { test } from "~~/test/playwright/utils/test-fixture"
+import { test, expect } from "@playwright/test"
import { dismissBannersUsingCookies } from "~~/test/playwright/utils/navigation"
diff --git a/frontend/test/playwright/playwright.config.ts b/frontend/test/playwright/playwright.config.ts
index 446619c85..aa61c81d6 100644
--- a/frontend/test/playwright/playwright.config.ts
+++ b/frontend/test/playwright/playwright.config.ts
@@ -43,7 +43,7 @@ const config: PlaywrightTestConfig = {
baseURL: "http://localhost:8443",
trace: "retain-on-failure",
},
- timeout: 60 * 1e3, // 1 minute
+ timeout: 60 * 1e3,
/**
* When updating or recreating tapes, if we have more than one worker running
* then Talkback is liable to see multiple requests at the same time that would
diff --git a/frontend/test/playwright/utils/breakpoints.ts b/frontend/test/playwright/utils/breakpoints.ts
index 3043cf33f..04291eb38 100644
--- a/frontend/test/playwright/utils/breakpoints.ts
+++ b/frontend/test/playwright/utils/breakpoints.ts
@@ -1,6 +1,4 @@
-import { expect, Expect } from "@playwright/test"
-
-import { test } from "~~/test/playwright/utils/test-fixture"
+import { test, expect, Expect } from "@playwright/test"
import { VIEWPORTS } from "~/constants/screens"
import type { Breakpoint } from "~/constants/screens"
diff --git a/frontend/test/playwright/utils/route.ts b/frontend/test/playwright/utils/route.ts
new file mode 100644
index 000000000..6c1d9c39d
--- /dev/null
+++ b/frontend/test/playwright/utils/route.ts
@@ -0,0 +1,6 @@
+import type { BrowserContext } from "@playwright/test"
+
+export const mockProviderApis = async (context: BrowserContext) => {
+ await context.route("**.jamendo.com**", (route) => route.abort())
+ await context.route("**.freesound.**", (r) => r.abort())
+}
diff --git a/frontend/test/playwright/utils/test-fixture.ts b/frontend/test/playwright/utils/test-fixture.ts
deleted file mode 100644
index a38df4196..000000000
--- a/frontend/test/playwright/utils/test-fixture.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-// eslint-disable-next-line no-restricted-syntax
-import { test as base } from "@playwright/test"
-
-/**
- * This file overwrites the default playwright test fixture
- * to apply some global settings and route handling.
- */
-export const test = base.extend({
- page: async ({ page }, use) => {
- // Intercept /api/event requests
- await page.route("/api/event", (route) => route.abort())
- // Intercept provider APIs
- await page.route("**.jamendo.com**", (route) => route.abort())
- await page.route("**.freesound.**", (route) => route.abort())
-
- await use(page)
- },
-})
diff --git a/frontend/test/playwright/visual-regression/components/content-report-form.spec.ts b/frontend/test/playwright/visual-regression/components/content-report-form.spec.ts
index 3121c3082..987f54d9c 100644
--- a/frontend/test/playwright/visual-regression/components/content-report-form.spec.ts
+++ b/frontend/test/playwright/visual-regression/components/content-report-form.spec.ts
@@ -1,10 +1,8 @@
-import { test } from "~~/test/playwright/utils/test-fixture"
+import { Page, test } from "@playwright/test"
import { t } from "~~/test/playwright/utils/navigation"
import breakpoints from "~~/test/playwright/utils/breakpoints"
-import type { Page } from "@playwright/test"
-
const imageUrl = "/image/feb91b13-422d-46fa-8ef4-cbf1e6ddee9b"
const getReportButton = (page: Page) => {
diff --git a/frontend/test/playwright/visual-regression/components/external-sources-section.spec.ts b/frontend/test/playwright/visual-regression/components/external-sources-section.spec.ts
index f3ea29182..78a0150ec 100644
--- a/frontend/test/playwright/visual-regression/components/external-sources-section.spec.ts
+++ b/frontend/test/playwright/visual-regression/components/external-sources-section.spec.ts
@@ -1,4 +1,4 @@
-import { test } from "~~/test/playwright/utils/test-fixture"
+import { test } from "@playwright/test"
import {
goToSearchTerm,
diff --git a/frontend/test/playwright/visual-regression/components/filters.spec.ts b/frontend/test/playwright/visual-regression/components/filters.spec.ts
index 4ccc81ea1..06755f568 100644
--- a/frontend/test/playwright/visual-regression/components/filters.spec.ts
+++ b/frontend/test/playwright/visual-regression/components/filters.spec.ts
@@ -1,6 +1,4 @@
-import { expect, Page } from "@playwright/test"
-
-import { test } from "~~/test/playwright/utils/test-fixture"
+import { expect, Page, test } from "@playwright/test"
import {
goToSearchTerm,
diff --git a/frontend/test/playwright/visual-regression/components/global-audio-player.spec.ts b/frontend/test/playwright/visual-regression/components/global-audio-player.spec.ts
index b7486630b..40b5dca5a 100644
--- a/frontend/test/playwright/visual-regression/components/global-audio-player.spec.ts
+++ b/frontend/test/playwright/visual-regression/components/global-audio-player.spec.ts
@@ -1,4 +1,4 @@
-import { test } from "~~/test/playwright/utils/test-fixture"
+import { test } from "@playwright/test"
import {
dismissTranslationBanner,
diff --git a/frontend/test/playwright/visual-regression/components/header.spec.ts b/frontend/test/playwright/visual-regression/components/header.spec.ts
index ba4113840..5d5906d6e 100644
--- a/frontend/test/playwright/visual-regression/components/header.spec.ts
+++ b/frontend/test/playwright/visual-regression/components/header.spec.ts
@@ -1,4 +1,4 @@
-import { test } from "~~/test/playwright/utils/test-fixture"
+import { test } from "@playwright/test"
import breakpoints, {
isMobileBreakpoint,
@@ -66,8 +66,7 @@ for (const dir of languageDirections) {
)
})
- // Skipping flaky test: https://github.com/WordPress/openverse/issues/2357
- test.skip("searchbar active", async ({ page }) => {
+ test("searchbar active", async ({ page }) => {
if (!isMobileBreakpoint(breakpoint)) {
await filters.close(page)
}
diff --git a/frontend/test/playwright/visual-regression/pages/homepage.spec.ts b/frontend/test/playwright/visual-regression/pages/homepage.spec.ts
index 61680e676..d14949fd0 100644
--- a/frontend/test/playwright/visual-regression/pages/homepage.spec.ts
+++ b/frontend/test/playwright/visual-regression/pages/homepage.spec.ts
@@ -1,4 +1,4 @@
-import { test } from "~~/test/playwright/utils/test-fixture"
+import { test, Page } from "@playwright/test"
import breakpoints from "~~/test/playwright/utils/breakpoints"
import { hideInputCursors } from "~~/test/playwright/utils/page"
@@ -9,8 +9,6 @@ import {
pathWithDir,
} from "~~/test/playwright/utils/navigation"
-import type { Page } from "@playwright/test"
-
test.describe.configure({ mode: "parallel" })
/**
@@ -59,15 +57,13 @@ for (const dir of languageDirections) {
)
})
- // @todo Fix flaky test: https://github.com/WordPress/openverse/issues/2377
- test.skip("content switcher open", async ({ page }) => {
+ test("content switcher open", async ({ page }) => {
await page.locator("#search-type-button").click()
await expectSnapshot(`content-switcher-open-${dir}`, page)
})
- // @todo Fix flaky test: https://github.com/WordPress/openverse/issues/2377
- test.skip("content switcher with external sources open", async ({
+ test("content switcher with external sources open", async ({
page,
}) => {
await page.goto(pathWithDir("/?ff_additional_search_types=on", dir))
diff --git a/frontend/test/playwright/visual-regression/pages/no-results.spec.ts b/frontend/test/playwright/visual-regression/pages/no-results.spec.ts
index d5b0f5c23..2b9fe5a91 100644
--- a/frontend/test/playwright/visual-regression/pages/no-results.spec.ts
+++ b/frontend/test/playwright/visual-regression/pages/no-results.spec.ts
@@ -1,4 +1,4 @@
-import { test } from "~~/test/playwright/utils/test-fixture"
+import { test } from "@playwright/test"
import {
closeFiltersUsingCookies,
diff --git a/frontend/test/playwright/visual-regression/pages/pages-single-result.spec.ts b/frontend/test/playwright/visual-regression/pages/pages-single-result.spec.ts
index b55148389..b7e51e807 100644
--- a/frontend/test/playwright/visual-regression/pages/pages-single-result.spec.ts
+++ b/frontend/test/playwright/visual-regression/pages/pages-single-result.spec.ts
@@ -1,4 +1,4 @@
-import { test } from "~~/test/playwright/utils/test-fixture"
+import { test } from "@playwright/test"
import breakpoints from "~~/test/playwright/utils/breakpoints"
import {
diff --git a/frontend/test/playwright/visual-regression/pages/pages.spec.ts b/frontend/test/playwright/visual-regression/pages/pages.spec.ts
index 01a5ba069..83bc48782 100644
--- a/frontend/test/playwright/visual-regression/pages/pages.spec.ts
+++ b/frontend/test/playwright/visual-regression/pages/pages.spec.ts
@@ -1,6 +1,4 @@
-import { expect, Page } from "@playwright/test"
-
-import { test } from "~~/test/playwright/utils/test-fixture"
+import { expect, Page, test } from "@playwright/test"
import breakpoints from "~~/test/playwright/utils/breakpoints"
import { removeHiddenOverflow } from "~~/test/playwright/utils/page"
diff --git a/frontend/test/playwright/visual-regression/pages/search-with-banners.spec.ts b/frontend/test/playwright/visual-regression/pages/search-with-banners.spec.ts
index 6bb357c6b..8a83bff59 100644
--- a/frontend/test/playwright/visual-regression/pages/search-with-banners.spec.ts
+++ b/frontend/test/playwright/visual-regression/pages/search-with-banners.spec.ts
@@ -1,4 +1,4 @@
-import { test } from "~~/test/playwright/utils/test-fixture"
+import { test } from "@playwright/test"
import breakpoints from "~~/test/playwright/utils/breakpoints"
import { setBreakpointCookie } from "~~/test/playwright/utils/navigation"
diff --git a/frontend/test/storybook/visual-regression/custom-button-components.spec.ts b/frontend/test/storybook/visual-regression/custom-button-components.spec.ts
index 3695e9875..8fe51e276 100644
--- a/frontend/test/storybook/visual-regression/custom-button-components.spec.ts
+++ b/frontend/test/storybook/visual-regression/custom-button-components.spec.ts
@@ -1,4 +1,4 @@
-import { test } from "~~/test/playwright/utils/test-fixture"
+import { test } from "@playwright/test"
import { makeGotoWithArgs } from "~~/test/storybook/utils/args"
import breakpoints from "~~/test/playwright/utils/breakpoints"
diff --git a/frontend/test/storybook/visual-regression/focus.spec.ts b/frontend/test/storybook/visual-regression/focus.spec.ts
index f5d5c3226..01a3389b2 100644
--- a/frontend/test/storybook/visual-regression/focus.spec.ts
+++ b/frontend/test/storybook/visual-regression/focus.spec.ts
@@ -1,6 +1,4 @@
-import { expect, Page, Locator } from "@playwright/test"
-
-import { test } from "~~/test/playwright/utils/test-fixture"
+import { test, expect, Page, Locator } from "@playwright/test"
const goTo = async (page: Page, slug: string) => {
await page.goto(`/iframe.html?id=meta-focus--${slug}`)
diff --git a/frontend/test/storybook/visual-regression/v-button.spec.ts b/frontend/test/storybook/visual-regression/v-button.spec.ts
index bd8511f59..62eed652c 100644
--- a/frontend/test/storybook/visual-regression/v-button.spec.ts
+++ b/frontend/test/storybook/visual-regression/v-button.spec.ts
@@ -1,6 +1,4 @@
-import { expect } from "@playwright/test"
-
-import { test } from "~~/test/playwright/utils/test-fixture"
+import { expect, test } from "@playwright/test"
import { makeGotoWithArgs } from "~~/test/storybook/utils/args"
diff --git a/frontend/test/storybook/visual-regression/v-checkbox.spec.ts b/frontend/test/storybook/visual-regression/v-checkbox.spec.ts
index 23e951f30..929676c03 100644
--- a/frontend/test/storybook/visual-regression/v-checkbox.spec.ts
+++ b/frontend/test/storybook/visual-regression/v-checkbox.spec.ts
@@ -1,6 +1,4 @@
-import { expect } from "@playwright/test"
-
-import { test } from "~~/test/playwright/utils/test-fixture"
+import { test, expect } from "@playwright/test"
test.describe.configure({ mode: "parallel" })
diff --git a/frontend/test/storybook/visual-regression/v-filter-button.spec.ts b/frontend/test/storybook/visual-regression/v-filter-button.spec.ts
index 7e7ddba88..eb9ad8e5d 100644
--- a/frontend/test/storybook/visual-regression/v-filter-button.spec.ts
+++ b/frontend/test/storybook/visual-regression/v-filter-button.spec.ts
@@ -1,4 +1,4 @@
-import { test } from "~~/test/playwright/utils/test-fixture"
+import { test } from "@playwright/test"
import breakpoints from "~~/test/playwright/utils/breakpoints"
import { makeGotoWithArgs } from "~~/test/storybook/utils/args"
diff --git a/frontend/test/storybook/visual-regression/v-filter-tab.spec.ts b/frontend/test/storybook/visual-regression/v-filter-tab.spec.ts
index aa570afe1..364d8cfa7 100644
--- a/frontend/test/storybook/visual-regression/v-filter-tab.spec.ts
+++ b/frontend/test/storybook/visual-regression/v-filter-tab.spec.ts
@@ -1,6 +1,4 @@
-import { expect, Page } from "@playwright/test"
-
-import { test } from "~~/test/playwright/utils/test-fixture"
+import { expect, Page, test } from "@playwright/test"
import { makeGotoWithArgs } from "~~/test/storybook/utils/args"
diff --git a/frontend/test/storybook/visual-regression/v-footer.spec.ts b/frontend/test/storybook/visual-regression/v-footer.spec.ts
index a6f139de8..1ef9eed95 100644
--- a/frontend/test/storybook/visual-regression/v-footer.spec.ts
+++ b/frontend/test/storybook/visual-regression/v-footer.spec.ts
@@ -1,4 +1,4 @@
-import { test } from "~~/test/playwright/utils/test-fixture"
+import { test } from "@playwright/test"
import breakpoints from "~~/test/playwright/utils/breakpoints"
import { languageDirections } from "~~/test/playwright/utils/navigation"
diff --git a/frontend/test/storybook/visual-regression/v-header-internal.spec.ts b/frontend/test/storybook/visual-regression/v-header-internal.spec.ts
index 7d5264871..05929880b 100644
--- a/frontend/test/storybook/visual-regression/v-header-internal.spec.ts
+++ b/frontend/test/storybook/visual-regression/v-header-internal.spec.ts
@@ -1,4 +1,4 @@
-import { test } from "~~/test/playwright/utils/test-fixture"
+import { test } from "@playwright/test"
import breakpoints from "~~/test/playwright/utils/breakpoints"
import { languageDirections } from "~~/test/playwright/utils/navigation"
diff --git a/frontend/test/storybook/visual-regression/v-icon-button.spec.ts b/frontend/test/storybook/visual-regression/v-icon-button.spec.ts
index 0c083c82a..ad1e1557f 100644
--- a/frontend/test/storybook/visual-regression/v-icon-button.spec.ts
+++ b/frontend/test/storybook/visual-regression/v-icon-button.spec.ts
@@ -1,6 +1,4 @@
-import { expect } from "@playwright/test"
-
-import { test } from "~~/test/playwright/utils/test-fixture"
+import { expect, test } from "@playwright/test"
test.describe("VIconButton", () => {
const url = "/iframe.html?id=components-viconbutton--sizes"
diff --git a/frontend/test/storybook/visual-regression/v-language-select.spec.ts b/frontend/test/storybook/visual-regression/v-language-select.spec.ts
index 3dddebeca..88d5a1cd2 100644
--- a/frontend/test/storybook/visual-regression/v-language-select.spec.ts
+++ b/frontend/test/storybook/visual-regression/v-language-select.spec.ts
@@ -1,6 +1,4 @@
-import { Page, expect } from "@playwright/test"
-
-import { test } from "~~/test/playwright/utils/test-fixture"
+import { Page, test, expect } from "@playwright/test"
import { makeGotoWithArgs } from "~~/test/storybook/utils/args"
diff --git a/frontend/test/storybook/visual-regression/v-media-license.spec.ts b/frontend/test/storybook/visual-regression/v-media-license.spec.ts
index f0faa40c1..6807de6ca 100644
--- a/frontend/test/storybook/visual-regression/v-media-license.spec.ts
+++ b/frontend/test/storybook/visual-regression/v-media-license.spec.ts
@@ -1,9 +1,7 @@
-import { test } from "~~/test/playwright/utils/test-fixture"
+import { test, Page } from "@playwright/test"
import breakpoints from "~~/test/playwright/utils/breakpoints"
-import type { Page } from "@playwright/test"
-
const goTo = async (page: Page, slug: string) => {
await page.goto(`/iframe.html?id=components-vmedialicense--${slug}`)
}
diff --git a/frontend/test/storybook/visual-regression/v-media-reuse.spec.ts b/frontend/test/storybook/visual-regression/v-media-reuse.spec.ts
index 56eadbc95..ec74b3f0f 100644
--- a/frontend/test/storybook/visual-regression/v-media-reuse.spec.ts
+++ b/frontend/test/storybook/visual-regression/v-media-reuse.spec.ts
@@ -1,4 +1,4 @@
-import { test } from "~~/test/playwright/utils/test-fixture"
+import { test } from "@playwright/test"
import breakpoints from "~~/test/playwright/utils/breakpoints"
import { languageDirections, t } from "~~/test/playwright/utils/navigation"
diff --git a/frontend/test/storybook/visual-regression/v-notitication-banner.spec.ts b/frontend/test/storybook/visual-regression/v-notitication-banner.spec.ts
index b2a422e04..641fc7c30 100644
--- a/frontend/test/storybook/visual-regression/v-notitication-banner.spec.ts
+++ b/frontend/test/storybook/visual-regression/v-notitication-banner.spec.ts
@@ -1,4 +1,4 @@
-import { test } from "~~/test/playwright/utils/test-fixture"
+import { test } from "@playwright/test"
test.describe.configure({ mode: "parallel" })
diff --git a/frontend/test/storybook/visual-regression/v-search-bar-button.spec.ts b/frontend/test/storybook/visual-regression/v-search-bar-button.spec.ts
index 68858e2b2..9871c32e3 100644
--- a/frontend/test/storybook/visual-regression/v-search-bar-button.spec.ts
+++ b/frontend/test/storybook/visual-regression/v-search-bar-button.spec.ts
@@ -1,6 +1,4 @@
-import { expect } from "@playwright/test"
-
-import { test } from "~~/test/playwright/utils/test-fixture"
+import { expect, test } from "@playwright/test"
test.describe.configure({ mode: "parallel" })
const wrapperLocator = ".wrapper"
diff --git a/frontend/test/storybook/visual-regression/v-search-type-button.spec.ts b/frontend/test/storybook/visual-regression/v-search-type-button.spec.ts
index a8ed0e9a1..888dd5d53 100644
--- a/frontend/test/storybook/visual-regression/v-search-type-button.spec.ts
+++ b/frontend/test/storybook/visual-regression/v-search-type-button.spec.ts
@@ -1,4 +1,4 @@
-import { test } from "~~/test/playwright/utils/test-fixture"
+import { test } from "@playwright/test"
import breakpoints from "~~/test/playwright/utils/breakpoints"
diff --git a/frontend/test/storybook/visual-regression/v-search-types.spec.ts b/frontend/test/storybook/visual-regression/v-search-types.spec.ts
index ca7116748..ce30adce0 100644
--- a/frontend/test/storybook/visual-regression/v-search-types.spec.ts
+++ b/frontend/test/storybook/visual-regression/v-search-types.spec.ts
@@ -1,4 +1,4 @@
-import { test } from "~~/test/playwright/utils/test-fixture"
+import { test } from "@playwright/test"
import breakpoints from "~~/test/playwright/utils/breakpoints"
diff --git a/frontend/test/storybook/visual-regression/v-select-field.spec.ts b/frontend/test/storybook/visual-regression/v-select-field.spec.ts
index c759c64af..3ba683949 100644
--- a/frontend/test/storybook/visual-regression/v-select-field.spec.ts
+++ b/frontend/test/storybook/visual-regression/v-select-field.spec.ts
@@ -1,6 +1,4 @@
-import { Page, expect } from "@playwright/test"
-
-import { test } from "~~/test/playwright/utils/test-fixture"
+import { Page, test, expect } from "@playwright/test"
import { makeGotoWithArgs } from "~~/test/storybook/utils/args"