Skip to content

Commit

Permalink
Merge pull request #279 from ral-facilities/bugfix/playwright-docker
Browse files Browse the repository at this point in the history
Add npm script for updating playwright snapshots
  • Loading branch information
kennethnym authored Aug 10, 2023
2 parents 1482b8c + 502de35 commit aed5a19
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Dockerfile.playwright
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ COPY . .
RUN yarn
RUN yarn playwright install --with-deps

CMD ["yarn", "playwright", "test"]
ENTRYPOINT ["yarn", "playwright", "test"]
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,12 @@
"lint:js": "eslint --max-warnings=0 --ext=tsx --ext=ts --ext=js --ext=jsx --fix ./src",
"start": "craco start",
"build": "craco build",
"build:playwright-docker": "docker build --tag operations-gateway-playwright-test --file Dockerfile.playwright .",
"serve:build": "yarn build && serve -l 5001 build",
"test": "craco test --env=jsdom --coverage --watchAll=false",
"test:watch": "craco test --env=jsdom --watch",
"test:playwright": "docker build --tag operations-gateway-playwright-test --file Dockerfile.playwright . && docker run --volume ./playwright-report:/app/playwright-report --publish 9323:9323 operations-gateway-playwright-test",
"playwright:test": "yarn build:playwright-docker && docker run --env LOCAL_DOCKER=true --volume ./playwright-report:/app/playwright-report --publish 9323:9323 operations-gateway-playwright-test",
"playwright:update-snapshot": "yarn build:playwright-docker && docker run --env LOCAL_DOCKER=true --volume .:/app --publish 9323:9323 operations-gateway-playwright-test",
"eject": "react-scripts eject",
"build:e2e": "cross-env REACT_APP_E2E_TESTING=true GENERATE_SOURCEMAP=false craco build",
"e2e-test-server": "node ./server/e2e-test-server.js",
Expand Down
15 changes: 14 additions & 1 deletion playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,20 @@ const config: PlaywrightTestConfig = {
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: 'html',
// use 0.0.0.0 loopback address when running the tests in a local docker container
// so that the report URL is accessible via host localhost:9323.
reporter: process.env.LOCAL_DOCKER
? [
[
'html',
{
open: 'never',
host: '0.0.0.0',
port: 9323,
},
],
]
: 'html',
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
Expand Down

0 comments on commit aed5a19

Please sign in to comment.