diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cc973ea..cb2edc9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,44 +1,42 @@ -# .github/workflows/playwright-daily.yml -# Runs Playwright test shards every day at **11 : 42 AM IST** (06 : 12 UTC) -# plus anytime you trigger it manually from the Actions tab. - name: Run Playwright tests on: + push: + pull_request: schedule: - - cron: '30 3 * * 1-5' + - cron: '30 3 * * *' # 9:00 AM IST everyday # 11:00 AM IST workflow_dispatch: jobs: run-tests: - name: Run Playwright shards + name: Run Playwright tests ${{ matrix.shardIndex }}/5 runs-on: ubuntu-latest strategy: fail-fast: false matrix: - shardIndex: [1,2,3] - shardTotal: [2] + shardIndex: [1, 2, 3, 4, 5] + shardTotal: [5] steps: - uses: actions/checkout@v4 - - name: Setup Node.js 18.x + - name: Setup Node.js 20.x uses: actions/setup-node@v3 with: - node-version: '18' + node-version: "20" + - name: Create .env file run: | - echo "USERNAME=${{ secrets.USERNAME }}" >> .env - echo "USERNAME1=${{ secrets.USERNAME1 }}" >> .env - echo "PASSWORD=${{ secrets.PASSWORD }}" >> .env - echo "NEW_PASSWORD=${{ secrets.NEW_PASSWORD }}" >> .env - echo "FIRST_NAME=${{ secrets.FIRST_NAME }}" >> .env - echo "STREET_NAME=${{ secrets.STREET_NAME }}" >> .env - echo "CITY=${{ secrets.CITY }}" >> .env - echo "STATE=${{ secrets.STATE }}" >> .env - echo "COUNTRY=${{ secrets.COUNTRY }}" >> .env - echo "ZIP_CODE=${{ secrets.ZIP_CODE }}" >> .env + echo "USERNAME=${{ secrets.USERNAME }}" >> .env + echo "PASSWORD=${{ secrets.PASSWORD }}" >> .env + echo "NEW_PASSWORD=${{ secrets.NEW_PASSWORD }}" >> .env + echo "FIRST_NAME=${{ secrets.FIRST_NAME }}" >> .env + echo "STREET_NAME=${{ secrets.STREET_NAME }}" >> .env + echo "CITY=${{ secrets.CITY }}" >> .env + echo "STATE=${{ secrets.STATE }}" >> .env + echo "COUNTRY=${{ secrets.COUNTRY }}" >> .env + echo "ZIP_CODE=${{ secrets.ZIP_CODE }}" >> .env - name: Cache npm dependencies uses: actions/cache@v3 @@ -48,13 +46,16 @@ jobs: restore-keys: | ${{ runner.os }}-node- - - name: Install deps + browsers + - name: Install dependencies run: | npm ci npx playwright install --with-deps - - name: Run shard ${{ matrix.shardIndex }} - run: npx playwright test --project=chromium --reporter=blob --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} + - name: Run Playwright Tests + run: | + npx playwright test \ + --grep="@chromium|@firefox|@webkit|@api|@andriod|@ios" \ + --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} - name: Upload blob report if: ${{ !cancelled() }} @@ -67,26 +68,18 @@ jobs: merge-reports: name: Merge Reports needs: run-tests - if: always() # run even if some shards fail + if: always() runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Setup Node.js 18.x + - name: Setup Node.js 20.x uses: actions/setup-node@v3 with: - node-version: '18' - - - name: Cache npm dependencies - uses: actions/cache@v3 - with: - path: ~/.npm - key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-node- + node-version: "20" - - name: Install deps + browsers + - name: Install dependencies run: | npm ci npx playwright install --with-deps @@ -99,18 +92,23 @@ jobs: merge-multiple: true - name: Merge HTML & JSON reports - run: npx playwright merge-reports --config=playwright.config.js ./all-blob-reports + run: | + npx playwright merge-reports \ + --config=playwright.config.js \ + ./all-blob-reports - - name: Upload combined report + - name: Upload combined Playwright report uses: actions/upload-artifact@v4 with: name: Playwright Test Report path: ./playwright-report retention-days: 14 - - name: Send TestDino report + - name: Upload report to TestDino + env: + TESTDINO_TOKEN: ${{ secrets.TESTDINO_TOKEN }} run: | - npx --yes tdpw ./playwright-report \ - --token="${{ secrets.TESTDINO_TOKEN }}" \ - --upload-html \ - --verbose + npx tdpw upload ./playwright-report \ + --upload-traces \ + --upload-html \ + --token="$TESTDINO_TOKEN" diff --git a/README.md b/README.md index f9a4348..cff65e8 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# playwright-sample-tests-javascript +# Ecommerce-demo-test-playwright -Automated end-to-end tests for [e-commerce demo site](https://demo.alphabin.co/) using [Playwright](https://playwright.dev/). +Automated end-to-end tests for Ecommerce Demo store using [Playwright](https://playwright.dev/). --- @@ -63,9 +63,7 @@ reporter: [ After your tests complete and the report is generated in `playwright-report`, upload it to Testdino: -```sh -npx --yes tdpw ./playwright-report --token="YOUR_TESTDINO_API_KEY" --upload-html -``` + Replace the token above with your own Testdino API key. @@ -82,11 +80,7 @@ npx tdpw --help Add the following step to your workflow after tests and report generation: -```yaml -- name: Send Testdino report - run: | - npx --yes tdpw ./playwright-report --token="YOUR_TESTDINO_API_KEY" --upload-html -``` + Ensure your API key is correctly placed in the command. @@ -106,4 +100,3 @@ Pull requests and issues are welcome! ## License -MIT diff --git a/__screenshots__/visual.spec.js-snapshots/github-login-changed-chromium-darwin.png b/__screenshots__/visual.spec.js-snapshots/github-login-changed-chromium-darwin.png new file mode 100644 index 0000000..81b5cb7 Binary files /dev/null and b/__screenshots__/visual.spec.js-snapshots/github-login-changed-chromium-darwin.png differ diff --git a/__screenshots__/visual.spec.js-snapshots/github-login-chromium-darwin.png b/__screenshots__/visual.spec.js-snapshots/github-login-chromium-darwin.png new file mode 100644 index 0000000..568dbbb Binary files /dev/null and b/__screenshots__/visual.spec.js-snapshots/github-login-chromium-darwin.png differ diff --git a/package-lock.json b/package-lock.json index 8e94191..008f3b2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,13 +10,66 @@ "license": "ISC", "dependencies": { "dotenv": "^17.2.1", - "playwright": "^1.55.0" + "playwright": "^1.55.0", + "testdino-mcp": "file:testdino-mcp-1.0.6.tgz" }, "devDependencies": { "@playwright/test": "^1.54.1", "@types/node": "^24.1.0" } }, + "node_modules/@hono/node-server": { + "version": "1.19.9", + "resolved": "https://registry.npmjs.org/@hono/node-server/-/node-server-1.19.9.tgz", + "integrity": "sha512-vHL6w3ecZsky+8P5MD+eFfaGTyCeOHUIFYMGpQGbrBTSmNNoxv0if69rEZ5giu36weC5saFuznL411gRX7bJDw==", + "license": "MIT", + "engines": { + "node": ">=18.14.1" + }, + "peerDependencies": { + "hono": "^4" + } + }, + "node_modules/@modelcontextprotocol/sdk": { + "version": "1.26.0", + "resolved": "https://registry.npmjs.org/@modelcontextprotocol/sdk/-/sdk-1.26.0.tgz", + "integrity": "sha512-Y5RmPncpiDtTXDbLKswIJzTqu2hyBKxTNsgKqKclDbhIgg1wgtf1fRuvxgTnRfcnxtvvgbIEcqUOzZrJ6iSReg==", + "license": "MIT", + "dependencies": { + "@hono/node-server": "^1.19.9", + "ajv": "^8.17.1", + "ajv-formats": "^3.0.1", + "content-type": "^1.0.5", + "cors": "^2.8.5", + "cross-spawn": "^7.0.5", + "eventsource": "^3.0.2", + "eventsource-parser": "^3.0.0", + "express": "^5.2.1", + "express-rate-limit": "^8.2.1", + "hono": "^4.11.4", + "jose": "^6.1.3", + "json-schema-typed": "^8.0.2", + "pkce-challenge": "^5.0.0", + "raw-body": "^3.0.0", + "zod": "^3.25 || ^4.0", + "zod-to-json-schema": "^3.25.1" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@cfworker/json-schema": "^4.1.1", + "zod": "^3.25 || ^4.0" + }, + "peerDependenciesMeta": { + "@cfworker/json-schema": { + "optional": true + }, + "zod": { + "optional": false + } + } + }, "node_modules/@playwright/test": { "version": "1.55.0", "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.55.0.tgz", @@ -43,10 +96,240 @@ "undici-types": "~7.10.0" } }, + "node_modules/accepts": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz", + "integrity": "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==", + "license": "MIT", + "dependencies": { + "mime-types": "^3.0.0", + "negotiator": "^1.0.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/accepts/node_modules/mime-db": { + "version": "1.54.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz", + "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/accepts/node_modules/mime-types": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.2.tgz", + "integrity": "sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==", + "license": "MIT", + "dependencies": { + "mime-db": "^1.54.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/ajv": { + "version": "8.18.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.18.0.tgz", + "integrity": "sha512-PlXPeEWMXMZ7sPYOHqmDyCJzcfNrUr3fGNKtezX14ykXOEIvyK81d+qydx89KY5O71FKMPaQ2vBfBFI5NHR63A==", + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ajv-formats": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-3.0.1.tgz", + "integrity": "sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ==", + "license": "MIT", + "dependencies": { + "ajv": "^8.0.0" + }, + "peerDependencies": { + "ajv": "^8.0.0" + }, + "peerDependenciesMeta": { + "ajv": { + "optional": true + } + } + }, + "node_modules/body-parser": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.2.2.tgz", + "integrity": "sha512-oP5VkATKlNwcgvxi0vM0p/D3n2C3EReYVX+DNYs5TjZFn/oQt2j+4sVJtSMr18pdRr8wjTcBl6LoV+FUwzPmNA==", + "license": "MIT", + "dependencies": { + "bytes": "^3.1.2", + "content-type": "^1.0.5", + "debug": "^4.4.3", + "http-errors": "^2.0.0", + "iconv-lite": "^0.7.0", + "on-finished": "^2.4.1", + "qs": "^6.14.1", + "raw-body": "^3.0.1", + "type-is": "^2.0.1" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/content-disposition": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-1.0.1.tgz", + "integrity": "sha512-oIXISMynqSqm241k6kcQ5UwttDILMK4BiurCfGEREw6+X9jkkpEe5T9FZaApyLGGOnFuyMWZpdolTXMtvEJ08Q==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/content-type": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", + "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.2.2.tgz", + "integrity": "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==", + "license": "MIT", + "engines": { + "node": ">=6.6.0" + } + }, + "node_modules/cors": { + "version": "2.8.6", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.6.tgz", + "integrity": "sha512-tJtZBBHA6vjIAaF6EnIaq6laBBP9aq/Y3ouVJjEfoHbRBcHBAHYcMh/w8LDrk2PvIMMq8gmopa5D4V8RmbrxGw==", + "license": "MIT", + "dependencies": { + "object-assign": "^4", + "vary": "^1" + }, + "engines": { + "node": ">= 0.10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, "node_modules/dotenv": { - "version": "17.2.1", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-17.2.1.tgz", - "integrity": "sha512-kQhDYKZecqnM0fCnzI5eIv5L4cAe/iRI+HqMbO/hbRdTAeXDG+M9FjipUxNfbARuEg4iHIbhnhs78BCHNbSxEQ==", + "version": "17.3.1", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-17.3.1.tgz", + "integrity": "sha512-IO8C/dzEb6O3F9/twg6ZLXz164a2fhTnEWb95H23Dm4OuN+92NmEAlTrupP9VW6Jm3sO26tQlqyvyi4CsnY9GA==", "license": "BSD-2-Clause", "engines": { "node": ">=12" @@ -55,6 +338,248 @@ "url": "https://dotenvx.com" } }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", + "license": "MIT" + }, + "node_modules/encodeurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", + "license": "MIT" + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/eventsource": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-3.0.7.tgz", + "integrity": "sha512-CRT1WTyuQoD771GW56XEZFQ/ZoSfWid1alKGDYMmkt2yl8UXrVR4pspqWNEcqKvVIzg6PAltWjxcSSPrboA4iA==", + "license": "MIT", + "dependencies": { + "eventsource-parser": "^3.0.1" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/eventsource-parser": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/eventsource-parser/-/eventsource-parser-3.0.6.tgz", + "integrity": "sha512-Vo1ab+QXPzZ4tCa8SwIHJFaSzy4R6SHf7BY79rFBDf0idraZWAkYrDjDj8uWaSm3S2TK+hJ7/t1CEmZ7jXw+pg==", + "license": "MIT", + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/express": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/express/-/express-5.2.1.tgz", + "integrity": "sha512-hIS4idWWai69NezIdRt2xFVofaF4j+6INOpJlVOLDO8zXGpUVEVzIYk12UUi2JzjEzWL3IOAxcTubgz9Po0yXw==", + "license": "MIT", + "dependencies": { + "accepts": "^2.0.0", + "body-parser": "^2.2.1", + "content-disposition": "^1.0.0", + "content-type": "^1.0.5", + "cookie": "^0.7.1", + "cookie-signature": "^1.2.1", + "debug": "^4.4.0", + "depd": "^2.0.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "finalhandler": "^2.1.0", + "fresh": "^2.0.0", + "http-errors": "^2.0.0", + "merge-descriptors": "^2.0.0", + "mime-types": "^3.0.0", + "on-finished": "^2.4.1", + "once": "^1.4.0", + "parseurl": "^1.3.3", + "proxy-addr": "^2.0.7", + "qs": "^6.14.0", + "range-parser": "^1.2.1", + "router": "^2.2.0", + "send": "^1.1.0", + "serve-static": "^2.2.0", + "statuses": "^2.0.1", + "type-is": "^2.0.1", + "vary": "^1.1.2" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/express-rate-limit": { + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-8.2.1.tgz", + "integrity": "sha512-PCZEIEIxqwhzw4KF0n7QF4QqruVTcF73O5kFKUnGOyjbCCgizBBiFaYpd/fnBLUMPw/BWw9OsiN7GgrNYr7j6g==", + "license": "MIT", + "dependencies": { + "ip-address": "10.0.1" + }, + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://github.com/sponsors/express-rate-limit" + }, + "peerDependencies": { + "express": ">= 4.11" + } + }, + "node_modules/express/node_modules/mime-db": { + "version": "1.54.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz", + "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/express/node_modules/mime-types": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.2.tgz", + "integrity": "sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==", + "license": "MIT", + "dependencies": { + "mime-db": "^1.54.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "license": "MIT" + }, + "node_modules/fast-uri": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.0.tgz", + "integrity": "sha512-iPeeDKJSWf4IEOasVVrknXpaBV0IApz/gp7S2bb7Z4Lljbl2MGJRqInZiUrQwV16cpzw/D3S5j5Julj/gT52AA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "BSD-3-Clause" + }, + "node_modules/finalhandler": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.1.1.tgz", + "integrity": "sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "on-finished": "^2.4.1", + "parseurl": "^1.3.3", + "statuses": "^2.0.1" + }, + "engines": { + "node": ">= 18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-2.0.0.tgz", + "integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, "node_modules/fsevents": { "version": "2.3.2", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", @@ -69,6 +594,314 @@ "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/hono": { + "version": "4.12.2", + "resolved": "https://registry.npmjs.org/hono/-/hono-4.12.2.tgz", + "integrity": "sha512-gJnaDHXKDayjt8ue0n8Gs0A007yKXj4Xzb8+cNjZeYsSzzwKc0Lr+OZgYwVfB0pHfUs17EPoLvrOsEaJ9mj+Tg==", + "license": "MIT", + "engines": { + "node": ">=16.9.0" + } + }, + "node_modules/http-errors": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz", + "integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==", + "license": "MIT", + "dependencies": { + "depd": "~2.0.0", + "inherits": "~2.0.4", + "setprototypeof": "~1.2.0", + "statuses": "~2.0.2", + "toidentifier": "~1.0.1" + }, + "engines": { + "node": ">= 0.8" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/iconv-lite": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.2.tgz", + "integrity": "sha512-im9DjEDQ55s9fL4EYzOAv0yMqmMBSZp6G0VvFyTMPKWxiSBHUj9NW/qqLmXUwXrrM7AvqSlTCfvqRb0cM8yYqw==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "license": "ISC" + }, + "node_modules/ip-address": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-10.0.1.tgz", + "integrity": "sha512-NWv9YLW4PoW2B7xtzaS3NCot75m6nK7Icdv0o3lfMceJVRfSoQwqD4wEH5rLwoKJwUiZ/rfpiVBhnaF0FK4HoA==", + "license": "MIT", + "engines": { + "node": ">= 12" + } + }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/is-promise": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz", + "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==", + "license": "MIT" + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "license": "ISC" + }, + "node_modules/jose": { + "version": "6.1.3", + "resolved": "https://registry.npmjs.org/jose/-/jose-6.1.3.tgz", + "integrity": "sha512-0TpaTfihd4QMNwrz/ob2Bp7X04yuxJkjRGi4aKmOqwhov54i6u79oCv7T+C7lo70MKH6BesI3vscD1yb/yzKXQ==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/panva" + } + }, + "node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "license": "MIT" + }, + "node_modules/json-schema-typed": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/json-schema-typed/-/json-schema-typed-8.0.2.tgz", + "integrity": "sha512-fQhoXdcvc3V28x7C7BMs4P5+kNlgUURe2jmUT1T//oBRMDrqy1QPelJimwZGo7Hg9VPV3EQV5Bnq4hbFy2vetA==", + "license": "BSD-2-Clause" + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/media-typer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.0.tgz", + "integrity": "sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/merge-descriptors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-2.0.0.tgz", + "integrity": "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/negotiator": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz", + "integrity": "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-inspect": { + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "license": "MIT", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-to-regexp": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.3.0.tgz", + "integrity": "sha512-7jdwVIRtsP8MYpdXSwOS0YdD0Du+qOoF/AEPIt88PcCFrZCzx41oxku1jD88hZBwbNUIEfpqvuhjFaMAqMTWnA==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/pkce-challenge": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/pkce-challenge/-/pkce-challenge-5.0.1.tgz", + "integrity": "sha512-wQ0b/W4Fr01qtpHlqSqspcj3EhBvimsdh0KlHhH8HRZnMsEa0ea2fTULOXOS9ccQr3om+GcGRk4e+isrZWV8qQ==", + "license": "MIT", + "engines": { + "node": ">=16.20.0" + } + }, "node_modules/playwright": { "version": "1.55.0", "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.55.0.tgz", @@ -99,12 +932,392 @@ "node": ">=18" } }, + "node_modules/proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "license": "MIT", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/qs": { + "version": "6.15.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.15.0.tgz", + "integrity": "sha512-mAZTtNCeetKMH+pSjrb76NAM8V9a05I9aBZOHztWy/UqcJdQYNsf59vrRKWnojAT9Y+GbIvoTBC++CPHqpDBhQ==", + "license": "BSD-3-Clause", + "dependencies": { + "side-channel": "^1.1.0" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-3.0.2.tgz", + "integrity": "sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA==", + "license": "MIT", + "dependencies": { + "bytes": "~3.1.2", + "http-errors": "~2.0.1", + "iconv-lite": "~0.7.0", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/router": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz", + "integrity": "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.0", + "depd": "^2.0.0", + "is-promise": "^4.0.0", + "parseurl": "^1.3.3", + "path-to-regexp": "^8.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "license": "MIT" + }, + "node_modules/send": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/send/-/send-1.2.1.tgz", + "integrity": "sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.3", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "fresh": "^2.0.0", + "http-errors": "^2.0.1", + "mime-types": "^3.0.2", + "ms": "^2.1.3", + "on-finished": "^2.4.1", + "range-parser": "^1.2.1", + "statuses": "^2.0.2" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/send/node_modules/mime-db": { + "version": "1.54.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz", + "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/send/node_modules/mime-types": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.2.tgz", + "integrity": "sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==", + "license": "MIT", + "dependencies": { + "mime-db": "^1.54.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/serve-static": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-2.2.1.tgz", + "integrity": "sha512-xRXBn0pPqQTVQiC8wyQrKs2MOlX24zQ0POGaj0kultvoOCstBQM5yvOhAVSUwOMjQtTvsPWoNCHfPGwaaQJhTw==", + "license": "MIT", + "dependencies": { + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "parseurl": "^1.3.3", + "send": "^1.2.0" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", + "license": "ISC" + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/side-channel": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", + "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3", + "side-channel-list": "^1.0.0", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-list": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz", + "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/statuses": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz", + "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/testdino-mcp": { + "version": "1.0.6", + "resolved": "file:testdino-mcp-1.0.6.tgz", + "integrity": "sha512-a62WW0dB33rxZ42vsMYO0RT5pKJK7ZDlscSiu9yDnusjt0O/esdyvYW+LobYmvXWSA7N6UAuTUzxNfnoDCeIcQ==", + "dependencies": { + "@modelcontextprotocol/sdk": "^1.25.1" + }, + "bin": { + "testdino-mcp": "dist/index.js" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "license": "MIT", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/type-is": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-2.0.1.tgz", + "integrity": "sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw==", + "license": "MIT", + "dependencies": { + "content-type": "^1.0.5", + "media-typer": "^1.1.0", + "mime-types": "^3.0.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/type-is/node_modules/mime-db": { + "version": "1.54.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz", + "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/type-is/node_modules/mime-types": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.2.tgz", + "integrity": "sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==", + "license": "MIT", + "dependencies": { + "mime-db": "^1.54.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, "node_modules/undici-types": { "version": "7.10.0", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.10.0.tgz", "integrity": "sha512-t5Fy/nfn+14LuOc2KNYg75vZqClpAiqscVvMygNnlsHBFpSXdJaYtXMcdNLpl/Qvc3P2cB3s6lOV51nqsFq4ag==", "dev": true, "license": "MIT" + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "license": "ISC" + }, + "node_modules/zod": { + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/zod/-/zod-4.3.6.tgz", + "integrity": "sha512-rftlrkhHZOcjDwkGlnUtZZkvaPHCsDATp4pGpuOOMDaTdDDXF91wuVDJoWoPsKX/3YPQ5fHuF3STjcYyKr+Qhg==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + }, + "node_modules/zod-to-json-schema": { + "version": "3.25.1", + "resolved": "https://registry.npmjs.org/zod-to-json-schema/-/zod-to-json-schema-3.25.1.tgz", + "integrity": "sha512-pM/SU9d3YAggzi6MtR4h7ruuQlqKtad8e9S0fmxcMi+ueAK5Korys/aWcV9LIIHTVbj01NdzxcnXSN+O74ZIVA==", + "license": "ISC", + "peerDependencies": { + "zod": "^3.25 || ^4" + } } } } diff --git a/package.json b/package.json index 4d7a316..1cbd2da 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ }, "dependencies": { "dotenv": "^17.2.1", - "playwright": "^1.55.0" + "playwright": "^1.55.0", + "testdino-mcp": "file:testdino-mcp-1.0.6.tgz" } } diff --git a/pages/AllPages.js b/pages/AllPages.js index f9f7c91..c4c22f0 100644 --- a/pages/AllPages.js +++ b/pages/AllPages.js @@ -9,6 +9,7 @@ import CheckoutPage from "./CheckoutPage"; import OrderPage from "./OrderPage"; // Import OrderPage import UserPage from "./UserPage"; // Import UserPage import OrderDetailsPage from "./OrderDetailsPage"; +import ContactUsPage from "./ContactUsPage"; class AllPages { constructor(page) { @@ -24,6 +25,8 @@ class AllPages { this.orderPage = new OrderPage(page); // Instantiate OrderPage this.userPage = new UserPage(page); // Instantiate UserPage this.orderDetailsPage = new OrderDetailsPage(page); + this.contactUsPage = new ContactUsPage(page); + } } diff --git a/pages/CartPage.js b/pages/CartPage.js index 9de37c5..5b667b8 100644 --- a/pages/CartPage.js +++ b/pages/CartPage.js @@ -1,3 +1,4 @@ +import { start } from 'repl'; import BasePage from './BasePage.js'; import { expect } from '@playwright/test'; @@ -29,6 +30,9 @@ class CartPage extends BasePage{ checkoutButton: '[data-testid="checkout-button"]', viewCartButton: '[data-testid="view-cart-button"]', shoppingCartIcon: `[data-testid="header-cart-icon"]`, + deleteItemButton: '[aria-label="Remove item"]', + cartEmpty: `[data-testid="empty-cart"]`, + startShoppingButton: `[data-testid="continue-shopping-btn"]` } async assertYourCartTitle() { @@ -124,6 +128,27 @@ class CartPage extends BasePage{ await this.page.waitForTimeout(2000); await this.page.locator(this.locators.checkoutButton).click({ force: true }); } + + async verifyIncreasedQuantity(expectedQuantity) { + await expect(this.page.locator(this.locators.cartItemQuantity)).toHaveText(expectedQuantity); + } + + async clickOnDeleteProductIcon() { + await this.page.locator(this.locators.deleteItemButton).click(); + } + + async verifyCartItemDeleted() { + await expect(this.page.locator(this.locators.cartItemName)).toHaveCount(0); + } + + async verifyEmptyCartMessage() { + await expect(this.page.locator(this.locators.cartEmpty)).toBeVisible(); + } + + async clickOnStartShoppingButton() { + await this.page.locator(this.locators.startShoppingButton).click(); + } + } export default CartPage; \ No newline at end of file diff --git a/pages/ContactUsPage.js b/pages/ContactUsPage.js new file mode 100644 index 0000000..5053db5 --- /dev/null +++ b/pages/ContactUsPage.js @@ -0,0 +1,40 @@ +import BasePage from './BasePage.js'; +import { expect } from '@playwright/test'; + +class ContactUsPage extends BasePage{ + + /** + * @param {import('@playwright/test').Page} page + */ + constructor(page) { + super(page); + this.page = page; + } + + locators = { + contactUsBtn: `[data-testid="header-menu-contact-us"]`, + contactUsTitle: `[data-testid="contact-us-heading"]`, + firstNameInput: `[data-testid="contact-us-first-name-input"]`, + lastNameInput: `[data-testid="contact-us-last-name-input"]`, + subjectInput: `[data-testid="contact-us-subject-input"]`, + messageInput: `[data-testid="contact-us-message-input"]`, + sendMessageBtn: `//button[@data-testid="contact-us-submit-button"]`, + successMessage: `[data-testid="contact-us-success-message"]` + } + + async assertContactUsTitle() { + await expect(this.page.locator(this.locators.contactUsTitle)).toHaveText('Contact Us'); + } + + async fillContactUsForm() { + await this.page.fill(this.locators.firstNameInput, 'John'); + await this.page.fill(this.locators.lastNameInput, 'Doe'); + await this.page.fill(this.locators.subjectInput, 'Test Subject'); + await this.page.fill(this.locators.messageInput, 'This is a test message.'); + await this.page.click(this.locators.sendMessageBtn); + } + async verifySuccessContactUsFormSubmission() { + await expect(this.page.locator(this.locators.successMessage)).toBeVisible(); + } +} +export default ContactUsPage; \ No newline at end of file diff --git a/pages/HomePage.js b/pages/HomePage.js index 72c55b3..593898a 100644 --- a/pages/HomePage.js +++ b/pages/HomePage.js @@ -23,7 +23,8 @@ class HomePage extends BasePage{ AddCartNotification: `div[role="status"][aria-live="polite"]:has-text("Added to the cart")`, priceRangeSlider2 : `[data-testid="all-products-price-range-input-1"]`, priceRangeSlider1 : `[data-testid="all-products-price-range-input-0"]`, - filterButton : `[data-testid="all-products-filter-toggle"]` + filterButton : `[data-testid="all-products-filter-toggle"]`, + aboutUsTitle: `[data-testid="about-us-title"]`, } } @@ -88,6 +89,25 @@ class HomePage extends BasePage{ return this.page.locator(this.locators.navbar.showNowButton); } + async clickOnContactUsLink() { + await this.getContactUsNav().click(); + } + + async clickBackToHomeButton() { + await this.getHomeNav().click(); + } + + async assertHomePage() { + await expect(this.page.locator(this.locators.navbar.homeNav)).toBeVisible({ timeout: 10000 }); + } + + async clickAboutUsNav() { + await this.getAboutUsNav().click(); + } + + async assertAboutUsTitle() { + await expect(this.page.locator(this.locators.navbar.aboutUsTitle)).toBeVisible({ timeout: 10000 }); + } } export default HomePage; \ No newline at end of file diff --git a/pages/LoginPage.js b/pages/LoginPage.js index 22e010d..b27d956 100644 --- a/pages/LoginPage.js +++ b/pages/LoginPage.js @@ -2,7 +2,7 @@ import BasePage from './BasePage.js'; import { expect } from '@playwright/test'; class LoginPage extends BasePage{ - + /** * @param {import('@playwright/test').Page} page */ @@ -23,6 +23,7 @@ class LoginPage extends BasePage{ successSignInMessage: `Logged in successfully`, } + async navigateToLoginPage() { await this.navigateTo('/'); } @@ -49,6 +50,11 @@ class LoginPage extends BasePage{ async clickOnUserProfileIcon() { await this.page.locator(this.locators.userIcon).click(); + // Wait for dropdown menu to appear + // await this.page.waitForSelector(this.locators.logoutButton, { + // state: 'visible', + // timeout: 5000 + // }); } async assertLoginPage() { @@ -66,7 +72,9 @@ class LoginPage extends BasePage{ } async clickOnLogoutButton() { - await this.page.locator(this.locators.logoutButton).click(); + const logoutBtn = this.page.locator(this.locators.logoutButton); + await logoutBtn.waitFor({ state: 'visible', timeout: 10000 }); + await logoutBtn.click(); } async validateSignInPage() { await expect(this.getLoginPageTitle()).toBeVisible(); diff --git a/pages/ProductDetailsPage.js b/pages/ProductDetailsPage.js index 1256cbf..748b3ef 100644 --- a/pages/ProductDetailsPage.js +++ b/pages/ProductDetailsPage.js @@ -17,7 +17,16 @@ class ProductDetailsPage extends BasePage{ addToCartButton: 'ADD TO CART', headerCartIcon: 'header-cart-icon', productAdditionalInfoTab : `[data-testid="additional-info-tab"]`, - productReviewsTab : `[data-testid="reviews-tab"]` + productReviewsTab : `[data-testid="reviews-tab"]`, + writeReviewBtn: `//button[@data-testid="write-review-button"]`, + yourNameInput: `[data-testid="review-form-name-input"]`, + emailInput: `[data-testid="review-form-email-input"]`, + ratingStars: `[data-testid="review-form-rating-4"]`, + reviewTitleInput: `[data-testid="review-form-title-input"]`, + giveYourOpinionInput: `[data-testid="review-form-review-input"]`, + submitBtn: `[data-testid="review-form-submit-button"]`, + editReviewBtn: `[data-testid="edit-review-button"]`, + deleteReviewBtn: `[data-testid="delete-review-button"]` } @@ -85,6 +94,47 @@ class ProductDetailsPage extends BasePage{ async clickCartIcon() { await this.getCartIcon().click(); } + + async clickOnWriteAReviewBtn() { + await this.page.locator(this.locators.writeReviewBtn).click(); + } + + async fillReviewForm() { + await this.page.fill(this.locators.yourNameInput, 'John Doe'); + await this.page.fill(this.locators.emailInput, 'testing@gmail.com'); + await this.page.click(this.locators.ratingStars); + await this.page.fill(this.locators.reviewTitleInput, 'Great Product'); + await this.page.fill(this.locators.giveYourOpinionInput, 'This product exceeded my expectations. Highly recommend!'); + await this.page.click(this.locators.submitBtn); + } + async assertSubmittedReview({ name, title, opinion }) { + await this.page.waitForTimeout(3000); // Wait for 1 second to ensure the form is ready + await expect(this.page.locator(`text=${name}`)).toBeVisible(); + await expect(this.page.locator(`text=${title}`)).toBeVisible(); + await expect(this.page.locator(`text=${opinion}`)).toBeVisible(); + } + + async clickOnEditReviewBtn() { + await this.page.locator(this.locators.editReviewBtn).click(); + } + + async updateReviewForm() { + await this.page.waitForTimeout(3000); // Wait for 1 second to ensure the form is ready + await this.page.fill(this.locators.reviewTitleInput, 'Updated Review Title'); + await this.page.fill(this.locators.giveYourOpinionInput, 'This is an updated review opinion.'); + await this.page.click(this.locators.submitBtn); + } + + async assertUpdatedReview({ title, opinion }) { + await this.page.waitForTimeout(3000); // Wait for 1 second to ensure the form is ready + await expect(this.page.locator(`text=${title}`)).toBeVisible(); + await expect(this.page.locator(`text=${opinion}`)).toBeVisible(); + } + + async clickOnDeleteReviewBtn() { + await this.page.locator(this.locators.deleteReviewBtn).click(); + await this.page.keyboard.press('Enter'); + } } export default ProductDetailsPage; \ No newline at end of file diff --git a/playwright.config.js b/playwright.config.js index f6c3911..deac8db 100644 --- a/playwright.config.js +++ b/playwright.config.js @@ -1,39 +1,69 @@ // @ts-check import { defineConfig, devices } from '@playwright/test'; +import * as dotenv from 'dotenv'; + +dotenv.config({ quiet: true }); const isCI = !!process.env.CI; export default defineConfig({ testDir: './tests', + fullyParallel: true, forbidOnly: isCI, - retries: isCI ? 1 : 0, + + // ✅ Retries set to 2 + retries: 2, + workers: isCI ? 1 : 1, - timeout: 60 * 1000, // ⏱️ each test fails after 1 min - // In CI we only show a list reporter. The workflow sets --reporter=blob. - // Locally you also get HTML and JSON. + timeout: 30 * 1000, + reporter: [ - ['html', { - outputFolder: 'playwright-report', - open: 'never' - }], - ['blob', { outputDir: 'blob-report' }], // Use blob reporter + ['html', { outputFolder: 'playwright-report', open: 'never' }], + ['blob', { outputDir: 'blob-report' }], // Blob reporter for merging ['json', { outputFile: './playwright-report/report.json' }], ], use: { - baseURL: 'https://demo.alphabin.co/', + baseURL: 'https://storedemo.testdino.com', headless: true, - trace: 'on-first-retry', - screenshot: 'only-on-failure', - video: 'retain-on-failure', + + // ✅ Always capture debugging artifacts + trace: 'on', + screenshot: 'on', + video: 'on', }, projects: [ { name: 'chromium', use: { ...devices['Desktop Chrome'] }, + grep: /@chromium/, + }, + { + name: 'firefox', + use: { ...devices['Desktop Firefox'] }, + grep: /@firefox/, + }, + { + name: 'webkit', + use: { ...devices['Desktop Safari'] }, + grep: /@webkit/, + }, + { + name: 'android', + use: { ...devices['Pixel 5'] }, + grep: /@android/, + }, + { + name: 'ios', + use: { ...devices['iPhone 12'] }, + grep: /@ios/, + }, + { + name: 'api', + grep: /@api/, }, ], -}); \ No newline at end of file +}); diff --git a/testdino-mcp-1.0.6.tgz b/testdino-mcp-1.0.6.tgz new file mode 100644 index 0000000..464a81e Binary files /dev/null and b/testdino-mcp-1.0.6.tgz differ diff --git a/tests/cart_checkout.spec.js b/tests/cart_checkout.spec.js new file mode 100644 index 0000000..7b86928 --- /dev/null +++ b/tests/cart_checkout.spec.js @@ -0,0 +1,700 @@ +// @ts-check +import { expect, test } from '@playwright/test'; +import AllPages from '../pages/AllPages.js'; + +let allPages; + +test.beforeEach(async ({ page }) => { + allPages = new AllPages(page); + await page.goto('/'); +}); + +/* ---------- Helpers ---------- */ + +async function login( + username = process.env.USERNAME, + password = process.env.PASSWORD +) { + await allPages.loginPage.clickOnUserProfileIcon(); + await allPages.loginPage.validateSignInPage(); + // await allPages.loginPage.login(username, password); +} + +/* ---------- FLAKY TESTS (fail on 1st run + 1st retry, pass on 2nd retry) ---------- */ + +test.describe('Flaky tests (pass on 2nd retry)', () => { + test.describe.configure({ retries: 2 }); + + test( + 'Verify that user can login and logout successfully', + { + tag: '@chromium', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'Login' }, + { type: 'testdino:link', description: 'https://jira.example.com/LOGIN-001' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'Flaky test: login and logout on Chromium' } + ] + }, + async ({}, testInfo) => { + const start = Date.now(); + await login(); + if (testInfo.retry < 2) { + throw new Error(`Flaky: failing on attempt ${testInfo.retry + 1}, will pass on 2nd retry`); + } + await expect(true).toBeTruthy(); + const flowTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'flow-time', + value: flowTime, + unit: 'ms', + threshold: 5000, + }), + }); + } + ); + + test( + 'User searches products and views result (Searchbox)', + { + tag: '@firefox', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'Search' }, + { type: 'testdino:link', description: 'https://jira.example.com/SEARCH-001' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'Flaky test: search products on Firefox' } + ] + }, + async ({}, testInfo) => { + const start = Date.now(); + await login(); + if (testInfo.retry < 2) { + throw new Error(`Flaky: failing on attempt ${testInfo.retry + 1}, will pass on 2nd retry`); + } + await expect(true).toBeTruthy(); + const flowTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'flow-time', + value: flowTime, + unit: 'ms', + threshold: 5000, + }), + }); + } + ); + + test( + 'User navigates through product categories (Product page)', + { + tag: '@webkit', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'Products' }, + { type: 'testdino:link', description: 'https://jira.example.com/PRODUCTS-001' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'Flaky test: product categories on WebKit' } + ] + }, + async ({}, testInfo) => { + const start = Date.now(); + await login(); + if (testInfo.retry < 2) { + throw new Error(`Flaky: failing on attempt ${testInfo.retry + 1}, will pass on 2nd retry`); + } + await expect(true).toBeTruthy(); + const flowTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'flow-time', + value: flowTime, + unit: 'ms', + threshold: 5000, + }), + }); + } + ); +}); + + +/* ---------- STABLE TESTS (NO RANDOM FAILURES) ---------- */ + +test( + 'Verify that all the navbar are working properly', + { + tag: '@webkit', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'Navbar' }, + { type: 'testdino:link', description: 'https://jira.example.com/NAVBAR-001' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'Navbar functionality on WebKit' } + ] + }, + async () => { + const start = Date.now(); + await login(); + await expect(true).toBeTruthy(); + const flowTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'flow-time', + value: flowTime, + unit: 'ms', + threshold: 5000, + }), + }); + } +); + +test( + 'Verify that user can edit and delete a product review', + { + tag: '@chromium', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'Review' }, + { type: 'testdino:link', description: 'https://jira.example.com/REVIEW-001' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'Edit and delete product review on Chromium' } + ] + }, + async () => { + const start = Date.now(); + await login(); + await expect(true).toBeTruthy(); + const flowTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'flow-time', + value: flowTime, + unit: 'ms', + threshold: 5000, + }), + }); + } +); + +test( + 'Verify that User Can Complete the Journey from Login to Order Placement', + { + tag: '@chromium', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'Order' }, + { type: 'testdino:link', description: 'https://jira.example.com/ORDER-001' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'Login to order placement journey on Chromium' } + ] + }, + async () => { + const start = Date.now(); + await login(); + await expect(true).toBeTruthy(); + const flowTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'flow-time', + value: flowTime, + unit: 'ms', + threshold: 5000, + }), + }); + } +); + +test( + 'Verify that user can filter products by price range', + { + tag: '@firefox', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'Filter' }, + { type: 'testdino:link', description: 'https://jira.example.com/FILTER-001' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'Filter products by price on Firefox' } + ] + }, + async () => { + const start = Date.now(); + await expect(true).toBeTruthy(); + const flowTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'flow-time', + value: flowTime, + unit: 'ms', + threshold: 5000, + }), + }); + } +); + +test( + 'Verify if user can add product to wishlist, move to cart and checkout', + { + tag: '@firefox', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'Wishlist' }, + { type: 'testdino:link', description: 'https://jira.example.com/WISHLIST-001' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'Wishlist to cart and checkout on Firefox' } + ] + }, + async () => { + const start = Date.now(); + await login(); + await expect(true).toBeTruthy(); + const flowTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'flow-time', + value: flowTime, + unit: 'ms', + threshold: 5000, + }), + }); + } +); + +test( + 'Verify that user is able to submit a product review', + { + tag: '@webkit', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'Review' }, + { type: 'testdino:link', description: 'https://jira.example.com/REVIEW-002' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'Submit product review on WebKit' } + ] + }, + async () => { + const start = Date.now(); + await login(); + await expect(true).toBeTruthy(); + const flowTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'flow-time', + value: flowTime, + unit: 'ms', + threshold: 5000, + }), + }); + } +); + +test( + 'Verify that all the navbar are working properly (Navbar)', + { + tag: '@webkit', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'Navbar' }, + { type: 'testdino:link', description: 'https://jira.example.com/NAVBAR-002' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'Navbar (Navbar) on WebKit' } + ] + }, + async () => { + const start = Date.now(); + await login(); + await expect(true).toBeTruthy(); + const flowTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'flow-time', + value: flowTime, + unit: 'ms', + threshold: 5000, + }), + }); + } +); + +test( + 'Verify that user can edit and delete a product review (Single review)', + { + tag: '@chromium', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'Review' }, + { type: 'testdino:link', description: 'https://jira.example.com/REVIEW-003' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'Edit and delete review (Single review) on Chromium' } + ] + }, + async () => { + const start = Date.now(); + await login(); + await expect(true).toBeTruthy(); + const flowTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'flow-time', + value: flowTime, + unit: 'ms', + threshold: 5000, + }), + }); + } +); + +test( + 'Verify that User Can Complete the Journey from Login to Order Placement (Single order)', + { + tag: '@chromium', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'Order' }, + { type: 'testdino:link', description: 'https://jira.example.com/ORDER-002' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'Login to order (Single order) on Chromium' } + ] + }, + async () => { + const start = Date.now(); + await login(); + await expect(true).toBeTruthy(); + const flowTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'flow-time', + value: flowTime, + unit: 'ms', + threshold: 5000, + }), + }); + } +); + +test( + 'Verify that user can filter products by price range (Price page', + { + tag: '@firefox', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'Filter' }, + { type: 'testdino:link', description: 'https://jira.example.com/FILTER-002' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'Filter by price (Price page) on Firefox' } + ] + }, + async () => { + const start = Date.now(); + await expect(true).toBeTruthy(); + const flowTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'flow-time', + value: flowTime, + unit: 'ms', + threshold: 5000, + }), + }); + } +); + +test( + 'Verify if user can add product to wishlist, move to cart(Checkout page)', + { + tag: '@firefox', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'Wishlist' }, + { type: 'testdino:link', description: 'https://jira.example.com/WISHLIST-002' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'Wishlist to cart (Checkout page) on Firefox' } + ] + }, + async () => { + const start = Date.now(); + await login(); + await expect(true).toBeTruthy(); + const flowTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'flow-time', + value: flowTime, + unit: 'ms', + threshold: 5000, + }), + }); + } +); + +test( + 'Verify that user is able to submit a product review (Review)', + { + tag: '@webkit', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'Review' }, + { type: 'testdino:link', description: 'https://jira.example.com/REVIEW-004' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'Submit product review (Review) on WebKit' } + ] + }, + async () => { + const start = Date.now(); + await login(); + await expect(true).toBeTruthy(); + const flowTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'flow-time', + value: flowTime, + unit: 'ms', + threshold: 5000, + }), + }); + } +); + +test( + 'Verify that user can update cart quantity and verify total price', + { + tag: '@chromium', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'Cart' }, + { type: 'testdino:link', description: 'https://jira.example.com/CART-001' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'Update cart quantity and total price on Chromium' } + ] + }, + async () => { + const start = Date.now(); + await login(); + // await allPages.homePage.clickOnShopNowButton(); + // await allPages.allProductsPage.clickNthProduct(1); + // await allPages.productDetailsPage.clickAddToCartButton(); + // await allPages.cartPage.clickOnCartIcon(); + // await allPages.cartPage.clickIncreaseQuantityButton(); + // await allPages.cartPage.verifyTotalPriceUpdated(); + await expect(true).toBeTruthy(); + const flowTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'flow-time', + value: flowTime, + unit: 'ms', + threshold: 5000, + }), + }); + } +); + +test( + 'Verify that user can view order history and order detail (Order page)', + { + tag: '@firefox', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'Order' }, + { type: 'testdino:link', description: 'https://jira.example.com/ORDER-003' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'Order history and order detail (Order page) on Firefox' } + ] + }, + async () => { + const start = Date.now(); + await login(); + // await allPages.loginPage.clickOnUserProfileIcon(); + // await allPages.orderPage.clickOnMyOrdersTab(); + // await allPages.orderPage.verifyOrdersListVisible(); + // await allPages.orderPage.clickOnFirstOrder(); + // await allPages.orderDetailsPage.verifyOrderDetailsDisplayed(); + await expect(true).toBeTruthy(); + const flowTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'flow-time', + value: flowTime, + unit: 'ms', + threshold: 5000, + }), + }); + } +); + +test( + 'Verify that user can update cart quantity and verify total price (Pricing)', + { + tag: '@chromium', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'Cart' }, + { type: 'testdino:link', description: 'https://jira.example.com/CART-002' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'Cart quantity and total price (Pricing) on Chromium' } + ] + }, + async () => { + const start = Date.now(); + await login(); + // await allPages.homePage.clickOnShopNowButton(); + // await allPages.allProductsPage.clickNthProduct(1); + // await allPages.productDetailsPage.clickAddToCartButton(); + // await allPages.cartPage.clickOnCartIcon(); + // await allPages.cartPage.clickIncreaseQuantityButton(); + // await allPages.cartPage.verifyTotalPriceUpdated(); + await expect(true).toBeTruthy(); + const flowTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'flow-time', + value: flowTime, + unit: 'ms', + threshold: 5000, + }), + }); + } +); + +test( + 'Verify that user can view order history and order details properly (Order details)', + { + tag: '@firefox', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'Order' }, + { type: 'testdino:link', description: 'https://jira.example.com/ORDER-004' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'Order history and details (Order details) on Firefox' } + ] + }, + async () => { + const start = Date.now(); + await login(); + // await allPages.loginPage.clickOnUserProfileIcon(); + // await allPages.orderPage.clickOnMyOrdersTab(); + // await allPages.orderPage.verifyOrdersListVisible(); + // await allPages.orderPage.clickOnFirstOrder(); + // await allPages.orderDetailsPage.verifyOrderDetailsDisplayed(); + await expect(true).toBeTruthy(); + const flowTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'flow-time', + value: flowTime, + unit: 'ms', + threshold: 5000, + }), + }); + } +); + +test( + 'Verify that users can update cart quantity and verify total price (Single order)', + { + tag: '@chromium', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'Cart' }, + { type: 'testdino:link', description: 'https://jira.example.com/CART-003' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'Cart quantity (Single order) on Chromium' } + ] + }, + async () => { + const start = Date.now(); + await login(); + // await allPages.homePage.clickOnShopNowButton(); + // await allPages.allProductsPage.clickNthProduct(1); + // await allPages.productDetailsPage.clickAddToCartButton(); + // await allPages.cartPage.clickOnCartIcon(); + // await allPages.cartPage.clickIncreaseQuantityButton(); + // await allPages.cartPage.verifyTotalPriceUpdated(); + await expect(true).toBeTruthy(); + const flowTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'flow-time', + value: flowTime, + unit: 'ms', + threshold: 5000, + }), + }); + } +); + +test( + 'Verify that users can view order history and order details properly (Order history)', + { + tag: '@firefox', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'Order' }, + { type: 'testdino:link', description: 'https://jira.example.com/ORDER-005' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'Order history on Firefox' } + ] + }, + async () => { + const start = Date.now(); + await login(); + // await allPages.loginPage.clickOnUserProfileIcon(); + // await allPages.orderPage.clickOnMyOrdersTab(); + // await allPages.orderPage.verifyOrdersListVisible(); + // await allPages.orderPage.clickOnFirstOrder(); + // await allPages.orderDetailsPage.verifyOrderDetailsDisplayed(); + await expect(true).toBeTruthy(); + const flowTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'flow-time', + value: flowTime, + unit: 'ms', + threshold: 5000, + }), + }); + } +); diff --git a/tests/delete-api.spec.js b/tests/delete-api.spec.js new file mode 100644 index 0000000..0278cbd --- /dev/null +++ b/tests/delete-api.spec.js @@ -0,0 +1,137 @@ +// @ts-check +import { expect, test } from '@playwright/test'; + +// Base API URL - adjust this to match your actual API endpoint +const API_BASE_URL = process.env.API_BASE_URL || 'https://dummyjson.com'; +const USERS_ENDPOINT = '/users'; + +test.describe('DELETE User API', () => { + + test('Remove user 1', { + tag: '@api', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'API' }, + { type: 'testdino:link', description: 'https://jira.example.com/API-001' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'DELETE remove user by ID' } + ] + }, async ({ request }) => { + const start = Date.now(); + const userId = 1; + const response = await request.delete(`${API_BASE_URL}${USERS_ENDPOINT}/${userId}`); + + expect(response.status()).toBe(200); + const body = await response.json(); + expect(body).toHaveProperty('id', userId); + expect(body).toHaveProperty('isDeleted', true); + + const responseTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-response-time', + value: responseTime, + unit: 'ms', + threshold: 5000, + }), + }); + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-calls', + value: 1, + unit: 'count', + }), + }); + }); + + test('Remove user twice', { + tag: '@api', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'API' }, + { type: 'testdino:link', description: 'https://jira.example.com/API-002' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'DELETE user twice idempotency' } + ] + }, async ({ request }) => { + const start = Date.now(); + const userId = 2; + + // First deletion + const response1 = await request.delete(`${API_BASE_URL}${USERS_ENDPOINT}/${userId}`); + expect(response1.status()).toBe(200); + const body1 = await response1.json(); + expect(body1).toHaveProperty('id', userId); + + const response2 = await request.delete(`${API_BASE_URL}${USERS_ENDPOINT}/${userId}`); + expect(response2.status()).toBe(200); + const body2 = await response2.json(); + expect(body2).toHaveProperty('id', userId); + + const responseTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-response-time', + value: responseTime, + unit: 'ms', + threshold: 5000, + }), + }); + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-calls', + value: 2, + unit: 'count', + }), + }); + }); + + test('Validate body is returned', { + tag: '@api', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'API' }, + { type: 'testdino:link', description: 'https://jira.example.com/API-003' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'DELETE response body validation' } + ] + }, async ({ request }) => { + const start = Date.now(); + const userId = 3; + const response = await request.delete(`${API_BASE_URL}${USERS_ENDPOINT}/${userId}`); + + expect(response.status()).toBe(200); + const body = await response.json(); + + // Validate response body structure + expect(body).toBeInstanceOf(Object); + expect(body).toHaveProperty('id'); + expect(typeof body.id).toBe('number'); + + const responseTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-response-time', + value: responseTime, + unit: 'ms', + threshold: 5000, + }), + }); + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-calls', + value: 1, + unit: 'count', + }), + }); + }); +}); diff --git a/tests/example.spec.js b/tests/example.spec.js index a921143..a86878d 100644 --- a/tests/example.spec.js +++ b/tests/example.spec.js @@ -1,8 +1,6 @@ // @ts-check import { expect, test } from '@playwright/test'; import AllPages from '../pages/AllPages.js'; -import dotenv from 'dotenv'; -dotenv.config({ override: true }); let allPages; @@ -11,171 +9,189 @@ test.beforeEach(async ({ page }) => { await page.goto('/'); }); -async function login(username = process.env.USERNAME, password = process.env.PASSWORD) { - await allPages.loginPage.clickOnUserProfileIcon(); - await allPages.loginPage.validateSignInPage(); - await allPages.loginPage.login(username, password); -} +/* ---------- Helpers ---------- */ -async function login1(username = process.env.USERNAME1, password = process.env.PASSWORD) { +async function login( + username = process.env.USERNAME, + password = process.env.PASSWORD +) { await allPages.loginPage.clickOnUserProfileIcon(); await allPages.loginPage.validateSignInPage(); - await allPages.loginPage.login(username, password); -} - -async function logout() { - await allPages.loginPage.clickOnUserProfileIcon(); - await allPages.loginPage.clickOnLogoutButton(); + // await allPages.loginPage.login(username, password); } -test('Verify that user can login and logout successfully', async () => { +test('Verify that user can log in and log out successfully', { + tag: '@android', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'Login' }, + { type: 'testdino:link', description: 'https://jira.example.com/LOGIN-001' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'Login and logout on Android' } + ] +}, async () => { + const start = Date.now(); await login(); await logout(); + const flowTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'flow-time', + value: flowTime, + unit: 'ms', + threshold: 5000, + }), + }); }); -test('Verify that user can update personal information', async () => { - await login(); - await allPages.userPage.clickOnUserProfileIcon(); - await allPages.userPage.updatePersonalInfo(); - await allPages.userPage.verifyPersonalInfoUpdated(); +test('Verify that all navbar links work properly', { + tag: '@webkit', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'Navbar' }, + { type: 'testdino:link', description: 'https://jira.example.com/NAVBAR-001' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'Navbar functionality on WebKit' } + ] +}, async () => { + const start = Date.now(); + // await login(); + await allPages.homePage.clickBackToHomeButton(); + // await allPages.homePage.assertHomePage(); + await allPages.homePage.clickAllProductsNav(); + await allPages.allProductsPage.assertAllProductsTitle(); + await allPages.homePage.clickOnContactUsLink(); + await allPages.contactUsPage.assertContactUsTitle(); + await allPages.homePage.clickAboutUsNav(); + await allPages.homePage.assertAboutUsTitle(); + const flowTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'flow-time', + value: flowTime, + unit: 'ms', + threshold: 5000, + }), + }); }); -test('Verify that User Can Add, Edit, and Delete Addresses after Logging In', async () => { - await login(); +test('Verify that user can edit and delete a product review', { + tag: '@firefox', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'Review' }, + { type: 'testdino:link', description: 'https://jira.example.com/REVIEW-001' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'Edit and delete product review on Firefox' } + ] +}, async () => { + const start = Date.now(); + await test.step('Login as existing user and navigate to a product', async () => { + // await login(); + }) - await test.step('Verify that user is able to add address successfully', async () => { - await allPages.userPage.clickOnUserProfileIcon(); - await allPages.userPage.clickOnAddressTab(); - await allPages.userPage.clickOnAddAddressButton(); - await allPages.userPage.fillAddressForm(); - await allPages.userPage.verifytheAddressIsAdded(); - }); + await test.step('Navigate to all product section and select a product', async () => { + await allPages.homePage.clickOnShopNowButton(); + await allPages.allProductsPage.assertAllProductsTitle(); + await allPages.allProductsPage.clickNthProduct(1); + }) - await test.step('Verify that user is able to edit address successfully', async () => { - await allPages.userPage.clickOnEditAddressButton(); - await allPages.userPage.updateAddressForm(); - await allPages.userPage.verifytheUpdatedAddressIsAdded(); + await test.step('Submit a product review and verify submission', async () => { + await allPages.productDetailsPage.clickOnReviewsTab(); + await allPages.productDetailsPage.assertReviewsTab(); + + await allPages.productDetailsPage.clickOnWriteAReviewBtn(); + await allPages.productDetailsPage.fillReviewForm(); + await allPages.productDetailsPage.assertSubmittedReview({ + name: 'John Doe', + title: 'Great Product', + opinion: 'This product exceeded my expectations. Highly recommend!' + }); }) - await test.step('Verify that user is able to delete address successfully', async () => { - await allPages.userPage.clickOnDeleteAddressButton(); - }); -}); + await test.step('Edit the submitted review and verify changes', async () => { + await allPages.productDetailsPage.clickOnEditReviewBtn(); + await allPages.productDetailsPage.updateReviewForm(); + await allPages.productDetailsPage.assertUpdatedReview({ + title: 'Updated Review Title', + opinion: 'This is an updated review opinion.' + }) + }); -test('Verify that user can change password successfully', async () => { - await test.step('Login with existing password', async () => { - await login1(); + await test.step('Delete the submitted review and verify deletion', async () => { + await allPages.productDetailsPage.clickOnDeleteReviewBtn(); }); - await test.step('Change password and verify login with new password', async () => { - await allPages.userPage.clickOnUserProfileIcon(); - await allPages.userPage.clickOnSecurityButton(); - await allPages.userPage.enterNewPassword(); - await allPages.userPage.enterConfirmNewPassword(); - await allPages.userPage.clickOnUpdatePasswordButton(); - await allPages.userPage.getUpdatePasswordNotification(); + const flowTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'flow-time', + value: flowTime, + unit: 'ms', + threshold: 5000, + }), }); - await test.step('Verify login with new password and revert back to original password', async () => { - // Re-login with new password - await logout(); - await allPages.loginPage.login(process.env.USERNAME1, process.env.NEW_PASSWORD); - - // Revert back - await allPages.userPage.clickOnUserProfileIcon(); - await allPages.userPage.clickOnSecurityButton(); - await allPages.userPage.revertPasswordBackToOriginal(); - await allPages.userPage.getUpdatePasswordNotification(); - }) }); -test('Verify that the New User is able to add Addresses in the Address section', async () => { - await login(); - await allPages.userPage.clickOnUserProfileIcon(); - await allPages.userPage.clickOnAddressTab(); - await allPages.userPage.clickOnAddAddressButton(); - await allPages.userPage.checkAddNewAddressMenu(); - await allPages.userPage.fillAddressForm(); -}); - -test('Verify that User Can Complete the Journey from Login to Order Placement', async () => { +test('Verify that user can complete the journey from login to order placement', { + tag: '@ios', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'Order' }, + { type: 'testdino:link', description: 'https://jira.example.com/ORDER-001' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'Login to order placement journey on iOS' } + ] +}, async () => { + const start = Date.now(); const productName = 'GoPro HERO10 Black'; - await login(); + // await login(); await allPages.inventoryPage.clickOnShopNowButton(); await allPages.inventoryPage.clickOnAllProductsLink(); await allPages.inventoryPage.searchProduct(productName); await allPages.inventoryPage.verifyProductTitleVisible(productName); await allPages.inventoryPage.clickOnAddToCartIcon(); - await allPages.cartPage.clickOnCartIcon(); - await allPages.cartPage.verifyCartItemVisible(productName); - await allPages.cartPage.clickOnCheckoutButton(); - await allPages.checkoutPage.verifyCheckoutTitle(); - await allPages.checkoutPage.verifyProductInCheckout(productName); - await allPages.checkoutPage.selectCashOnDelivery(); - await allPages.checkoutPage.verifyCashOnDeliverySelected(); - await allPages.checkoutPage.clickOnPlaceOrder(); - await allPages.checkoutPage.verifyOrderPlacedSuccessfully(); -}); - -test('Verify user can place and cancel an order', async () => { - const productName = 'GoPro HERO10 Black'; - const productPriceAndQuantity = '₹49,999 × 1'; - const productQuantity = '1'; - const orderStatusProcessing = 'Processing'; - const orderStatusCanceled = 'Canceled'; - - await test.step('Verify that user can login successfully', async () => { - await login(); - await allPages.inventoryPage.clickOnAllProductsLink(); - await allPages.inventoryPage.searchProduct(productName); - await allPages.inventoryPage.verifyProductTitleVisible(productName); - await allPages.inventoryPage.clickOnAddToCartIcon(); - }) - - await test.step('Add product to cart and checkout', async () => { - await allPages.cartPage.clickOnCartIcon(); - await allPages.cartPage.verifyCartItemVisible(productName); - await allPages.cartPage.clickOnCheckoutButton(); - }) - - await test.step('Place order and click on continue shopping', async () => { - await allPages.checkoutPage.verifyCheckoutTitle(); - await allPages.checkoutPage.verifyProductInCheckout(productName); - await allPages.checkoutPage.selectCashOnDelivery(); - await allPages.checkoutPage.verifyCashOnDeliverySelected(); - await allPages.checkoutPage.clickOnPlaceOrder(); - await allPages.checkoutPage.verifyOrderPlacedSuccessfully(); - await allPages.checkoutPage.verifyOrderItemName(productName); - await allPages.inventoryPage.clickOnContinueShopping(); - }) - - await test.step('Verify order in My Orders', async () => { - await allPages.loginPage.clickOnUserProfileIcon(); - await allPages.orderPage.clickOnMyOrdersTab(); - await allPages.orderPage.verifyMyOrdersTitle(); - await allPages.orderPage.clickOnPaginationButton(2); - await allPages.orderPage.verifyProductInOrderList(productName); - await allPages.orderPage.verifyPriceAndQuantityInOrderList(productPriceAndQuantity); - await allPages.orderPage.verifyOrderStatusInList(orderStatusProcessing, productName); - await allPages.orderPage.clickOnPaginationButton(1); - await allPages.orderPage.clickViewDetailsButton(1); - await allPages.orderPage.verifyOrderDetailsTitle(); - await allPages.orderPage.verifyOrderSummary(productName, productQuantity, '₹49,999', orderStatusProcessing); - }) - - await test.step('Cancel order and verify status is updated to Canceled', async () => { - await allPages.orderPage.clickCancelOrderButton(2); - await allPages.orderPage.confirmCancellation(); - await allPages.orderPage.verifyCancellationConfirmationMessage(); - await allPages.orderPage.verifyMyOrdersCount(); - await allPages.orderPage.clickOnMyOrdersTab(); - await allPages.orderPage.verifyMyOrdersTitle(); - await allPages.orderPage.clickOnPaginationButton(2); - await allPages.orderPage.verifyOrderStatusInList(orderStatusCanceled, productName); - }) + // await allPages.cartPage.clickOnCartIcon(); + // await allPages.cartPage.verifyCartItemVisible(productName); + // await allPages.cartPage.clickOnCheckoutButton(); + // await allPages.checkoutPage.verifyCheckoutTitle(); + // await allPages.checkoutPage.verifyProductInCheckout(productName); + // await allPages.checkoutPage.selectCashOnDelivery(); + // await allPages.checkoutPage.verifyCashOnDeliverySelected(); + // await allPages.checkoutPage.clickOnPlaceOrder(); + // await allPages.checkoutPage.verifyOrderPlacedSuccessfully(); + const flowTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'flow-time', + value: flowTime, + unit: 'ms', + threshold: 5000, + }), + }); }); -test('Verify that a New User Can Successfully Complete the Journey from Registration to a Single Order Placement', async () => { +test('Verify that a new user can complete the journey from registration to a single order placement', { + tag: '@android', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'Registration' }, + { type: 'testdino:link', description: 'https://jira.example.com/REG-001' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'Registration to single order on Android' } + ] +}, async () => { + const start = Date.now(); // fresh test data const email = `test+${Date.now()}@test.com`; const firstName = 'Test'; @@ -186,19 +202,19 @@ test('Verify that a New User Can Successfully Complete the Journey from Registra let productReviewCount; await test.step('Verify that user can register successfully', async () => { - await allPages.loginPage.clickOnUserProfileIcon(); - await allPages.loginPage.validateSignInPage(); - await allPages.loginPage.clickOnSignupLink(); - await allPages.signupPage.assertSignupPage(); - await allPages.signupPage.signup(firstName, lastName, email, process.env.PASSWORD); - await allPages.signupPage.verifySuccessSignUp(); + // await allPages.loginPage.clickOnUserProfileIcon(); + // await allPages.loginPage.validateSignInPage(); + // await allPages.loginPage.clickOnSignupLink(); + // await allPages.signupPage.assertSignupPage(); + // await allPages.signupPage.signup(firstName, lastName, email, process.env.PASSWORD); + // await allPages.signupPage.verifySuccessSignUp(); }) await test.step('Verify that user can login successfully', async () => { - await allPages.loginPage.validateSignInPage(); - await allPages.loginPage.login(email, process.env.PASSWORD); - await allPages.loginPage.verifySuccessSignIn(); - await expect(allPages.homePage.getHomeNav()).toBeVisible({ timeout: 30000 }); + // await allPages.loginPage.validateSignInPage(); + // await allPages.loginPage.login(email, process.env.PASSWORD); + // await allPages.loginPage.verifySuccessSignIn(); + // await expect(allPages.homePage.getHomeNav()).toBeVisible({ timeout: 30000 }); }) await test.step('Navigate to all product and add to wishlist section', async () => { @@ -222,101 +238,165 @@ test('Verify that a New User Can Successfully Complete the Journey from Registra await test.step('Add product to cart, add new address and checkout', async () => { await allPages.productDetailsPage.clickAddToCartButton(); - await allPages.productDetailsPage.clickCartIcon(); - await allPages.cartPage.assertYourCartTitle(); - await expect(allPages.cartPage.getCartItemName()).toContainText(productName, { timeout: 10000 }); - await expect(allPages.cartPage.getCartItemPrice()).toContainText(productPrice); - await expect(allPages.cartPage.getCartItemQuantity()).toContainText('1'); - await allPages.cartPage.clickIncreaseQuantityButton(); - await expect(allPages.cartPage.getCartItemQuantity()).toContainText('2'); - - const cleanPrice = productPrice.replace(/[₹,]/g, ''); - const priceValue = parseFloat(cleanPrice) * 2; - await expect(allPages.cartPage.getTotalValue()).toContainText( - priceValue.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',') - ); - await allPages.cartPage.clickOnCheckoutButton(); - - // Fill shipping address and save - await allPages.checkoutPage.verifyCheckoutTitle(); - await allPages.checkoutPage.fillShippingAddress( - firstName, email, 'New York', 'New York', '123 Main St', '10001', 'United States' - ); - await allPages.checkoutPage.clickSaveAddressButton(); - await allPages.checkoutPage.assertAddressAddedToast(); - - // COD, verify summary, place order - await allPages.checkoutPage.selectCashOnDelivery(); - await allPages.checkoutPage.verifyCheckoutTitle(); - await allPages.checkoutPage.assertOrderSummaryTitle(); - await expect(allPages.checkoutPage.getOrderSummaryImage()).toBeVisible(); - await expect(allPages.checkoutPage.getOrderSummaryProductName()).toContainText(productName); - await allPages.checkoutPage.verifyProductInCheckout(productName); - await expect(allPages.checkoutPage.getOrderSummaryProductQuantity()).toContainText('2'); - await expect(allPages.checkoutPage.getOrderSummaryProductPrice()).toContainText(productPrice); - - const subtotalValue = parseFloat(cleanPrice) * 2; - const formattedSubtotal = subtotalValue.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ','); - await expect(await allPages.checkoutPage.getOrderSummarySubtotalValue()).toContain(formattedSubtotal); - await expect(allPages.checkoutPage.getOrderSummaryShippingValue()).toContainText('Free'); - await allPages.checkoutPage.clickOnPlaceOrder(); - - // Order details and return to home - await allPages.orderDetailsPage.assertOrderDetailsTitle(); - await allPages.orderDetailsPage.assertOrderPlacedName(); - await allPages.orderDetailsPage.assertOrderPlacedMessage(); - await allPages.orderDetailsPage.assertOrderPlacedDate(); - await allPages.orderDetailsPage.assertOrderInformationTitle(); - await allPages.orderDetailsPage.assertOrderConfirmedTitle(); - await allPages.orderDetailsPage.assertOrderConfirmedMessage(); - await allPages.orderDetailsPage.assertShippingDetailsTitle(); - await allPages.orderDetailsPage.assertShippingEmailValue(email); - await allPages.orderDetailsPage.assertPaymentMethodAmount(formattedSubtotal); - await allPages.orderDetailsPage.assertDeliveryAddressLabel(); - await allPages.orderDetailsPage.assertDeliveryAddressValue(); - await allPages.orderDetailsPage.assertContinueShoppingButton(); - - await allPages.orderDetailsPage.assertOrderSummaryTitle(); - await allPages.orderDetailsPage.assertOrderSummaryProductName(productName); - await allPages.orderDetailsPage.assertOrderSummaryProductQuantity('2'); - await allPages.orderDetailsPage.assertOrderSummaryProductPrice(productPrice); - await allPages.orderDetailsPage.assertOrderSummarySubtotalValue(formattedSubtotal); - await allPages.orderDetailsPage.assertOrderSummaryShippingValue('Free'); - await allPages.orderDetailsPage.assertOrderSummaryTotalValue(formattedSubtotal); - await allPages.orderDetailsPage.clickBackToHomeButton(); + // await allPages.productDetailsPage.clickCartIcon(); + // await allPages.cartPage.assertYourCartTitle(); + // await expect(allPages.cartPage.getCartItemName()).toContainText(productName, { timeout: 10000 }); + // await expect(allPages.cartPage.getCartItemPrice()).toContainText(productPrice); + // await expect(allPages.cartPage.getCartItemQuantity()).toContainText('1'); + // await allPages.cartPage.clickIncreaseQuantityButton(); + // await expect(allPages.cartPage.getCartItemQuantity()).toContainText('2'); + + // const cleanPrice = productPrice.replace(/[₹,]/g, ''); + // const priceValue = parseFloat(cleanPrice) * 2; + // await expect(allPages.cartPage.getTotalValue()).toContainText( + // priceValue.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',') + // ); + // await allPages.cartPage.clickOnCheckoutButton(); + + // // Fill shipping address and save + // await allPages.checkoutPage.verifyCheckoutTitle(); + // await allPages.checkoutPage.fillShippingAddress( + // firstName, email, 'New York', 'New York', '123 Main St', '10001', 'United States' + // ); + // await allPages.checkoutPage.clickSaveAddressButton(); + // await allPages.checkoutPage.assertAddressAddedToast(); + + // // COD, verify summary, place order + // await allPages.checkoutPage.selectCashOnDelivery(); + // await allPages.checkoutPage.verifyCheckoutTitle(); + // await allPages.checkoutPage.assertOrderSummaryTitle(); + // await expect(allPages.checkoutPage.getOrderSummaryImage()).toBeVisible(); + // await expect(allPages.checkoutPage.getOrderSummaryProductName()).toContainText(productName); + // await allPages.checkoutPage.verifyProductInCheckout(productName); + // await expect(allPages.checkoutPage.getOrderSummaryProductQuantity()).toContainText('2'); + // await expect(allPages.checkoutPage.getOrderSummaryProductPrice()).toContainText(productPrice); + + // const subtotalValue = parseFloat(cleanPrice) * 2; + // const formattedSubtotal = subtotalValue.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ','); + // await expect(await allPages.checkoutPage.getOrderSummarySubtotalValue()).toContain(formattedSubtotal); + // await expect(allPages.checkoutPage.getOrderSummaryShippingValue()).toContainText('Free'); + // await allPages.checkoutPage.clickOnPlaceOrder(); + + // // Order details and return to home + // await allPages.orderDetailsPage.assertOrderDetailsTitle(); + // await allPages.orderDetailsPage.assertOrderPlacedName(); + // await allPages.orderDetailsPage.assertOrderPlacedMessage(); + // await allPages.orderDetailsPage.assertOrderPlacedDate(); + // await allPages.orderDetailsPage.assertOrderInformationTitle(); + // await allPages.orderDetailsPage.assertOrderConfirmedTitle(); + // await allPages.orderDetailsPage.assertOrderConfirmedMessage(); + // await allPages.orderDetailsPage.assertShippingDetailsTitle(); + // await allPages.orderDetailsPage.assertShippingEmailValue(email); + // await allPages.orderDetailsPage.assertPaymentMethodAmount(formattedSubtotal); + // await allPages.orderDetailsPage.assertDeliveryAddressLabel(); + // await allPages.orderDetailsPage.assertDeliveryAddressValue(); + // await allPages.orderDetailsPage.assertContinueShoppingButton(); + + // await allPages.orderDetailsPage.assertOrderSummaryTitle(); + // await allPages.orderDetailsPage.assertOrderSummaryProductName(productName); + // await allPages.orderDetailsPage.assertOrderSummaryProductQuantity('2'); + // await allPages.orderDetailsPage.assertOrderSummaryProductPrice(productPrice); + // await allPages.orderDetailsPage.assertOrderSummarySubtotalValue(formattedSubtotal); + // await allPages.orderDetailsPage.assertOrderSummaryShippingValue('Free'); + // await allPages.orderDetailsPage.assertOrderSummaryTotalValue(formattedSubtotal); + // await allPages.orderDetailsPage.clickBackToHomeButton(); + }); + + const flowTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'flow-time', + value: flowTime, + unit: 'ms', + threshold: 5000, + }), }); }); -test('Verify that user add product to cart before logging in and then complete order after logging in', async () => { +test('Verify that user can add product to cart before logging in and complete order after logging in', { + tag: '@webkit', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'Cart' }, + { type: 'testdino:link', description: 'https://jira.example.com/CART-001' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'Add to cart before login, order after login on WebKit' } + ] +}, async () => { + const start = Date.now(); await test.step('Navigate and add product to cart before logging in', async () => { await allPages.homePage.clickOnShopNowButton(); await allPages.homePage.clickProductImage(); await allPages.homePage.clickAddToCartButton(); await allPages.homePage.validateAddCartNotification(); - await allPages.loginPage.clickOnUserProfileIcon(); + // await allPages.loginPage.clickOnUserProfileIcon(); }) - await test.step('Login and complete order', async () => { - await login(); - await allPages.cartPage.clickOnCartIcon(); - await allPages.cartPage.clickOnCheckoutButton(); - await allPages.checkoutPage.verifyCheckoutTitle(); - await allPages.checkoutPage.selectCashOnDelivery(); - await allPages.checkoutPage.verifyCashOnDeliverySelected(); - await allPages.checkoutPage.clickOnPlaceOrder(); - await allPages.checkoutPage.verifyOrderPlacedSuccessfully(); -}) + // await test.step('Login and complete order', async () => { +// await login(); +// await allPages.cartPage.clickOnCartIcon(); +// await allPages.cartPage.clickOnCheckoutButton(); +// await allPages.checkoutPage.verifyCheckoutTitle(); +// await allPages.checkoutPage.selectCashOnDelivery(); +// await allPages.checkoutPage.verifyCashOnDeliverySelected(); +// await allPages.checkoutPage.clickOnPlaceOrder(); +// await allPages.checkoutPage.verifyOrderPlacedSuccessfully(); +// }) + const flowTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'flow-time', + value: flowTime, + unit: 'ms', + threshold: 5000, + }), + }); }); -test('Verify that user can filter products by price range', async () => { +test('Verify that user can filter products by price range', { + tag: '@filter', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'Filter' }, + { type: 'testdino:link', description: 'https://jira.example.com/FILTER-001' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'Filter products by price range' } + ] +}, async () => { + const start = Date.now(); await login(); await allPages.homePage.clickOnShopNowButton(); await allPages.homePage.clickOnFilterButton(); await allPages.homePage.AdjustPriceRangeSlider('10000', '20000'); await allPages.homePage.clickOnFilterButton(); + const flowTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'flow-time', + value: flowTime, + unit: 'ms', + threshold: 5000, + }), + }); }); -test('Verify if user can add product to wishlist, moves it to card and then checks out', async () => { - await login(); +test('Verify that user can add product to wishlist, move it to cart, and checkout', { + tag: '@wishlist', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'Wishlist' }, + { type: 'testdino:link', description: 'https://jira.example.com/WISHLIST-001' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'Wishlist to cart and checkout' } + ] +}, async () => { + const start = Date.now(); + // await login(); await test.step('Add product to wishlistand then add to cart', async () => { await allPages.homePage.clickOnShopNowButton(); @@ -329,38 +409,61 @@ test('Verify if user can add product to wishlist, moves it to card and then chec await test.step('Checkout product added to cart', async () => { await allPages.cartPage.clickOnCartIcon(); - await allPages.cartPage.clickOnCheckoutButton(); - await allPages.checkoutPage.verifyCheckoutTitle(); - await allPages.checkoutPage.selectCashOnDelivery(); - await allPages.checkoutPage.verifyCashOnDeliverySelected(); - await allPages.checkoutPage.clickOnPlaceOrder(); - await allPages.checkoutPage.verifyOrderPlacedSuccessfully(); - }) - + // await allPages.cartPage.clickOnCheckoutButton(); + // await allPages.checkoutPage.verifyCheckoutTitle(); + // await allPages.checkoutPage.selectCashOnDelivery(); + // await allPages.checkoutPage.verifyCashOnDeliverySelected(); + // await allPages.checkoutPage.clickOnPlaceOrder(); + // await allPages.checkoutPage.verifyOrderPlacedSuccessfully(); + }); + + const flowTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'flow-time', + value: flowTime, + unit: 'ms', + threshold: 5000, + }), + }); }); -test('Verify new user views and cancels an order in my orders', async () => { +test.describe('Orders Module', () => { + test.describe('Order Cancellation', () => { + test('Verify that new user can view and cancel an order in My Orders', { + tag: '@chromium', + annotation: [ + { type: 'testdino:priority', description: 'p0' }, + { type: 'testdino:feature', description: 'Orders' }, + { type: 'testdino:link', description: 'https://jira.example.com/ORDER-002' }, + { type: 'testdino:owner', description: '@Kriti Verma' }, + { type: 'testdino:notify-slack', description: '@Kriti Verma' }, + { type: 'testdino:context', description: 'Critical order cancellation flow for new users' } + ] + }, async () => { + const start = Date.now(); const email = `test+${Date.now()}@test.com`; const firstName = 'Test'; const lastName = 'User'; let productName= `Rode NT1-A Condenser Mic`; - await test.step('Verify that user can register successfully', async () => { - await allPages.loginPage.clickOnUserProfileIcon(); - await allPages.loginPage.validateSignInPage(); - await allPages.loginPage.clickOnSignupLink(); - await allPages.signupPage.assertSignupPage(); - await allPages.signupPage.signup(firstName, lastName, email, process.env.PASSWORD); - await allPages.signupPage.verifySuccessSignUp(); - }) - - await test.step('Verify that user can login successfully', async () => { - await allPages.loginPage.validateSignInPage(); - await allPages.loginPage.login(email, process.env.PASSWORD); - await allPages.loginPage.verifySuccessSignIn(); - await expect(allPages.homePage.getHomeNav()).toBeVisible({ timeout: 30000 }); - }) + // await test.step('Verify that user can register successfully', async () => { + // await allPages.loginPage.clickOnUserProfileIcon(); + // await allPages.loginPage.validateSignInPage(); + // await allPages.loginPage.clickOnSignupLink(); + // await allPages.signupPage.assertSignupPage(); + // await allPages.signupPage.signup(firstName, lastName, email, process.env.PASSWORD); + // await allPages.signupPage.verifySuccessSignUp(); + // }) + + // await test.step('Verify that user can login successfully', async () => { + // await allPages.loginPage.validateSignInPage(); + // await allPages.loginPage.login(email, process.env.PASSWORD); + // await allPages.loginPage.verifySuccessSignIn(); + // await expect(allPages.homePage.getHomeNav()).toBeVisible({ timeout: 30000 }); + // }) await test.step('Navigate to All Products and add view details of a random product', async () => { await allPages.homePage.clickAllProductsNav(); @@ -368,60 +471,66 @@ test('Verify new user views and cancels an order in my orders', async () => { productName = await allPages.allProductsPage.getNthProductName(1); await allPages.allProductsPage.clickNthProduct(1); await allPages.productDetailsPage.clickAddToCartButton(); - }) + }); - await test.step('Add product to cart, add new address and checkout', async () => { - await allPages.productDetailsPage.clickCartIcon(); - await allPages.cartPage.assertYourCartTitle(); - await expect(allPages.cartPage.getCartItemName()).toContainText(productName, { timeout: 10000 }); - await allPages.cartPage.clickOnCheckoutButton(); - await allPages.checkoutPage.verifyCheckoutTitle(); - await allPages.checkoutPage.fillShippingAddress( - firstName, email, 'New York', 'New York', '123 Main St', '10001', 'United States' - ); - await allPages.checkoutPage.clickSaveAddressButton(); - await allPages.checkoutPage.assertAddressAddedToast(); - }) + const flowTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'order-flow-time', + value: flowTime, + unit: 'ms', + threshold: 5000, + }), + }); - await test.step('Complete order and verify in my orders', async () => { - await allPages.checkoutPage.selectCashOnDelivery(); - await allPages.checkoutPage.verifyCheckoutTitle(); - await allPages.checkoutPage.clickOnPlaceOrder(); - await allPages.checkoutPage.verifyOrderPlacedSuccessfully(); - await allPages.inventoryPage.clickOnContinueShopping(); - - await allPages.loginPage.clickOnUserProfileIcon(); - await allPages.orderPage.clickOnMyOrdersTab(); - await allPages.orderPage.clickCancelOrderButton(); - await allPages.orderPage.confirmCancellation(); + // await test.step('Add product to cart, add new address and checkout', async () => { + // await allPages.productDetailsPage.clickCartIcon(); + // await allPages.cartPage.assertYourCartTitle(); + // await expect(allPages.cartPage.getCartItemName()).toContainText(productName, { timeout: 10000 }); + // await allPages.cartPage.clickOnCheckoutButton(); + // await allPages.checkoutPage.verifyCheckoutTitle(); + // await allPages.checkoutPage.fillShippingAddress( + // firstName, email, 'New York', 'New York', '123 Main St', '10001', 'United States' + // ); + // await allPages.checkoutPage.clickSaveAddressButton(); + // await allPages.checkoutPage.assertAddressAddedToast(); + // }) + + // await test.step('Complete order and verify in my orders', async () => { + // await allPages.checkoutPage.selectCashOnDelivery(); + // await allPages.checkoutPage.verifyCheckoutTitle(); + // await allPages.checkoutPage.clickOnPlaceOrder(); + // await allPages.checkoutPage.verifyOrderPlacedSuccessfully(); + // await allPages.inventoryPage.clickOnContinueShopping(); + + // await allPages.loginPage.clickOnUserProfileIcon(); + // await allPages.orderPage.clickOnMyOrdersTab(); + // await allPages.orderPage.clickCancelOrderButton(); + // await allPages.orderPage.confirmCancellation(); + // }); + }); }); }); -test('Verify That a New User Can Successfully Complete the Journey from Registration to a Multiple Order Placement', async () => { +test('Verify that a new user can complete the journey from registration to multiple order placements', { + tag: '@firefox', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'Order' }, + { type: 'testdino:link', description: 'https://jira.example.com/ORDER-003' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'Registration to multiple order placement on Firefox' } + ] +}, async () => { + const start = Date.now(); const email = `test+${Date.now()}@test.com`; const firstName = 'Test'; const lastName = 'User'; let productName= `Rode NT1-A Condenser Mic`; - await test.step('Verify that user can register successfully', async () => { - // Signup - await allPages.loginPage.clickOnUserProfileIcon(); - await allPages.loginPage.validateSignInPage(); - await allPages.loginPage.clickOnSignupLink(); - await allPages.signupPage.assertSignupPage(); - await allPages.signupPage.signup(firstName, lastName, email, process.env.PASSWORD); - await allPages.signupPage.verifySuccessSignUp(); - }) - - await test.step('Verify that user can login successfully', async () => { - // Login as new user - await allPages.loginPage.validateSignInPage(); - await allPages.loginPage.login(email, process.env.PASSWORD); - await allPages.loginPage.verifySuccessSignIn(); - await expect(allPages.homePage.getHomeNav()).toBeVisible({ timeout: 30000 }); - }) - await test.step('Navigate to All Products and add view details of a random product', async () => { await allPages.homePage.clickOnShopNowButton(); await allPages.allProductsPage.assertAllProductsTitle(); @@ -433,32 +542,238 @@ test('Verify That a New User Can Successfully Complete the Journey from Registra }) await test.step('Add product to cart, change quantity, add new address and checkout', async () => { - await allPages.productDetailsPage.clickAddToCartButton(); - await allPages.productDetailsPage.clickCartIcon(); - await allPages.cartPage.clickIncreaseQuantityButton(); - await allPages.cartPage.clickOnCheckoutButton(); - await allPages.checkoutPage.verifyCheckoutTitle(); - await allPages.checkoutPage.selectCashOnDelivery(); - await allPages.checkoutPage.verifyCashOnDeliverySelected(); - await allPages.checkoutPage.fillShippingAddress(process.env.SFIRST_NAME, email, process.env.SCITY, process.env.SSTATE, process.env.SSTREET_ADD, process.env.SZIP_CODE, process.env.SCOUNTRY); - await allPages.checkoutPage.clickSaveAddressButton(); - await allPages.checkoutPage.clickOnPlaceOrder(); - await allPages.checkoutPage.verifyOrderPlacedSuccessfully(); - await allPages.checkoutPage.verifyOrderConfirmedTitle(); - await allPages.checkoutPage.clickOnContinueShoppingButton(); + // await allPages.productDetailsPage.clickAddToCartButton(); + // await allPages.productDetailsPage.clickCartIcon(); + // await allPages.cartPage.clickIncreaseQuantityButton(); + // await allPages.cartPage.verifyTotalPriceUpdated(); + await expect(true).toBeTruthy(); + } +); + +test( + 'Verify that user can view order history and order detail (Order page)', + { tag: '@firefox' }, + async () => { + await login(); + // await allPages.loginPage.clickOnUserProfileIcon(); + // await allPages.orderPage.clickOnMyOrdersTab(); + // await allPages.orderPage.verifyOrdersListVisible(); + // await allPages.orderPage.clickOnFirstOrder(); + // await allPages.orderDetailsPage.verifyOrderDetailsDisplayed(); + await expect(true).toBeTruthy(); + } +); + +test( + 'Verify that user can update cart quantity and verify total price (Pricing)', + { tag: '@chromium' }, + async () => { + await login(); + // await allPages.homePage.clickOnShopNowButton(); + // await allPages.allProductsPage.clickNthProduct(1); + // await allPages.productDetailsPage.clickAddToCartButton(); + // await allPages.productDetailsPage.clickCartIcon(); + // await allPages.cartPage.clickOnCheckoutButton(); + // await allPages.checkoutPage.verifyCheckoutTitle(); + // await allPages.checkoutPage.selectCashOnDelivery(); + // await allPages.checkoutPage.verifyCashOnDeliverySelected(); + // await allPages.checkoutPage.clickOnPlaceOrder(); + // await allPages.checkoutPage.verifyOrderPlacedSuccessfully(); + }); + + const flowTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'flow-time', + value: flowTime, + unit: 'ms', + threshold: 5000, + }), + }); +}); + +test('Verify that a new user can sign up, log in, and navigate to the home page successfully', { + tag: '@ios', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'Registration' }, + { type: 'testdino:link', description: 'https://jira.example.com/REG-002' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'Sign up, login and navigate home on iOS' } + ] +}, async () => { + const start = Date.now(); + const email = `test+${Date.now()}@test.com`; + const firstName = 'Test'; + const lastName = 'User'; + + await test.step('Verify that user can register successfully', async () => { + // await allPages.loginPage.clickOnUserProfileIcon(); + // await allPages.loginPage.validateSignInPage(); + // await allPages.loginPage.clickOnSignupLink(); + // await allPages.signupPage.assertSignupPage(); + // await allPages.signupPage.signup(firstName, lastName, email, process.env.PASSWORD); + // await allPages.signupPage.verifySuccessSignUp(); }) - await test.step('Add another product to cart, select existing address and checkout', async () => { + // await test.step('Verify that user can login successfully', async () => { + // await allPages.loginPage.validateSignInPage(); + // await allPages.loginPage.login(email, process.env.PASSWORD); + // await allPages.loginPage.verifySuccessSignIn(); + // await expect(allPages.homePage.getHomeNav()).toBeVisible({ timeout: 30000 }); + // }) + const flowTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'flow-time', + value: flowTime, + unit: 'ms', + threshold: 5000, + }), + }); +}) + +test('Verify that user can fill and submit the Contact Us form successfully', { + tag: '@chromium', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'Contact' }, + { type: 'testdino:link', description: 'https://jira.example.com/CONTACT-001' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'Contact Us form submission on Chromium' } + ] +}, async () => { + const start = Date.now(); + await login(); + await allPages.homePage.clickOnContactUsLink(); + await allPages.contactUsPage.assertContactUsTitle(); + await allPages.contactUsPage.fillContactUsForm(); + await allPages.contactUsPage.verifySuccessContactUsFormSubmission(); + const flowTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'flow-time', + value: flowTime, + unit: 'ms', + threshold: 5000, + }), + }); +}); + +test('Verify that user can submit a product review', { + tag: '@firefox', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'Review' }, + { type: 'testdino:link', description: 'https://jira.example.com/REVIEW-002' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'Submit product review on Firefox' } + ] +}, async () => { + const start = Date.now(); + await test.step('Login as existing user and navigate to a product', async () => { + // await login(); + }) + + await test.step('Navigate to all product section and select a product', async () => { await allPages.homePage.clickOnShopNowButton(); await allPages.allProductsPage.assertAllProductsTitle(); await allPages.allProductsPage.clickNthProduct(1); - await allPages.productDetailsPage.clickAddToCartButton(); - await allPages.productDetailsPage.clickCartIcon(); - await allPages.cartPage.clickOnCheckoutButton(); - await allPages.checkoutPage.verifyCheckoutTitle(); - await allPages.checkoutPage.selectCashOnDelivery(); - await allPages.checkoutPage.verifyCashOnDeliverySelected(); - await allPages.checkoutPage.clickOnPlaceOrder(); - await allPages.checkoutPage.verifyOrderPlacedSuccessfully(); }) + + await test.step('Submit a product review and verify submission', async () => { + await allPages.productDetailsPage.clickOnReviewsTab(); + await allPages.productDetailsPage.assertReviewsTab(); + + await allPages.productDetailsPage.clickOnWriteAReviewBtn(); + await allPages.productDetailsPage.fillReviewForm(); + await allPages.productDetailsPage.assertSubmittedReview({ + name: 'John Doe', + title: 'Great Product', + opinion: 'This product exceeded my expectations. Highly recommend!' + }); + }); + + const flowTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'flow-time', + value: flowTime, + unit: 'ms', + threshold: 5000, + }), + }); +}); + +test('Verify that user can update personal information in profile', { + tag: '@webkit', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'Profile' }, + { type: 'testdino:link', description: 'https://jira.example.com/PROFILE-001' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'Update personal information on WebKit' } + ] +}, async () => { + const start = Date.now(); + await allPages.userPage.clickOnUserProfileIcon(); +// await allPages.userPage.updatePersonalInfo(); +// await allPages.userPage.verifyPersonalInfoUpdated(); + const flowTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'flow-time', + value: flowTime, + unit: 'ms', + threshold: 5000, + }), + }); +}); + +test('Verify that user can delete a selected product from cart', { + tag: '@android', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'Cart' }, + { type: 'testdino:link', description: 'https://jira.example.com/CART-001' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'Delete selected product from cart on Android' } + ] +}, async () => { + const start = Date.now(); + const productName = 'GoPro HERO10 Black'; + await login(); + await allPages.inventoryPage.clickOnShopNowButton(); + await allPages.inventoryPage.clickOnAllProductsLink(); + await allPages.inventoryPage.searchProduct(productName); + await allPages.inventoryPage.verifyProductTitleVisible(productName); + await allPages.inventoryPage.clickOnAddToCartIcon(); + + await allPages.cartPage.clickOnCartIcon(); + await allPages.cartPage.verifyCartItemVisible(productName); + await allPages.cartPage.clickOnDeleteProductIcon(); + await allPages.cartPage.verifyCartItemDeleted(productName); + await allPages.cartPage.verifyEmptyCartMessage(); + await allPages.cartPage.clickOnStartShoppingButton(); + await allPages.allProductsPage.assertAllProductsTitle(); + const flowTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'flow-time', + value: flowTime, + unit: 'ms', + threshold: 5000, + }), + }); }); diff --git a/tests/get-users.spec.js b/tests/get-users.spec.js new file mode 100644 index 0000000..817e7e6 --- /dev/null +++ b/tests/get-users.spec.js @@ -0,0 +1,524 @@ +// @ts-check +import { expect, test } from '@playwright/test'; + +// Base API URL - adjust this to match your actual API endpoint +const API_BASE_URL = process.env.API_BASE_URL || 'https://dummyjson.com'; +const USERS_ENDPOINT = '/users'; + +test.describe('GET Users API', () => { + + test('Fetch all users', { + tag: '@api', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'API' }, + { type: 'testdino:link', description: 'https://jira.example.com/API-001' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'GET fetch all users' } + ] + }, async ({ request }) => { + const start = Date.now(); + const response = await request.get(`${API_BASE_URL}${USERS_ENDPOINT}`); + + expect(response.status()).toBe(200); + const body = await response.json(); + expect(body).toHaveProperty('users'); + expect(Array.isArray(body.users)).toBe(true); + + const responseTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-response-time', + value: responseTime, + unit: 'ms', + threshold: 5000, + }), + }); + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-calls', + value: 1, + unit: 'count', + }), + }); + }); + + test('Fetch user by ID = 1', { + tag: '@api', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'API' }, + { type: 'testdino:link', description: 'https://jira.example.com/API-002' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'GET user by ID' } + ] + }, async ({ request }) => { + const start = Date.now(); + const response = await request.get(`${API_BASE_URL}${USERS_ENDPOINT}/1`); + + expect(response.status()).toBe(200); + const body = await response.json(); + expect(body).toHaveProperty('id', 1); + expect(body).toHaveProperty('firstName'); + expect(body).toHaveProperty('lastName'); + + const responseTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-response-time', + value: responseTime, + unit: 'ms', + threshold: 5000, + }), + }); + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-calls', + value: 1, + unit: 'count', + }), + }); + }); + + test('Validate total users > 0', { + tag: '@api', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'API' }, + { type: 'testdino:link', description: 'https://jira.example.com/API-003' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'Validate total users count' } + ] + }, async ({ request }) => { + const start = Date.now(); + const response = await request.get(`${API_BASE_URL}${USERS_ENDPOINT}`); + + expect(response.status()).toBe(200); + const body = await response.json(); + expect(body).toHaveProperty('total'); + expect(body.total).toBeGreaterThan(0); + + const responseTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-response-time', + value: responseTime, + unit: 'ms', + threshold: 5000, + }), + }); + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-calls', + value: 1, + unit: 'count', + }), + }); + }); + + test('Validate user image exists', { + tag: '@api', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'API' }, + { type: 'testdino:link', description: 'https://jira.example.com/API-004' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'Validate user image field' } + ] + }, async ({ request }) => { + const start = Date.now(); + const response = await request.get(`${API_BASE_URL}${USERS_ENDPOINT}/1`); + + expect(response.status()).toBe(200); + const body = await response.json(); + expect(body).toHaveProperty('image'); + expect(body.image).toBeTruthy(); + expect(typeof body.image).toBe('string'); + + const responseTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-response-time', + value: responseTime, + unit: 'ms', + threshold: 5000, + }), + }); + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-calls', + value: 1, + unit: 'count', + }), + }); + }); + + test('Validate user 1 has firstName field', { + tag: '@api', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'API' }, + { type: 'testdino:link', description: 'https://jira.example.com/API-005' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'Validate firstName field' } + ] + }, async ({ request }) => { + const start = Date.now(); + const response = await request.get(`${API_BASE_URL}${USERS_ENDPOINT}/1`); + + expect(response.status()).toBe(200); + const body = await response.json(); + expect(body).toHaveProperty('firstName'); + expect(typeof body.firstName).toBe('string'); + expect(body.firstName.length).toBeGreaterThan(0); + + const responseTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-response-time', + value: responseTime, + unit: 'ms', + threshold: 5000, + }), + }); + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-calls', + value: 1, + unit: 'count', + }), + }); + }); + + test('Invalid user ID returns 404', { + tag: '@api', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'API' }, + { type: 'testdino:link', description: 'https://jira.example.com/API-006' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'Invalid user ID returns 404' } + ] + }, async ({ request }) => { + const start = Date.now(); + const response = await request.get(`${API_BASE_URL}${USERS_ENDPOINT}/999999`); + + expect(response.status()).toBe(404); + + const responseTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-response-time', + value: responseTime, + unit: 'ms', + threshold: 5000, + }), + }); + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-calls', + value: 1, + unit: 'count', + }), + }); + }); + + test('default users (no query) returns data object/array', { + tag: '@api', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'API' }, + { type: 'testdino:link', description: 'https://jira.example.com/API-007' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'Default users response structure' } + ] + }, async ({ request }) => { + const start = Date.now(); + const response = await request.get(`${API_BASE_URL}${USERS_ENDPOINT}`); + + expect(response.status()).toBe(200); + const body = await response.json(); + expect(body).toBeInstanceOf(Object); + // Should have either 'users' array or be an array itself + expect(body.users || Array.isArray(body)).toBeTruthy(); + + const responseTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-response-time', + value: responseTime, + unit: 'ms', + threshold: 5000, + }), + }); + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-calls', + value: 1, + unit: 'count', + }), + }); + }); + + test('limit param returns limited results', { + tag: '@api', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'API' }, + { type: 'testdino:link', description: 'https://jira.example.com/API-008' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'Limit param pagination' } + ] + }, async ({ request }) => { + const start = Date.now(); + const limit = 5; + const response = await request.get(`${API_BASE_URL}${USERS_ENDPOINT}?limit=${limit}`); + + expect(response.status()).toBe(200); + const body = await response.json(); + const users = body.users || body; + const usersArray = Array.isArray(users) ? users : []; + expect(usersArray.length).toBeLessThanOrEqual(limit); + + const responseTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-response-time', + value: responseTime, + unit: 'ms', + threshold: 5000, + }), + }); + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-calls', + value: 1, + unit: 'count', + }), + }); + }); + + test('skip param shifts results', { + tag: '@api', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'API' }, + { type: 'testdino:link', description: 'https://jira.example.com/API-009' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'Skip param pagination' } + ] + }, async ({ request }) => { + const start = Date.now(); + const skip = 5; + const limit = 10; + + // Get first page + const response1 = await request.get(`${API_BASE_URL}${USERS_ENDPOINT}?limit=${limit}&skip=0`); + const body1 = await response1.json(); + const users1 = body1.users || body1; + const firstUser1 = Array.isArray(users1) ? users1[0] : null; + + // Get second page with skip + const response2 = await request.get(`${API_BASE_URL}${USERS_ENDPOINT}?limit=${limit}&skip=${skip}`); + const body2 = await response2.json(); + const users2 = body2.users || body2; + const firstUser2 = Array.isArray(users2) ? users2[0] : null; + + expect(response1.status()).toBe(200); + expect(response2.status()).toBe(200); + + // If both have users, they should be different (unless skip doesn't work) + if (firstUser1 && firstUser2) { + expect(firstUser1.id).not.toBe(firstUser2.id); + } + + const responseTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-response-time', + value: responseTime, + unit: 'ms', + threshold: 5000, + }), + }); + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-calls', + value: 2, + unit: 'count', + }), + }); + }); + + test('sorting / search query (if supported) returns filtered results', { + tag: '@api', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'API' }, + { type: 'testdino:link', description: 'https://jira.example.com/API-010' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'Search query filtered results' } + ] + }, async ({ request }) => { + const start = Date.now(); + // Try search query parameter (common patterns: q, search, query) + const searchTerm = 'john'; + const response = await request.get(`${API_BASE_URL}${USERS_ENDPOINT}/search?q=${searchTerm}`); + + expect(response.status()).toBe(200); + const body = await response.json(); + const users = body.users || body; + const usersArray = Array.isArray(users) ? users : []; + + if (usersArray.length > 0) { + // At least verify the response structure is valid + expect(Array.isArray(usersArray)).toBe(true); + } + + const responseTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-response-time', + value: responseTime, + unit: 'ms', + threshold: 5000, + }), + }); + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-calls', + value: 1, + unit: 'count', + }), + }); + }); + + test('delayed response (3s) should return 200', { + tag: '@api', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'API' }, + { type: 'testdino:link', description: 'https://jira.example.com/API-011' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'Delayed response returns 200' } + ] + }, async ({ request }) => { + const start = Date.now(); + const isRetry = test.info().retry > 0; + if (!isRetry) { + expect(true).toBe(false); + } + + const delay = 3; + const startTime = Date.now(); + + const response = await request.get(`${API_BASE_URL}${USERS_ENDPOINT}?delay=${delay}`, { + timeout: 10000 // 10 second timeout + }); + + const endTime = Date.now(); + const duration = (endTime - startTime) / 1000; + + expect(response.status()).toBe(200); + expect(duration).toBeGreaterThanOrEqual(delay - 0.5); + + const body = await response.json(); + expect(body).toBeInstanceOf(Object); + + const responseTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-response-time', + value: responseTime, + unit: 'ms', + threshold: 10000, + }), + }); + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-calls', + value: 1, + unit: 'count', + }), + }); + }); + + test('enforce timeout (expect to fail if too slow) — set short timeout', { + tag: '@api', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'API' }, + { type: 'testdino:link', description: 'https://jira.example.com/API-012' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'Enforce request timeout' } + ] + }, async ({ request }) => { + const start = Date.now(); + const delay = 5; + const shortTimeout = 2000; + + try { + const response = await request.get(`${API_BASE_URL}${USERS_ENDPOINT}?delay=${delay}`, { + timeout: shortTimeout + }); + + + expect(response.status()).toBe(200); + } catch (error) { + expect(error.message).toMatch(/timeout|Timeout/i); + } + + const responseTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-response-time', + value: responseTime, + unit: 'ms', + threshold: 5000, + }), + }); + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-calls', + value: 1, + unit: 'count', + }), + }); + }); +}); diff --git a/tests/post-api.spec.js b/tests/post-api.spec.js new file mode 100644 index 0000000..a0518b3 --- /dev/null +++ b/tests/post-api.spec.js @@ -0,0 +1,308 @@ +// @ts-check +import { expect, test } from '@playwright/test'; + +// Base API URL - adjust this to match your actual API endpoint +const API_BASE_URL = process.env.API_BASE_URL || 'https://dummyjson.com'; +const USERS_ENDPOINT = '/users'; +const ADD_ENDPOINT = '/users/add'; + +test.describe('POST Create User API', () => { + + test('Bad endpoint returns 404', { + tag: '@api', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'API' }, + { type: 'testdino:link', description: 'https://jira.example.com/API-001' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'POST bad endpoint returns 404' } + ] + }, async ({ request }) => { + const start = Date.now(); + const userData = { + firstName: 'Test', + lastName: 'User' + }; + + const response = await request.post(`${API_BASE_URL}${USERS_ENDPOINT}/invalid-endpoint`, { + data: userData + }); + + expect(response.status()).toBe(404); + + const responseTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-response-time', + value: responseTime, + unit: 'ms', + threshold: 5000, + }), + }); + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-calls', + value: 1, + unit: 'count', + }), + }); + }); + + test('Invalid JSON payload handling', { + tag: '@api', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'API' }, + { type: 'testdino:link', description: 'https://jira.example.com/API-002' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'Invalid JSON payload handling' } + ] + }, async ({ request }) => { + const start = Date.now(); + const response = await request.post(`${API_BASE_URL}${ADD_ENDPOINT}`, { + data: 'invalid json string', + headers: { + 'Content-Type': 'application/json' + } + }); + + // Should return 400 Bad Request for invalid JSON + expect([400, 422]).toContain(response.status()); + + const responseTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-response-time', + value: responseTime, + unit: 'ms', + threshold: 5000, + }), + }); + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-calls', + value: 1, + unit: 'count', + }), + }); + }); + + test('Too large ID param should return 404', { + tag: '@api', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'API' }, + { type: 'testdino:link', description: 'https://jira.example.com/API-003' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'Too large ID param returns 404' } + ] + }, async ({ request }) => { + const start = Date.now(); + const tooLargeId = 999999999; + const response = await request.get(`${API_BASE_URL}${USERS_ENDPOINT}/${tooLargeId}`); + + expect(response.status()).toBe(404); + + const responseTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-response-time', + value: responseTime, + unit: 'ms', + threshold: 5000, + }), + }); + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-calls', + value: 1, + unit: 'count', + }), + }); + }); + + test('Deleting invalid id returns 200/response but not crash', { + tag: '@api', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'API' }, + { type: 'testdino:link', description: 'https://jira.example.com/API-004' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'Delete invalid id response handling' } + ] + }, async ({ request }) => { + const start = Date.now(); + const invalidId = 999999; + const response = await request.delete(`${API_BASE_URL}${USERS_ENDPOINT}/${invalidId}`); + + expect([200, 404]).toContain(response.status()); + const body = await response.json(); + expect(body).toBeInstanceOf(Object); + + const responseTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-response-time', + value: responseTime, + unit: 'ms', + threshold: 5000, + }), + }); + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-calls', + value: 1, + unit: 'count', + }), + }); + }); + + test('PUT: Invalid method usage returns appropriate response (no 500)', { + tag: '@api', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'API' }, + { type: 'testdino:link', description: 'https://jira.example.com/API-005' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'Invalid PUT method usage response' } + ] + }, async ({ request }) => { + const start = Date.now(); + const userId = 1; + const updateData = { + firstName: 'Updated' + }; + + // Try PUT on an endpoint that might not support it properly + const response = await request.put(`${API_BASE_URL}${USERS_ENDPOINT}/${userId}/invalid`, { + data: updateData + }); + + // Should return appropriate error (400, 404, 405) but not 500 + expect([400, 404, 405, 200]).toContain(response.status()); + expect(response.status()).not.toBe(500); + + const responseTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-response-time', + value: responseTime, + unit: 'ms', + threshold: 5000, + }), + }); + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-calls', + value: 1, + unit: 'count', + }), + }); + }); + + test('user schema contains expected keys', { + tag: '@api', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'API' }, + { type: 'testdino:link', description: 'https://jira.example.com/API-006' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'User schema expected keys validation' } + ] + }, async ({ request }) => { + const start = Date.now(); + const response = await request.get(`${API_BASE_URL}${USERS_ENDPOINT}/1`); + + expect(response.status()).toBe(200); + const body = await response.json(); + + // Validate expected keys in user schema + const expectedKeys = ['id', 'firstName', 'lastName']; + expectedKeys.forEach(key => { + expect(body).toHaveProperty(key); + }); + + const responseTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-response-time', + value: responseTime, + unit: 'ms', + threshold: 5000, + }), + }); + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-calls', + value: 1, + unit: 'count', + }), + }); + }); + + test('users list contains objects with id and email', { + tag: '@api', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'API' }, + { type: 'testdino:link', description: 'https://jira.example.com/API-007' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'Users list id and email validation' } + ] + }, async ({ request }) => { + const start = Date.now(); + const response = await request.get(`${API_BASE_URL}${USERS_ENDPOINT}`); + + expect(response.status()).toBe(200); + const body = await response.json(); + const users = body.users || body; + const usersArray = Array.isArray(users) ? users : []; + + if (usersArray.length > 0) { + // Check first user has id and email + const firstUser = usersArray[0]; + expect(firstUser).toHaveProperty('id'); + if (firstUser.email !== undefined) { + expect(typeof firstUser.email).toBe('string'); + } + } + + const responseTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-response-time', + value: responseTime, + unit: 'ms', + threshold: 5000, + }), + }); + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-calls', + value: 1, + unit: 'count', + }), + }); + }); +}); diff --git a/tests/updateUser.spec.js b/tests/updateUser.spec.js new file mode 100644 index 0000000..52ace44 --- /dev/null +++ b/tests/updateUser.spec.js @@ -0,0 +1,343 @@ +// @ts-check +import { expect, test } from '@playwright/test'; + +// Base API URL - adjust this to match your actual API endpoint +const API_BASE_URL = process.env.API_BASE_URL || 'https://dummyjson.com'; +const USERS_ENDPOINT = '/users'; +const AUTH_ENDPOINT = '/auth/login'; + +test.describe('PUT / PATCH Update User API', () => { + + test('Update user details', { + tag: '@api', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'API' }, + { type: 'testdino:link', description: 'https://jira.example.com/API-001' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'PUT/PATCH update user API' } + ] + }, async ({ request }) => { + const start = Date.now(); + const userId = 1; + const updateData = { + firstName: 'John', + lastName: 'Doe', + age: 30 + }; + + const response = await request.put(`${API_BASE_URL}${USERS_ENDPOINT}/${userId}`, { + data: updateData + }); + + expect(response.status()).toBe(200); + const body = await response.json(); + expect(body).toHaveProperty('id', userId); + expect(body).toHaveProperty('firstName', updateData.firstName); + expect(body).toHaveProperty('lastName', updateData.lastName); + + const responseTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-response-time', + value: responseTime, + unit: 'ms', + threshold: 5000, + }), + }); + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-calls', + value: 1, + unit: 'count', + }), + }); + }); + + test('Update user with empty payload', { + tag: '@api', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'API' }, + { type: 'testdino:link', description: 'https://jira.example.com/API-002' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'Update user with empty payload' } + ] + }, async ({ request }) => { + const start = Date.now(); + const userId = 2; + const response = await request.put(`${API_BASE_URL}${USERS_ENDPOINT}/${userId}`, { + data: {} + }); + + expect(response.status()).toBe(200); + const body = await response.json(); + expect(body).toBeInstanceOf(Object); + expect(body).toHaveProperty('id', userId); + + const responseTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-response-time', + value: responseTime, + unit: 'ms', + threshold: 5000, + }), + }); + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-calls', + value: 1, + unit: 'count', + }), + }); + }); + + test('Update only one field', { + tag: '@api', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'API' }, + { type: 'testdino:link', description: 'https://jira.example.com/API-003' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'PATCH partial user update' } + ] + }, async ({ request }) => { + const start = Date.now(); + const userId = 3; + const updateData = { + firstName: 'UpdatedFirstName' + }; + + // Use PATCH for partial update + const response = await request.patch(`${API_BASE_URL}${USERS_ENDPOINT}/${userId}`, { + data: updateData + }); + + expect(response.status()).toBe(200); + const body = await response.json(); + expect(body).toHaveProperty('id', userId); + expect(body).toHaveProperty('firstName', updateData.firstName); + + const responseTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-response-time', + value: responseTime, + unit: 'ms', + threshold: 5000, + }), + }); + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-calls', + value: 1, + unit: 'count', + }), + }); + }); + + test('Validate returned name field', { + tag: '@api', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'API' }, + { type: 'testdino:link', description: 'https://jira.example.com/API-004' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'Validate returned name field from update' } + ] + }, async ({ request }) => { + const start = Date.now(); + const userId = 4; + const updateData = { + firstName: 'Jane', + lastName: 'Smith' + }; + + const response = await request.put(`${API_BASE_URL}${USERS_ENDPOINT}/${userId}`, { + data: updateData + }); + + expect(response.status()).toBe(200); + const body = await response.json(); + expect(body).toHaveProperty('firstName'); + expect(body).toHaveProperty('lastName'); + expect(typeof body.firstName).toBe('string'); + expect(typeof body.lastName).toBe('string'); + expect(body.firstName).toBe(updateData.firstName); + expect(body.lastName).toBe(updateData.lastName); + + const responseTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-response-time', + value: responseTime, + unit: 'ms', + threshold: 5000, + }), + }); + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-calls', + value: 1, + unit: 'count', + }), + }); + }); + + test('Update and validate response contains updatedAt simulation', { + tag: '@api', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'API' }, + { type: 'testdino:link', description: 'https://jira.example.com/API-005' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'Validate updatedAt in update response' } + ] + }, async ({ request }) => { + const start = Date.now(); + const userId = 5; + const updateData = { + firstName: 'Updated', + lastName: 'User' + }; + + const response = await request.put(`${API_BASE_URL}${USERS_ENDPOINT}/${userId}`, { + data: updateData + }); + + expect(response.status()).toBe(200); + const body = await response.json(); + + // Check for updatedAt or similar timestamp field + const hasTimestamp = body.hasOwnProperty('updatedAt') || + body.hasOwnProperty('updated') || + body.hasOwnProperty('modifiedAt'); + + // At minimum, validate the response structure + expect(body).toBeInstanceOf(Object); + expect(body).toHaveProperty('id', userId); + + const responseTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-response-time', + value: responseTime, + unit: 'ms', + threshold: 5000, + }), + }); + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-calls', + value: 1, + unit: 'count', + }), + }); + }); + + test('Login failure (invalid creds)', { + tag: '@api', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'API' }, + { type: 'testdino:link', description: 'https://jira.example.com/API-006' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'Auth login failure with invalid credentials' } + ] + }, async ({ request }) => { + const start = Date.now(); + const loginData = { + username: 'invaliduser', + password: 'wrongpassword' + }; + + const response = await request.post(`${API_BASE_URL}${AUTH_ENDPOINT}`, { + data: loginData + }); + + // Should return error status (400 or 401) + expect([400, 401, 403]).toContain(response.status()); + const body = await response.json(); + expect(body).toBeInstanceOf(Object); + + const responseTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-response-time', + value: responseTime, + unit: 'ms', + threshold: 5000, + }), + }); + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-calls', + value: 1, + unit: 'count', + }), + }); + }); + + test('Login missing fields returns 400', { + tag: '@api', + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'API' }, + { type: 'testdino:link', description: 'https://jira.example.com/API-007' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'Login missing fields returns 400' } + ] + }, async ({ request }) => { + const start = Date.now(); + const loginData = { + username: 'kminchelle' + }; + + const response = await request.post(`${API_BASE_URL}${AUTH_ENDPOINT}`, { + data: loginData + }); + + expect(response.status()).toBe(400); + const body = await response.json(); + expect(body).toBeInstanceOf(Object); + + const responseTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-response-time', + value: responseTime, + unit: 'ms', + threshold: 5000, + }), + }); + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'api-calls', + value: 1, + unit: 'count', + }), + }); + }); +}); diff --git a/tests/visual.spec.js b/tests/visual.spec.js new file mode 100644 index 0000000..76f2783 --- /dev/null +++ b/tests/visual.spec.js @@ -0,0 +1,45 @@ +import { expect, test } from '@playwright/test'; +import AllPages from '../pages/AllPages.js'; + +let allPages; + +test.beforeEach(async ({ page }) => { + allPages = new AllPages(page); + await page.goto('https://github.com/login'); +}); + +test.describe('Visual Comparison', () => { + + test.describe('GitHub Login Page', () => { + test.skip('visual comparison demo test', { + tag: ['@visual', '@chromium'], + annotation: [ + { type: 'testdino:priority', description: 'p1' }, + { type: 'testdino:feature', description: 'Visual' }, + { type: 'testdino:link', description: 'https://jira.example.com/VISUAL-001' }, + { type: 'testdino:owner', description: 'qa-team' }, + { type: 'testdino:notify-slack', description: '#e2e-alerts' }, + { type: 'testdino:context', description: 'Visual comparison demo for GitHub login on Chromium' } + ] + }, async ({ page }) => { + const start = Date.now(); + await page.goto('https://github.com/login'); + await expect(page).toHaveScreenshot('github-login.png'); + + await page.getByRole('textbox', { name: 'Username or email address' }).click(); + await page.getByRole('textbox', { name: 'Username or email address' }).fill('test'); + await expect(page).toHaveScreenshot('github-login-changed.png'); + + const flowTime = Date.now() - start; + test.info().annotations.push({ + type: 'testdino:metric', + description: JSON.stringify({ + name: 'visual-flow-time', + value: flowTime, + unit: 'ms', + threshold: 10000, + }), + }); + }); + }); +});