Flatten the playwright workspace down into the root package.json. (#4082)
This removes the need to pass `--workspace playwright` and avoids a name collision with the npm "playwright" package.
This commit is contained in:
Родитель
30c08caec6
Коммит
89df006edb
|
@ -18,7 +18,7 @@ jobs:
|
|||
node-version: 18
|
||||
- name: Run your tests
|
||||
timeout-minutes: 30
|
||||
run: npm run pwtests-shutdown --workspace=playwright; npm run test --workspace=playwright
|
||||
run: npm run pwtests-shutdown; npm run pwtests
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: failure()
|
||||
with:
|
||||
|
|
|
@ -74,7 +74,7 @@ your change of the test files.
|
|||
|
||||
To run the Playwright visual tests (aka end-to-end tests), the command to use is:
|
||||
```bash
|
||||
npm run pwtests --workspace=playwright
|
||||
npm run pwtests
|
||||
```
|
||||
|
||||
If there are errors, they will be displayed in the console.
|
||||
|
@ -82,7 +82,7 @@ If you need to update any of the screenshot images, you will see differences in
|
|||
the `packages/playwright/test-results` directory, and if they look correct,
|
||||
then you can update _all_ images for all tests with:
|
||||
```bash
|
||||
npm run pwtests-update --workspace=playwright
|
||||
npm run pwtests-update
|
||||
```
|
||||
|
||||
The updated images are also added to the __screenshots__ directory. Images that
|
||||
|
|
|
@ -6,8 +6,7 @@
|
|||
"": {
|
||||
"name": "chromestatus-dashboard",
|
||||
"workspaces": [
|
||||
"./gen/js/*",
|
||||
"packages/playwright"
|
||||
"./gen/js/*"
|
||||
],
|
||||
"dependencies": {
|
||||
"@lit/task": "^1.0.1",
|
||||
|
@ -34,6 +33,7 @@
|
|||
"@babel/register": "^7.24.6",
|
||||
"@open-wc/testing": "^4.0.0",
|
||||
"@openapitools/openapi-generator-cli": "^2.13.4",
|
||||
"@playwright/test": "1.44.1",
|
||||
"@rollup/plugin-babel": "^6.0.4",
|
||||
"@rollup/plugin-node-resolve": "^15.2.3",
|
||||
"@rollup/plugin-typescript": "^11.1.6",
|
||||
|
@ -11706,10 +11706,6 @@
|
|||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/playwright": {
|
||||
"resolved": "packages/playwright",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/playwright-core": {
|
||||
"version": "1.44.0",
|
||||
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.44.0.tgz",
|
||||
|
@ -14521,12 +14517,6 @@
|
|||
"funding": {
|
||||
"url": "https://github.com/sponsors/colinhacks"
|
||||
}
|
||||
},
|
||||
"packages/playwright": {
|
||||
"version": "1.0.0",
|
||||
"devDependencies": {
|
||||
"@playwright/test": "1.44.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
15
package.json
15
package.json
|
@ -8,8 +8,7 @@
|
|||
"node": ">=18.0.0"
|
||||
},
|
||||
"workspaces": [
|
||||
"./gen/js/*",
|
||||
"packages/playwright"
|
||||
"./gen/js/*"
|
||||
],
|
||||
"scripts": {
|
||||
"setup": "npm ci; python3.11 -m venv cs-env; npm run deps",
|
||||
|
@ -27,7 +26,7 @@
|
|||
"start-app": "npm run build && curl --retry 4 http://${DATASTORE_EMULATOR_HOST:-localhost:15606}/ --retry-connrefused && ./scripts/start_server.sh",
|
||||
"debug-app": "npm run build && curl --retry 4 http://${DATASTORE_EMULATOR_HOST:-localhost:15606}/ --retry-connrefused && ./scripts/debug_server.sh",
|
||||
"start": "npm stop; . cs-env/bin/activate; (npm run start-emulator-persist > /dev/null 2>&1 &); npm run start-app; status=$?; npm run stop-emulator; exit $status",
|
||||
"stop": "npm run pwtests-shutdown --workspace=playwright; kill `pgrep gunicorn`",
|
||||
"stop": "npm run pwtests-shutdown; kill `pgrep gunicorn`",
|
||||
"test": "(npm run start-emulator > /dev/null 2>&1 &); sleep 6; curl --retry 4 http://localhost:15606/ --retry-connrefused; npm run do-tests; status=$?; npm run stop-emulator; exit $status",
|
||||
"webtest": "npm run build && web-test-runner \"build/**/*_test.js\" --node-resolve --playwright --browsers chromium firefox",
|
||||
"webtest:watch": "npm run build && web-test-runner \"build/**/*_test.{js,ts}\" --node-resolve --playwright --watch --browsers chromium",
|
||||
|
@ -47,7 +46,14 @@
|
|||
"openapi": "npm run openapi-backend && npm run openapi-frontend",
|
||||
"openapi-frontend": "rm -rf gen/js/chromestatus-openapi && openapi-generator-cli generate -i openapi/api.yaml -g typescript-fetch -o gen/js/chromestatus-openapi --config openapi/js-config.yaml && npm install",
|
||||
"openapi-backend": ". cs-env/bin/activate; rm -rf gen/py/chromestatus_openapi && openapi-generator-cli generate -i openapi/api.yaml -g python-flask -o gen/py/chromestatus_openapi --additional-properties=packageName=chromestatus_openapi && pip install -r requirements.txt",
|
||||
"openapi-validate": "openapi-generator-cli validate -i openapi/api.yaml"
|
||||
"openapi-validate": "openapi-generator-cli validate -i openapi/api.yaml",
|
||||
"pwtests": "npm run pwtests-shutdown; ./packages/playwright/run.sh bash -c \"./wait-for-app.sh && npx playwright test\"",
|
||||
"pwtests-update": "npm run pwtests-shutdown; ./packages/playwright/run.sh bash -c \"./wait-for-app.sh && npx playwright test --update-snapshots $npm_config_filename \"",
|
||||
"pwtests-report": "npm run pwtests-shutdown; ./packages/playwright/run.sh bash -c \"./wait-for-app.sh && npx playwright show-report\"",
|
||||
"pwtests-ui": "npm run pwtests-shutdown; ./packages/playwright/run.sh bash -c \"./wait-for-app.sh && npx playwright test --ui --ui-port=8123\"",
|
||||
"pwtests-shell": "./packages/playwright/run.sh bash",
|
||||
"pwtests-debug": "./packages/playwright/run.sh debug",
|
||||
"pwtests-shutdown": "./packages/playwright/run.sh down"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -68,6 +74,7 @@
|
|||
"@babel/register": "^7.24.6",
|
||||
"@open-wc/testing": "^4.0.0",
|
||||
"@openapitools/openapi-generator-cli": "^2.13.4",
|
||||
"@playwright/test": "1.44.1",
|
||||
"@rollup/plugin-babel": "^6.0.4",
|
||||
"@rollup/plugin-node-resolve": "^15.2.3",
|
||||
"@rollup/plugin-typescript": "^11.1.6",
|
||||
|
|
|
@ -19,8 +19,11 @@ RUN npm config set script-shell bash --global
|
|||
|
||||
USER pwuser
|
||||
WORKDIR /work
|
||||
# Cache the infrequent but time consuming changes early
|
||||
COPY --chown=pwuser:pwuser package.json /work/
|
||||
RUN npm install -D
|
||||
# Copy the rest of the root directory. Subdirectories are mounted in docker-compose.yml.
|
||||
|
||||
# Install a consistent version of Playwright. The duplicate ARG line is needed to copy the value
|
||||
# into this build stage.
|
||||
ARG PLAYWRIGHT_VERSION
|
||||
RUN npm install @playwright/test@${PLAYWRIGHT_VERSION}
|
||||
|
||||
# Copy the root directory. Subdirectories are mounted in docker-compose.yml.
|
||||
COPY --chown=pwuser:pwuser wait-for-app.sh playwright.config.cjs /work/
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
{
|
||||
"name": "playwright",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"//pwtests": "The version of playwright used here in devDependencies:@playwright/test must be the same as the docker image version used in Dockerfile, so the '^' prefix should not be included to avoid auto-upgrade of playwright which would then be out of sync.",
|
||||
"test": "npm run pwtests",
|
||||
"pwtests": "npm run pwtests-shutdown; ./run.sh bash -c \"./wait-for-app.sh && npx playwright test\"",
|
||||
"pwtests-update": "npm run pwtests-shutdown; ./run.sh bash -c \"./wait-for-app.sh && npx playwright test --update-snapshots $npm_config_filename \"",
|
||||
"pwtests-report": "npm run pwtests-shutdown; ./run.sh bash -c \"./wait-for-app.sh && npx playwright show-report\"",
|
||||
"pwtests-ui": "npm run pwtests-shutdown; ./run.sh bash -c \"./wait-for-app.sh && npx playwright test --ui --ui-port=8123\"",
|
||||
"pwtests-shell": "./run.sh bash",
|
||||
"pwtests-debug": "./run.sh debug",
|
||||
"pwtests-shutdown": "./run.sh down"
|
||||
},
|
||||
"author": "",
|
||||
"devDependencies": {
|
||||
"@playwright/test": "1.44.1"
|
||||
}
|
||||
}
|
|
@ -1,13 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
|
||||
export USERID=$(id -u)
|
||||
export GROUPID=$(id -g)
|
||||
export PLAYWRIGHT_VERSION=$(bash -c './get-npm-package-version.sh ./package.json "@playwright/test"')
|
||||
export PLAYWRIGHT_VERSION=$(bash -c "${SCRIPT_DIR}/get-npm-package-version.sh ./package.json '@playwright/test'")
|
||||
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
|
||||
export COMPOSE_FILES_FLAG="-f ${SCRIPT_DIR}/docker-compose.yml
|
||||
-f ${SCRIPT_DIR}/../../.devcontainer/db-docker-compose.yml"
|
||||
echo $COMPOSE_FILES_FLAG
|
||||
|
|
Загрузка…
Ссылка в новой задаче