Skip to content

Commit

Permalink
Revert PW changes from #1920
Browse files Browse the repository at this point in the history
  • Loading branch information
obulat committed May 25, 2023
1 parent f138b15 commit 810053a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 19 deletions.
1 change: 0 additions & 1 deletion frontend/docker-compose.playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,4 @@ services:
- DEBUG=pw:webserver
- DISABLE_SENTRY=true
- UPDATE_TAPES=${UPDATE_TAPES:-false}
- FASTSTART=${FASTSTART:-false}
cpus: 0.000
4 changes: 1 addition & 3 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"docker:run": "docker run --rm -it -p 127.0.0.1:8443:8443/tcp openverse-frontend:latest",
"generate": "nuxt generate",
"start": "nuxt start",
"start:playwright": "pnpm i18n:copy-test-locales && pnpm start",
"prod": "pnpm build:only && pnpm start",
"prod:playwright": "pnpm i18n:copy-test-locales && pnpm prod",
"storybook": "nuxt storybook --port=54000",
Expand All @@ -30,12 +29,11 @@
"test:unit": "jest",
"test:unit:watch": "pnpm test:unit --collectCoverage=false --watch",
"test:playwright": "./bin/playwright.sh",
"test:playwright:local": "DISABLE_SENTRY=true pnpm exec playwright test -c test/playwright",
"test:playwright:local": "DISABLE_SENTRY=true playwright test -c test/playwright",
"test:playwright:debug": "PWDEBUG=1 pnpm test:playwright:local",
"test:playwright:recreate-tapes": "rimraf test/tapes && pnpm test:playwright:update-tapes",
"test:playwright:update-tapes": "UPDATE_TAPES=true pnpm test:playwright",
"test:playwright:gen": "playwright codegen localhost:8443/",
"test:playwright:faststart": "FASTSTART=true pnpm test:playwright",
"test:storybook": "TEST_COMMAND=test:storybook:local ./bin/playwright.sh",
"test:storybook:local": "playwright test -c test/storybook",
"test:storybook:debug": "PWDEBUG=1 pnpm test:storybook:local",
Expand Down
31 changes: 16 additions & 15 deletions frontend/test/playwright/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,24 @@ addAliases({

const UPDATE_TAPES = process.env.UPDATE_TAPES || "false"

/**
* Enabling `FASTSTART` allows you to bypass running the nuxt build
* when rapidly debugging tests locally within the container. If you
* already have the Docker image, this is an easy way to iterate on
* tests and do log-based debugging without needing to download the
* enormous browser binaries (on top of the already huge Docker image
* download).
*
* Note that visual-regression tests can be quite flaky when using
* `FASTSTART`.
*/
const pwCommand =
process.env.FASTSTART !== "false" ? "start:playwright" : "prod:playwright"

const config: PlaywrightTestConfig = {
webServer: {
command: `./node_modules/.bin/npm-run-all -p -r talkback ${pwCommand}`,
/**
* Note: You can speed up local testing by switching `prod` out for `start`
* to skip the build, but be aware that then talkback and the Nuxt server
* will be racing to warm up and the tests could start before talkback is
* ready to start serving API responses. Playwright only lets you specify
* one port to wait for a ready response from so there's no way around it.
* Normally the build introduces more than enough time for talkback to
* be ready by the time the Nuxt server is actually started.
*
* This doesn't mean _don't_ use `start`, it just means that once you've
* debugged everything else, make sure to inspect the trace output for any
* ConsoleMessage strings that refer to incorrect responses. Once you've
* verified that there is indeed a tape saved for the response in question,
* switch this back to `prod` and see if your tests pass.
*/
command: "./node_modules/.bin/npm-run-all -p -r talkback prod:playwright",
cwd: "/app",
timeout: process.env.CI ? 60_000 * 5 : 60_000 * 10, // 5 minutes in CI, 10 in other envs
port: 8443,
Expand Down

0 comments on commit 810053a

Please sign in to comment.