diff --git a/e2e/fixtures/login.js b/e2e/fixtures/login.ts similarity index 82% rename from e2e/fixtures/login.js rename to e2e/fixtures/login.ts index 85260c2..5991daf 100644 --- a/e2e/fixtures/login.js +++ b/e2e/fixtures/login.ts @@ -1,7 +1,13 @@ +import type { Page } from "@playwright/test"; + // Drives the real OAuth flow (PAR/PKCE/DPoP) against the devnet PDS: the // login form, the PDS's own sign-in page, and its consent screen. Not a // mock — this is the actual redirect chain a browser goes through. -export async function loginAs(page, handle, password) { +export async function loginAs( + page: Page, + handle: string, + password: string, +): Promise { await page.goto("/"); await page.fill('input[type="text"]', handle); await page.click("text=LOG IN WITH ATPROTO"); diff --git a/e2e/package-lock.json b/e2e/package-lock.json index e02a9d3..27d61da 100644 --- a/e2e/package-lock.json +++ b/e2e/package-lock.json @@ -6,7 +6,9 @@ "": { "name": "at-record-e2e", "devDependencies": { - "@playwright/test": "^1.48.0" + "@playwright/test": "^1.48.0", + "@types/node": "^26.1.1", + "typescript": "^5.6.0" } }, "node_modules/@playwright/test": { @@ -25,6 +27,16 @@ "node": ">=18" } }, + "node_modules/@types/node": { + "version": "26.1.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-26.1.1.tgz", + "integrity": "sha512-nxAkRSVkN1Y0JC1W8ky/fTfkGsMmcrRsbx+3XoZE+rMOX71kLYTV7fLXpqud1GpbpP5TuffXFqfX7fH2GgZREw==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~8.3.0" + } + }, "node_modules/fsevents": { "version": "2.3.2", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", @@ -71,6 +83,27 @@ "engines": { "node": ">=18" } + }, + "node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undici-types": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-8.3.0.tgz", + "integrity": "sha512-j375ScV60dom+YkPFIfTLcOiPxkN/buHz5GobjLhixFuANaNs3C9l4GmrWqejgXWJ7BbJcFYpTEUkS1Ge8bpZQ==", + "dev": true, + "license": "MIT" } } } diff --git a/e2e/package.json b/e2e/package.json index 44ae38d..cc059d6 100644 --- a/e2e/package.json +++ b/e2e/package.json @@ -3,9 +3,12 @@ "private": true, "type": "module", "scripts": { - "test": "playwright test" + "test": "playwright test", + "typecheck": "tsc --noEmit" }, "devDependencies": { - "@playwright/test": "^1.48.0" + "@playwright/test": "^1.48.0", + "@types/node": "^26.1.1", + "typescript": "^5.6.0" } } diff --git a/e2e/playwright.config.js b/e2e/playwright.config.ts similarity index 100% rename from e2e/playwright.config.js rename to e2e/playwright.config.ts diff --git a/e2e/tests/adoption.spec.js b/e2e/tests/adoption.spec.ts similarity index 92% rename from e2e/tests/adoption.spec.js rename to e2e/tests/adoption.spec.ts index 6849a49..a68d015 100644 --- a/e2e/tests/adoption.spec.js +++ b/e2e/tests/adoption.spec.ts @@ -1,9 +1,9 @@ -import { test, expect } from "@playwright/test"; +import { test, expect, type Page } from "@playwright/test"; import { loginAs } from "../fixtures/login.js"; const PASSWORD = process.env.TEST_ACCOUNT_PASSWORD || "e2e-test-password"; -async function addFirstSearchResult(page, query) { +async function addFirstSearchResult(page: Page, query: string): Promise { await page.goto("/add"); await page.fill(".autocomplete input", query); await page.waitForSelector(".suggestions li", { timeout: 15_000 }); diff --git a/e2e/tsconfig.json b/e2e/tsconfig.json new file mode 100644 index 0000000..503a254 --- /dev/null +++ b/e2e/tsconfig.json @@ -0,0 +1,12 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "ESNext", + "moduleResolution": "bundler", + "strict": true, + "noUncheckedIndexedAccess": true, + "skipLibCheck": true, + "types": ["@playwright/test", "node"] + }, + "include": ["**/*.ts"] +}