Skip to content

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

Update Playwright to use a custom test fixture with global mocks (#2196)

Zack Kridade7d99e70bd5
diff --git a/.eslintrc.js b/.eslintrc.js
index 197ddc8c7..2df9e9132 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -185,6 +185,7 @@ module.exports = {
"tsdoc/syntax": "error",
},
},
+ // Overrides for unit tests
{
env: { jest: true },
files: ["frontend/test/unit/**"],
@@ -212,6 +213,21 @@ 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 8e9eb589a..5668f361a 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 "@playwright/test"
+import { test } from "~~/test/playwright/utils/test-fixture"
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 ab1eb3855..57df48e15 100644
--- a/frontend/test/playwright/e2e/all-results-keyboard.spec.ts
+++ b/frontend/test/playwright/e2e/all-results-keyboard.spec.ts
@@ -1,4 +1,6 @@
-import { test, expect, Page } from "@playwright/test"
+import { expect, Page } from "@playwright/test"
+
+import { test } from "~~/test/playwright/utils/test-fixture"
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 c6a4e50f2..cb1687107 100644
--- a/frontend/test/playwright/e2e/attribution.spec.ts
+++ b/frontend/test/playwright/e2e/attribution.spec.ts
@@ -1,4 +1,6 @@
-import { test, expect } from "@playwright/test"
+import { expect } from "@playwright/test"
+
+import { test } from "~~/test/playwright/utils/test-fixture"
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 a9ff89b56..48714133e 100644
--- a/frontend/test/playwright/e2e/audio-detail.spec.ts
+++ b/frontend/test/playwright/e2e/audio-detail.spec.ts
@@ -1,6 +1,6 @@
-import { test, expect, Page } from "@playwright/test"
+import { expect, Page } from "@playwright/test"
-import { mockProviderApis } from "~~/test/playwright/utils/route"
+import { test } from "~~/test/playwright/utils/test-fixture"
const goToCustomAudioPage = async (page: Page) => {
// Test in a custom audio detail page, it should apply the same for any audio.
@@ -15,10 +15,6 @@ 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 9592a7969..8caf73301 100644
--- a/frontend/test/playwright/e2e/external-sources.spec.ts
+++ b/frontend/test/playwright/e2e/external-sources.spec.ts
@@ -1,4 +1,6 @@
-import { test, expect } from "@playwright/test"
+import { expect } from "@playwright/test"
+
+import { test } from "~~/test/playwright/utils/test-fixture"
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 e991ae554..83daf638b 100644
--- a/frontend/test/playwright/e2e/filters-sidebar-keyboard.spec.ts
+++ b/frontend/test/playwright/e2e/filters-sidebar-keyboard.spec.ts
@@ -1,4 +1,6 @@
-import { test, expect, Page } from "@playwright/test"
+import { expect, Page } from "@playwright/test"
+
+import { test } from "~~/test/playwright/utils/test-fixture"
import {
LanguageDirection,
diff --git a/frontend/test/playwright/e2e/filters.spec.ts b/frontend/test/playwright/e2e/filters.spec.ts
index f16adc345..a35eab94e 100644
--- a/frontend/test/playwright/e2e/filters.spec.ts
+++ b/frontend/test/playwright/e2e/filters.spec.ts
@@ -1,4 +1,6 @@
-import { test, expect, Page } from "@playwright/test"
+import { expect, Page } from "@playwright/test"
+
+import { test } from "~~/test/playwright/utils/test-fixture"
import {
assertCheckboxStatus,
@@ -8,8 +10,6 @@ import {
filters,
} from "~~/test/playwright/utils/navigation"
-import { mockProviderApis } from "~~/test/playwright/utils/route"
-
import breakpoints from "~~/test/playwright/utils/breakpoints"
import {
@@ -42,9 +42,6 @@ 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 01a0e7bed..dd74e6290 100644
--- a/frontend/test/playwright/e2e/global-audio.spec.ts
+++ b/frontend/test/playwright/e2e/global-audio.spec.ts
@@ -1,4 +1,6 @@
-import { expect, test } from "@playwright/test"
+import { expect } from "@playwright/test"
+
+import { test } from "~~/test/playwright/utils/test-fixture"
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 71fa4e143..f60b55771 100644
--- a/frontend/test/playwright/e2e/header-internal.spec.ts
+++ b/frontend/test/playwright/e2e/header-internal.spec.ts
@@ -1,4 +1,6 @@
-import { test, expect, Page } from "@playwright/test"
+import { expect, Page } from "@playwright/test"
+
+import { test } from "~~/test/playwright/utils/test-fixture"
import {
isDialogOpen,
diff --git a/frontend/test/playwright/e2e/homepage.spec.ts b/frontend/test/playwright/e2e/homepage.spec.ts
index 1d5c60283..2165d9106 100644
--- a/frontend/test/playwright/e2e/homepage.spec.ts
+++ b/frontend/test/playwright/e2e/homepage.spec.ts
@@ -1,16 +1,13 @@
-import { expect, Page, test } from "@playwright/test"
+import { expect, Page } from "@playwright/test"
+
+import { test } from "~~/test/playwright/utils/test-fixture"
-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 7b3de2828..010ba78a8 100644
--- a/frontend/test/playwright/e2e/image-detail.spec.ts
+++ b/frontend/test/playwright/e2e/image-detail.spec.ts
@@ -1,6 +1,7 @@
-import { test, expect, Page } from "@playwright/test"
+import { expect, Page } from "@playwright/test"
+
+import { test } from "~~/test/playwright/utils/test-fixture"
-import { mockProviderApis } from "~~/test/playwright/utils/route"
import { t } from "~~/test/playwright/utils/navigation"
const goToCustomImagePage = async (page: Page) => {
@@ -16,10 +17,6 @@ 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 63bf8d341..b5c6dcb3c 100644
--- a/frontend/test/playwright/e2e/load-more.spec.ts
+++ b/frontend/test/playwright/e2e/load-more.spec.ts
@@ -1,11 +1,12 @@
-import { expect, Page, test } from "@playwright/test"
+import { expect, Page } from "@playwright/test"
+
+import { test } from "~~/test/playwright/utils/test-fixture"
import {
goToSearchTerm,
renderModes,
t,
} from "~~/test/playwright/utils/navigation"
-import { mockProviderApis } from "~~/test/playwright/utils/route"
import { AUDIO, IMAGE, SupportedMediaType } from "~/constants/media"
@@ -39,10 +40,6 @@ 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 95f8c2719..64acb31ba 100644
--- a/frontend/test/playwright/e2e/migration-banner.spec.ts
+++ b/frontend/test/playwright/e2e/migration-banner.spec.ts
@@ -1,4 +1,6 @@
-import { test, expect } from "@playwright/test"
+import { expect } from "@playwright/test"
+
+import { test } from "~~/test/playwright/utils/test-fixture"
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 60117cd40..c153e86b7 100644
--- a/frontend/test/playwright/e2e/mobile-menu.spec.ts
+++ b/frontend/test/playwright/e2e/mobile-menu.spec.ts
@@ -1,4 +1,6 @@
-import { test, expect } from "@playwright/test"
+import { expect } from "@playwright/test"
+
+import { test } from "~~/test/playwright/utils/test-fixture"
import {
goToSearchTerm,
diff --git a/frontend/test/playwright/e2e/recent-searches.spec.ts b/frontend/test/playwright/e2e/recent-searches.spec.ts
index 316f3fb11..c43d0708c 100644
--- a/frontend/test/playwright/e2e/recent-searches.spec.ts
+++ b/frontend/test/playwright/e2e/recent-searches.spec.ts
@@ -1,4 +1,6 @@
-import { expect, test, type Page } from "@playwright/test"
+import { expect, type Page } from "@playwright/test"
+
+import { test } from "~~/test/playwright/utils/test-fixture"
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 a6fc32281..28cffc4fa 100644
--- a/frontend/test/playwright/e2e/redirect-queryless-searches.spec.ts
+++ b/frontend/test/playwright/e2e/redirect-queryless-searches.spec.ts
@@ -3,7 +3,9 @@
* redirect to the homepage.
*/
-import { test, expect } from "@playwright/test"
+import { expect } from "@playwright/test"
+
+import { test } from "~~/test/playwright/utils/test-fixture"
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 eb2393a7c..46a5757eb 100644
--- a/frontend/test/playwright/e2e/report-media.spec.ts
+++ b/frontend/test/playwright/e2e/report-media.spec.ts
@@ -1,6 +1,7 @@
-import { test, expect, Page, BrowserContext } from "@playwright/test"
+import { expect, Page, BrowserContext } from "@playwright/test"
+
+import { test } from "~~/test/playwright/utils/test-fixture"
-import { mockProviderApis } from "~~/test/playwright/utils/route"
import {
goToSearchTerm,
openFirstResult,
@@ -80,10 +81,6 @@ 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 fe5f047ee..2ebb2af2d 100644
--- a/frontend/test/playwright/e2e/search-navigation.spec.ts
+++ b/frontend/test/playwright/e2e/search-navigation.spec.ts
@@ -1,4 +1,6 @@
-import { expect, Page, test } from "@playwright/test"
+import { expect, Page } from "@playwright/test"
+
+import { test } from "~~/test/playwright/utils/test-fixture"
import {
goToSearchTerm,
@@ -7,7 +9,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"
@@ -21,10 +23,6 @@ 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 88d51495e..d01ff793c 100644
--- a/frontend/test/playwright/e2e/search-query-client.spec.ts
+++ b/frontend/test/playwright/e2e/search-query-client.spec.ts
@@ -1,11 +1,12 @@
-import { expect, test } from "@playwright/test"
+import { expect } from "@playwright/test"
+
+import { test } from "~~/test/playwright/utils/test-fixture"
import {
changeSearchType,
goToSearchTerm,
searchFromHeader,
} from "~~/test/playwright/utils/navigation"
-import { mockProviderApis } from "~~/test/playwright/utils/route"
import breakpoints from "~~/test/playwright/utils/breakpoints"
@@ -27,10 +28,6 @@ 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 cae7deadb..45f5c6eca 100644
--- a/frontend/test/playwright/e2e/search-query-server.spec.ts
+++ b/frontend/test/playwright/e2e/search-query-server.spec.ts
@@ -1,4 +1,6 @@
-import { test, expect } from "@playwright/test"
+import { expect } from "@playwright/test"
+
+import { test } from "~~/test/playwright/utils/test-fixture"
import {
assertCheckboxStatus,
@@ -7,7 +9,6 @@ import {
goToSearchTerm,
searchTypeNames,
} from "~~/test/playwright/utils/navigation"
-import { mockProviderApis } from "~~/test/playwright/utils/route"
import breakpoints from "~~/test/playwright/utils/breakpoints"
@@ -29,10 +30,6 @@ 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 c31be9de6..1b347af5c 100644
--- a/frontend/test/playwright/e2e/search-types.spec.ts
+++ b/frontend/test/playwright/e2e/search-types.spec.ts
@@ -1,10 +1,11 @@
-import { test, expect, Page } from "@playwright/test"
+import { expect, Page } from "@playwright/test"
+
+import { test } from "~~/test/playwright/utils/test-fixture"
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"
@@ -95,10 +96,6 @@ 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 678c74765..6ce2a59fa 100644
--- a/frontend/test/playwright/e2e/search.spec.ts
+++ b/frontend/test/playwright/e2e/search.spec.ts
@@ -6,9 +6,10 @@
* When pending: does not show 'No images', Safer Browsing, search rating or error message
* On error: shows error message
*/
-import { expect, test } from "@playwright/test"
+import { expect } from "@playwright/test"
+
+import { test } from "~~/test/playwright/utils/test-fixture"
-import { mockProviderApis } from "~~/test/playwright/utils/route"
import {
goToSearchTerm,
scrollToBottom,
@@ -17,10 +18,6 @@ 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 7f849ca73..79b976263 100644
--- a/frontend/test/playwright/e2e/translation-banner.spec.ts
+++ b/frontend/test/playwright/e2e/translation-banner.spec.ts
@@ -1,4 +1,6 @@
-import { test, expect } from "@playwright/test"
+import { expect } from "@playwright/test"
+
+import { test } from "~~/test/playwright/utils/test-fixture"
import { dismissBannersUsingCookies } from "~~/test/playwright/utils/navigation"
diff --git a/frontend/test/playwright/playwright.config.ts b/frontend/test/playwright/playwright.config.ts
index aa61c81d6..446619c85 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,
+ timeout: 60 * 1e3, // 1 minute
/**
* 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 04291eb38..3043cf33f 100644
--- a/frontend/test/playwright/utils/breakpoints.ts
+++ b/frontend/test/playwright/utils/breakpoints.ts
@@ -1,4 +1,6 @@
-import { test, expect, Expect } from "@playwright/test"
+import { expect, Expect } from "@playwright/test"
+
+import { test } from "~~/test/playwright/utils/test-fixture"
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
deleted file mode 100644
index 6c1d9c39d..000000000
--- a/frontend/test/playwright/utils/route.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-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
new file mode 100644
index 000000000..a38df4196
--- /dev/null
+++ b/frontend/test/playwright/utils/test-fixture.ts
@@ -0,0 +1,18 @@
+// 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 987f54d9c..3121c3082 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,8 +1,10 @@
-import { Page, test } from "@playwright/test"
+import { test } from "~~/test/playwright/utils/test-fixture"
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 78a0150ec..f3ea29182 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 "@playwright/test"
+import { test } from "~~/test/playwright/utils/test-fixture"
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 06755f568..4ccc81ea1 100644
--- a/frontend/test/playwright/visual-regression/components/filters.spec.ts
+++ b/frontend/test/playwright/visual-regression/components/filters.spec.ts
@@ -1,4 +1,6 @@
-import { expect, Page, test } from "@playwright/test"
+import { expect, Page } from "@playwright/test"
+
+import { test } from "~~/test/playwright/utils/test-fixture"
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 40b5dca5a..b7486630b 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 "@playwright/test"
+import { test } from "~~/test/playwright/utils/test-fixture"
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 5d5906d6e..649b4f8fd 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 "@playwright/test"
+import { test } from "~~/test/playwright/utils/test-fixture"
import breakpoints, {
isMobileBreakpoint,
diff --git a/frontend/test/playwright/visual-regression/pages/homepage.spec.ts b/frontend/test/playwright/visual-regression/pages/homepage.spec.ts
index d14949fd0..f6a2b664b 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, Page } from "@playwright/test"
+import { test } from "~~/test/playwright/utils/test-fixture"
import breakpoints from "~~/test/playwright/utils/breakpoints"
import { hideInputCursors } from "~~/test/playwright/utils/page"
@@ -9,6 +9,8 @@ import {
pathWithDir,
} from "~~/test/playwright/utils/navigation"
+import type { Page } from "@playwright/test"
+
test.describe.configure({ mode: "parallel" })
/**
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 2b9fe5a91..d5b0f5c23 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 "@playwright/test"
+import { test } from "~~/test/playwright/utils/test-fixture"
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 b7e51e807..b55148389 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 "@playwright/test"
+import { test } from "~~/test/playwright/utils/test-fixture"
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 83bc48782..01a5ba069 100644
--- a/frontend/test/playwright/visual-regression/pages/pages.spec.ts
+++ b/frontend/test/playwright/visual-regression/pages/pages.spec.ts
@@ -1,4 +1,6 @@
-import { expect, Page, test } from "@playwright/test"
+import { expect, Page } from "@playwright/test"
+
+import { test } from "~~/test/playwright/utils/test-fixture"
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 8a83bff59..6bb357c6b 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 "@playwright/test"
+import { test } from "~~/test/playwright/utils/test-fixture"
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 8fe51e276..3695e9875 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 "@playwright/test"
+import { test } from "~~/test/playwright/utils/test-fixture"
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 01a3389b2..f5d5c3226 100644
--- a/frontend/test/storybook/visual-regression/focus.spec.ts
+++ b/frontend/test/storybook/visual-regression/focus.spec.ts
@@ -1,4 +1,6 @@
-import { test, expect, Page, Locator } from "@playwright/test"
+import { expect, Page, Locator } from "@playwright/test"
+
+import { test } from "~~/test/playwright/utils/test-fixture"
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 62eed652c..bd8511f59 100644
--- a/frontend/test/storybook/visual-regression/v-button.spec.ts
+++ b/frontend/test/storybook/visual-regression/v-button.spec.ts
@@ -1,4 +1,6 @@
-import { expect, test } from "@playwright/test"
+import { expect } from "@playwright/test"
+
+import { test } from "~~/test/playwright/utils/test-fixture"
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 929676c03..23e951f30 100644
--- a/frontend/test/storybook/visual-regression/v-checkbox.spec.ts
+++ b/frontend/test/storybook/visual-regression/v-checkbox.spec.ts
@@ -1,4 +1,6 @@
-import { test, expect } from "@playwright/test"
+import { expect } from "@playwright/test"
+
+import { test } from "~~/test/playwright/utils/test-fixture"
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 eb9ad8e5d..7e7ddba88 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 "@playwright/test"
+import { test } from "~~/test/playwright/utils/test-fixture"
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 364d8cfa7..aa570afe1 100644
--- a/frontend/test/storybook/visual-regression/v-filter-tab.spec.ts
+++ b/frontend/test/storybook/visual-regression/v-filter-tab.spec.ts
@@ -1,4 +1,6 @@
-import { expect, Page, test } from "@playwright/test"
+import { expect, Page } from "@playwright/test"
+
+import { test } from "~~/test/playwright/utils/test-fixture"
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 1ef9eed95..a6f139de8 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 "@playwright/test"
+import { test } from "~~/test/playwright/utils/test-fixture"
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 05929880b..7d5264871 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 "@playwright/test"
+import { test } from "~~/test/playwright/utils/test-fixture"
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 ad1e1557f..0c083c82a 100644
--- a/frontend/test/storybook/visual-regression/v-icon-button.spec.ts
+++ b/frontend/test/storybook/visual-regression/v-icon-button.spec.ts
@@ -1,4 +1,6 @@
-import { expect, test } from "@playwright/test"
+import { expect } from "@playwright/test"
+
+import { test } from "~~/test/playwright/utils/test-fixture"
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 88d5a1cd2..3dddebeca 100644
--- a/frontend/test/storybook/visual-regression/v-language-select.spec.ts
+++ b/frontend/test/storybook/visual-regression/v-language-select.spec.ts
@@ -1,4 +1,6 @@
-import { Page, test, expect } from "@playwright/test"
+import { Page, expect } from "@playwright/test"
+
+import { test } from "~~/test/playwright/utils/test-fixture"
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 6807de6ca..f0faa40c1 100644
--- a/frontend/test/storybook/visual-regression/v-media-license.spec.ts
+++ b/frontend/test/storybook/visual-regression/v-media-license.spec.ts
@@ -1,7 +1,9 @@
-import { test, Page } from "@playwright/test"
+import { test } from "~~/test/playwright/utils/test-fixture"
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 ec74b3f0f..56eadbc95 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 "@playwright/test"
+import { test } from "~~/test/playwright/utils/test-fixture"
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 641fc7c30..b2a422e04 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 "@playwright/test"
+import { test } from "~~/test/playwright/utils/test-fixture"
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 9871c32e3..68858e2b2 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,4 +1,6 @@
-import { expect, test } from "@playwright/test"
+import { expect } from "@playwright/test"
+
+import { test } from "~~/test/playwright/utils/test-fixture"
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 888dd5d53..a8ed0e9a1 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 "@playwright/test"
+import { test } from "~~/test/playwright/utils/test-fixture"
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 ce30adce0..ca7116748 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 "@playwright/test"
+import { test } from "~~/test/playwright/utils/test-fixture"
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 3ba683949..c759c64af 100644
--- a/frontend/test/storybook/visual-regression/v-select-field.spec.ts
+++ b/frontend/test/storybook/visual-regression/v-select-field.spec.ts
@@ -1,4 +1,6 @@
-import { Page, test, expect } from "@playwright/test"
+import { Page, expect } from "@playwright/test"
+
+import { test } from "~~/test/playwright/utils/test-fixture"
import { makeGotoWithArgs } from "~~/test/storybook/utils/args"