Browse Source

feat(testing): Improved debugging dx

pull/3848/head
Muhammed Mustafa 2 years ago
parent
commit
238c1382bc
  1. 30
      scripts/playwright/package-lock.json
  2. 6
      scripts/playwright/package.json
  3. 4
      scripts/playwright/playwright.config.ts
  4. 6
      scripts/playwright/startPlayWrightServer.sh

30
scripts/playwright/package-lock.json generated

@ -12,7 +12,7 @@
"fs": "^0.0.1-security" "fs": "^0.0.1-security"
}, },
"devDependencies": { "devDependencies": {
"@playwright/test": "^1.26.1", "@playwright/test": "1.27.1",
"axios": "^0.24.0", "axios": "^0.24.0",
"dotenv": "^16.0.3", "dotenv": "^16.0.3",
"mysql2": "^2.3.3", "mysql2": "^2.3.3",
@ -20,13 +20,13 @@
} }
}, },
"node_modules/@playwright/test": { "node_modules/@playwright/test": {
"version": "1.26.1", "version": "1.27.1",
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.26.1.tgz", "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.27.1.tgz",
"integrity": "sha512-bNxyZASVt2adSZ9gbD7NCydzcb5JaI0OR9hc7s+nmPeH604gwp0zp17NNpwXY4c8nvuBGQQ9oGDx72LE+cUWvw==", "integrity": "sha512-mrL2q0an/7tVqniQQF6RBL2saskjljXzqNcCOVMUjRIgE6Y38nCNaP+Dc2FBW06bcpD3tqIws/HT9qiMHbNU0A==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@types/node": "*", "@types/node": "*",
"playwright-core": "1.26.1" "playwright-core": "1.27.1"
}, },
"bin": { "bin": {
"playwright": "cli.js" "playwright": "cli.js"
@ -742,9 +742,9 @@
} }
}, },
"node_modules/playwright-core": { "node_modules/playwright-core": {
"version": "1.26.1", "version": "1.27.1",
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.26.1.tgz", "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.27.1.tgz",
"integrity": "sha512-hzFchhhxnEiPc4qVPs9q2ZR+5eKNifY2hQDHtg1HnTTUuphYCBP8ZRb2si+B1TR7BHirgXaPi48LIye5SgrLAA==", "integrity": "sha512-9EmeXDncC2Pmp/z+teoVYlvmPWUC6ejSSYZUln7YaP89Z6lpAaiaAnqroUt/BoLo8tn7WYShcfaCh+xofZa44Q==",
"dev": true, "dev": true,
"bin": { "bin": {
"playwright": "cli.js" "playwright": "cli.js"
@ -961,13 +961,13 @@
}, },
"dependencies": { "dependencies": {
"@playwright/test": { "@playwright/test": {
"version": "1.26.1", "version": "1.27.1",
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.26.1.tgz", "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.27.1.tgz",
"integrity": "sha512-bNxyZASVt2adSZ9gbD7NCydzcb5JaI0OR9hc7s+nmPeH604gwp0zp17NNpwXY4c8nvuBGQQ9oGDx72LE+cUWvw==", "integrity": "sha512-mrL2q0an/7tVqniQQF6RBL2saskjljXzqNcCOVMUjRIgE6Y38nCNaP+Dc2FBW06bcpD3tqIws/HT9qiMHbNU0A==",
"dev": true, "dev": true,
"requires": { "requires": {
"@types/node": "*", "@types/node": "*",
"playwright-core": "1.26.1" "playwright-core": "1.27.1"
} }
}, },
"@types/node": { "@types/node": {
@ -1566,9 +1566,9 @@
"dev": true "dev": true
}, },
"playwright-core": { "playwright-core": {
"version": "1.26.1", "version": "1.27.1",
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.26.1.tgz", "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.27.1.tgz",
"integrity": "sha512-hzFchhhxnEiPc4qVPs9q2ZR+5eKNifY2hQDHtg1HnTTUuphYCBP8ZRb2si+B1TR7BHirgXaPi48LIye5SgrLAA==", "integrity": "sha512-9EmeXDncC2Pmp/z+teoVYlvmPWUC6ejSSYZUln7YaP89Z6lpAaiaAnqroUt/BoLo8tn7WYShcfaCh+xofZa44Q==",
"dev": true "dev": true
}, },
"process-nextick-args": { "process-nextick-args": {

6
scripts/playwright/package.json

@ -4,15 +4,15 @@
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"test": "npx playwright test --workers=4", "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:3010/ npx playwright test -c playwright.config.ts --headed --project=chromium --repeat-each 1 --retries 0 --timeout 0 --workers 1 --max-failures=1", "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" "ci-test-mysql": "E2E_DB_TYPE=mysql npx playwright test --workers=2"
}, },
"keywords": [], "keywords": [],
"author": "", "author": "",
"license": "ISC", "license": "ISC",
"devDependencies": { "devDependencies": {
"@playwright/test": "^1.26.1", "@playwright/test": "1.27.1",
"axios": "^0.24.0", "axios": "^0.24.0",
"dotenv": "^16.0.3", "dotenv": "^16.0.3",
"mysql2": "^2.3.3", "mysql2": "^2.3.3",

4
scripts/playwright/playwright.config.ts

@ -30,7 +30,6 @@ const config: PlaywrightTestConfig = {
/* Opt out of parallel tests on CI. */ /* Opt out of parallel tests on CI. */
workers: process.env.CI ? 2 : 4, workers: process.env.CI ? 2 : 4,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */ /* 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. */ /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: { use: {
/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ /* 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', baseURL: 'http://localhost:3000',
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ /* 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', screenshot: 'only-on-failure',
}, },
/* Configure projects for major browsers */ /* Configure projects for major browsers */
projects: [ projects: [
{ {

6
scripts/playwright/startPlayWrightServer.sh

@ -1,11 +1,11 @@
# Run server if its not running # 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 then
echo "Starting PlayWright Server" 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 # 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 sleep 0.2
done done
fi fi
Loading…
Cancel
Save