From 7950b382f1053576ddfb57fc083d43b5e4b1bef4 Mon Sep 17 00:00:00 2001 From: Raj Beemi Date: Fri, 5 Jan 2024 22:23:51 +0000 Subject: [PATCH] feat: improved framework with tests --- .github/workflows/playwright.yml | 27 ++ .gitignore | 6 + README.md | 20 +- docs/playwright-logo.png | Bin 0 -> 15443 bytes global-setup.ts | 16 + package-lock.json | 561 +++++++------------------------ package.json | 9 +- pages/home-page.ts | 89 +++++ pages/login-page.ts | 69 ++++ pages/register-page.ts | 74 ++++ playwright.config.ts | 32 ++ pretest.sh | 21 ++ src/simple.spec.js | 26 -- src/tl.spec.js | 98 ------ tests/example.spec.ts | 18 + tsconfig.json | 12 + 16 files changed, 510 insertions(+), 568 deletions(-) create mode 100644 .github/workflows/playwright.yml create mode 100644 docs/playwright-logo.png create mode 100644 global-setup.ts create mode 100644 pages/home-page.ts create mode 100644 pages/login-page.ts create mode 100644 pages/register-page.ts create mode 100644 playwright.config.ts create mode 100755 pretest.sh delete mode 100644 src/simple.spec.js delete mode 100644 src/tl.spec.js create mode 100644 tests/example.spec.ts create mode 100644 tsconfig.json diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml new file mode 100644 index 0000000..90b6b70 --- /dev/null +++ b/.github/workflows/playwright.yml @@ -0,0 +1,27 @@ +name: Playwright Tests +on: + push: + branches: [ main, master ] + pull_request: + branches: [ main, master ] +jobs: + test: + timeout-minutes: 60 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 18 + - name: Install dependencies + run: npm ci + - name: Install Playwright Browsers + run: npx playwright install --with-deps + - name: Run Playwright tests + run: npx playwright test + - uses: actions/upload-artifact@v3 + if: always() + with: + name: playwright-report + path: playwright-report/ + retention-days: 30 diff --git a/.gitignore b/.gitignore index 6704566..634d167 100644 --- a/.gitignore +++ b/.gitignore @@ -102,3 +102,9 @@ dist # TernJS port file .tern-port +/test-results/ +/playwright-report/ +/blob-report/ +/playwright/.cache/ +/allure-report/ +/allure-results/ diff --git a/README.md b/README.md index 96b4fe5..b1d96c3 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,21 @@ -# playwright-automation-test-example -UI Automation framework with Playwright +# Playwright UI Automation Framework + + +![alt text](docs/playwright-logo.png) + +## Installation + +```bash +npm init playwright@latest +``` + +Check the installation by running the following command: + +```bash +npx playwright --version +``` ```bash npm test -``` \ No newline at end of file +``` diff --git a/docs/playwright-logo.png b/docs/playwright-logo.png new file mode 100644 index 0000000000000000000000000000000000000000..a765578d4d3f99e76b31f1ef993a82dfe6e12f54 GIT binary patch literal 15443 zcmZ`=V{|4>uzq9Pwrv|5Yh&BCZ9CZ{n~iPTwv9J7HrZG=-~D%g+%rAhXQsR7RCiT( zRZrCurKIo!0Tve)001CJONpy|mt+6k(2(DGwPsE3cL8o8A};~})F;5b8$o z$O8c0lmI|rC;;&K{VMPj0B~al0L~2o0NzXh0Lw9_Lz(}(0@7IahdAKtzbmi1H0ApZ zl&iG71k@1-J`6g2kD8GX0KlgqEiR(!xpCF)m59IUck=Smo$*V}kISCDPnI8W3m^_m zrXFuVoJ^-jJzPt+l@7G^8f3Xx|BX#_@f*j-{WA0S-|+4O0wT1>coV+_d8r=LIAN7^ zU#TULq*SRyfF}SPDG@N=_Etm2w(IcaskOZvCs@%@+0lXb5m!c?*Fk%KH2E~W`{6S{ ziyOWz^c*!8-hx*2bDp8VR>YKU4$2n53DUh@33dwUtX6BC8c3=%wi6LF*@rPVN&L~5 zU6!l7*F=0G{6j_lM{*Oo&{Hu}lQ*wAc+oPLX8hXc-kW7YhYPVDwT`$cUL8RjOdC!c z;b}k9D?jr5bGy56ER`Y(Hed&!FXja?pHk69EZSQzXmXUl@Rvzw>%3gYU6Vozq3wPr z0qs{Af|-EiHL@Ag06`x?pPMk&+{(F=y2#%m9MBoSY$1Q`z#_LF;hyn&8r-bF-D)-A zN%APIhvd@$%iIsO7si41!3e~WYQim* zeh$UN?KeTA*bM~i_8+N8Bwa`jKbl&-ZDV3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uP;L?ibS~gsD&JxA+JOu`P(awH zauu2JyiVT zb=t2|3H7r-nFRV75}9k~;bWGE>y><`(+#b1 zxb-CHV>M=i2~=o?L-(L(fCcisJ^FLvd(M3emqUIb%E|<*7Jg5A{x_f?0Aa7IPp`=n zY+j8Wzn1R3f!qJ%R&08DOb_}S?F0CZl8@rLUVBIlx&dxx>-R2=c180ffqnsA*=EQM zJdfv2(qp?>2-2&fIWT;#cXy%geu4@?*xG*sby%2m!9RuPcfSo8V7od}2_}7Zsnb_f zAz8Nj)&m1rgh-GASr zQ=ofix&8Wh%zs?GIeO9&$nB`3hXJko2HNDS?SQ=FJ2HKv>{zOeQAYxqfX21Ns6&}`gj8i*@AgrqgBodhh;$o2>{NS%o6gp z(O<=`*A-w*qZhm*_Y8R~OKM@`>!-c)-(n%=20YG%IDI43=&LM)RqMX7O?||zk&Z&Q zG(be+-E$`fw$wnfz7w?fDw;PCDPmY5@a{-jCUKRgYNasB|aVEqYxY zhjF(bjMIqO44?e|w2YkM8g}+|2Kn3;_hknur0;IgFoXU(h`XXvJK~EZ{5e`|qo*-An|&7mR%TWf24)rpR&G^h9$r>vUUqgmW@cVy k=Akfj(*M)J&cW2m-0T1E(7aalA4(V?EukP@BWf7@Kf^1sx&QzG literal 0 HcmV?d00001 diff --git a/global-setup.ts b/global-setup.ts new file mode 100644 index 0000000..5e21159 --- /dev/null +++ b/global-setup.ts @@ -0,0 +1,16 @@ +let TEST_ENVIRONMENT = process.env.TEST_ENVIRONMENT + +if (!TEST_ENVIRONMENT) { + TEST_ENVIRONMENT = process.env.TEST_ENVIRONMENT = 'qa' +} + +async function globalSetup() { + const config = { + baseUrl: 'https://www.google.com', + testEnvironment: TEST_ENVIRONMENT, + testEnvironmentUrl: 'https://www.google.com', + testEnvironmentUsername: 'test', + } +} + +module.exports = globalSetup diff --git a/package-lock.json b/package-lock.json index da95fbe..0099927 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,9 +5,13 @@ "requires": true, "packages": { "": { + "name": "playwright-automation-test-example", "version": "1.0.0", "license": "ISC", "devDependencies": { + "@playwright/test": "^1.40.1", + "@types/node": "^20.10.6", + "allure-playwright": "^2.10.0", "assert": "^2.0.0", "chai": "^4.3.3", "chance": "^1.1.7", @@ -129,6 +133,21 @@ "node": ">= 10.14.2" } }, + "node_modules/@playwright/test": { + "version": "1.40.1", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.40.1.tgz", + "integrity": "sha512-EaaawMTOeEItCRvfmkI9v6rBkF1svM8wjl/YPRrg2N2Wmp+4qJYkWtJsbew1szfKKDm6fPLy4YAanBhIlf9dWw==", + "dev": true, + "dependencies": { + "playwright": "1.40.1" + }, + "bin": { + "playwright": "cli.js" + }, + "engines": { + "node": ">=16" + } + }, "node_modules/@types/istanbul-lib-coverage": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.3.tgz", @@ -154,10 +173,13 @@ } }, "node_modules/@types/node": { - "version": "14.14.31", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.31.tgz", - "integrity": "sha512-vFHy/ezP5qI0rFgJ7aQnjDXwAMrG0KqqIH7tQG5PPv3BWBayOPIQNBjVc/P6hhdZfMx51REc6tfDNXHUio893g==", - "dev": true + "version": "20.10.6", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.6.tgz", + "integrity": "sha512-Vac8H+NlRNNlAmDfGUP7b5h/KA+AtWIzuXy0E6OyP8f1tCLYAtPvKRRDJjAPqhpCb0t6U2j7/xqAuLEebW2kiw==", + "dev": true, + "dependencies": { + "undici-types": "~5.26.4" + } }, "node_modules/@types/stack-utils": { "version": "2.0.0", @@ -180,32 +202,28 @@ "integrity": "sha512-37RSHht+gzzgYeobbG+KWryeAW8J33Nhr69cjTqSYymXVZEN9NbRYWoYlRtDhHKPVT1FyNKwaTPC1NynKZpzRA==", "dev": true }, - "node_modules/@types/yauzl": { - "version": "2.9.1", - "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.9.1.tgz", - "integrity": "sha512-A1b8SU4D10uoPjwb0lnHmmu8wZhR9d+9o2PKBQT2jU5YPTKsxac6M2qGAdY7VcL+dHHhARVUDmeg0rOrcd9EjA==", - "dev": true, - "optional": true, - "dependencies": { - "@types/node": "*" - } - }, "node_modules/@ungap/promise-all-settled": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz", "integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==", "dev": true }, - "node_modules/agent-base": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", - "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "node_modules/allure-js-commons": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/allure-js-commons/-/allure-js-commons-2.10.0.tgz", + "integrity": "sha512-DgACWBU2dchQD8tQOo5Y0MXx08SSzdgCnKBdwrOu29vITYBXih+0r8SbmrFYQhjAbn8eKMM+mXq+rKtjZRa2oA==", "dev": true, "dependencies": { - "debug": "4" - }, - "engines": { - "node": ">= 6.0.0" + "properties": "^1.2.1" + } + }, + "node_modules/allure-playwright": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/allure-playwright/-/allure-playwright-2.10.0.tgz", + "integrity": "sha512-zDljPJ/Fnyd2fn7msChtZebwkSVmAGLe/oWK7okGi0Ed+iHZ0E5Vwe5Z5MtUdfLjnT/OkOduwmS7R/DHeTXFSA==", + "dev": true, + "dependencies": { + "allure-js-commons": "2.10.0" } }, "node_modules/ansi-colors": { @@ -339,15 +357,6 @@ "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", "dev": true }, - "node_modules/buffer-crc32": { - "version": "0.2.13", - "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", - "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=", - "dev": true, - "engines": { - "node": "*" - } - }, "node_modules/call-bind": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", @@ -417,7 +426,6 @@ "dependencies": { "anymatch": "~3.1.1", "braces": "~3.0.2", - "fsevents": "~2.3.1", "glob-parent": "~5.1.0", "is-binary-path": "~2.1.0", "is-glob": "~4.0.1", @@ -449,15 +457,6 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, - "node_modules/commander": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz", - "integrity": "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==", - "dev": true, - "engines": { - "node": ">= 6" - } - }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -529,15 +528,6 @@ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dev": true }, - "node_modules/end-of-stream": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", - "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", - "dev": true, - "dependencies": { - "once": "^1.4.0" - } - }, "node_modules/es-abstract": { "version": "1.18.0", "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0.tgz", @@ -626,36 +616,6 @@ "node": ">= 10.14.2" } }, - "node_modules/extract-zip": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz", - "integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==", - "dev": true, - "dependencies": { - "@types/yauzl": "^2.9.1", - "debug": "^4.1.1", - "get-stream": "^5.1.0", - "yauzl": "^2.10.0" - }, - "bin": { - "extract-zip": "cli.js" - }, - "engines": { - "node": ">= 10.17.0" - }, - "optionalDependencies": { - "@types/yauzl": "^2.9.1" - } - }, - "node_modules/fd-slicer": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", - "integrity": "sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=", - "dev": true, - "dependencies": { - "pend": "~1.2.0" - } - }, "node_modules/fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -741,21 +701,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/get-stream": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", - "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", - "dev": true, - "dependencies": { - "pump": "^3.0.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/glob": { "version": "7.1.6", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", @@ -854,19 +799,6 @@ "he": "bin/he" } }, - "node_modules/https-proxy-agent": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz", - "integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==", - "dev": true, - "dependencies": { - "agent-base": "6", - "debug": "4" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -1194,12 +1126,6 @@ "node": ">= 10.14.2" } }, - "node_modules/jpeg-js": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/jpeg-js/-/jpeg-js-0.4.3.tgz", - "integrity": "sha512-ru1HWKek8octvUHFHvE5ZzQ1yAsJmIvRdGWvSoKV52XKyuyYA437QWDttXT8eZXDSbuMpHlLzPDZUPd6idIz+Q==", - "dev": true - }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -1231,18 +1157,6 @@ "node": ">=8" } }, - "node_modules/mime": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/mime/-/mime-2.5.2.tgz", - "integrity": "sha512-tqkh47FzKeCPD2PUiPB6pkbMzsCasjxAfC62/Wap5qrUWcb+sFasXUC5I3gYM5iBM8v/Qpn4UK0x+j0iHyFPDg==", - "dev": true, - "bin": { - "mime": "cli.js" - }, - "engines": { - "node": ">=4.0.0" - } - }, "node_modules/minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", @@ -1590,12 +1504,6 @@ "node": "*" } }, - "node_modules/pend": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", - "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=", - "dev": true - }, "node_modules/picomatch": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", @@ -1609,40 +1517,33 @@ } }, "node_modules/playwright": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.9.1.tgz", - "integrity": "sha512-bZXnks4UGJZoqja6TqVEUG0IQ2liqYFcO1R4lT43aO4oDVTQtawEJjS+EqLYsAuniRFWVE87Cemus4fRQbyXMg==", + "version": "1.40.1", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.40.1.tgz", + "integrity": "sha512-2eHI7IioIpQ0bS1Ovg/HszsN/XKNwEG1kbzSDDmADpclKc7CyqkHw7Mg2JCz/bbCxg25QUPcjksoMW7JcIFQmw==", "dev": true, - "hasInstallScript": true, "dependencies": { - "commander": "^6.1.0", - "debug": "^4.1.1", - "extract-zip": "^2.0.1", - "https-proxy-agent": "^5.0.0", - "jpeg-js": "^0.4.2", - "mime": "^2.4.6", - "pngjs": "^5.0.0", - "progress": "^2.0.3", - "proper-lockfile": "^4.1.1", - "proxy-from-env": "^1.1.0", - "rimraf": "^3.0.2", - "stack-utils": "^2.0.3", - "ws": "^7.3.1" + "playwright-core": "1.40.1" }, "bin": { - "playwright": "lib/cli/cli.js" + "playwright": "cli.js" }, "engines": { - "node": ">=10.17.0" + "node": ">=16" + }, + "optionalDependencies": { + "fsevents": "2.3.2" } }, - "node_modules/pngjs": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-5.0.0.tgz", - "integrity": "sha512-40QW5YalBNfQo5yRYmiw7Yz6TKKVr3h6970B2YE+3fQpsWcrbj1PzJgxeJ19DRQjhMbKPIuMY8rFaXc8moolVw==", + "node_modules/playwright-core": { + "version": "1.40.1", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.40.1.tgz", + "integrity": "sha512-+hkOycxPiV534c4HhpfX6yrlawqVUzITRKwHAmYfmsVreltEl6fAZJ3DPfLMOODw0H3s1Itd6MDCWmP1fl/QvQ==", "dev": true, + "bin": { + "playwright-core": "cli.js" + }, "engines": { - "node": ">=10.13.0" + "node": ">=16" } }, "node_modules/pretty-format": { @@ -1660,40 +1561,13 @@ "node": ">= 10" } }, - "node_modules/progress": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", - "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "node_modules/properties": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/properties/-/properties-1.2.1.tgz", + "integrity": "sha512-qYNxyMj1JeW54i/EWEFsM1cVwxJbtgPp8+0Wg9XjNaK6VE/c4oRi6PNu5p7w1mNXEIQIjV5Wwn8v8Gz82/QzdQ==", "dev": true, "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/proper-lockfile": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/proper-lockfile/-/proper-lockfile-4.1.2.tgz", - "integrity": "sha512-TjNPblN4BwAWMXU8s9AEz4JmQxnD1NNL7bNOY/AKUzyamc379FWASUhc/K1pL2noVb+XmZKLL68cjzLsiOAMaA==", - "dev": true, - "dependencies": { - "graceful-fs": "^4.2.4", - "retry": "^0.12.0", - "signal-exit": "^3.0.2" - } - }, - "node_modules/proxy-from-env": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", - "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", - "dev": true - }, - "node_modules/pump": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", - "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", - "dev": true, - "dependencies": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" + "node": ">=0.10" } }, "node_modules/randombytes": { @@ -1732,30 +1606,6 @@ "node": ">=0.10.0" } }, - "node_modules/retry": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", - "integrity": "sha1-G0KmJmoh8HQh0bC1S33BZ7AcATs=", - "dev": true, - "engines": { - "node": ">= 4" - } - }, - "node_modules/rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dev": true, - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", @@ -1771,12 +1621,6 @@ "randombytes": "^2.1.0" } }, - "node_modules/signal-exit": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", - "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==", - "dev": true - }, "node_modules/slash": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", @@ -1907,6 +1751,12 @@ "which-boxed-primitive": "^1.0.1" } }, + "node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "dev": true + }, "node_modules/util": { "version": "0.12.3", "resolved": "https://registry.npmjs.org/util/-/util-0.12.3.tgz", @@ -2037,27 +1887,6 @@ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true }, - "node_modules/ws": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.4.tgz", - "integrity": "sha512-Qm8k8ojNQIMx7S+Zp8u/uHOx7Qazv3Yv4q68MiWWWOJhiwG5W3x7iqmRtJo8xxrciZUY4vRxUTJCKuRnF28ZZw==", - "dev": true, - "engines": { - "node": ">=8.3.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": "^5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } - } - }, "node_modules/yargs-unparser": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", @@ -2097,16 +1926,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/yauzl": { - "version": "2.10.0", - "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", - "integrity": "sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=", - "dev": true, - "dependencies": { - "buffer-crc32": "~0.2.3", - "fd-slicer": "~1.1.0" - } - }, "node_modules/yocto-queue": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", @@ -2218,6 +2037,15 @@ "chalk": "^4.0.0" } }, + "@playwright/test": { + "version": "1.40.1", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.40.1.tgz", + "integrity": "sha512-EaaawMTOeEItCRvfmkI9v6rBkF1svM8wjl/YPRrg2N2Wmp+4qJYkWtJsbew1szfKKDm6fPLy4YAanBhIlf9dWw==", + "dev": true, + "requires": { + "playwright": "1.40.1" + } + }, "@types/istanbul-lib-coverage": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.3.tgz", @@ -2243,10 +2071,13 @@ } }, "@types/node": { - "version": "14.14.31", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.31.tgz", - "integrity": "sha512-vFHy/ezP5qI0rFgJ7aQnjDXwAMrG0KqqIH7tQG5PPv3BWBayOPIQNBjVc/P6hhdZfMx51REc6tfDNXHUio893g==", - "dev": true + "version": "20.10.6", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.6.tgz", + "integrity": "sha512-Vac8H+NlRNNlAmDfGUP7b5h/KA+AtWIzuXy0E6OyP8f1tCLYAtPvKRRDJjAPqhpCb0t6U2j7/xqAuLEebW2kiw==", + "dev": true, + "requires": { + "undici-types": "~5.26.4" + } }, "@types/stack-utils": { "version": "2.0.0", @@ -2269,29 +2100,28 @@ "integrity": "sha512-37RSHht+gzzgYeobbG+KWryeAW8J33Nhr69cjTqSYymXVZEN9NbRYWoYlRtDhHKPVT1FyNKwaTPC1NynKZpzRA==", "dev": true }, - "@types/yauzl": { - "version": "2.9.1", - "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.9.1.tgz", - "integrity": "sha512-A1b8SU4D10uoPjwb0lnHmmu8wZhR9d+9o2PKBQT2jU5YPTKsxac6M2qGAdY7VcL+dHHhARVUDmeg0rOrcd9EjA==", - "dev": true, - "optional": true, - "requires": { - "@types/node": "*" - } - }, "@ungap/promise-all-settled": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz", "integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==", "dev": true }, - "agent-base": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", - "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "allure-js-commons": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/allure-js-commons/-/allure-js-commons-2.10.0.tgz", + "integrity": "sha512-DgACWBU2dchQD8tQOo5Y0MXx08SSzdgCnKBdwrOu29vITYBXih+0r8SbmrFYQhjAbn8eKMM+mXq+rKtjZRa2oA==", "dev": true, "requires": { - "debug": "4" + "properties": "^1.2.1" + } + }, + "allure-playwright": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/allure-playwright/-/allure-playwright-2.10.0.tgz", + "integrity": "sha512-zDljPJ/Fnyd2fn7msChtZebwkSVmAGLe/oWK7okGi0Ed+iHZ0E5Vwe5Z5MtUdfLjnT/OkOduwmS7R/DHeTXFSA==", + "dev": true, + "requires": { + "allure-js-commons": "2.10.0" } }, "ansi-colors": { @@ -2395,12 +2225,6 @@ "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", "dev": true }, - "buffer-crc32": { - "version": "0.2.13", - "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", - "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=", - "dev": true - }, "call-bind": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", @@ -2478,12 +2302,6 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, - "commander": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz", - "integrity": "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==", - "dev": true - }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -2535,15 +2353,6 @@ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dev": true }, - "end-of-stream": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", - "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", - "dev": true, - "requires": { - "once": "^1.4.0" - } - }, "es-abstract": { "version": "1.18.0", "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0.tgz", @@ -2611,27 +2420,6 @@ "jest-regex-util": "^26.0.0" } }, - "extract-zip": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz", - "integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==", - "dev": true, - "requires": { - "@types/yauzl": "^2.9.1", - "debug": "^4.1.1", - "get-stream": "^5.1.0", - "yauzl": "^2.10.0" - } - }, - "fd-slicer": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", - "integrity": "sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=", - "dev": true, - "requires": { - "pend": "~1.2.0" - } - }, "fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -2695,15 +2483,6 @@ "has-symbols": "^1.0.1" } }, - "get-stream": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", - "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", - "dev": true, - "requires": { - "pump": "^3.0.0" - } - }, "glob": { "version": "7.1.6", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", @@ -2772,16 +2551,6 @@ "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", "dev": true }, - "https-proxy-agent": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz", - "integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==", - "dev": true, - "requires": { - "agent-base": "6", - "debug": "4" - } - }, "inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -3001,12 +2770,6 @@ "integrity": "sha512-Gv3ZIs/nA48/Zvjrl34bf+oD76JHiGDUxNOVgUjh3j890sblXryjY4rss71fPtD/njchl6PSE2hIhvyWa1eT0A==", "dev": true }, - "jpeg-js": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/jpeg-js/-/jpeg-js-0.4.3.tgz", - "integrity": "sha512-ru1HWKek8octvUHFHvE5ZzQ1yAsJmIvRdGWvSoKV52XKyuyYA437QWDttXT8eZXDSbuMpHlLzPDZUPd6idIz+Q==", - "dev": true - }, "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -3032,12 +2795,6 @@ "picomatch": "^2.0.5" } }, - "mime": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/mime/-/mime-2.5.2.tgz", - "integrity": "sha512-tqkh47FzKeCPD2PUiPB6pkbMzsCasjxAfC62/Wap5qrUWcb+sFasXUC5I3gYM5iBM8v/Qpn4UK0x+j0iHyFPDg==", - "dev": true - }, "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", @@ -3283,12 +3040,6 @@ "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", "dev": true }, - "pend": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", - "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=", - "dev": true - }, "picomatch": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", @@ -3296,30 +3047,19 @@ "dev": true }, "playwright": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.9.1.tgz", - "integrity": "sha512-bZXnks4UGJZoqja6TqVEUG0IQ2liqYFcO1R4lT43aO4oDVTQtawEJjS+EqLYsAuniRFWVE87Cemus4fRQbyXMg==", - "dev": true, - "requires": { - "commander": "^6.1.0", - "debug": "^4.1.1", - "extract-zip": "^2.0.1", - "https-proxy-agent": "^5.0.0", - "jpeg-js": "^0.4.2", - "mime": "^2.4.6", - "pngjs": "^5.0.0", - "progress": "^2.0.3", - "proper-lockfile": "^4.1.1", - "proxy-from-env": "^1.1.0", - "rimraf": "^3.0.2", - "stack-utils": "^2.0.3", - "ws": "^7.3.1" - } - }, - "pngjs": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-5.0.0.tgz", - "integrity": "sha512-40QW5YalBNfQo5yRYmiw7Yz6TKKVr3h6970B2YE+3fQpsWcrbj1PzJgxeJ19DRQjhMbKPIuMY8rFaXc8moolVw==", + "version": "1.40.1", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.40.1.tgz", + "integrity": "sha512-2eHI7IioIpQ0bS1Ovg/HszsN/XKNwEG1kbzSDDmADpclKc7CyqkHw7Mg2JCz/bbCxg25QUPcjksoMW7JcIFQmw==", + "dev": true, + "requires": { + "fsevents": "2.3.2", + "playwright-core": "1.40.1" + } + }, + "playwright-core": { + "version": "1.40.1", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.40.1.tgz", + "integrity": "sha512-+hkOycxPiV534c4HhpfX6yrlawqVUzITRKwHAmYfmsVreltEl6fAZJ3DPfLMOODw0H3s1Itd6MDCWmP1fl/QvQ==", "dev": true }, "pretty-format": { @@ -3334,39 +3074,12 @@ "react-is": "^17.0.1" } }, - "progress": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", - "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", - "dev": true - }, - "proper-lockfile": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/proper-lockfile/-/proper-lockfile-4.1.2.tgz", - "integrity": "sha512-TjNPblN4BwAWMXU8s9AEz4JmQxnD1NNL7bNOY/AKUzyamc379FWASUhc/K1pL2noVb+XmZKLL68cjzLsiOAMaA==", - "dev": true, - "requires": { - "graceful-fs": "^4.2.4", - "retry": "^0.12.0", - "signal-exit": "^3.0.2" - } - }, - "proxy-from-env": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", - "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", + "properties": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/properties/-/properties-1.2.1.tgz", + "integrity": "sha512-qYNxyMj1JeW54i/EWEFsM1cVwxJbtgPp8+0Wg9XjNaK6VE/c4oRi6PNu5p7w1mNXEIQIjV5Wwn8v8Gz82/QzdQ==", "dev": true }, - "pump": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", - "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", - "dev": true, - "requires": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, "randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", @@ -3397,21 +3110,6 @@ "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", "dev": true }, - "retry": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", - "integrity": "sha1-G0KmJmoh8HQh0bC1S33BZ7AcATs=", - "dev": true - }, - "rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dev": true, - "requires": { - "glob": "^7.1.3" - } - }, "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", @@ -3427,12 +3125,6 @@ "randombytes": "^2.1.0" } }, - "signal-exit": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", - "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==", - "dev": true - }, "slash": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", @@ -3530,6 +3222,12 @@ "which-boxed-primitive": "^1.0.1" } }, + "undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "dev": true + }, "util": { "version": "0.12.3", "resolved": "https://registry.npmjs.org/util/-/util-0.12.3.tgz", @@ -3635,13 +3333,6 @@ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true }, - "ws": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.4.tgz", - "integrity": "sha512-Qm8k8ojNQIMx7S+Zp8u/uHOx7Qazv3Yv4q68MiWWWOJhiwG5W3x7iqmRtJo8xxrciZUY4vRxUTJCKuRnF28ZZw==", - "dev": true, - "requires": {} - }, "yargs-unparser": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", @@ -3668,16 +3359,6 @@ } } }, - "yauzl": { - "version": "2.10.0", - "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", - "integrity": "sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=", - "dev": true, - "requires": { - "buffer-crc32": "~0.2.3", - "fd-slicer": "~1.1.0" - } - }, "yocto-queue": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", diff --git a/package.json b/package.json index 97bcf06..5b5bb35 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,11 @@ "test": "src" }, "scripts": { - "test": "mocha --timeout 15000 --spec src/tl.spec.js" + "clean:reports": "sh ./pretest.sh", + "test": "npx playwright test tests/*.spec.ts", + "test:ui": "npx playwright test --ui", + "generate:allure:report": "allure generate my-allure-results -o allure-report --clean", + "open:allure:report": "allure open allure-report" }, "repository": { "type": "git", @@ -20,6 +24,9 @@ }, "homepage": "https://github.com/beemi/playwright-automation-test-example#readme", "devDependencies": { + "@playwright/test": "^1.40.1", + "@types/node": "^20.10.6", + "allure-playwright": "^2.10.0", "assert": "^2.0.0", "chai": "^4.3.3", "chance": "^1.1.7", diff --git a/pages/home-page.ts b/pages/home-page.ts new file mode 100644 index 0000000..8e27a57 --- /dev/null +++ b/pages/home-page.ts @@ -0,0 +1,89 @@ +import { expect, type Locator, type Page } from '@playwright/test'; + +export class HomePage { + private page: Page; + + constructor(page: Page) { + this.page = page; + } + + async navigateToHomePage(url: string) { + await this.page.goto(url); + } + + async clickOnLoginButton() { + await this.page.click('text=Login'); + } + + async clickOnRegisterButton() { + await this.page.click('text=Register'); + } + + async clickOnLogoutButton() { + await this.page.click('text=Logout'); + } + + async clickOnBillingLineButton() { + await this.page.click('text=Billing Lines'); + } + + async clickOnBillingLineBasketButton() { + await this.page.click('text=Billing Line Basket'); + } + + async clickOnBillingLineBasketCheckoutButton() { + await this.page.click('text=Checkout'); + } + + async clickOnBillingLineBasketCheckoutConfirmButton() { + await this.page.click('text=Confirm'); + } + + async clickOnBillingLineBasketCheckoutCancelButton() { + await this.page.click('text=Cancel'); + } + + async clickOnBillingLineBasketCheckoutCloseButton() { + await this.page.click('text=Close'); + } + + async clickOnBillingLineBasketCheckoutCloseConfirmButton() { + await this.page.click('text=Confirm'); + } + + async clickOnBillingLineBasketCheckoutCloseCancelButton() { + await this.page.click('text=Cancel'); + } + + async clickOnBillingLineBasketCheckoutCloseCloseButton() { + await this.page.click('text=Close'); + } + + async clickOnBillingLineBasketCheckoutCloseCloseConfirmButton() { + await this.page.click('text=Confirm'); + } + + async clickOnBillingLineBasketCheckoutCloseCloseCancelButton() { + await this.page.click('text=Cancel'); + } + + async clickOnBillingLineBasketCheckoutCloseCloseCloseButton() { + await this.page.click('text=Close'); + } + + async clickOnBillingLineBasketCheckoutCloseCloseCloseConfirmButton() { + await this.page.click('text=Confirm'); + } + + async clickOnBillingLineBasketCheckoutCloseCloseCloseCancelButton() { + await this.page.click('text=Cancel'); + } + + async clickOnBillingLineBasketCheckoutCloseCloseCloseCloseButton() { + await this.page.click('text=Close'); + } + + async clickOnBillingLineBasketCheckoutCloseCloseCloseCloseConfirmButton() { + await this.page.click('text=Confirm'); + } +} diff --git a/pages/login-page.ts b/pages/login-page.ts new file mode 100644 index 0000000..c903669 --- /dev/null +++ b/pages/login-page.ts @@ -0,0 +1,69 @@ +import { expect, type Locator, type Page } from '@playwright/test'; + +export class LoginPage { + private page: Page; + + constructor(page: Page) { + this.page = page; + } + + async navigateToLoginPage(url: string) { + await this.page.goto(url); + } + + async enterUsername(username: string) { + await this.page.fill('input[name="username"]', username); + } + + async enterPassword(password: string) { + await this.page.fill('input[name="password"]', password); + } + + async clickOnLoginButton() { + await this.page.click('text=Login'); + } + + async clickOnRegisterButton() { + await this.page.click('text=Register'); + } + + async clickOnLogoutButton() { + await this.page.click('text=Logout'); + } + + async clickOnBillingLineButton() { + await this.page.click('text=Billing Lines'); + } + + async clickOnBillingLineBasketButton() { + await this.page.click('text=Billing Line Basket'); + } + + async clickOnBillingLineBasketCheckoutButton() { + await this.page.click('text=Checkout'); + } + + async clickOnBillingLineBasketCheckoutConfirmButton() { + await this.page.click('text=Confirm'); + } + + async clickOnBillingLineBasketCheckoutCancelButton() { + await this.page.click('text=Cancel'); + } + + async clickOnBillingLineBasketCheckoutCloseButton() { + await this.page.click('text=Close'); + } + + async clickOnBillingLineBasketCheckoutCloseConfirmButton() { + await this.page.click('text=Confirm'); + } + + async clickOnBillingLineBasketCheckoutCloseCancelButton() { + await this.page.click('text=Cancel'); + } + + async clickOnBillingLineBasketCheckoutCloseCloseButton() { + await this.page.click('text=Close'); + } +} diff --git a/pages/register-page.ts b/pages/register-page.ts new file mode 100644 index 0000000..60cd468 --- /dev/null +++ b/pages/register-page.ts @@ -0,0 +1,74 @@ +import { expect, type Locator, type Page } from '@playwright/test'; + +export class RegisterPage { + + private page: Page; + + constructor(page: Page) { + this.page = page; + } + + async navigateToRegisterPage(url: string) { + await this.page.goto(url); + } + + async enterUsername(username: string) { + await this.page.fill('input[name="username"]', username); + } + + async enterPassword(password: string) { + await this.page.fill('input[name="password"]', password); + } + + async enterConfirmPassword(password: string) { + await this.page.fill('input[name="confirmPassword"]', password); + } + + async clickOnRegisterButton() { + await this.page.click('text=Register'); + } + + async clickOnLoginButton() { + await this.page.click('text=Login'); + } + + async clickOnLogoutButton() { + await this.page.click('text=Logout'); + } + + async clickOnBillingLineButton() { + await this.page.click('text=Billing Lines'); + } + + async clickOnBillingLineBasketButton() { + await this.page.click('text=Billing Line Basket'); + } + + async clickOnBillingLineBasketCheckoutButton() { + await this.page.click('text=Checkout'); + } + + async clickOnBillingLineBasketCheckoutConfirmButton() { + await this.page.click('text=Confirm'); + } + + async clickOnBillingLineBasketCheckoutCancelButton() { + await this.page.click('text=Cancel'); + } + + async clickOnBillingLineBasketCheckoutCloseButton() { + await this.page.click('text=Close'); + } + + async clickOnBillingLineBasketCheckoutCloseConfirmButton() { + await this.page.click('text=Confirm'); + } + + async clickOnBillingLineBasketCheckoutCloseCancelButton() { + await this.page.click('text=Cancel'); + } + + async clickOnBillingLineBasketCheckoutCloseCloseButton() { + await this.page.click('text=Close'); + } +} diff --git a/playwright.config.ts b/playwright.config.ts new file mode 100644 index 0000000..86cf40f --- /dev/null +++ b/playwright.config.ts @@ -0,0 +1,32 @@ +// playwright.config.ts +import { PlaywrightTestConfig } from '@playwright/test' + +const config: PlaywrightTestConfig = { + globalSetup: require.resolve('./global-setup'), + timeout: 600000, + retries: 2, + use: { + baseURL: 'https://ecommerce-playground.lambdatest.io/', + ignoreHTTPSErrors: true, + screenshot: 'only-on-failure', + video: 'retain-on-failure', + trace: 'retain-on-failure', + viewport: { + width: 1920, + height: 1080 + }, + headless: true, + actionTimeout: 30000 + }, + reporter: [['list'], ['allure-playwright'], ['html', { open: 'never' }]], + projects: [ + { + name: 'Chrome', + use: { + browserName: 'chromium' + } + } + ] +} + +export default config diff --git a/pretest.sh b/pretest.sh new file mode 100755 index 0000000..089b042 --- /dev/null +++ b/pretest.sh @@ -0,0 +1,21 @@ +#! /bin/bash + +if [[ -d allure-report ]] +then +rm -r allure-report +fi + +if [[ -d allure-results ]] +then +rm -r allure-results +fi + +if [[ -d test-results ]] +then +rm -r test-results +fi + +if [[ -d temp ]] +then +rm -r temp +fi \ No newline at end of file diff --git a/src/simple.spec.js b/src/simple.spec.js deleted file mode 100644 index e8fb521..0000000 --- a/src/simple.spec.js +++ /dev/null @@ -1,26 +0,0 @@ -const {chromium} = require('playwright'); -const chai = require('chai') -const expect = chai.expect - -// playwright variables -let browser, page, context; - -describe("Simple playwright test", async () => { - - beforeEach(async () => { - browser = await chromium.launch({headless: false}); - context = await browser.newContext(); - page = await context.newPage(); - }); - - afterEach(async () => { - await page.close(); - }); - - it("Page title validation", async () => { - await page.goto('http://automationpractice.com/index.php'); - expect(await page.title()).to.equal("My Sore"); - }); - -}); - diff --git a/src/tl.spec.js b/src/tl.spec.js deleted file mode 100644 index d594deb..0000000 --- a/src/tl.spec.js +++ /dev/null @@ -1,98 +0,0 @@ -const {chromium} = require('playwright'); -const chai = require('chai') -const expect = chai.expect - -const Chance = require("chance"); -const chance = new Chance(); - -let firstname, lastname, email, address1, address2, city, county, postcode, phoneNumber; - -// playwright variables -let browser, page, context; - -describe("paypal", async () => { - - before(async () => { - browser = await chromium.launch({headless: false}); - context = await browser.newContext(); - page = await context.newPage(); - - - email = chance.email({domain: "example.com"}); - firstname = chance.first(); - lastname = chance.last(); - address1 = chance.address({short_suffix: true}); - address2 = chance.address({short_suffix: true}); - city = chance.city(); - county = chance.county(); - postcode = "RM17 6EY"; - phoneNumber = chance.phone({country: "uk"}); - }); - after(async () => { - // await page.close(); - }); - - - it("tl payment paypal payment", async () => { - - await page.goto("https://tlqa:1000parrots@trinnylondon-dev.com"); - - await page.waitForSelector("#email"); - await page.click("[class*='ModalDialog_closeButtonSVG_']"); - - await page.click("[data-test-id$='menu-accessories']"); - await page.waitForSelector("[data-test-id$='buy-button']"); - - await page.click("[data-test-id$='buy-button']"); - - await page.click("[data-test-id$='navigation-cart']"); - - await page.waitForSelector("[data-test-id$='checkout']"); - await page.click("[data-test-id$='checkout']"); - - await page.waitForSelector("[data-test-id$='guest-checkout-email-input']"); - await page.fill("[data-test-id$='guest-checkout-email-input']", email); - - await page.click("[data-test-id$='checkout-as-a-guest']"); - - await page.waitForSelector("[data-test-id$='skip']"); - await page.click("[data-test-id$='skip']"); - - await page.waitForSelector("[data-test-id$='shippingfirst-name']"); - await page.fill("[data-test-id$='shippingfirst-name']", firstname); - await page.fill("[data-test-id$='shippinglast-name']", lastname); - await page.fill("[data-test-id$='shippingaddress1']", address1); - await page.fill("[data-test-id$='shippingaddress2']", address2); - await page.fill("[data-test-id$='shippingcity']", city); - await page.fill("[data-test-id$='shippingcounty']", county); - await page.fill("[data-test-id$='shippingpostcode']", postcode); - await page.fill("[data-test-id$='shippingphone-number']", phoneNumber); - - await page.click("[data-test-id$='continue-to-delivery']"); - - await page.waitForSelector("[data-test-id$='continue-to-payment']"); - await page.click("[data-test-id$='continue-to-payment']"); - - await page.waitForSelector("[data-test-id$='add-a-gift-card']"); - - // const payPalRadioButton = await page.$('[class*="BaseSection_radioButton_"]'); - await page.click("div[class='BaseSection_title_196Xv PayPal_title_3CSVy'] img[class='BaseSection_radioButton_-YHcy']"); - - await page.click("[id$='terms']"); - - const [newPage] = await Promise.all([ - context.waitForEvent('page'), - page.click('[class$="adyen-checkout__paypal__buttons"]') - ]) - - await newPage.waitForLoadState('domcontentloaded'); - console.log("Paypal new window:", await newPage.title()); - await newPage.waitForSelector("#email"); - console.log("Paypal url:", newPage.url()) - - await newPage.fill("#email", "test@test.com"); - await newPage.fill("#password", "test121"); - - await newPage.click("#btnLogin"); - }); -}); \ No newline at end of file diff --git a/tests/example.spec.ts b/tests/example.spec.ts new file mode 100644 index 0000000..54a906a --- /dev/null +++ b/tests/example.spec.ts @@ -0,0 +1,18 @@ +import { test, expect } from '@playwright/test'; + +test('has title', async ({ page }) => { + await page.goto('https://playwright.dev/'); + + // Expect a title "to contain" a substring. + await expect(page).toHaveTitle(/Playwright/); +}); + +test('get started link', async ({ page }) => { + await page.goto('https://playwright.dev/'); + + // Click the get started link. + await page.getByRole('link', { name: 'Get started' }).click(); + + // Expects page to have a heading with the name of Installation. + await expect(page.getByRole('heading', { name: 'Installation' })).toBeVisible(); +}); diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..73a3bb4 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,12 @@ +{ + "compilerOptions": { + "sourceMap": true, + "target": "es6", + "lib": ["dom", "dom.iterable", "esnext"], + "strict": true, + "module": "commonjs", + "noEmit": true, + "resolveJsonModule": true + }, + "include": ["tests"] +}