Openverse is a search engine for openly-licensed media. This monorepo includes all application code.
Add baseline functionality for running Playwright tests against live environments (#5075)
Saradaf2545d57b8
diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.ymlindex 32b168c69..0e6efbcc6 100644--- a/.github/workflows/ci_cd.yml+++ b/.github/workflows/ci_cd.yml@@ -1312,6 +1312,22 @@ jobs:wait_time: 60 # check every minutemax_time: 1800 # allow up to 30 minutes for a deployment+ - name: Trigger staging Playwright smoketests+ uses: convictional/[email protected]+ with:+ owner: WordPress+ repo: openverse+ github_token: ${{ secrets.ACCESS_TOKEN }}+ workflow_file_name: playwright_deployment_smoketest.yml+ wait_interval: 60+ # TODO: Set to true once we see that this test is stable, and we can fail the deployment if it fails.+ # @see https://github.com/WordPress/openverse/pull/4991+ propagate_failure: false+ client_payload: |+ {+ "service_url": "https://staging.openverse.org/"+ }+- name: Trigger staging k6 load testuses: convictional/[email protected]with:diff --git a/.github/workflows/playwright_deployment_smoketest.yml b/.github/workflows/playwright_deployment_smoketest.ymlnew file mode 100644index 000000000..9b589668f--- /dev/null+++ b/.github/workflows/playwright_deployment_smoketest.yml@@ -0,0 +1,44 @@+name: Run Playwright smoketests++on:+ workflow_dispatch:+ inputs:+ service_url:+ description: "The service against which to run the Playwright smoketests."+ required: true+ type: string++run-name: Playwright smoketests ${{ inputs.service_url }}++# Disallow running multiple smoketests at once against the same service+concurrency: ${{ github.workflow }}-${{ inputs.service_url }}++jobs:+ smoketests:+ name: "Playwright smoketests ${{ inputs.service_url }}"+ runs-on: ubuntu-latest++ steps:+ - name: Checkout repository+ uses: actions/checkout@v4++ - name: Setup CI env+ uses: ./.github/actions/setup-env+ with:+ setup_python: false+ install_recipe: node-install++ - name: Run playwright+ env:+ # The secret name is k6 but it's usable for anything sending HMAC signed requests+ HMAC_SIGNING_SECRET: ${{ secrets.K6_SIGNING_SECRET }}+ PLAYWRIGHT_BASE_URL: ${{ inputs.service_url }}+ run: |+ just p frontend test:playwright --grep '@deployment-smoketest'++ - uses: actions/upload-artifact@v4+ if: failure()+ id: test-results+ with:+ name: test_results+ path: frontend/test-resultsdiff --git a/frontend/.remake/component-storybook-test/remake-fileName.spec.ts b/frontend/.remake/component-storybook-test/remake-fileName.spec.tsindex 8e9eb589a..696130e3c 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"import breakpoints from "~~/test/playwright/utils/breakpoints"diff --git a/frontend/docker-compose.playwright.yml b/frontend/docker-compose.playwright.ymlindex f89e81ec2..ab8911a7f 100644--- a/frontend/docker-compose.playwright.yml+++ b/frontend/docker-compose.playwright.yml@@ -20,3 +20,5 @@ services:- DEBUG=pw:webserver- UPDATE_TAPES=${UPDATE_TAPES:-false}- FASTSTART=${FASTSTART:-false}+ - PLAYWRIGHT_BASE_URL=${PLAYWRIGHT_BASE_URL:-}+ - HMAC_SIGNING_SECRET=${HMAC_SIGNING_SECRET:-}diff --git a/frontend/test/playwright/e2e/all-results-analytics.spec.ts b/frontend/test/playwright/e2e/all-results-analytics.spec.tsindex 6c8384f14..e8f046803 100644--- a/frontend/test/playwright/e2e/all-results-analytics.spec.ts+++ b/frontend/test/playwright/e2e/all-results-analytics.spec.ts@@ -1,4 +1,6 @@-import { expect, test } from "@playwright/test"+import { expect } from "@playwright/test"++import { test } from "~~/test/playwright/utils/test"import {getFirstResult,diff --git a/frontend/test/playwright/e2e/all-results-keyboard.spec.ts b/frontend/test/playwright/e2e/all-results-keyboard.spec.tsindex 52945eed7..af8f9b0b6 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 { expect, test } from "@playwright/test"+import { expect } from "@playwright/test"++import { test } from "~~/test/playwright/utils/test"import audio from "~~/test/playwright/utils/audio"import {@@ -30,116 +32,122 @@ const singleResultRegex = ()}-test.describe("all results grid keyboard accessibility test", () => {- const searchTerm = "birds"- test.beforeEach(async ({ page }) => {- await preparePageForTests(page, "xl")- await goToSearchTerm(page, searchTerm)- })-- test("should open image results as links", async ({ page }) => {- const mediaType = "image"- await walkToType(mediaType, page)- await page.keyboard.press("Enter")- const urlRegex = singleResultRegex(mediaType, searchTerm)-- await page.waitForURL(urlRegex)- expect(page.url()).toMatch(urlRegex)- })-- test("should open audio results as links", async ({ page }) => {- const mediaType = "audio"- await walkToType(mediaType, page)- await page.keyboard.press("Enter")- const urlRegex = singleResultRegex(mediaType, searchTerm)- await page.waitForURL(urlRegex)- expect(page.url()).toMatch(urlRegex)- })-- test("should show instructions snackbar when focusing first audio", async ({- page,- }) => {- await walkToType("audio", page)-- await expect(page.getByRole("alert")).toBeVisible()- })-- test("should hide the instructions snackbar when interacted with audio", async ({- page,- }) => {- await walkToType("audio", page)-- await expect(page.getByRole("alert")).toBeVisible()-- const focusedResult = await locateFocusedResult(page)- const playButton = await audio.getInactive(focusedResult)- await playButton.click()-- await expect(page.getByRole("alert")).toBeHidden()- })-- test("should allow toggling audio playback via play/pause click", async ({- page,- }) => {- await walkToType("audio", page)- const focusedResult = await locateFocusedResult(page)- const playButton = await audio.getInactive(focusedResult)- await playButton.click()-- // Get the path for comparison purposes- const url = new URL(page.url())- const path = url.pathname + url.search-- // should not navigate- expect(path).toMatch(/\/search\/?\?q=birds$/)-- const pauseButton = await audio.getActive(focusedResult)- await pauseButton.click()- await expect(playButton).toBeVisible()- })-- test("should allow toggling audio playback via spacebar", async ({- page,- }) => {- await walkToType("audio", page)- await page.keyboard.press(keycodes.Spacebar)- const focusedResult = await locateFocusedResult(page)- await expect(await audio.getActive(focusedResult)).toBeVisible()- await page.keyboard.press(keycodes.Spacebar)- await expect(await audio.getInactive(focusedResult)).toBeVisible()- })-- test("should pause audio after playing another", async ({ page }) => {- await walkToType("audio", page)- const focusedResult = await locateFocusedResult(page)- const playButton = await audio.getInactive(focusedResult)- await playButton.click()- const pauseButton = await audio.getActive(focusedResult)-- await page.keyboard.press(keycodes.Tab)- await walkToNextOfType("audio", page)-- const nextFocusedResult = await locateFocusedResult(page)- const nextPlayButton = await audio.getInactive(nextFocusedResult)- await nextPlayButton.click()- await audio.getActive(nextFocusedResult)-- await expect(playButton).toBeVisible()- await expect(pauseButton).toBeHidden()- })-- // Test for https://github.com/WordPress/openverse/issues/3940- test("clicking on skip-to-content should not navigate", async ({ page }) => {- const getResultsLabel = async (type: SupportedMediaType) => {- const link = await getContentLink(page, type)- return link.textContent()- }- const imageResultsLabel = await getResultsLabel("image")- const audioResultsLabel = await getResultsLabel("audio")-- await skipToContent(page)-- expect(await getResultsLabel("image")).toEqual(imageResultsLabel)- expect(await getResultsLabel("audio")).toEqual(audioResultsLabel)- })-})+test.describe(+ "all results grid keyboard accessibility test",+ { tag: "@deployment-smoketest" },+ () => {+ const searchTerm = "birds"+ test.beforeEach(async ({ page }) => {+ await preparePageForTests(page, "xl")+ await goToSearchTerm(page, searchTerm)+ })++ test("should open image results as links", async ({ page }) => {+ const mediaType = "image"+ await walkToType(mediaType, page)+ await page.keyboard.press("Enter")+ const urlRegex = singleResultRegex(mediaType, searchTerm)++ await page.waitForURL(urlRegex)+ expect(page.url()).toMatch(urlRegex)+ })++ test("should open audio results as links", async ({ page }) => {+ const mediaType = "audio"+ await walkToType(mediaType, page)+ await page.keyboard.press("Enter")+ const urlRegex = singleResultRegex(mediaType, searchTerm)+ await page.waitForURL(urlRegex)+ expect(page.url()).toMatch(urlRegex)+ })++ test("should show instructions snackbar when focusing first audio", async ({+ page,+ }) => {+ await walkToType("audio", page)++ await expect(page.getByRole("alert")).toBeVisible()+ })++ test("should hide the instructions snackbar when interacted with audio", async ({+ page,+ }) => {+ await walkToType("audio", page)++ await expect(page.getByRole("alert")).toBeVisible()++ const focusedResult = await locateFocusedResult(page)+ const playButton = await audio.getInactive(focusedResult)+ await playButton.click()++ await expect(page.getByRole("alert")).toBeHidden()+ })++ test("should allow toggling audio playback via play/pause click", async ({+ page,+ }) => {+ await walkToType("audio", page)+ const focusedResult = await locateFocusedResult(page)+ const playButton = await audio.getInactive(focusedResult)+ await playButton.click()++ // Get the path for comparison purposes+ const url = new URL(page.url())+ const path = url.pathname + url.search++ // should not navigate+ expect(path).toMatch(/\/search\/?\?q=birds$/)++ const pauseButton = await audio.getActive(focusedResult)+ await pauseButton.click()+ await expect(playButton).toBeVisible()+ })++ test("should allow toggling audio playback via spacebar", async ({+ page,+ }) => {+ await walkToType("audio", page)+ await page.keyboard.press(keycodes.Spacebar)+ const focusedResult = await locateFocusedResult(page)+ await expect(await audio.getActive(focusedResult)).toBeVisible()+ await page.keyboard.press(keycodes.Spacebar)+ await expect(await audio.getInactive(focusedResult)).toBeVisible()+ })++ test("should pause audio after playing another", async ({ page }) => {+ await walkToType("audio", page)+ const focusedResult = await locateFocusedResult(page)+ const playButton = await audio.getInactive(focusedResult)+ await playButton.click()+ const pauseButton = await audio.getActive(focusedResult)++ await page.keyboard.press(keycodes.Tab)+ await walkToNextOfType("audio", page)++ const nextFocusedResult = await locateFocusedResult(page)+ const nextPlayButton = await audio.getInactive(nextFocusedResult)+ await nextPlayButton.click()+ await audio.getActive(nextFocusedResult)++ await expect(playButton).toBeVisible()+ await expect(pauseButton).toBeHidden()+ })++ // Test for https://github.com/WordPress/openverse/issues/3940+ test("clicking on skip-to-content should not navigate", async ({+ page,+ }) => {+ const getResultsLabel = async (type: SupportedMediaType) => {+ const link = await getContentLink(page, type)+ return link.textContent()+ }+ const imageResultsLabel = await getResultsLabel("image")+ const audioResultsLabel = await getResultsLabel("audio")++ await skipToContent(page)++ expect(await getResultsLabel("image")).toEqual(imageResultsLabel)+ expect(await getResultsLabel("audio")).toEqual(audioResultsLabel)+ })+ }+)diff --git a/frontend/test/playwright/e2e/attribution.spec.ts b/frontend/test/playwright/e2e/attribution.spec.tsindex 538de279a..c9b469be5 100644--- a/frontend/test/playwright/e2e/attribution.spec.ts+++ b/frontend/test/playwright/e2e/attribution.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"import { preparePageForTests } from "~~/test/playwright/utils/navigation"import {diff --git a/frontend/test/playwright/e2e/audio-detail.spec.ts b/frontend/test/playwright/e2e/audio-detail.spec.tsindex 31f989a04..d8ec7fd2f 100644--- a/frontend/test/playwright/e2e/audio-detail.spec.ts+++ b/frontend/test/playwright/e2e/audio-detail.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"import {collectAnalyticsEvents,diff --git a/frontend/test/playwright/e2e/audio-results.spec.ts b/frontend/test/playwright/e2e/audio-results.spec.tsindex ea83f05c5..3a2b3a1cd 100644--- a/frontend/test/playwright/e2e/audio-results.spec.ts+++ b/frontend/test/playwright/e2e/audio-results.spec.ts@@ -1,4 +1,6 @@-import { expect, test } from "@playwright/test"+import { expect } from "@playwright/test"++import { test } from "~~/test/playwright/utils/test"import {goToSearchTerm,diff --git a/frontend/test/playwright/e2e/collections.spec.ts b/frontend/test/playwright/e2e/collections.spec.tsindex 81c2fb651..0b991fa44 100644--- a/frontend/test/playwright/e2e/collections.spec.ts+++ b/frontend/test/playwright/e2e/collections.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"import { preparePageForTests } from "~~/test/playwright/utils/navigation"import {diff --git a/frontend/test/playwright/e2e/external-sources.spec.ts b/frontend/test/playwright/e2e/external-sources.spec.tsindex cfd8adccf..ee0059553 100644--- a/frontend/test/playwright/e2e/external-sources.spec.ts+++ b/frontend/test/playwright/e2e/external-sources.spec.ts@@ -1,4 +1,6 @@-import { expect, test } from "@playwright/test"+import { expect } from "@playwright/test"++import { test } from "~~/test/playwright/utils/test"import {goToSearchTerm,diff --git a/frontend/test/playwright/e2e/filters-sidebar-keyboard.spec.ts b/frontend/test/playwright/e2e/filters-sidebar-keyboard.spec.tsindex 177fbe9a0..112da5f2c 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"import {goToSearchTerm,diff --git a/frontend/test/playwright/e2e/filters.spec.ts b/frontend/test/playwright/e2e/filters.spec.tsindex 757d4ff73..30953eb25 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"import {changeSearchType,diff --git a/frontend/test/playwright/e2e/global-audio.spec.ts b/frontend/test/playwright/e2e/global-audio.spec.tsindex 0f7ce9eea..fa71a121b 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"import {goToSearchTerm,diff --git a/frontend/test/playwright/e2e/header-internal.spec.ts b/frontend/test/playwright/e2e/header-internal.spec.tsindex 57b93a6e3..812a17163 100644--- a/frontend/test/playwright/e2e/header-internal.spec.ts+++ b/frontend/test/playwright/e2e/header-internal.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"import {isDialogOpen,diff --git a/frontend/test/playwright/e2e/healthcheck.spec.ts b/frontend/test/playwright/e2e/healthcheck.spec.tsindex 4ea524fbe..555b21a71 100644--- a/frontend/test/playwright/e2e/healthcheck.spec.ts+++ b/frontend/test/playwright/e2e/healthcheck.spec.ts@@ -1,4 +1,6 @@-import { test, expect } from "@playwright/test"+import { expect } from "@playwright/test"++import { test } from "~~/test/playwright/utils/test"test("returns OK on healthcheck", async ({ page }) => {await page.goto("/healthcheck")diff --git a/frontend/test/playwright/e2e/homepage.spec.ts b/frontend/test/playwright/e2e/homepage.spec.tsindex 9432c4801..f23c32938 100644--- a/frontend/test/playwright/e2e/homepage.spec.ts+++ b/frontend/test/playwright/e2e/homepage.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"import { mockProviderApis } from "~~/test/playwright/utils/route"import {diff --git a/frontend/test/playwright/e2e/image-detail.spec.ts b/frontend/test/playwright/e2e/image-detail.spec.tsindex 3bc5114c1..e0cac8530 100644--- a/frontend/test/playwright/e2e/image-detail.spec.ts+++ b/frontend/test/playwright/e2e/image-detail.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"import { mockProviderApis } from "~~/test/playwright/utils/route"import {diff --git a/frontend/test/playwright/e2e/load-more.spec.ts b/frontend/test/playwright/e2e/load-more.spec.tsindex 34d394dd3..00a924b66 100644--- a/frontend/test/playwright/e2e/load-more.spec.ts+++ b/frontend/test/playwright/e2e/load-more.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"import {goToSearchTerm,diff --git a/frontend/test/playwright/e2e/mobile-menu.spec.ts b/frontend/test/playwright/e2e/mobile-menu.spec.tsindex 780442541..f60f01af3 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, type Page } from "@playwright/test"+import { expect, type Page } from "@playwright/test"++import { test } from "~~/test/playwright/utils/test"import {goToSearchTerm,diff --git a/frontend/test/playwright/e2e/preferences.spec.ts b/frontend/test/playwright/e2e/preferences.spec.tsindex bb91b8b74..185676cef 100644--- a/frontend/test/playwright/e2e/preferences.spec.ts+++ b/frontend/test/playwright/e2e/preferences.spec.ts@@ -1,4 +1,6 @@-import { type Page, expect, test } from "@playwright/test"+import { type Page, expect } from "@playwright/test"++import { test } from "~~/test/playwright/utils/test"import { preparePageForTests } from "~~/test/playwright/utils/navigation"diff --git a/frontend/test/playwright/e2e/recent-searches.spec.ts b/frontend/test/playwright/e2e/recent-searches.spec.tsindex 94485c760..aefd205ac 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"import {goToSearchTerm,diff --git a/frontend/test/playwright/e2e/redirect-queryless-searches.spec.ts b/frontend/test/playwright/e2e/redirect-queryless-searches.spec.tsindex a6fc32281..791ed0280 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"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.tsindex 8233a0216..2f9b2b73e 100644--- a/frontend/test/playwright/e2e/report-media.spec.ts+++ b/frontend/test/playwright/e2e/report-media.spec.ts@@ -1,4 +1,6 @@-import { test, expect, Page, BrowserContext } from "@playwright/test"+import { expect, Page, BrowserContext } from "@playwright/test"++import { test } from "~~/test/playwright/utils/test"import { mockProviderApis } from "~~/test/playwright/utils/route"import {diff --git a/frontend/test/playwright/e2e/search-analytics.spec.ts b/frontend/test/playwright/e2e/search-analytics.spec.tsindex d81a62509..7adde23cd 100644--- a/frontend/test/playwright/e2e/search-analytics.spec.ts+++ b/frontend/test/playwright/e2e/search-analytics.spec.ts@@ -1,4 +1,6 @@-import { expect, test } from "@playwright/test"+import { expect } from "@playwright/test"++import { test } from "~~/test/playwright/utils/test"import {goToSearchTerm,diff --git a/frontend/test/playwright/e2e/search-navigation.spec.ts b/frontend/test/playwright/e2e/search-navigation.spec.tsindex 7dc10dc47..7b57e1807 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, test } from "@playwright/test"+import { expect } from "@playwright/test"++import { test } from "~~/test/playwright/utils/test"import {filters,diff --git a/frontend/test/playwright/e2e/search-query-client.spec.ts b/frontend/test/playwright/e2e/search-query-client.spec.tsindex bc644c9e0..16b4d9d57 100644--- a/frontend/test/playwright/e2e/search-query-client.spec.ts+++ b/frontend/test/playwright/e2e/search-query-client.spec.ts@@ -1,4 +1,6 @@-import { expect, test } from "@playwright/test"+import { expect } from "@playwright/test"++import { test } from "~~/test/playwright/utils/test"import {changeSearchType,diff --git a/frontend/test/playwright/e2e/search-query-server.spec.ts b/frontend/test/playwright/e2e/search-query-server.spec.tsindex 6aeb08a60..65ca776f2 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"import {currentContentType,diff --git a/frontend/test/playwright/e2e/search-types.spec.ts b/frontend/test/playwright/e2e/search-types.spec.tsindex 06f0c3b6b..ce169fecc 100644--- a/frontend/test/playwright/e2e/search-types.spec.ts+++ b/frontend/test/playwright/e2e/search-types.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"import {changeSearchType,diff --git a/frontend/test/playwright/e2e/search.spec.ts b/frontend/test/playwright/e2e/search.spec.tsindex 2a81c32b1..06f238d37 100644--- a/frontend/test/playwright/e2e/search.spec.ts+++ b/frontend/test/playwright/e2e/search.spec.ts@@ -6,7 +6,9 @@* 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"import {collectAnalyticsEvents,diff --git a/frontend/test/playwright/e2e/sensitive-results.spec.ts b/frontend/test/playwright/e2e/sensitive-results.spec.tsindex 4ac1fd04d..623f3b196 100644--- a/frontend/test/playwright/e2e/sensitive-results.spec.ts+++ b/frontend/test/playwright/e2e/sensitive-results.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"import {filters,diff --git a/frontend/test/playwright/e2e/seo.spec.ts b/frontend/test/playwright/e2e/seo.spec.tsindex 9826f7d9a..e67ca28b4 100644--- a/frontend/test/playwright/e2e/seo.spec.ts+++ b/frontend/test/playwright/e2e/seo.spec.ts@@ -1,4 +1,6 @@-import { expect, test } from "@playwright/test"+import { expect } from "@playwright/test"++import { test } from "~~/test/playwright/utils/test"import { preparePageForTests } from "~~/test/playwright/utils/navigation"diff --git a/frontend/test/playwright/e2e/single-result-analytics.spec.ts b/frontend/test/playwright/e2e/single-result-analytics.spec.tsindex df76f08f0..246b72647 100644--- a/frontend/test/playwright/e2e/single-result-analytics.spec.ts+++ b/frontend/test/playwright/e2e/single-result-analytics.spec.ts@@ -1,4 +1,6 @@-import { expect, test } from "@playwright/test"+import { expect } from "@playwright/test"++import { test } from "~~/test/playwright/utils/test"import {goToSearchTerm,diff --git a/frontend/test/playwright/e2e/skip-to-content.spec.ts b/frontend/test/playwright/e2e/skip-to-content.spec.tsindex 7441a8528..4044a4970 100644--- a/frontend/test/playwright/e2e/skip-to-content.spec.ts+++ b/frontend/test/playwright/e2e/skip-to-content.spec.ts@@ -1,4 +1,6 @@-import { expect, test } from "@playwright/test"+import { expect } from "@playwright/test"++import { test } from "~~/test/playwright/utils/test"import breakpoints from "~~/test/playwright/utils/breakpoints"diff --git a/frontend/test/playwright/e2e/sources.spec.ts b/frontend/test/playwright/e2e/sources.spec.tsindex 04fb09e06..169a2161d 100644--- a/frontend/test/playwright/e2e/sources.spec.ts+++ b/frontend/test/playwright/e2e/sources.spec.ts@@ -1,4 +1,6 @@-import { expect, test } from "@playwright/test"+import { expect } from "@playwright/test"++import { test } from "~~/test/playwright/utils/test"import { getH1 } from "~~/test/playwright/utils/components"import { preparePageForTests } from "~~/test/playwright/utils/navigation"diff --git a/frontend/test/playwright/e2e/translation-banner.spec.ts b/frontend/test/playwright/e2e/translation-banner.spec.tsindex 853fa85bc..e3ea794cc 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"import { preparePageForTests } from "~~/test/playwright/utils/navigation"diff --git a/frontend/test/playwright/playwright.config.ts b/frontend/test/playwright/playwright.config.tsindex 2ad345677..b7f9090c8 100644--- a/frontend/test/playwright/playwright.config.ts+++ b/frontend/test/playwright/playwright.config.ts@@ -19,27 +19,37 @@ export const API_URL = "http://localhost:49153/"*/const pwCommand = process.env.FASTSTART !== "false" ? "dev" : "prod:playwright"+const localBaseURL = "http://localhost:8443"+const baseURL = process.env.PLAYWRIGHT_BASE_URL || localBaseURL++// Only run the local webserver if the baseURL is the local+// In other words, don't bother running the webserver if the test target is a live environment+const webServer =+ baseURL === localBaseURL+ ? {+ command: `pnpm exec npm-run-all -p -r talkback ${pwCommand}`,+ timeout: process.env.CI ? 60_000 * 5 : 60_000 * 10, // 5 minutes in CI, 10 in other envs+ port: 8443,+ reuseExistingServer: !process.env.CI || process.env.PWDEBUG === "1",+ env: {+ UPDATE_TAPES: UPDATE_TAPES,+ NUXT_PUBLIC_API_URL: API_URL,+ // Must be true for seo tests to receive appropriate values+ NUXT_PUBLIC_SITE_INDEXABLE: "true",+ NUXT_PUBLIC_DEPLOYMENT_ENV: STAGING,+ NUXT_PUBLIC_PLAUSIBLE_DOMAIN: "localhost",+ NUXT_PUBLIC_PLAUSIBLE_API_HOST: "http://localhost:50290",+ NUXT_PUBLIC_PLAUSIBLE_AUTO_PAGEVIEWS: "false",+ NUXT_PUBLIC_PLAUSIBLE_IGNORED_HOSTNAMES: "[]",+ },+ }+ : undefined+const config: PlaywrightTestConfig = {forbidOnly: !!process.env.CI,- webServer: {- command: `pnpm exec npm-run-all -p -r talkback ${pwCommand}`,- timeout: process.env.CI ? 60_000 * 5 : 60_000 * 10, // 5 minutes in CI, 10 in other envs- port: 8443,- reuseExistingServer: !process.env.CI || process.env.PWDEBUG === "1",- env: {- UPDATE_TAPES: UPDATE_TAPES,- NUXT_PUBLIC_API_URL: API_URL,- // Must be true for seo tests to receive appropriate values- NUXT_PUBLIC_SITE_INDEXABLE: "true",- NUXT_PUBLIC_DEPLOYMENT_ENV: STAGING,- NUXT_PUBLIC_PLAUSIBLE_DOMAIN: "localhost",- NUXT_PUBLIC_PLAUSIBLE_API_HOST: "http://localhost:50290",- NUXT_PUBLIC_PLAUSIBLE_AUTO_PAGEVIEWS: "false",- NUXT_PUBLIC_PLAUSIBLE_IGNORED_HOSTNAMES: "[]",- },- },+ webServer,use: {- baseURL: "http://localhost:8443",+ baseURL,trace: "retain-on-failure",},timeout: 60 * 1e3,@@ -51,8 +61,11 @@ const config: PlaywrightTestConfig = {* and then reuse it for the others. If we run with a single worker when updating* tapes then we can avoid this problem. Defaulting to `undefined` means the* Playwright default of using 1/2 of the number of CPU cores continues to work otherwise.+ *+ * Also: when running Playwright against a live environment, only use a single worker+ * to avoid the test also becoming a load test.*/- workers: UPDATE_TAPES === "true" ? 1 : undefined,+ workers: UPDATE_TAPES === "true" || baseURL !== localBaseURL ? 1 : undefined,}export default configdiff --git a/frontend/test/playwright/utils/breakpoints.ts b/frontend/test/playwright/utils/breakpoints.tsindex 3234c9412..6b574b098 100644--- a/frontend/test/playwright/utils/breakpoints.ts+++ b/frontend/test/playwright/utils/breakpoints.ts@@ -1,4 +1,4 @@-import { test } from "@playwright/test"+import { test } from "~~/test/playwright/utils/test"import type { LanguageDirection } from "~~/test/playwright/utils/i18n"diff --git a/frontend/test/playwright/utils/test.ts b/frontend/test/playwright/utils/test.tsnew file mode 100644index 000000000..e9c12e066--- /dev/null+++ b/frontend/test/playwright/utils/test.ts@@ -0,0 +1,61 @@+// eslint-disable-next-line no-restricted-imports+import { test as base } from "@playwright/test"++const encoder = new TextEncoder()++const signingSecret = process.env.HMAC_SIGNING_SECRET++const { subtle } = globalThis.crypto++let signingKey: null | CryptoKey = null++async function getSigningKey() {+ if (!signingSecret) {+ return null+ }++ if (!signingKey) {+ const encodedSecret = encoder.encode(signingSecret)+ signingKey = await crypto.subtle.importKey(+ "raw",+ encodedSecret,+ { name: "HMAC", hash: "SHA-256" },+ false,+ ["sign"]+ )+ }++ return signingKey+}++export const test = base.extend({+ page: async ({ page }, use) => {+ // Only match staging; it'll just be ignored for local testing+ await page.route(+ (url) => url.host === "staging.openverse.org",+ async (route) => {+ const key = await getSigningKey()+ if (!key) {+ return route.continue()+ }++ const request = route.request()+ const url = new URL(request.url())+ const timestamp = Math.floor(Date.now() / 1000)+ const resource = `${url.pathname}${url.search}${timestamp}`+ const mac = await subtle.sign("HMAC", key, encoder.encode(resource))++ const headers = request.headers()+ await route.continue({+ headers: {+ ...headers,+ "x-ov-cf-mac": Buffer.from(mac).toString("base64url"),+ "x-ov-cf-timestamp": timestamp.toString(),+ },+ })+ }+ )++ 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.tsindex bc9240e87..aa9177bfc 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,4 +1,6 @@-import { Page, test } from "@playwright/test"+import { type Page } from "@playwright/test"++import { test } from "~~/test/playwright/utils/test"import { preparePageForTests } from "~~/test/playwright/utils/navigation"import breakpoints from "~~/test/playwright/utils/breakpoints"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.tsindex 2a80711de..409fc3568 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"import {goToSearchTerm,diff --git a/frontend/test/playwright/visual-regression/components/filters.spec.ts b/frontend/test/playwright/visual-regression/components/filters.spec.tsindex 72535cb0e..5a74ddfde 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, test, type Page } from "@playwright/test"+import { expect, type Page } from "@playwright/test"++import { test } from "~~/test/playwright/utils/test"import {filters,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.tsindex f61c7bec5..76c02ce2f 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"import {pathWithDir,diff --git a/frontend/test/playwright/visual-regression/components/header.spec.ts b/frontend/test/playwright/visual-regression/components/header.spec.tsindex 58d86c456..82ca4e0ef 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"import breakpoints, {isMobileBreakpoint,diff --git a/frontend/test/playwright/visual-regression/pages/errors.spec.ts b/frontend/test/playwright/visual-regression/pages/errors.spec.tsindex d62bc0418..aa9bffbd4 100644--- a/frontend/test/playwright/visual-regression/pages/errors.spec.ts+++ b/frontend/test/playwright/visual-regression/pages/errors.spec.ts@@ -1,4 +1,4 @@-import { test } from "@playwright/test"+import { test } from "~~/test/playwright/utils/test"import breakpoints from "~~/test/playwright/utils/breakpoints"import {diff --git a/frontend/test/playwright/visual-regression/pages/homepage.spec.ts b/frontend/test/playwright/visual-regression/pages/homepage.spec.tsindex d5905d9a9..97bdd4393 100644--- a/frontend/test/playwright/visual-regression/pages/homepage.spec.ts+++ b/frontend/test/playwright/visual-regression/pages/homepage.spec.ts@@ -1,4 +1,6 @@-import { test, Page } from "@playwright/test"+import { Page } from "@playwright/test"++import { test } from "~~/test/playwright/utils/test"import breakpoints from "~~/test/playwright/utils/breakpoints"import { hideInputCursors } from "~~/test/playwright/utils/page"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.tsindex 278b65a0c..c9f2294b5 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,6 @@-import { expect, test } from "@playwright/test"+import { expect } from "@playwright/test"++import { test } from "~~/test/playwright/utils/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.tsindex 63449f647..47ad69bb7 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, test } from "@playwright/test"+import { expect } from "@playwright/test"++import { test } from "~~/test/playwright/utils/test"import breakpoints from "~~/test/playwright/utils/breakpoints"import {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.tsindex e1752cd66..f66babd9c 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"import breakpoints from "~~/test/playwright/utils/breakpoints"import {diff --git a/frontend/test/storybook/functional/smoke-test.spec.ts b/frontend/test/storybook/functional/smoke-test.spec.tsindex 8cc0b9998..b144cb65f 100644--- a/frontend/test/storybook/functional/smoke-test.spec.ts+++ b/frontend/test/storybook/functional/smoke-test.spec.ts@@ -1,4 +1,6 @@-import { test, expect, type Page, type Locator } from "@playwright/test"+import { expect, type Page, type Locator } from "@playwright/test"++import { test } from "~~/test/playwright/utils/test"const checkPageLoaded = async (page: Page) => {await expect(diff --git a/frontend/test/storybook/functional/v-checkbox.spec.ts b/frontend/test/storybook/functional/v-checkbox.spec.tsindex 79176312c..df6ed7438 100644--- a/frontend/test/storybook/functional/v-checkbox.spec.ts+++ b/frontend/test/storybook/functional/v-checkbox.spec.ts@@ -1,4 +1,6 @@-import { expect, test } from "@playwright/test"+import { expect } from "@playwright/test"++import { test } from "~~/test/playwright/utils/test"import { makeGotoWithArgs } from "~~/test/storybook/utils/args"diff --git a/frontend/test/storybook/functional/v-popover.spec.ts b/frontend/test/storybook/functional/v-popover.spec.tsindex 0fce0d701..6b037129e 100644--- a/frontend/test/storybook/functional/v-popover.spec.ts+++ b/frontend/test/storybook/functional/v-popover.spec.ts@@ -1,4 +1,6 @@-import { expect, test } from "@playwright/test"+import { expect } from "@playwright/test"++import { test } from "~~/test/playwright/utils/test"const popoverStory ="/iframe.html?id=components-vpopover--control&viewMode=story"diff --git a/frontend/test/storybook/visual-regression/custom-button-components.spec.ts b/frontend/test/storybook/visual-regression/custom-button-components.spec.tsindex 02eab94f1..e7b0d9472 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"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.tsindex ccbb01cd4..28bdbfbaf 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, Page } from "@playwright/test"+import { Page } from "@playwright/test"++import { test } from "~~/test/playwright/utils/test"import { expectScreenshotAreaSnapshot } from "~~/test/playwright/utils/expect-snapshot"diff --git a/frontend/test/storybook/visual-regression/v-button.spec.ts b/frontend/test/storybook/visual-regression/v-button.spec.tsindex be523d5c4..3368661b3 100644--- a/frontend/test/storybook/visual-regression/v-button.spec.ts+++ b/frontend/test/storybook/visual-regression/v-button.spec.ts@@ -1,4 +1,4 @@-import { test } from "@playwright/test"+import { test } from "~~/test/playwright/utils/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.tsindex d604f8f92..1d37eb569 100644--- a/frontend/test/storybook/visual-regression/v-checkbox.spec.ts+++ b/frontend/test/storybook/visual-regression/v-checkbox.spec.ts@@ -1,4 +1,4 @@-import { test } from "@playwright/test"+import { test } from "~~/test/playwright/utils/test"import { expectScreenshotAreaSnapshot } from "~~/test/playwright/utils/expect-snapshot"diff --git a/frontend/test/storybook/visual-regression/v-collection-header.spec.ts b/frontend/test/storybook/visual-regression/v-collection-header.spec.tsindex d0393e060..935d1b140 100644--- a/frontend/test/storybook/visual-regression/v-collection-header.spec.ts+++ b/frontend/test/storybook/visual-regression/v-collection-header.spec.ts@@ -1,4 +1,6 @@-import { expect, test } from "@playwright/test"+import { expect } from "@playwright/test"++import { test } from "~~/test/playwright/utils/test"import breakpoints from "~~/test/playwright/utils/breakpoints"import { dirParam } from "~~/test/storybook/utils/args"diff --git a/frontend/test/storybook/visual-regression/v-filter-button.spec.ts b/frontend/test/storybook/visual-regression/v-filter-button.spec.tsindex 4640cc8d7..a285238d1 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"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.tsindex 4d5211172..ea94bf398 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, type Page, test } from "@playwright/test"+import { expect, type Page } from "@playwright/test"++import { test } from "~~/test/playwright/utils/test"import { makeUrlWithArgs } from "~~/test/storybook/utils/args"import { waitForResponse } from "~~/test/storybook/utils/response"diff --git a/frontend/test/storybook/visual-regression/v-footer.spec.ts b/frontend/test/storybook/visual-regression/v-footer.spec.tsindex 482e50cbe..2f2db2469 100644--- a/frontend/test/storybook/visual-regression/v-footer.spec.ts+++ b/frontend/test/storybook/visual-regression/v-footer.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"import breakpoints from "~~/test/playwright/utils/breakpoints"diff --git a/frontend/test/storybook/visual-regression/v-header-internal.spec.ts b/frontend/test/storybook/visual-regression/v-header-internal.spec.tsindex f704eebfc..7f12d9b0e 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"import breakpoints from "~~/test/playwright/utils/breakpoints"import {diff --git a/frontend/test/storybook/visual-regression/v-icon-button.spec.ts b/frontend/test/storybook/visual-regression/v-icon-button.spec.tsindex aa47b137b..062350317 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"import { expectSnapshot } from "~~/test/playwright/utils/expect-snapshot"diff --git a/frontend/test/storybook/visual-regression/v-image-cell.spec.ts b/frontend/test/storybook/visual-regression/v-image-cell.spec.tsindex 12cbb04f3..8b94222f7 100644--- a/frontend/test/storybook/visual-regression/v-image-cell.spec.ts+++ b/frontend/test/storybook/visual-regression/v-image-cell.spec.ts@@ -1,4 +1,4 @@-import { test } from "@playwright/test"+import { test } from "~~/test/playwright/utils/test"import breakpoints from "~~/test/playwright/utils/breakpoints"diff --git a/frontend/test/storybook/visual-regression/v-language-select.spec.ts b/frontend/test/storybook/visual-regression/v-language-select.spec.tsindex 635486802..9721f7cae 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 { expect, test } from "@playwright/test"+import { expect } from "@playwright/test"++import { test } from "~~/test/playwright/utils/test"import { makeGotoWithArgs } from "~~/test/storybook/utils/args"import { expectSnapshot } from "~~/test/playwright/utils/expect-snapshot"diff --git a/frontend/test/storybook/visual-regression/v-media-license.spec.ts b/frontend/test/storybook/visual-regression/v-media-license.spec.tsindex 4e13b506c..a58f0b323 100644--- a/frontend/test/storybook/visual-regression/v-media-license.spec.ts+++ b/frontend/test/storybook/visual-regression/v-media-license.spec.ts@@ -1,4 +1,6 @@-import { test, Page } from "@playwright/test"+import { Page } from "@playwright/test"++import { test } from "~~/test/playwright/utils/test"import breakpoints from "~~/test/playwright/utils/breakpoints"diff --git a/frontend/test/storybook/visual-regression/v-media-reuse.spec.ts b/frontend/test/storybook/visual-regression/v-media-reuse.spec.tsindex fd92485bc..1922cf7e3 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"import breakpoints from "~~/test/playwright/utils/breakpoints"import { sleep } 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.tsindex a68faecb5..422c41f6c 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"import breakpoints from "~~/test/playwright/utils/breakpoints"diff --git a/frontend/test/storybook/visual-regression/v-safety-wall.spec.ts b/frontend/test/storybook/visual-regression/v-safety-wall.spec.tsindex 4c35c4e26..c501155b2 100644--- a/frontend/test/storybook/visual-regression/v-safety-wall.spec.ts+++ b/frontend/test/storybook/visual-regression/v-safety-wall.spec.ts@@ -1,4 +1,4 @@-import { test } from "@playwright/test"+import { test } from "~~/test/playwright/utils/test"import breakpoints from "~~/test/playwright/utils/breakpoints"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.tsindex a98168cdf..e5c87720f 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,4 @@-import { test } from "@playwright/test"+import { test } from "~~/test/playwright/utils/test"import { expectSnapshot } from "~~/test/playwright/utils/expect-snapshot"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.tsindex 915ff4a28..8b5fdda62 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,6 @@-import { expect, type Page, test } from "@playwright/test"+import { expect, type Page } from "@playwright/test"++import { test } from "~~/test/playwright/utils/test"import { makeUrlWithArgs } from "~~/test/storybook/utils/args"import { t } from "~~/test/playwright/utils/i18n"diff --git a/frontend/test/storybook/visual-regression/v-search-types.spec.ts b/frontend/test/storybook/visual-regression/v-search-types.spec.tsindex 3792e5ecf..381c0b9cb 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,6 @@-import { expect, test } from "@playwright/test"+import { expect } from "@playwright/test"++import { test } from "~~/test/playwright/utils/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.tsindex dedabccb3..b1424359e 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 { test, expect } from "@playwright/test"+import { expect } from "@playwright/test"++import { test } from "~~/test/playwright/utils/test"import { makeGotoWithArgs } from "~~/test/storybook/utils/args"import { expectSnapshot } from "~~/test/playwright/utils/expect-snapshot"diff --git a/packages/js/eslint-plugin/src/configs/index.ts b/packages/js/eslint-plugin/src/configs/index.tsindex c67c76c8d..1a4d505c8 100644--- a/packages/js/eslint-plugin/src/configs/index.ts+++ b/packages/js/eslint-plugin/src/configs/index.ts@@ -108,6 +108,16 @@ export const project: TSESLint.Linter.ConfigType = {],},],++ "no-restricted-imports": [+ "error",+ {+ name: "@playwright/test",+ importNames: ["test"],+ message:+ "Import test from `~~/test/playwright/utils/test` to ensure global fixtures are used.",+ },+ ],},},{