From f09caf2f9a9cea025e8527e221c10ebc05214ce4 Mon Sep 17 00:00:00 2001 From: Scott Elliott Date: Sat, 16 May 2026 14:05:19 -0700 Subject: [PATCH 1/9] add assignment 4: E2E tests with Playwright, golden paths analysis, test report, manual testing doc --- .github/workflows/ci.yml | 63 + assignment-4-e2e-test-report.md | 29 + assignment-4-golden-paths.md | 27 + assignment-4-manual-testing.md | 23 + mock-project/e2e_tests/colorblind.spec.js | 47 + mock-project/node_modules/.bin/playwright | 1 + .../node_modules/.bin/playwright-core | 1 + mock-project/node_modules/.package-lock.json | 50 + .../node_modules/@playwright/test/LICENSE | 202 + .../node_modules/@playwright/test/NOTICE | 5 + .../node_modules/@playwright/test/README.md | 318 + .../node_modules/@playwright/test/cli.js | 19 + .../node_modules/@playwright/test/index.d.ts | 18 + .../node_modules/@playwright/test/index.js | 17 + .../node_modules/@playwright/test/index.mjs | 18 + .../@playwright/test/package.json | 35 + .../@playwright/test/reporter.d.ts | 17 + .../node_modules/@playwright/test/reporter.js | 17 + .../@playwright/test/reporter.mjs | 17 + .../node_modules/playwright-core/LICENSE | 202 + .../node_modules/playwright-core/NOTICE | 5 + .../node_modules/playwright-core/README.md | 3 + .../playwright-core/ThirdPartyNotices.txt | 13 + .../bin/install_media_pack.ps1 | 5 + .../bin/install_webkit_wsl.ps1 | 33 + .../bin/reinstall_chrome_beta_linux.sh | 42 + .../bin/reinstall_chrome_beta_mac.sh | 13 + .../bin/reinstall_chrome_beta_win.ps1 | 24 + .../bin/reinstall_chrome_stable_linux.sh | 42 + .../bin/reinstall_chrome_stable_mac.sh | 12 + .../bin/reinstall_chrome_stable_win.ps1 | 24 + .../bin/reinstall_msedge_beta_linux.sh | 48 + .../bin/reinstall_msedge_beta_mac.sh | 11 + .../bin/reinstall_msedge_beta_win.ps1 | 23 + .../bin/reinstall_msedge_dev_linux.sh | 48 + .../bin/reinstall_msedge_dev_mac.sh | 11 + .../bin/reinstall_msedge_dev_win.ps1 | 23 + .../bin/reinstall_msedge_stable_linux.sh | 48 + .../bin/reinstall_msedge_stable_mac.sh | 11 + .../bin/reinstall_msedge_stable_win.ps1 | 24 + .../playwright-core/browsers.json | 81 + .../node_modules/playwright-core/cli.js | 21 + .../node_modules/playwright-core/index.d.ts | 17 + .../node_modules/playwright-core/index.js | 32 + .../node_modules/playwright-core/index.mjs | 28 + .../node_modules/playwright-core/package.json | 34 + .../playwright-core/types/protocol.d.ts | 24565 ++++++++++++++++ .../playwright-core/types/structs.d.ts | 45 + .../playwright-core/types/types.d.ts | 24518 +++++++++++++++ mock-project/node_modules/playwright/LICENSE | 202 + mock-project/node_modules/playwright/NOTICE | 5 + .../node_modules/playwright/README.md | 318 + .../playwright/ThirdPartyNotices.txt | 14 + mock-project/node_modules/playwright/cli.js | 19 + .../node_modules/playwright/index.d.ts | 17 + mock-project/node_modules/playwright/index.js | 17 + .../node_modules/playwright/index.mjs | 18 + .../node_modules/playwright/jsx-runtime.js | 42 + .../node_modules/playwright/jsx-runtime.mjs | 21 + .../node_modules/playwright/package.json | 61 + .../node_modules/playwright/test.d.ts | 18 + mock-project/node_modules/playwright/test.js | 24 + mock-project/node_modules/playwright/test.mjs | 35 + .../node_modules/playwright/types/test.d.ts | 10411 +++++++ .../playwright/types/testReporter.d.ts | 824 + mock-project/package-lock.json | 71 + mock-project/package.json | 10 + mock-project/run-e2e-tests.sh | 18 + 68 files changed, 63075 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 assignment-4-e2e-test-report.md create mode 100644 assignment-4-golden-paths.md create mode 100644 assignment-4-manual-testing.md create mode 100644 mock-project/e2e_tests/colorblind.spec.js create mode 120000 mock-project/node_modules/.bin/playwright create mode 120000 mock-project/node_modules/.bin/playwright-core create mode 100644 mock-project/node_modules/.package-lock.json create mode 100644 mock-project/node_modules/@playwright/test/LICENSE create mode 100644 mock-project/node_modules/@playwright/test/NOTICE create mode 100644 mock-project/node_modules/@playwright/test/README.md create mode 100755 mock-project/node_modules/@playwright/test/cli.js create mode 100644 mock-project/node_modules/@playwright/test/index.d.ts create mode 100644 mock-project/node_modules/@playwright/test/index.js create mode 100644 mock-project/node_modules/@playwright/test/index.mjs create mode 100644 mock-project/node_modules/@playwright/test/package.json create mode 100644 mock-project/node_modules/@playwright/test/reporter.d.ts create mode 100644 mock-project/node_modules/@playwright/test/reporter.js create mode 100644 mock-project/node_modules/@playwright/test/reporter.mjs create mode 100644 mock-project/node_modules/playwright-core/LICENSE create mode 100644 mock-project/node_modules/playwright-core/NOTICE create mode 100644 mock-project/node_modules/playwright-core/README.md create mode 100644 mock-project/node_modules/playwright-core/ThirdPartyNotices.txt create mode 100644 mock-project/node_modules/playwright-core/bin/install_media_pack.ps1 create mode 100644 mock-project/node_modules/playwright-core/bin/install_webkit_wsl.ps1 create mode 100755 mock-project/node_modules/playwright-core/bin/reinstall_chrome_beta_linux.sh create mode 100755 mock-project/node_modules/playwright-core/bin/reinstall_chrome_beta_mac.sh create mode 100644 mock-project/node_modules/playwright-core/bin/reinstall_chrome_beta_win.ps1 create mode 100755 mock-project/node_modules/playwright-core/bin/reinstall_chrome_stable_linux.sh create mode 100755 mock-project/node_modules/playwright-core/bin/reinstall_chrome_stable_mac.sh create mode 100644 mock-project/node_modules/playwright-core/bin/reinstall_chrome_stable_win.ps1 create mode 100755 mock-project/node_modules/playwright-core/bin/reinstall_msedge_beta_linux.sh create mode 100755 mock-project/node_modules/playwright-core/bin/reinstall_msedge_beta_mac.sh create mode 100644 mock-project/node_modules/playwright-core/bin/reinstall_msedge_beta_win.ps1 create mode 100755 mock-project/node_modules/playwright-core/bin/reinstall_msedge_dev_linux.sh create mode 100755 mock-project/node_modules/playwright-core/bin/reinstall_msedge_dev_mac.sh create mode 100644 mock-project/node_modules/playwright-core/bin/reinstall_msedge_dev_win.ps1 create mode 100755 mock-project/node_modules/playwright-core/bin/reinstall_msedge_stable_linux.sh create mode 100755 mock-project/node_modules/playwright-core/bin/reinstall_msedge_stable_mac.sh create mode 100644 mock-project/node_modules/playwright-core/bin/reinstall_msedge_stable_win.ps1 create mode 100644 mock-project/node_modules/playwright-core/browsers.json create mode 100755 mock-project/node_modules/playwright-core/cli.js create mode 100644 mock-project/node_modules/playwright-core/index.d.ts create mode 100644 mock-project/node_modules/playwright-core/index.js create mode 100644 mock-project/node_modules/playwright-core/index.mjs create mode 100644 mock-project/node_modules/playwright-core/package.json create mode 100644 mock-project/node_modules/playwright-core/types/protocol.d.ts create mode 100644 mock-project/node_modules/playwright-core/types/structs.d.ts create mode 100644 mock-project/node_modules/playwright-core/types/types.d.ts create mode 100644 mock-project/node_modules/playwright/LICENSE create mode 100644 mock-project/node_modules/playwright/NOTICE create mode 100644 mock-project/node_modules/playwright/README.md create mode 100644 mock-project/node_modules/playwright/ThirdPartyNotices.txt create mode 100755 mock-project/node_modules/playwright/cli.js create mode 100644 mock-project/node_modules/playwright/index.d.ts create mode 100644 mock-project/node_modules/playwright/index.js create mode 100644 mock-project/node_modules/playwright/index.mjs create mode 100644 mock-project/node_modules/playwright/jsx-runtime.js create mode 100644 mock-project/node_modules/playwright/jsx-runtime.mjs create mode 100644 mock-project/node_modules/playwright/package.json create mode 100644 mock-project/node_modules/playwright/test.d.ts create mode 100644 mock-project/node_modules/playwright/test.js create mode 100644 mock-project/node_modules/playwright/test.mjs create mode 100644 mock-project/node_modules/playwright/types/test.d.ts create mode 100644 mock-project/node_modules/playwright/types/testReporter.d.ts create mode 100644 mock-project/package-lock.json create mode 100644 mock-project/package.json create mode 100755 mock-project/run-e2e-tests.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..8f5d051 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,63 @@ +name: CI + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + unit-and-integration-tests: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Build and start containers + run: | + cd mock-project + docker compose up --build -d + + - name: Wait for API + run: sleep 5 + + - name: Run unit tests + run: | + cd mock-project + docker compose exec api pytest unit_tests/ -v + + - name: Run integration tests + run: | + cd mock-project + docker compose exec api pytest integration_tests/ -v + + - name: Stop containers + run: | + cd mock-project + docker compose down + + e2e-tests: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install dependencies + run: | + cd mock-project + npm ci + + - name: Install Playwright browsers + run: | + cd mock-project + npx playwright install --with-deps + + - name: Run E2E tests + run: | + cd mock-project + ./run-e2e-tests.sh diff --git a/assignment-4-e2e-test-report.md b/assignment-4-e2e-test-report.md new file mode 100644 index 0000000..cacab81 --- /dev/null +++ b/assignment-4-e2e-test-report.md @@ -0,0 +1,29 @@ +# E2E Test Report + +## Tests run + +5 E2E tests using Playwright + +## Results + +| Test | Status | +|------|--------| +| homepage loads and shows title | PASS | +| health endpoint returns ok | PASS | +| red vs green returns false | PASS | +| red vs blue returns true | PASS | +| full user flow via web interface | PASS | + +## Environment + +- Local: Docker Compose +- CI: GitHub Actions (Ubuntu latest) +- Browser: Chromium (headless) + +## AI Generation + +The test structure was AI-generated. I added the full user flow test and the health endpoint test based on the golden paths analysis. + +## Limitations + +These tests verify functionality but cannot validate visual accessibility or perceptual accuracy. Those require manual testing. diff --git a/assignment-4-golden-paths.md b/assignment-4-golden-paths.md new file mode 100644 index 0000000..9d78676 --- /dev/null +++ b/assignment-4-golden-paths.md @@ -0,0 +1,27 @@ +# Golden Paths Analysis + +## What users pay for + +Users pay for accurate colorblindness diagnosis. The most valuable scenario is a user completing the full test and receiving a reliable result. + +## Golden Path 1: Quick check via API + +A developer integrates the API into their workflow. They send a POST request to `/check` with two hex colors and receive a true/false response. + +## Golden Path 2: Manual testing via web interface + +A non-technical user opens the web page, enters two hex colors, clicks Check, and reads the result. + +## Golden Path 3: Health monitoring + +A DevOps engineer calls `/health` to verify the service is running before routing traffic. + +## Why these are valuable + +The API check is the core function. The web interface makes it accessible to non-developers. The health endpoint is required for production reliability. + +## E2E tests covering these paths + +- API check covered by Playwright API tests +- Web interface covered by browser-based Playwright test +- Health endpoint covered by API test diff --git a/assignment-4-manual-testing.md b/assignment-4-manual-testing.md new file mode 100644 index 0000000..5948248 --- /dev/null +++ b/assignment-4-manual-testing.md @@ -0,0 +1,23 @@ +# Manual Testing Required + +## What cannot be automated + +1. **Perceptual accuracy** – An automated test cannot verify that a transformed palette actually looks distinguishable to a colorblind user. Only a human with the condition can judge that. + +2. **Visual layout** – The web interface could render incorrectly (overlapping text, broken alignment) and all E2E tests would still pass because elements exist and buttons work. + +3. **Error message clarity** – An automated test can check that an error message appears, but not whether it is helpful or confusing to a user. + +4. **Realistic user behavior** – Automated tests follow a script. Real users do unexpected things. Manual exploratory testing catches edge cases the script misses. + +## Manual test cases to run + +1. Enter invalid hex formats like `#FFF` (three-digit) and `FF0000` (no hash). Does the error message make sense? + +2. Use the web interface on different browsers (Chrome, Firefox, Safari). Does the layout break? + +3. Ask a colorblind friend to use the tool. Do they trust the result? Is the language clear? + +4. Spam the Check button rapidly. Does the UI freeze or show inconsistent results? + +5. Test with very dark colors like `#001100` vs `#000011`. The API currently assumes all non-red-green pairs are distinguishable. A human would know that is not always true. diff --git a/mock-project/e2e_tests/colorblind.spec.js b/mock-project/e2e_tests/colorblind.spec.js new file mode 100644 index 0000000..b5754cf --- /dev/null +++ b/mock-project/e2e_tests/colorblind.spec.js @@ -0,0 +1,47 @@ +const { test, expect } = require('@playwright/test'); + +test('homepage loads and shows title', async ({ page }) => { + await page.goto('http://localhost:5000'); + await expect(page).toHaveTitle(/Colorblindness Checker Demo/); +}); + +test('health endpoint returns ok', async ({ request }) => { + const response = await request.get('http://localhost:5000/health'); + expect(response.status()).toBe(200); + expect(await response.json()).toEqual({ status: 'ok' }); +}); + +test('red vs green returns false', async ({ request }) => { + const response = await request.post('http://localhost:5000/check', { + data: { color1: '#FF0000', color2: '#00FF00' } + }); + expect(response.status()).toBe(200); + expect(await response.json()).toEqual({ distinguishable: false }); +}); + +test('red vs blue returns true', async ({ request }) => { + const response = await request.post('http://localhost:5000/check', { + data: { color1: '#FF0000', color2: '#0000FF' } + }); + expect(response.status()).toBe(200); + expect(await response.json()).toEqual({ distinguishable: true }); +}); + +test('full user flow via web interface', async ({ page }) => { + await page.goto('http://localhost:5000'); + + // Fill in colors + await page.fill('#color1', '#FF0000'); + await page.fill('#color2', '#00FF00'); + + // Click check button + await page.click('button'); + + // Wait for result and verify + await expect(page.locator('.result')).toContainText('NOT DISTINGUISHABLE'); + + // Change to red and blue + await page.fill('#color2', '#0000FF'); + await page.click('button'); + await expect(page.locator('.result')).toContainText('DISTINGUISHABLE'); +}); diff --git a/mock-project/node_modules/.bin/playwright b/mock-project/node_modules/.bin/playwright new file mode 120000 index 0000000..c30d07f --- /dev/null +++ b/mock-project/node_modules/.bin/playwright @@ -0,0 +1 @@ +../@playwright/test/cli.js \ No newline at end of file diff --git a/mock-project/node_modules/.bin/playwright-core b/mock-project/node_modules/.bin/playwright-core new file mode 120000 index 0000000..08d6c28 --- /dev/null +++ b/mock-project/node_modules/.bin/playwright-core @@ -0,0 +1 @@ +../playwright-core/cli.js \ No newline at end of file diff --git a/mock-project/node_modules/.package-lock.json b/mock-project/node_modules/.package-lock.json new file mode 100644 index 0000000..f21cc70 --- /dev/null +++ b/mock-project/node_modules/.package-lock.json @@ -0,0 +1,50 @@ +{ + "name": "mock-project", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "node_modules/@playwright/test": { + "version": "1.60.0", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.60.0.tgz", + "integrity": "sha512-O71yZIbAh/PxDMNGns37GHBIfrVkEVyn+AXyIa5dOTfb4/xNvRWV+Vv/NMbNCtODB/pO7vLlF2OTmMVLhmr7Ag==", + "dependencies": { + "playwright": "1.60.0" + }, + "bin": { + "playwright": "cli.js" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/playwright": { + "version": "1.60.0", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.60.0.tgz", + "integrity": "sha512-hheHdokM8cdqCb0lcE3s+zT4t4W+vvjpGxsZlDnikarzx8tSzMebh3UiFtgqwFwnTnjYQcsyMF8ei2mCO/tpeA==", + "dependencies": { + "playwright-core": "1.60.0" + }, + "bin": { + "playwright": "cli.js" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "fsevents": "2.3.2" + } + }, + "node_modules/playwright-core": { + "version": "1.60.0", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.60.0.tgz", + "integrity": "sha512-9bW6zvX/m0lEbgTKJ6YppOKx8H3VOPBMOCFh2irXFOT4BbHgrx5hPjwJYLT40Lu+4qtD36qKc/Hn56StUW57IA==", + "bin": { + "playwright-core": "cli.js" + }, + "engines": { + "node": ">=18" + } + } + } +} diff --git a/mock-project/node_modules/@playwright/test/LICENSE b/mock-project/node_modules/@playwright/test/LICENSE new file mode 100644 index 0000000..df11237 --- /dev/null +++ b/mock-project/node_modules/@playwright/test/LICENSE @@ -0,0 +1,202 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Portions Copyright (c) Microsoft Corporation. + Portions Copyright 2017 Google Inc. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/mock-project/node_modules/@playwright/test/NOTICE b/mock-project/node_modules/@playwright/test/NOTICE new file mode 100644 index 0000000..814ec16 --- /dev/null +++ b/mock-project/node_modules/@playwright/test/NOTICE @@ -0,0 +1,5 @@ +Playwright +Copyright (c) Microsoft Corporation + +This software contains code derived from the Puppeteer project (https://github.com/puppeteer/puppeteer), +available under the Apache 2.0 license (https://github.com/puppeteer/puppeteer/blob/master/LICENSE). diff --git a/mock-project/node_modules/@playwright/test/README.md b/mock-project/node_modules/@playwright/test/README.md new file mode 100644 index 0000000..17feb3c --- /dev/null +++ b/mock-project/node_modules/@playwright/test/README.md @@ -0,0 +1,318 @@ +# 🎭 Playwright + +[![npm version](https://img.shields.io/npm/v/playwright.svg)](https://www.npmjs.com/package/playwright) [![Chromium version](https://img.shields.io/badge/chromium-148.0.7778.96-blue.svg?logo=google-chrome)](https://www.chromium.org/Home) [![Firefox version](https://img.shields.io/badge/firefox-150.0.2-blue.svg?logo=firefoxbrowser)](https://www.mozilla.org/en-US/firefox/new/) [![WebKit version](https://img.shields.io/badge/webkit-26.4-blue.svg?logo=safari)](https://webkit.org/) [![Join Discord](https://img.shields.io/badge/join-discord-informational)](https://aka.ms/playwright/discord) + +## [Documentation](https://playwright.dev) | [API reference](https://playwright.dev/docs/api/class-playwright) + +Playwright is a framework for web automation and testing. It drives Chromium, Firefox, and WebKit with a single API — in your tests, in your scripts, and as a tool for AI agents. + +## Get Started + +Choose the path that fits your workflow: + +| | Best for | Install | +|---|---|---| +| **[Playwright Test](#playwright-test)** | End-to-end testing | `npm init playwright@latest` | +| **[Playwright CLI](#playwright-cli)** | Coding agents (Claude Code, Copilot) | `npm i -g @playwright/cli@latest` | +| **[Playwright MCP](#playwright-mcp)** | AI agents and LLM-driven automation | `npx @playwright/mcp@latest` | +| **[Playwright Library](#playwright-library)** | Browser automation scripts | `npm i playwright` | +| **[VS Code Extension](#vs-code-extension)** | Test authoring and debugging in VS Code | [Install from Marketplace](https://marketplace.visualstudio.com/items?itemName=ms-playwright.playwright) | + +--- + +## Playwright Test + +Playwright Test is a full-featured test runner built for end-to-end testing. It runs tests across Chromium, Firefox, and WebKit with full browser isolation, auto-waiting, and web-first assertions. + +### Install + +```bash +npm init playwright@latest +``` + +Or add manually: + +```bash +npm i -D @playwright/test +npx playwright install +``` + +### Write a test + +```TypeScript +import { test, expect } from '@playwright/test'; + +test('has title', async ({ page }) => { + await page.goto('https://playwright.dev/'); + await expect(page).toHaveTitle(/Playwright/); +}); + +test('get started link', async ({ page }) => { + await page.goto('https://playwright.dev/'); + await page.getByRole('link', { name: 'Get started' }).click(); + await expect(page.getByRole('heading', { name: 'Installation' })).toBeVisible(); +}); +``` + +### Run tests + +```bash +npx playwright test +``` + +Tests run in parallel across all configured browsers, in headless mode by default. Each test gets a fresh browser context — full isolation with near-zero overhead. + +### Key capabilities + +**Auto-wait and web-first assertions.** No artificial timeouts. Playwright waits for elements to be actionable, and assertions automatically retry until conditions are met. + +**Locators.** Find elements with resilient locators that mirror how users see the page: + +```TypeScript +page.getByRole('button', { name: 'Submit' }) +page.getByLabel('Email') +page.getByPlaceholder('Search...') +page.getByTestId('login-form') +``` + +**Test isolation.** Each test runs in its own browser context — equivalent to a fresh browser profile. Save authentication state once and reuse it across tests: + +```TypeScript +// Save state after login +await page.context().storageState({ path: 'auth.json' }); + +// Reuse in other tests +test.use({ storageState: 'auth.json' }); +``` + +**Tracing.** Capture execution traces, screenshots, and videos on failure. Inspect every action, DOM snapshot, network request, and console message in the [Trace Viewer](https://playwright.dev/docs/trace-viewer): + +```TypeScript +// playwright.config.ts +export default defineConfig({ + use: { + trace: 'on-first-retry', + }, +}); +``` + +```bash +npx playwright show-trace trace.zip +``` + + + +**Parallelism.** Tests run in parallel by default across all configured browsers. + +[Full testing documentation](https://playwright.dev/docs/intro) + +--- + +## Playwright CLI + +[Playwright CLI](https://github.com/microsoft/playwright-cli) is a command-line interface for browser automation designed for coding agents. It's more token-efficient than MCP — commands avoid loading large tool schemas and accessibility trees into the model context. + +### Install + +```bash +npm install -g @playwright/cli@latest +``` + +Optionally install skills for richer agent integration: + +```bash +playwright-cli install --skills +``` + +### Usage + +Point your coding agent at a task: + +``` +Test the "add todo" flow on https://demo.playwright.dev/todomvc using playwright-cli. +Take screenshots for all successful and failing scenarios. +``` + +Or run commands directly: + +```bash +playwright-cli open https://demo.playwright.dev/todomvc/ --headed +playwright-cli type "Buy groceries" +playwright-cli press Enter +playwright-cli screenshot +``` + +### Session monitoring + +Use `playwright-cli show` to open a visual dashboard with live screencast previews of all running browser sessions. Click any session to zoom in and take remote control. + +```bash +playwright-cli show +``` + + + +[Full CLI documentation](https://playwright.dev/docs/cli-agent) | [GitHub](https://github.com/microsoft/playwright-cli) + +--- + +## Playwright MCP + +The [Playwright MCP server](https://github.com/microsoft/playwright-mcp) gives AI agents full browser control through the [Model Context Protocol](https://modelcontextprotocol.io). Agents interact with pages using structured accessibility snapshots — no vision models or screenshots required. + +### Setup + +Add to your MCP client (VS Code, Cursor, Claude Desktop, Windsurf, etc.): + +```json +{ + "mcpServers": { + "playwright": { + "command": "npx", + "args": ["@playwright/mcp@latest"] + } + } +} +``` + +**One-click install for VS Code:** + +[Install in VS Code](https://insiders.vscode.dev/redirect?url=vscode%3Amcp%2Finstall%3F%257B%2522name%2522%253A%2522playwright%2522%252C%2522command%2522%253A%2522npx%2522%252C%2522args%2522%253A%255B%2522%2540playwright%252Fmcp%2540latest%2522%255D%257D) + +**For Claude Code:** + +```bash +claude mcp add playwright npx @playwright/mcp@latest +``` + +### How it works + +Ask your AI assistant to interact with any web page: + +``` +Navigate to https://demo.playwright.dev/todomvc and add a few todo items. +``` + +The agent sees the page as a structured accessibility tree: + +``` +- heading "todos" [level=1] +- textbox "What needs to be done?" [ref=e5] +- listitem: + - checkbox "Toggle Todo" [ref=e10] + - text: "Buy groceries" +``` + +It uses element refs like `e5` and `e10` to click, type, and interact — deterministically and without visual ambiguity. Tools cover navigation, form filling, screenshots, network mocking, storage management, and more. + +[Full MCP documentation](https://playwright.dev/docs/mcp) | [GitHub](https://github.com/microsoft/playwright-mcp) + +--- + +## Playwright Library + +Use `playwright` as a library for browser automation scripts — web scraping, PDF generation, screenshot capture, and any workflow that needs programmatic browser control without a test runner. + +### Install + +```bash +npm i playwright +``` + +### Examples + +**Take a screenshot:** + +```TypeScript +import { chromium } from 'playwright'; + +const browser = await chromium.launch(); +const page = await browser.newPage(); +await page.goto('https://playwright.dev/'); +await page.screenshot({ path: 'screenshot.png' }); +await browser.close(); +``` + +**Generate a PDF:** + +```TypeScript +import { chromium } from 'playwright'; + +const browser = await chromium.launch(); +const page = await browser.newPage(); +await page.goto('https://playwright.dev/'); +await page.pdf({ path: 'page.pdf', format: 'A4' }); +await browser.close(); +``` + +**Emulate a mobile device:** + +```TypeScript +import { chromium, devices } from 'playwright'; + +const browser = await chromium.launch(); +const context = await browser.newContext(devices['iPhone 15']); +const page = await context.newPage(); +await page.goto('https://playwright.dev/'); +await page.screenshot({ path: 'mobile.png' }); +await browser.close(); +``` + +**Intercept network requests:** + +```TypeScript +import { chromium } from 'playwright'; + +const browser = await chromium.launch(); +const page = await browser.newPage(); +await page.route('**/*.{png,jpg,jpeg}', route => route.abort()); +await page.goto('https://playwright.dev/'); +await browser.close(); +``` + +[Library documentation](https://playwright.dev/docs/library) | [API reference](https://playwright.dev/docs/api/class-playwright) + +--- + +## VS Code Extension + +The [Playwright VS Code extension](https://marketplace.visualstudio.com/items?itemName=ms-playwright.playwright) brings test running, debugging, and code generation directly into your editor. + + + +**Run and debug tests** from the editor with a single click. Set breakpoints, inspect variables, and step through test execution with a live browser view. + +**Generate tests with CodeGen.** Click "Record new" to open a browser — navigate and interact with your app while Playwright writes the test code for you. + +**Pick locators.** Hover over any element in the browser to see the best available locator, then click to copy it to your clipboard. + +**Trace Viewer integration.** Enable "Show Trace Viewer" in the sidebar to get a full execution trace after each test run — DOM snapshots, network requests, console logs, and screenshots at every step. + +[Install the extension](https://marketplace.visualstudio.com/items?itemName=ms-playwright.playwright) | [VS Code guide](https://playwright.dev/docs/getting-started-vscode) + +--- + +## Cross-Browser Support + +| | Linux | macOS | Windows | +| :--- | :---: | :---: | :---: | +| Chromium1 148.0.7778.96 | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| WebKit 26.4 | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| Firefox 150.0.2 | :white_check_mark: | :white_check_mark: | :white_check_mark: | + +Headless and headed execution on all platforms. 1 Uses [Chrome for Testing](https://developer.chrome.com/blog/chrome-for-testing) by default. + +## Other Languages + +Playwright is also available for [Python](https://playwright.dev/python/docs/intro), [.NET](https://playwright.dev/dotnet/docs/intro), and [Java](https://playwright.dev/java/docs/intro). + +## Resources + +* [Documentation](https://playwright.dev) +* [API reference](https://playwright.dev/docs/api/class-playwright) +* [MCP server](https://github.com/microsoft/playwright-mcp) +* [CLI for coding agents](https://github.com/microsoft/playwright-cli) +* [VS Code extension](https://github.com/microsoft/playwright-vscode) +* [Contribution guide](CONTRIBUTING.md) +* [Changelog](https://github.com/microsoft/playwright/releases) +* [Discord](https://aka.ms/playwright/discord) diff --git a/mock-project/node_modules/@playwright/test/cli.js b/mock-project/node_modules/@playwright/test/cli.js new file mode 100755 index 0000000..e42facb --- /dev/null +++ b/mock-project/node_modules/@playwright/test/cli.js @@ -0,0 +1,19 @@ +#!/usr/bin/env node +/** + * Copyright (c) Microsoft Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +const { program } = require('playwright/lib/program'); +program.parse(process.argv); diff --git a/mock-project/node_modules/@playwright/test/index.d.ts b/mock-project/node_modules/@playwright/test/index.d.ts new file mode 100644 index 0000000..8d99c91 --- /dev/null +++ b/mock-project/node_modules/@playwright/test/index.d.ts @@ -0,0 +1,18 @@ +/** + * Copyright (c) Microsoft Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export * from 'playwright/test'; +export { default } from 'playwright/test'; diff --git a/mock-project/node_modules/@playwright/test/index.js b/mock-project/node_modules/@playwright/test/index.js new file mode 100644 index 0000000..8536f06 --- /dev/null +++ b/mock-project/node_modules/@playwright/test/index.js @@ -0,0 +1,17 @@ +/** + * Copyright (c) Microsoft Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +module.exports = require('playwright/test'); diff --git a/mock-project/node_modules/@playwright/test/index.mjs b/mock-project/node_modules/@playwright/test/index.mjs new file mode 100644 index 0000000..8d99c91 --- /dev/null +++ b/mock-project/node_modules/@playwright/test/index.mjs @@ -0,0 +1,18 @@ +/** + * Copyright (c) Microsoft Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export * from 'playwright/test'; +export { default } from 'playwright/test'; diff --git a/mock-project/node_modules/@playwright/test/package.json b/mock-project/node_modules/@playwright/test/package.json new file mode 100644 index 0000000..2898afa --- /dev/null +++ b/mock-project/node_modules/@playwright/test/package.json @@ -0,0 +1,35 @@ +{ + "name": "@playwright/test", + "version": "1.60.0", + "description": "A high-level API to automate web browsers", + "repository": { + "type": "git", + "url": "git+https://github.com/microsoft/playwright.git" + }, + "homepage": "https://playwright.dev", + "engines": { + "node": ">=18" + }, + "author": { + "name": "Microsoft Corporation" + }, + "license": "Apache-2.0", + "exports": { + ".": { + "types": "./index.d.ts", + "import": "./index.mjs", + "require": "./index.js", + "default": "./index.js" + }, + "./cli": "./cli.js", + "./package.json": "./package.json", + "./reporter": "./reporter.js" + }, + "bin": { + "playwright": "cli.js" + }, + "scripts": {}, + "dependencies": { + "playwright": "1.60.0" + } +} diff --git a/mock-project/node_modules/@playwright/test/reporter.d.ts b/mock-project/node_modules/@playwright/test/reporter.d.ts new file mode 100644 index 0000000..806d13f --- /dev/null +++ b/mock-project/node_modules/@playwright/test/reporter.d.ts @@ -0,0 +1,17 @@ +/** + * Copyright (c) Microsoft Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export * from 'playwright/types/testReporter'; diff --git a/mock-project/node_modules/@playwright/test/reporter.js b/mock-project/node_modules/@playwright/test/reporter.js new file mode 100644 index 0000000..485e880 --- /dev/null +++ b/mock-project/node_modules/@playwright/test/reporter.js @@ -0,0 +1,17 @@ +/** + * Copyright (c) Microsoft Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// We only export types in reporter.d.ts. diff --git a/mock-project/node_modules/@playwright/test/reporter.mjs b/mock-project/node_modules/@playwright/test/reporter.mjs new file mode 100644 index 0000000..485e880 --- /dev/null +++ b/mock-project/node_modules/@playwright/test/reporter.mjs @@ -0,0 +1,17 @@ +/** + * Copyright (c) Microsoft Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// We only export types in reporter.d.ts. diff --git a/mock-project/node_modules/playwright-core/LICENSE b/mock-project/node_modules/playwright-core/LICENSE new file mode 100644 index 0000000..df11237 --- /dev/null +++ b/mock-project/node_modules/playwright-core/LICENSE @@ -0,0 +1,202 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Portions Copyright (c) Microsoft Corporation. + Portions Copyright 2017 Google Inc. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/mock-project/node_modules/playwright-core/NOTICE b/mock-project/node_modules/playwright-core/NOTICE new file mode 100644 index 0000000..814ec16 --- /dev/null +++ b/mock-project/node_modules/playwright-core/NOTICE @@ -0,0 +1,5 @@ +Playwright +Copyright (c) Microsoft Corporation + +This software contains code derived from the Puppeteer project (https://github.com/puppeteer/puppeteer), +available under the Apache 2.0 license (https://github.com/puppeteer/puppeteer/blob/master/LICENSE). diff --git a/mock-project/node_modules/playwright-core/README.md b/mock-project/node_modules/playwright-core/README.md new file mode 100644 index 0000000..422b373 --- /dev/null +++ b/mock-project/node_modules/playwright-core/README.md @@ -0,0 +1,3 @@ +# playwright-core + +This package contains the no-browser flavor of [Playwright](http://github.com/microsoft/playwright). diff --git a/mock-project/node_modules/playwright-core/ThirdPartyNotices.txt b/mock-project/node_modules/playwright-core/ThirdPartyNotices.txt new file mode 100644 index 0000000..369e202 --- /dev/null +++ b/mock-project/node_modules/playwright-core/ThirdPartyNotices.txt @@ -0,0 +1,13 @@ +microsoft/playwright-core + +THIRD-PARTY SOFTWARE NOTICES AND INFORMATION + +This package bundles third-party software inside individual files under +`lib/`. Each bundled output has a sidecar `.js.LICENSE` file next +to it listing every npm package whose source was inlined into that +bundle, together with the full license text for each. + +For example: +- lib/utilsBundle.js.LICENSE + +This project incorporates components from the projects listed below. The original copyright notices and the licenses under which Microsoft received such components are set forth below. Microsoft reserves all rights not expressly granted herein, whether by implication, estoppel or otherwise. diff --git a/mock-project/node_modules/playwright-core/bin/install_media_pack.ps1 b/mock-project/node_modules/playwright-core/bin/install_media_pack.ps1 new file mode 100644 index 0000000..6170754 --- /dev/null +++ b/mock-project/node_modules/playwright-core/bin/install_media_pack.ps1 @@ -0,0 +1,5 @@ +$osInfo = Get-WmiObject -Class Win32_OperatingSystem +# check if running on Windows Server +if ($osInfo.ProductType -eq 3) { + Install-WindowsFeature Server-Media-Foundation +} diff --git a/mock-project/node_modules/playwright-core/bin/install_webkit_wsl.ps1 b/mock-project/node_modules/playwright-core/bin/install_webkit_wsl.ps1 new file mode 100644 index 0000000..ccaaf15 --- /dev/null +++ b/mock-project/node_modules/playwright-core/bin/install_webkit_wsl.ps1 @@ -0,0 +1,33 @@ +$ErrorActionPreference = 'Stop' + +# This script sets up a WSL distribution that will be used to run WebKit. + +$Distribution = "playwright" +$Username = "pwuser" + +$distributions = (wsl --list --quiet) -split "\r?\n" +if ($distributions -contains $Distribution) { + Write-Host "WSL distribution '$Distribution' already exists. Skipping installation." +} else { + Write-Host "Installing new WSL distribution '$Distribution'..." + $VhdSize = "10GB" + wsl --install -d Ubuntu-24.04 --name $Distribution --no-launch --vhd-size $VhdSize + wsl -d $Distribution -u root adduser --gecos GECOS --disabled-password $Username +} + +$pwshDirname = (Resolve-Path -Path $PSScriptRoot).Path; +$playwrightCoreRoot = Resolve-Path (Join-Path $pwshDirname "..") + +$initScript = @" +if [ ! -f "/home/$Username/node/bin/node" ]; then + mkdir -p /home/$Username/node + curl -fsSL https://nodejs.org/dist/v22.17.0/node-v22.17.0-linux-x64.tar.xz -o /home/$Username/node/node-v22.17.0-linux-x64.tar.xz + tar -xJf /home/$Username/node/node-v22.17.0-linux-x64.tar.xz -C /home/$Username/node --strip-components=1 + sudo -u $Username echo 'export PATH=/home/$Username/node/bin:\`$PATH' >> /home/$Username/.profile +fi +/home/$Username/node/bin/node cli.js install-deps webkit +sudo -u $Username PLAYWRIGHT_SKIP_BROWSER_GC=1 /home/$Username/node/bin/node cli.js install webkit +"@ -replace "\r\n", "`n" + +wsl -d $Distribution --cd $playwrightCoreRoot -u root -- bash -c "$initScript" +Write-Host "Done!" \ No newline at end of file diff --git a/mock-project/node_modules/playwright-core/bin/reinstall_chrome_beta_linux.sh b/mock-project/node_modules/playwright-core/bin/reinstall_chrome_beta_linux.sh new file mode 100755 index 0000000..0451bda --- /dev/null +++ b/mock-project/node_modules/playwright-core/bin/reinstall_chrome_beta_linux.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env bash +set -e +set -x + +if [[ $(arch) == "aarch64" ]]; then + echo "ERROR: not supported on Linux Arm64" + exit 1 +fi + +if [ -z "$PLAYWRIGHT_HOST_PLATFORM_OVERRIDE" ]; then + if [[ ! -f "/etc/os-release" ]]; then + echo "ERROR: cannot install on unknown linux distribution (/etc/os-release is missing)" + exit 1 + fi + + ID=$(bash -c 'source /etc/os-release && echo $ID') + if [[ "${ID}" != "ubuntu" && "${ID}" != "debian" ]]; then + echo "ERROR: cannot install on $ID distribution - only Ubuntu and Debian are supported" + exit 1 + fi +fi + +# 1. make sure to remove old beta if any. +if dpkg --get-selections | grep -q "^google-chrome-beta[[:space:]]*install$" >/dev/null; then + apt-get remove -y google-chrome-beta +fi + +# 2. Update apt lists (needed to install curl and chrome dependencies) +apt-get update + +# 3. Install curl to download chrome +if ! command -v curl >/dev/null; then + apt-get install -y curl +fi + +# 4. download chrome beta from dl.google.com and install it. +cd /tmp +curl -O https://dl.google.com/linux/direct/google-chrome-beta_current_amd64.deb +apt-get install -y ./google-chrome-beta_current_amd64.deb +rm -rf ./google-chrome-beta_current_amd64.deb +cd - +google-chrome-beta --version diff --git a/mock-project/node_modules/playwright-core/bin/reinstall_chrome_beta_mac.sh b/mock-project/node_modules/playwright-core/bin/reinstall_chrome_beta_mac.sh new file mode 100755 index 0000000..617e3b5 --- /dev/null +++ b/mock-project/node_modules/playwright-core/bin/reinstall_chrome_beta_mac.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +set -e +set -x + +rm -rf "/Applications/Google Chrome Beta.app" +cd /tmp +curl --retry 3 -o ./googlechromebeta.dmg https://dl.google.com/chrome/mac/universal/beta/googlechromebeta.dmg +hdiutil attach -nobrowse -quiet -noautofsck -noautoopen -mountpoint /Volumes/googlechromebeta.dmg ./googlechromebeta.dmg +cp -pR "/Volumes/googlechromebeta.dmg/Google Chrome Beta.app" /Applications +hdiutil detach /Volumes/googlechromebeta.dmg +rm -rf /tmp/googlechromebeta.dmg + +/Applications/Google\ Chrome\ Beta.app/Contents/MacOS/Google\ Chrome\ Beta --version diff --git a/mock-project/node_modules/playwright-core/bin/reinstall_chrome_beta_win.ps1 b/mock-project/node_modules/playwright-core/bin/reinstall_chrome_beta_win.ps1 new file mode 100644 index 0000000..3fbe551 --- /dev/null +++ b/mock-project/node_modules/playwright-core/bin/reinstall_chrome_beta_win.ps1 @@ -0,0 +1,24 @@ +$ErrorActionPreference = 'Stop' + +$url = 'https://dl.google.com/tag/s/dl/chrome/install/beta/googlechromebetastandaloneenterprise64.msi' + +Write-Host "Downloading Google Chrome Beta" +$wc = New-Object net.webclient +$msiInstaller = "$env:temp\google-chrome-beta.msi" +$wc.Downloadfile($url, $msiInstaller) + +Write-Host "Installing Google Chrome Beta" +$arguments = "/i `"$msiInstaller`" /quiet" +Start-Process msiexec.exe -ArgumentList $arguments -Wait +Remove-Item $msiInstaller + +$suffix = "\\Google\\Chrome Beta\\Application\\chrome.exe" +if (Test-Path "${env:ProgramFiles(x86)}$suffix") { + (Get-Item "${env:ProgramFiles(x86)}$suffix").VersionInfo +} elseif (Test-Path "${env:ProgramFiles}$suffix") { + (Get-Item "${env:ProgramFiles}$suffix").VersionInfo +} else { + Write-Host "ERROR: Failed to install Google Chrome Beta." + Write-Host "ERROR: This could be due to insufficient privileges, in which case re-running as Administrator may help." + exit 1 +} diff --git a/mock-project/node_modules/playwright-core/bin/reinstall_chrome_stable_linux.sh b/mock-project/node_modules/playwright-core/bin/reinstall_chrome_stable_linux.sh new file mode 100755 index 0000000..78f1d41 --- /dev/null +++ b/mock-project/node_modules/playwright-core/bin/reinstall_chrome_stable_linux.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env bash +set -e +set -x + +if [[ $(arch) == "aarch64" ]]; then + echo "ERROR: not supported on Linux Arm64" + exit 1 +fi + +if [ -z "$PLAYWRIGHT_HOST_PLATFORM_OVERRIDE" ]; then + if [[ ! -f "/etc/os-release" ]]; then + echo "ERROR: cannot install on unknown linux distribution (/etc/os-release is missing)" + exit 1 + fi + + ID=$(bash -c 'source /etc/os-release && echo $ID') + if [[ "${ID}" != "ubuntu" && "${ID}" != "debian" ]]; then + echo "ERROR: cannot install on $ID distribution - only Ubuntu and Debian are supported" + exit 1 + fi +fi + +# 1. make sure to remove old stable if any. +if dpkg --get-selections | grep -q "^google-chrome[[:space:]]*install$" >/dev/null; then + apt-get remove -y google-chrome +fi + +# 2. Update apt lists (needed to install curl and chrome dependencies) +apt-get update + +# 3. Install curl to download chrome +if ! command -v curl >/dev/null; then + apt-get install -y curl +fi + +# 4. download chrome stable from dl.google.com and install it. +cd /tmp +curl -O https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb +apt-get install -y ./google-chrome-stable_current_amd64.deb +rm -rf ./google-chrome-stable_current_amd64.deb +cd - +google-chrome --version diff --git a/mock-project/node_modules/playwright-core/bin/reinstall_chrome_stable_mac.sh b/mock-project/node_modules/playwright-core/bin/reinstall_chrome_stable_mac.sh new file mode 100755 index 0000000..6aa650a --- /dev/null +++ b/mock-project/node_modules/playwright-core/bin/reinstall_chrome_stable_mac.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +set -e +set -x + +rm -rf "/Applications/Google Chrome.app" +cd /tmp +curl --retry 3 -o ./googlechrome.dmg https://dl.google.com/chrome/mac/universal/stable/GGRO/googlechrome.dmg +hdiutil attach -nobrowse -quiet -noautofsck -noautoopen -mountpoint /Volumes/googlechrome.dmg ./googlechrome.dmg +cp -pR "/Volumes/googlechrome.dmg/Google Chrome.app" /Applications +hdiutil detach /Volumes/googlechrome.dmg +rm -rf /tmp/googlechrome.dmg +/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --version diff --git a/mock-project/node_modules/playwright-core/bin/reinstall_chrome_stable_win.ps1 b/mock-project/node_modules/playwright-core/bin/reinstall_chrome_stable_win.ps1 new file mode 100644 index 0000000..7ca2dba --- /dev/null +++ b/mock-project/node_modules/playwright-core/bin/reinstall_chrome_stable_win.ps1 @@ -0,0 +1,24 @@ +$ErrorActionPreference = 'Stop' +$url = 'https://dl.google.com/tag/s/dl/chrome/install/googlechromestandaloneenterprise64.msi' + +$wc = New-Object net.webclient +$msiInstaller = "$env:temp\google-chrome.msi" +Write-Host "Downloading Google Chrome" +$wc.Downloadfile($url, $msiInstaller) + +Write-Host "Installing Google Chrome" +$arguments = "/i `"$msiInstaller`" /quiet" +Start-Process msiexec.exe -ArgumentList $arguments -Wait +Remove-Item $msiInstaller + + +$suffix = "\\Google\\Chrome\\Application\\chrome.exe" +if (Test-Path "${env:ProgramFiles(x86)}$suffix") { + (Get-Item "${env:ProgramFiles(x86)}$suffix").VersionInfo +} elseif (Test-Path "${env:ProgramFiles}$suffix") { + (Get-Item "${env:ProgramFiles}$suffix").VersionInfo +} else { + Write-Host "ERROR: Failed to install Google Chrome." + Write-Host "ERROR: This could be due to insufficient privileges, in which case re-running as Administrator may help." + exit 1 +} diff --git a/mock-project/node_modules/playwright-core/bin/reinstall_msedge_beta_linux.sh b/mock-project/node_modules/playwright-core/bin/reinstall_msedge_beta_linux.sh new file mode 100755 index 0000000..a1531a9 --- /dev/null +++ b/mock-project/node_modules/playwright-core/bin/reinstall_msedge_beta_linux.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash + +set -e +set -x + +if [[ $(arch) == "aarch64" ]]; then + echo "ERROR: not supported on Linux Arm64" + exit 1 +fi + +if [ -z "$PLAYWRIGHT_HOST_PLATFORM_OVERRIDE" ]; then + if [[ ! -f "/etc/os-release" ]]; then + echo "ERROR: cannot install on unknown linux distribution (/etc/os-release is missing)" + exit 1 + fi + + ID=$(bash -c 'source /etc/os-release && echo $ID') + if [[ "${ID}" != "ubuntu" && "${ID}" != "debian" ]]; then + echo "ERROR: cannot install on $ID distribution - only Ubuntu and Debian are supported" + exit 1 + fi +fi + +# 1. make sure to remove old beta if any. +if dpkg --get-selections | grep -q "^microsoft-edge-beta[[:space:]]*install$" >/dev/null; then + apt-get remove -y microsoft-edge-beta +fi + +# 2. Install curl to download Microsoft gpg key +if ! command -v curl >/dev/null; then + apt-get update + apt-get install -y curl +fi + +# GnuPG is not preinstalled in slim images +if ! command -v gpg >/dev/null; then + apt-get update + apt-get install -y gpg +fi + +# 3. Add the GPG key, the apt repo, update the apt cache, and install the package +curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > /tmp/microsoft.gpg +install -o root -g root -m 644 /tmp/microsoft.gpg /etc/apt/trusted.gpg.d/ +sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/edge stable main" > /etc/apt/sources.list.d/microsoft-edge-dev.list' +rm /tmp/microsoft.gpg +apt-get update && apt-get install -y microsoft-edge-beta + +microsoft-edge-beta --version diff --git a/mock-project/node_modules/playwright-core/bin/reinstall_msedge_beta_mac.sh b/mock-project/node_modules/playwright-core/bin/reinstall_msedge_beta_mac.sh new file mode 100755 index 0000000..72ec3e4 --- /dev/null +++ b/mock-project/node_modules/playwright-core/bin/reinstall_msedge_beta_mac.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +set -e +set -x + +cd /tmp +curl --retry 3 -o ./msedge_beta.pkg "$1" +# Note: there's no way to uninstall previously installed MSEdge. +# However, running PKG again seems to update installation. +sudo installer -pkg /tmp/msedge_beta.pkg -target / +rm -rf /tmp/msedge_beta.pkg +/Applications/Microsoft\ Edge\ Beta.app/Contents/MacOS/Microsoft\ Edge\ Beta --version diff --git a/mock-project/node_modules/playwright-core/bin/reinstall_msedge_beta_win.ps1 b/mock-project/node_modules/playwright-core/bin/reinstall_msedge_beta_win.ps1 new file mode 100644 index 0000000..cce0d0b --- /dev/null +++ b/mock-project/node_modules/playwright-core/bin/reinstall_msedge_beta_win.ps1 @@ -0,0 +1,23 @@ +$ErrorActionPreference = 'Stop' +$url = $args[0] + +Write-Host "Downloading Microsoft Edge Beta" +$wc = New-Object net.webclient +$msiInstaller = "$env:temp\microsoft-edge-beta.msi" +$wc.Downloadfile($url, $msiInstaller) + +Write-Host "Installing Microsoft Edge Beta" +$arguments = "/i `"$msiInstaller`" /quiet" +Start-Process msiexec.exe -ArgumentList $arguments -Wait +Remove-Item $msiInstaller + +$suffix = "\\Microsoft\\Edge Beta\\Application\\msedge.exe" +if (Test-Path "${env:ProgramFiles(x86)}$suffix") { + (Get-Item "${env:ProgramFiles(x86)}$suffix").VersionInfo +} elseif (Test-Path "${env:ProgramFiles}$suffix") { + (Get-Item "${env:ProgramFiles}$suffix").VersionInfo +} else { + Write-Host "ERROR: Failed to install Microsoft Edge Beta." + Write-Host "ERROR: This could be due to insufficient privileges, in which case re-running as Administrator may help." + exit 1 +} diff --git a/mock-project/node_modules/playwright-core/bin/reinstall_msedge_dev_linux.sh b/mock-project/node_modules/playwright-core/bin/reinstall_msedge_dev_linux.sh new file mode 100755 index 0000000..7fde34e --- /dev/null +++ b/mock-project/node_modules/playwright-core/bin/reinstall_msedge_dev_linux.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash + +set -e +set -x + +if [[ $(arch) == "aarch64" ]]; then + echo "ERROR: not supported on Linux Arm64" + exit 1 +fi + +if [ -z "$PLAYWRIGHT_HOST_PLATFORM_OVERRIDE" ]; then + if [[ ! -f "/etc/os-release" ]]; then + echo "ERROR: cannot install on unknown linux distribution (/etc/os-release is missing)" + exit 1 + fi + + ID=$(bash -c 'source /etc/os-release && echo $ID') + if [[ "${ID}" != "ubuntu" && "${ID}" != "debian" ]]; then + echo "ERROR: cannot install on $ID distribution - only Ubuntu and Debian are supported" + exit 1 + fi +fi + +# 1. make sure to remove old dev if any. +if dpkg --get-selections | grep -q "^microsoft-edge-dev[[:space:]]*install$" >/dev/null; then + apt-get remove -y microsoft-edge-dev +fi + +# 2. Install curl to download Microsoft gpg key +if ! command -v curl >/dev/null; then + apt-get update + apt-get install -y curl +fi + +# GnuPG is not preinstalled in slim images +if ! command -v gpg >/dev/null; then + apt-get update + apt-get install -y gpg +fi + +# 3. Add the GPG key, the apt repo, update the apt cache, and install the package +curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > /tmp/microsoft.gpg +install -o root -g root -m 644 /tmp/microsoft.gpg /etc/apt/trusted.gpg.d/ +sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/edge stable main" > /etc/apt/sources.list.d/microsoft-edge-dev.list' +rm /tmp/microsoft.gpg +apt-get update && apt-get install -y microsoft-edge-dev + +microsoft-edge-dev --version diff --git a/mock-project/node_modules/playwright-core/bin/reinstall_msedge_dev_mac.sh b/mock-project/node_modules/playwright-core/bin/reinstall_msedge_dev_mac.sh new file mode 100755 index 0000000..3376e86 --- /dev/null +++ b/mock-project/node_modules/playwright-core/bin/reinstall_msedge_dev_mac.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +set -e +set -x + +cd /tmp +curl --retry 3 -o ./msedge_dev.pkg "$1" +# Note: there's no way to uninstall previously installed MSEdge. +# However, running PKG again seems to update installation. +sudo installer -pkg /tmp/msedge_dev.pkg -target / +rm -rf /tmp/msedge_dev.pkg +/Applications/Microsoft\ Edge\ Dev.app/Contents/MacOS/Microsoft\ Edge\ Dev --version diff --git a/mock-project/node_modules/playwright-core/bin/reinstall_msedge_dev_win.ps1 b/mock-project/node_modules/playwright-core/bin/reinstall_msedge_dev_win.ps1 new file mode 100644 index 0000000..22e6db8 --- /dev/null +++ b/mock-project/node_modules/playwright-core/bin/reinstall_msedge_dev_win.ps1 @@ -0,0 +1,23 @@ +$ErrorActionPreference = 'Stop' +$url = $args[0] + +Write-Host "Downloading Microsoft Edge Dev" +$wc = New-Object net.webclient +$msiInstaller = "$env:temp\microsoft-edge-dev.msi" +$wc.Downloadfile($url, $msiInstaller) + +Write-Host "Installing Microsoft Edge Dev" +$arguments = "/i `"$msiInstaller`" /quiet" +Start-Process msiexec.exe -ArgumentList $arguments -Wait +Remove-Item $msiInstaller + +$suffix = "\\Microsoft\\Edge Dev\\Application\\msedge.exe" +if (Test-Path "${env:ProgramFiles(x86)}$suffix") { + (Get-Item "${env:ProgramFiles(x86)}$suffix").VersionInfo +} elseif (Test-Path "${env:ProgramFiles}$suffix") { + (Get-Item "${env:ProgramFiles}$suffix").VersionInfo +} else { + Write-Host "ERROR: Failed to install Microsoft Edge Dev." + Write-Host "ERROR: This could be due to insufficient privileges, in which case re-running as Administrator may help." + exit 1 +} diff --git a/mock-project/node_modules/playwright-core/bin/reinstall_msedge_stable_linux.sh b/mock-project/node_modules/playwright-core/bin/reinstall_msedge_stable_linux.sh new file mode 100755 index 0000000..4acb1db --- /dev/null +++ b/mock-project/node_modules/playwright-core/bin/reinstall_msedge_stable_linux.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash + +set -e +set -x + +if [[ $(arch) == "aarch64" ]]; then + echo "ERROR: not supported on Linux Arm64" + exit 1 +fi + +if [ -z "$PLAYWRIGHT_HOST_PLATFORM_OVERRIDE" ]; then + if [[ ! -f "/etc/os-release" ]]; then + echo "ERROR: cannot install on unknown linux distribution (/etc/os-release is missing)" + exit 1 + fi + + ID=$(bash -c 'source /etc/os-release && echo $ID') + if [[ "${ID}" != "ubuntu" && "${ID}" != "debian" ]]; then + echo "ERROR: cannot install on $ID distribution - only Ubuntu and Debian are supported" + exit 1 + fi +fi + +# 1. make sure to remove old stable if any. +if dpkg --get-selections | grep -q "^microsoft-edge-stable[[:space:]]*install$" >/dev/null; then + apt-get remove -y microsoft-edge-stable +fi + +# 2. Install curl to download Microsoft gpg key +if ! command -v curl >/dev/null; then + apt-get update + apt-get install -y curl +fi + +# GnuPG is not preinstalled in slim images +if ! command -v gpg >/dev/null; then + apt-get update + apt-get install -y gpg +fi + +# 3. Add the GPG key, the apt repo, update the apt cache, and install the package +curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > /tmp/microsoft.gpg +install -o root -g root -m 644 /tmp/microsoft.gpg /etc/apt/trusted.gpg.d/ +sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/edge stable main" > /etc/apt/sources.list.d/microsoft-edge-stable.list' +rm /tmp/microsoft.gpg +apt-get update && apt-get install -y microsoft-edge-stable + +microsoft-edge-stable --version diff --git a/mock-project/node_modules/playwright-core/bin/reinstall_msedge_stable_mac.sh b/mock-project/node_modules/playwright-core/bin/reinstall_msedge_stable_mac.sh new file mode 100755 index 0000000..afcd2f5 --- /dev/null +++ b/mock-project/node_modules/playwright-core/bin/reinstall_msedge_stable_mac.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +set -e +set -x + +cd /tmp +curl --retry 3 -o ./msedge_stable.pkg "$1" +# Note: there's no way to uninstall previously installed MSEdge. +# However, running PKG again seems to update installation. +sudo installer -pkg /tmp/msedge_stable.pkg -target / +rm -rf /tmp/msedge_stable.pkg +/Applications/Microsoft\ Edge.app/Contents/MacOS/Microsoft\ Edge --version diff --git a/mock-project/node_modules/playwright-core/bin/reinstall_msedge_stable_win.ps1 b/mock-project/node_modules/playwright-core/bin/reinstall_msedge_stable_win.ps1 new file mode 100644 index 0000000..31fdf51 --- /dev/null +++ b/mock-project/node_modules/playwright-core/bin/reinstall_msedge_stable_win.ps1 @@ -0,0 +1,24 @@ +$ErrorActionPreference = 'Stop' + +$url = $args[0] + +Write-Host "Downloading Microsoft Edge" +$wc = New-Object net.webclient +$msiInstaller = "$env:temp\microsoft-edge-stable.msi" +$wc.Downloadfile($url, $msiInstaller) + +Write-Host "Installing Microsoft Edge" +$arguments = "/i `"$msiInstaller`" /quiet" +Start-Process msiexec.exe -ArgumentList $arguments -Wait +Remove-Item $msiInstaller + +$suffix = "\\Microsoft\\Edge\\Application\\msedge.exe" +if (Test-Path "${env:ProgramFiles(x86)}$suffix") { + (Get-Item "${env:ProgramFiles(x86)}$suffix").VersionInfo +} elseif (Test-Path "${env:ProgramFiles}$suffix") { + (Get-Item "${env:ProgramFiles}$suffix").VersionInfo +} else { + Write-Host "ERROR: Failed to install Microsoft Edge." + Write-Host "ERROR: This could be due to insufficient privileges, in which case re-running as Administrator may help." + exit 1 +} \ No newline at end of file diff --git a/mock-project/node_modules/playwright-core/browsers.json b/mock-project/node_modules/playwright-core/browsers.json new file mode 100644 index 0000000..9652f7d --- /dev/null +++ b/mock-project/node_modules/playwright-core/browsers.json @@ -0,0 +1,81 @@ +{ + "comment": "Do not edit this file, use utils/roll_browser.js", + "browsers": [ + { + "name": "chromium", + "revision": "1223", + "installByDefault": true, + "browserVersion": "148.0.7778.96", + "title": "Chrome for Testing" + }, + { + "name": "chromium-headless-shell", + "revision": "1223", + "installByDefault": true, + "browserVersion": "148.0.7778.96", + "title": "Chrome Headless Shell" + }, + { + "name": "chromium-tip-of-tree", + "revision": "1427", + "installByDefault": false, + "browserVersion": "149.0.7827.0", + "title": "Chrome Canary for Testing" + }, + { + "name": "chromium-tip-of-tree-headless-shell", + "revision": "1427", + "installByDefault": false, + "browserVersion": "149.0.7827.0", + "title": "Chrome Canary Headless Shell" + }, + { + "name": "firefox", + "revision": "1522", + "installByDefault": true, + "browserVersion": "150.0.2", + "title": "Firefox" + }, + { + "name": "firefox-beta", + "revision": "1512", + "installByDefault": false, + "browserVersion": "151.0b5", + "title": "Firefox Beta" + }, + { + "name": "webkit", + "revision": "2287", + "installByDefault": true, + "revisionOverrides": { + "mac14": "2251", + "mac14-arm64": "2251", + "debian11-x64": "2105", + "debian11-arm64": "2105", + "ubuntu20.04-x64": "2092", + "ubuntu20.04-arm64": "2092" + }, + "browserVersion": "26.4", + "title": "WebKit" + }, + { + "name": "ffmpeg", + "revision": "1011", + "installByDefault": true, + "revisionOverrides": { + "mac12": "1010", + "mac12-arm64": "1010" + } + }, + { + "name": "winldd", + "revision": "1007", + "installByDefault": false + }, + { + "name": "android", + "revision": "1001", + "installByDefault": false + } + ] +} diff --git a/mock-project/node_modules/playwright-core/cli.js b/mock-project/node_modules/playwright-core/cli.js new file mode 100755 index 0000000..f275a03 --- /dev/null +++ b/mock-project/node_modules/playwright-core/cli.js @@ -0,0 +1,21 @@ +#!/usr/bin/env node +/** + * Copyright (c) Microsoft Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +const { libCli, libCliTestStub } = require('./lib/coreBundle'); +const { program } = require('./lib/utilsBundle'); +libCli.decorateProgram(program); +libCliTestStub.decorateProgram(program); +program.parse(process.argv); diff --git a/mock-project/node_modules/playwright-core/index.d.ts b/mock-project/node_modules/playwright-core/index.d.ts new file mode 100644 index 0000000..97c1493 --- /dev/null +++ b/mock-project/node_modules/playwright-core/index.d.ts @@ -0,0 +1,17 @@ +/** + * Copyright (c) Microsoft Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export * from './types/types'; diff --git a/mock-project/node_modules/playwright-core/index.js b/mock-project/node_modules/playwright-core/index.js new file mode 100644 index 0000000..e845cfa --- /dev/null +++ b/mock-project/node_modules/playwright-core/index.js @@ -0,0 +1,32 @@ +/** + * Copyright (c) Microsoft Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +const minimumMajorNodeVersion = 18; +const currentNodeVersion = process.versions.node; +const semver = currentNodeVersion.split('.'); +const [major] = [+semver[0]]; + +if (major < minimumMajorNodeVersion) { + console.error( + 'You are running Node.js ' + + currentNodeVersion + + '.\n' + + `Playwright requires Node.js ${minimumMajorNodeVersion} or higher. \n` + + 'Please update your version of Node.js.' + ); + process.exit(1); +} + +module.exports = require('./lib/coreBundle').inprocess.playwright; diff --git a/mock-project/node_modules/playwright-core/index.mjs b/mock-project/node_modules/playwright-core/index.mjs new file mode 100644 index 0000000..3b3c75b --- /dev/null +++ b/mock-project/node_modules/playwright-core/index.mjs @@ -0,0 +1,28 @@ +/** + * Copyright (c) Microsoft Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import playwright from './index.js'; + +export const chromium = playwright.chromium; +export const firefox = playwright.firefox; +export const webkit = playwright.webkit; +export const selectors = playwright.selectors; +export const devices = playwright.devices; +export const errors = playwright.errors; +export const request = playwright.request; +export const _electron = playwright._electron; +export const _android = playwright._android; +export default playwright; diff --git a/mock-project/node_modules/playwright-core/package.json b/mock-project/node_modules/playwright-core/package.json new file mode 100644 index 0000000..2ac3960 --- /dev/null +++ b/mock-project/node_modules/playwright-core/package.json @@ -0,0 +1,34 @@ +{ + "name": "playwright-core", + "version": "1.60.0", + "description": "A high-level API to automate web browsers", + "repository": { + "type": "git", + "url": "git+https://github.com/microsoft/playwright.git" + }, + "homepage": "https://playwright.dev", + "engines": { + "node": ">=18" + }, + "author": { + "name": "Microsoft Corporation" + }, + "license": "Apache-2.0", + "exports": { + ".": { + "types": "./index.d.ts", + "import": "./index.mjs", + "require": "./index.js", + "default": "./index.js" + }, + "./package.json": "./package.json", + "./lib/bootstrap": "./lib/bootstrap.js", + "./lib/coreBundle": "./lib/coreBundle.js", + "./lib/utilsBundle": "./lib/utilsBundle.js", + "./lib/tools/cli-client/program": "./lib/tools/cli-client/program.js" + }, + "bin": { + "playwright-core": "cli.js" + }, + "types": "types/types.d.ts" +} diff --git a/mock-project/node_modules/playwright-core/types/protocol.d.ts b/mock-project/node_modules/playwright-core/types/protocol.d.ts new file mode 100644 index 0000000..14b1122 --- /dev/null +++ b/mock-project/node_modules/playwright-core/types/protocol.d.ts @@ -0,0 +1,24565 @@ +// This is generated from /utils/protocol-types-generator/index.js +type binary = string; +export namespace Protocol { + export namespace Accessibility { + /** + * Unique accessibility node identifier. + */ + export type AXNodeId = string; + /** + * Enum of possible property types. + */ + export type AXValueType = "boolean"|"tristate"|"booleanOrUndefined"|"idref"|"idrefList"|"integer"|"node"|"nodeList"|"number"|"string"|"computedString"|"token"|"tokenList"|"domRelation"|"role"|"internalRole"|"valueUndefined"; + /** + * Enum of possible property sources. + */ + export type AXValueSourceType = "attribute"|"implicit"|"style"|"contents"|"placeholder"|"relatedElement"; + /** + * Enum of possible native property sources (as a subtype of a particular AXValueSourceType). + */ + export type AXValueNativeSourceType = "description"|"figcaption"|"label"|"labelfor"|"labelwrapped"|"legend"|"rubyannotation"|"tablecaption"|"title"|"other"; + /** + * A single source for a computed AX property. + */ + export interface AXValueSource { + /** + * What type of source this is. + */ + type: AXValueSourceType; + /** + * The value of this property source. + */ + value?: AXValue; + /** + * The name of the relevant attribute, if any. + */ + attribute?: string; + /** + * The value of the relevant attribute, if any. + */ + attributeValue?: AXValue; + /** + * Whether this source is superseded by a higher priority source. + */ + superseded?: boolean; + /** + * The native markup source for this value, e.g. a `