diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 10d76be..2766332 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,6 +26,9 @@ jobs: - name: Install dependencies run: npm ci + - name: Install browser engine + run: npx playwright install --with-deps chromium + - name: Format run: npm run fmt:check diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index fccccb1..4b80593 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -39,6 +39,9 @@ jobs: - name: Install dependencies run: npm ci + - name: Install browser engine + run: npx playwright install --with-deps chromium + - name: Validate source run: npm run fmt:check && npm run lint && npm run typecheck diff --git a/.gitignore b/.gitignore index dbd76ba..6d0b757 100644 --- a/.gitignore +++ b/.gitignore @@ -52,10 +52,11 @@ Thumbs.db # Screenshots screenshots/ **/screenshots/ +**/__screenshots__/ .codex-screenshots/ +.vitest-attachments/ # Environment .env .env.* !.env.example - diff --git a/package-lock.json b/package-lock.json index e97a982..38b4fc9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@askrjs/website", - "version": "0.1.1", + "version": "0.1.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@askrjs/website", - "version": "0.1.1", + "version": "0.1.2", "license": "Apache-2.0", "dependencies": { "@askrjs/askr": "0.0.92", @@ -31,7 +31,9 @@ "@askrjs/vite": "0.0.13", "@types/node": "^26.2.0", "@typescript/native": "npm:typescript@^7.0.2", + "@vitest/browser-playwright": "4.1.10", "monaco-editor": "^0.56.0", + "playwright": "^1.62.1", "tsx": "4.23.11", "typescript": "npm:@typescript/typescript6@^6.0.2", "vite-plus": "^0.2.8" @@ -2544,6 +2546,30 @@ "vitest": "4.1.10" } }, + "node_modules/@vitest/browser-playwright": { + "version": "4.1.10", + "resolved": "https://registry.npmjs.org/@vitest/browser-playwright/-/browser-playwright-4.1.10.tgz", + "integrity": "sha512-nMoXGEiRpT7m3W7NsbvrM2aKNwiNHZf+zEpUCvMteGjZFvfT96Q9fh7QyB98dvDWXiKvrLxA7bJ1mCOOv+JQPw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/browser": "4.1.10", + "@vitest/mocker": "4.1.10", + "tinyrainbow": "^3.1.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "playwright": "*", + "vitest": "4.1.10" + }, + "peerDependenciesMeta": { + "playwright": { + "optional": false + } + } + }, "node_modules/@vitest/browser-preview": { "version": "4.1.10", "resolved": "https://registry.npmjs.org/@vitest/browser-preview/-/browser-preview-4.1.10.tgz", @@ -4597,6 +4623,53 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, + "node_modules/playwright": { + "version": "1.62.1", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.62.1.tgz", + "integrity": "sha512-0M+L3LAD8/nm554LOla9Ayx0j0tmFZ0FBcoQ7F1VuVHpM/XpiC8RcDzBQB8W5+hA8L22THxELzeF+2WcUzvcLg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "playwright-core": "1.62.1" + }, + "bin": { + "playwright": "cli.js" + }, + "engines": { + "node": ">=20" + }, + "optionalDependencies": { + "fsevents": "2.3.2" + } + }, + "node_modules/playwright-core": { + "version": "1.62.1", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.62.1.tgz", + "integrity": "sha512-wPYSwEBJY9GHraISXqyqtx0na0LpO3XEX7jNDhntbex7tzUS7kLnZsOlFruFJB4Hi/rhDMjXGqHewDZ68nYZVw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "playwright-core": "cli.js" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/playwright/node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, "node_modules/pngjs": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-7.0.0.tgz", diff --git a/package.json b/package.json index 4e73a62..f5dae0d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@askrjs/website", - "version": "0.1.1", + "version": "0.1.2", "private": true, "description": "Askr marketing and documentation site", "license": "Apache-2.0", @@ -17,9 +17,10 @@ "lint": "vp lint src tests scripts ssg.config.ts vite.config.ts", "fmt": "vp fmt .", "fmt:check": "vp fmt . --check", - "test:unit": "vp test run --exclude tests/generated-output-contract.test.ts", + "test:unit": "vp test run --exclude tests/generated-output-contract.test.ts --exclude \"tests/browser/**\"", "test:static": "vp test run tests/generated-output-contract.test.ts", - "test": "npm run test:unit", + "test": "npm run test:unit && npm run test:browser", + "test:browser": "vp test run -c vitest.test.browser.config.ts --mode production", "typecheck": "tsc --noEmit", "check": "npm run fmt:check && npm run lint && npm run typecheck && npm test && npm run build", "preview": "vp preview --outDir dist" @@ -47,7 +48,9 @@ "@askrjs/vite": "0.0.13", "@types/node": "^26.2.0", "@typescript/native": "npm:typescript@^7.0.2", + "@vitest/browser-playwright": "4.1.10", "monaco-editor": "^0.56.0", + "playwright": "^1.62.1", "tsx": "4.23.11", "typescript": "npm:@typescript/typescript6@^6.0.2", "vite-plus": "^0.2.8" diff --git a/src/pages/docs/search.tsx b/src/pages/docs/search.tsx index 3ea8a9f..90f4593 100644 --- a/src/pages/docs/search.tsx +++ b/src/pages/docs/search.tsx @@ -25,7 +25,9 @@ function loadSearchIndex(): Promise { } function DocsSearchInput(props: { + activeResultId: () => string | undefined; close: () => void; + onKeyDown: (event: KeyboardEvent) => void; runSearch: (value: string | undefined) => Promise; }) { return ( @@ -33,8 +35,14 @@ function DocsSearchInput(props: {