diff --git a/.gitignore b/.gitignore index 687f983..ac471a6 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,5 @@ rewriter/out static/wasm.js rewriter/*.js pnpm-lock.yaml +playwright-report +test-results \ No newline at end of file diff --git a/package.json b/package.json index 396b14c..4e1d56b 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "format": "prettier --config .prettierrc.js --write .", "lint": "eslint ./src/", "lint:fix": "eslint ./src/ --fix", - "test": "cd tests && npx playwright test" + "test": "npx playwright test" }, "files": [ "dist", @@ -60,5 +60,15 @@ "htmlparser2": "^9.1.0", "parse-domain": "^8.2.2", "set-cookie-parser": "^2.7.0" + }, + "optionalDependencies": { + "@playwright/test": "^1.48.1", + "playwright": "^1.48.1" + }, + "pnpm": { + "ignoredOptionalDependencies": [ + "@playwright/test", + "playwright" + ] } } diff --git a/tests/playwright.config.ts b/playwright.config.ts similarity index 77% rename from tests/playwright.config.ts rename to playwright.config.ts index 49fb540..02319e9 100644 --- a/tests/playwright.config.ts +++ b/playwright.config.ts @@ -1,13 +1,5 @@ import { defineConfig, devices } from "@playwright/test"; -/** - * Read environment variables from file. - * https://github.com/motdotla/dotenv - */ -// import dotenv from 'dotenv'; -// import path from 'path'; -// dotenv.config({ path: path.resolve(__dirname, '.env') }); - /** * See https://playwright.dev/docs/test-configuration. */ @@ -40,8 +32,8 @@ export default defineConfig({ /* Run your local dev server before starting the tests */ webServer: { - command: "cd .. && pnpm run dev", + command: "pnpm run dev", url: "http://127.0.0.1:1337", - reuseExistingServer: true, + reuseExistingServer: false, }, }); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 97a12d4..72c6edf 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -11,6 +11,9 @@ importers: '@mercuryworkshop/bare-mux': specifier: ^2.1.6 version: 2.1.6 + '@playwright/test': + specifier: ^1.48.1 + version: 1.48.1 dom-serializer: specifier: ^2.0.0 version: 2.0.0 @@ -287,6 +290,11 @@ packages: resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==} engines: {node: '>=14'} + '@playwright/test@1.48.1': + resolution: {integrity: sha512-s9RtWoxkOLmRJdw3oFvhFbs9OJS0BzrLUc8Hf6l2UdCNd1rqeEyD4BhCJkvzeEoD1FsK4mirsWwGerhVmYKtZg==} + engines: {node: '>=18'} + hasBin: true + '@polka/url@1.0.0-next.28': resolution: {integrity: sha512-8LduaNlMZGwdZ6qWrKlfa+2M4gahzFkprZiAt2TF8uS0qQgBizKXpXURqvTJ4WtmupWxaLqjRb2UCTe72mu+Aw==} @@ -1241,6 +1249,11 @@ packages: resolution: {integrity: sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==} engines: {node: '>=14.14'} + fsevents@2.3.2: + resolution: {integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==} + engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} + os: [darwin] + fsevents@2.3.3: resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} @@ -1810,6 +1823,16 @@ packages: resolution: {integrity: sha512-xSEmD4pLnV54t0NOUN16yCl7RIB1c5UUOse5HSyEXtBp+FgFQyPeDutc+Q2ZO7/22vImV7VfEjH/1zV2QuqvYw==} hasBin: true + playwright-core@1.48.1: + resolution: {integrity: sha512-Yw/t4VAFX/bBr1OzwCuOMZkY1Cnb4z/doAFSwf4huqAGWmf9eMNjmK7NiOljCdLmxeRYcGPPmcDgU0zOlzP0YA==} + engines: {node: '>=18'} + hasBin: true + + playwright@1.48.1: + resolution: {integrity: sha512-j8CiHW/V6HxmbntOfyB4+T/uk08tBy6ph0MpBXwuoofkSnLmlfdYNNkFTYD6ofzzlSqLA1fwH4vwvVFvJgLN0w==} + engines: {node: '>=18'} + hasBin: true + prelude-ls@1.2.1: resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} engines: {node: '>= 0.8.0'} @@ -2387,6 +2410,10 @@ packages: resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} engines: {node: '>=10'} +ignoredOptionalDependencies: + - '@playwright/test' + - playwright + snapshots: '@babel/code-frame@7.25.7': @@ -2601,6 +2628,10 @@ snapshots: '@pkgjs/parseargs@0.11.0': optional: true + '@playwright/test@1.48.1': + dependencies: + playwright: 1.48.1 + '@polka/url@1.0.0-next.28': {} '@rsdoctor/client@0.4.7': {} @@ -3788,6 +3819,9 @@ snapshots: jsonfile: 6.1.0 universalify: 2.0.1 + fsevents@2.3.2: + optional: true + fsevents@2.3.3: optional: true @@ -4292,6 +4326,14 @@ snapshots: sonic-boom: 4.2.0 thread-stream: 3.1.0 + playwright-core@1.48.1: {} + + playwright@1.48.1: + dependencies: + playwright-core: 1.48.1 + optionalDependencies: + fsevents: 2.3.2 + prelude-ls@1.2.1: {} prettier@3.3.3: {} diff --git a/tests/.gitignore b/tests/.gitignore deleted file mode 100644 index fc5299a..0000000 --- a/tests/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -node_modules/ -/test-results/ -/playwright-report/ -/blob-report/ -/playwright/.cache/ \ No newline at end of file diff --git a/tests/.gitmodules b/tests/.gitmodules deleted file mode 100644 index 25e9da5..0000000 --- a/tests/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "scramjet"] - path = scramjet - url = git@github.com:MercuryWorkshop/scramjet.git diff --git a/tests/tests/google.spec.ts b/tests/google.spec.ts similarity index 100% rename from tests/tests/google.spec.ts rename to tests/google.spec.ts diff --git a/tests/package.json b/tests/package.json deleted file mode 100644 index 48f7bf5..0000000 --- a/tests/package.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "scramjet-tests", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": {}, - "keywords": [], - "author": "", - "license": "ISC", - "devDependencies": { - "@playwright/test": "^1.48.0", - "@types/node": "^22.7.5" - } -} diff --git a/tests/tests/util/setupPage.ts b/tests/util/setupPage.ts similarity index 100% rename from tests/tests/util/setupPage.ts rename to tests/util/setupPage.ts diff --git a/tests/tests/youtube.spec.ts b/tests/youtube.spec.ts similarity index 100% rename from tests/tests/youtube.spec.ts rename to tests/youtube.spec.ts