From 238c1382bc1ee6d5e9348e494e1702ca53fbb357 Mon Sep 17 00:00:00 2001 From: Muhammed Mustafa Date: Mon, 17 Oct 2022 23:45:20 +0530 Subject: [PATCH] feat(testing): Improved debugging dx --- scripts/playwright/package-lock.json | 30 ++++++++++----------- scripts/playwright/package.json | 6 ++--- scripts/playwright/playwright.config.ts | 4 +-- scripts/playwright/startPlayWrightServer.sh | 6 ++--- 4 files changed, 22 insertions(+), 24 deletions(-) diff --git a/scripts/playwright/package-lock.json b/scripts/playwright/package-lock.json index ea3daaa3dd..f77233a4c5 100644 --- a/scripts/playwright/package-lock.json +++ b/scripts/playwright/package-lock.json @@ -12,7 +12,7 @@ "fs": "^0.0.1-security" }, "devDependencies": { - "@playwright/test": "^1.26.1", + "@playwright/test": "1.27.1", "axios": "^0.24.0", "dotenv": "^16.0.3", "mysql2": "^2.3.3", @@ -20,13 +20,13 @@ } }, "node_modules/@playwright/test": { - "version": "1.26.1", - "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.26.1.tgz", - "integrity": "sha512-bNxyZASVt2adSZ9gbD7NCydzcb5JaI0OR9hc7s+nmPeH604gwp0zp17NNpwXY4c8nvuBGQQ9oGDx72LE+cUWvw==", + "version": "1.27.1", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.27.1.tgz", + "integrity": "sha512-mrL2q0an/7tVqniQQF6RBL2saskjljXzqNcCOVMUjRIgE6Y38nCNaP+Dc2FBW06bcpD3tqIws/HT9qiMHbNU0A==", "dev": true, "dependencies": { "@types/node": "*", - "playwright-core": "1.26.1" + "playwright-core": "1.27.1" }, "bin": { "playwright": "cli.js" @@ -742,9 +742,9 @@ } }, "node_modules/playwright-core": { - "version": "1.26.1", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.26.1.tgz", - "integrity": "sha512-hzFchhhxnEiPc4qVPs9q2ZR+5eKNifY2hQDHtg1HnTTUuphYCBP8ZRb2si+B1TR7BHirgXaPi48LIye5SgrLAA==", + "version": "1.27.1", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.27.1.tgz", + "integrity": "sha512-9EmeXDncC2Pmp/z+teoVYlvmPWUC6ejSSYZUln7YaP89Z6lpAaiaAnqroUt/BoLo8tn7WYShcfaCh+xofZa44Q==", "dev": true, "bin": { "playwright": "cli.js" @@ -961,13 +961,13 @@ }, "dependencies": { "@playwright/test": { - "version": "1.26.1", - "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.26.1.tgz", - "integrity": "sha512-bNxyZASVt2adSZ9gbD7NCydzcb5JaI0OR9hc7s+nmPeH604gwp0zp17NNpwXY4c8nvuBGQQ9oGDx72LE+cUWvw==", + "version": "1.27.1", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.27.1.tgz", + "integrity": "sha512-mrL2q0an/7tVqniQQF6RBL2saskjljXzqNcCOVMUjRIgE6Y38nCNaP+Dc2FBW06bcpD3tqIws/HT9qiMHbNU0A==", "dev": true, "requires": { "@types/node": "*", - "playwright-core": "1.26.1" + "playwright-core": "1.27.1" } }, "@types/node": { @@ -1566,9 +1566,9 @@ "dev": true }, "playwright-core": { - "version": "1.26.1", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.26.1.tgz", - "integrity": "sha512-hzFchhhxnEiPc4qVPs9q2ZR+5eKNifY2hQDHtg1HnTTUuphYCBP8ZRb2si+B1TR7BHirgXaPi48LIye5SgrLAA==", + "version": "1.27.1", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.27.1.tgz", + "integrity": "sha512-9EmeXDncC2Pmp/z+teoVYlvmPWUC6ejSSYZUln7YaP89Z6lpAaiaAnqroUt/BoLo8tn7WYShcfaCh+xofZa44Q==", "dev": true }, "process-nextick-args": { diff --git a/scripts/playwright/package.json b/scripts/playwright/package.json index 0df87a4219..ad25b2d814 100644 --- a/scripts/playwright/package.json +++ b/scripts/playwright/package.json @@ -4,15 +4,15 @@ "description": "", "main": "index.js", "scripts": { - "test": "npx playwright test --workers=4", - "test-debug": "./startPlayWrightServer.sh; PW_TEST_REUSE_CONTEXT=1 PW_TEST_CONNECT_WS_ENDPOINT=ws://127.0.0.1:3010/ npx playwright test -c playwright.config.ts --headed --project=chromium --repeat-each 1 --retries 0 --timeout 0 --workers 1 --max-failures=1", + "test": "TRACE=true npx playwright test --workers=4", + "test-debug": "./startPlayWrightServer.sh; PW_TEST_REUSE_CONTEXT=1 PW_TEST_CONNECT_WS_ENDPOINT=ws://127.0.0.1:31000/ PWDEBUG=console npx playwright test -c playwright.config.ts --headed --project=chromium --retries 0 --timeout 0 --workers 1 --max-failures=1", "ci-test-mysql": "E2E_DB_TYPE=mysql npx playwright test --workers=2" }, "keywords": [], "author": "", "license": "ISC", "devDependencies": { - "@playwright/test": "^1.26.1", + "@playwright/test": "1.27.1", "axios": "^0.24.0", "dotenv": "^16.0.3", "mysql2": "^2.3.3", diff --git a/scripts/playwright/playwright.config.ts b/scripts/playwright/playwright.config.ts index a629974e93..41ebe6a53b 100644 --- a/scripts/playwright/playwright.config.ts +++ b/scripts/playwright/playwright.config.ts @@ -30,7 +30,6 @@ const config: PlaywrightTestConfig = { /* Opt out of parallel tests on CI. */ workers: process.env.CI ? 2 : 4, /* Reporter to use. See https://playwright.dev/docs/test-reporters */ - reporter: '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). */ @@ -39,10 +38,9 @@ const config: PlaywrightTestConfig = { baseURL: 'http://localhost:3000', /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ - trace: process.env.CI ? 'on-first-retry': 'on', + trace: process.env.CI ? 'on-first-retry': process.env.TRACE ? 'on' : 'off', screenshot: 'only-on-failure', }, - /* Configure projects for major browsers */ projects: [ { diff --git a/scripts/playwright/startPlayWrightServer.sh b/scripts/playwright/startPlayWrightServer.sh index 342497d6eb..3e49b8269d 100755 --- a/scripts/playwright/startPlayWrightServer.sh +++ b/scripts/playwright/startPlayWrightServer.sh @@ -1,11 +1,11 @@ # Run server if its not running -if ! curl --output /dev/null --silent --head --fail http://localhost:3010 +if ! curl --output /dev/null --silent --head --fail http://localhost:31000 then echo "Starting PlayWright Server" - npx playwright run-server --reuse-browser --port 3010 & + PWDEBUG=console npx playwright run-server --reuse-browser --port 31000 & # Wait for server to start - while ! curl --output /dev/null --silent --head --fail http://localhost:3010; do + while ! curl --output /dev/null --silent --head --fail http://localhost:31000; do sleep 0.2 done fi \ No newline at end of file