Repository Public
1/**2 * =============================================================================3 * SP BOUCHER | SOFTWARE & RESEARCH4 * ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5 * =============================================================================6 *7 * Project : ORIX App Universe8 * File : e2e/public.spec.ts9 * Module : e2e10 * Repository : https://git.spboucher.ai/orix-spboucher-ai11 * Project Website : https://www.orixlab.dev12 * Created : 2026-11-2113 * Last Modified : 2026-11-2114 *15 * Author : Simon-Pierre Boucher16 * Position : Professor of Finance17 * Institution : Université du Québec en Outaouais (UQO)18 * Organization : SP Boucher19 * Website : https://spboucher.ai20 * Git : https://git.spboucher.ai21 *22 * Preferred Contact: support@spboucher.ai23 * Development : dev@spboucher.ai24 * Support : support@spboucher.ai25 * Security/Admin : admin@spboucher.ai26 *27 * Copyright (c) 202628 * Simon-Pierre Boucher29 * All rights reserved where applicable. This file is governed by the30 * applicable project license, copyright notices and relevant law.31 * Existing third-party rights and notices remain unaffected.32 *33 * License : None specified (no license file in this repository)34 *35 * Do not embed credentials, private keys, access tokens,36 * certificates or confidential personal information.37 *38 * =============================================================================39 * END OF SP BOUCHER SOURCE HEADER40 * =============================================================================41 */4243import { createHash } from "node:crypto";44import { readFileSync } from "node:fs";45import AxeBuilder from "@axe-core/playwright";46import { expect, test } from "@playwright/test";47const state = () => JSON.parse(readFileSync("e2e/.tmp/state.json", "utf8")) as { sha: string; size: number };48import { APP_STORE, AVAILABLE, COMING, DOCS, FIXTURES, MAC_LINEUP, MOBILE_LINEUP, REAL, RETIRED, SHOWCASE, TOTAL } from "./catalog";4950/** The cards of a list that belong to the real catalogue, in the order shown (the fixtures come after them). */51const realSlugs = async (cards: import("@playwright/test").Locator) => (await cards.evaluateAll((els) => els.map((e) => e.getAttribute("data-slug")!))).filter((s) => !s.startsWith("fixture-"));5253test.describe("homepage", () => {54 test("hero, counts taken from the catalog, and working primary actions", async ({ page }) => {55 await page.goto("/");56 await expect(page.getByRole("heading", { level: 1 })).toContainText("Extraordinary Possibilities.");57 // The real catalogue plus the three fixtures of this database: two released Mac fixtures and one public beta.58 await expect(page.getByTestId("hero-counts")).toHaveText(`${TOTAL} applications · ${AVAILABLE.length + FIXTURES.mac.length} available · ${FIXTURES.ios.length} in beta · ${COMING.length} coming soon`);59 // The download call to action exists because the database holds verified images (the fixtures), and only those are offered.60 // (The admin tests, which run first, withdraw the second fixture image: one verified image is left.)61 await expect(page.getByTestId("hero-pill")).toContainText("1 app available for Mac now");62 await expect(page.getByTestId("hero-pill")).toHaveAttribute("href", "/downloads");63 await expect(page.getByTestId("hero-download")).toHaveAttribute("href", "/downloads");64 // Figures counted at request time: the catalogue, the verified Mac images, the public App Store pages, and no tracker.65 const stats = page.getByTestId("home-stats").locator("div");66 await expect(stats).toHaveCount(4);67 for (const [i, value, label] of [[0, TOTAL, "applications in the catalog"], [1, 1, "available for Mac today"], [2, Object.keys(APP_STORE).length, "on the App Store for iPhone and iPad"], [3, 0, "third-party trackers"]] as const) {68 await expect(stats.nth(i).locator("dt")).toContainText(label);69 await expect(stats.nth(i).locator("dd")).toHaveText(String(value));70 }71 expect(Object.keys(APP_STORE).sort()).toEqual(["audio", "camera"]);72 // The home page no longer carries the download shelf nor the per-status sections; the shelf lives on /downloads.73 await expect(page.getByTestId("download-shelf")).toHaveCount(0);74 await expect(page.getByTestId("release-card")).toHaveCount(0);75 await expect(page.getByText("In beta now")).toHaveCount(0);76 await expect(page.getByText("On the workbench")).toHaveCount(0);77 await page.getByTestId("hero").getByRole("link", { name: "Explore Apps" }).click();78 await expect(page).toHaveURL(/\/apps$/);79 await page.goto("/");80 await page.getByTestId("hero-download").click();81 await expect(page).toHaveURL(/\/downloads$/);82 await expect(page.getByTestId("download-shelf").locator('[data-slug="fixture-mac"]').getByRole("link", { name: "Download for Mac" })).toHaveAttribute("href", "/download/fixture-mac/1.2.0/ORIXFixture.dmg");83 });84 test("showcase presents the released applications only, each with a real capture", async ({ page }) => {85 await page.goto("/");86 const panels = page.getByTestId("showcase").getByTestId("showcase-panel");87 // The fixtures are released too but have no capture: they are not staged.88 expect(await panels.evaluateAll((els) => els.map((e) => e.getAttribute("data-slug")))).toEqual(SHOWCASE);89 expect([...SHOWCASE].sort()).toEqual(AVAILABLE);90 for (const slug of COMING) await expect(page.getByTestId("showcase").locator(`[data-slug="${slug}"]`)).toHaveCount(0);91 for (const slug of ["astra", "camera"]) {92 const panel = panels.and(page.locator(`[data-slug="${slug}"]`));93 await expect(panel.locator(".status")).toHaveText("Available");94 await expect(panel.getByRole("link", { name: "Learn more" })).toHaveAttribute("href", `/apps/${slug}`);95 expect(await panel.locator(".showcase-stage img").first().getAttribute("src")).toContain(encodeURIComponent(`/apps/${slug}/`));96 }97 // A real action only where its destination is verified: the App Store page, never a download that is not mirrored here.98 await expect(panels.and(page.locator('[data-slug="camera"]')).getByRole("link", { name: "View on the App Store" })).toHaveAttribute("href", APP_STORE.camera);99 await expect(page.getByTestId("showcase").locator('a[href^="/download/"], a[href*="testflight.apple.com"]')).toHaveCount(0);100 });101 test("line-up: one section per device family, in editorial order, with honest statuses and actions", async ({ page }) => {102 await page.goto("/");103 const mac = page.getByTestId("lineup-mac"), mobile = page.getByTestId("lineup-mobile");104 await expect(mac.getByRole("heading", { level: 2 })).toContainText(`${MAC_LINEUP.length + FIXTURES.mac.length} apps for the Mac.`);105 await expect(mobile.getByRole("heading", { level: 2 })).toContainText(`${MOBILE_LINEUP.length + FIXTURES.ios.length} apps for iPhone and iPad`);106 await expect(mac.getByTestId("app-card")).toHaveCount(MAC_LINEUP.length + FIXTURES.mac.length);107 await expect(mobile.getByTestId("app-card")).toHaveCount(MOBILE_LINEUP.length + FIXTURES.ios.length);108 expect(await realSlugs(mac.getByTestId("app-card"))).toEqual(MAC_LINEUP);109 expect(await realSlugs(mobile.getByTestId("app-card"))).toEqual(MOBILE_LINEUP);110 const card = (family: typeof mac, slug: string) => family.locator(`[data-testid="app-card"][data-slug="${slug}"]`);111 // A coming-soon application says so, shows no version and offers nothing to install.112 for (const slug of COMING.filter((s) => MOBILE_LINEUP.includes(s))) {113 await expect(card(mobile, slug).locator(".status"), slug).toHaveText("Coming Soon");114 await expect(card(mobile, slug).locator(".tag").filter({ hasText: /^v\d/ }), slug).toHaveCount(0);115 await expect(card(mobile, slug).getByRole("link", { name: /Download|TestFlight|App Store/ }), slug).toHaveCount(0);116 }117 // ORIX Astra is in both families, with the status of each: released for Mac, to come on iPhone.118 await expect(card(mac, "astra").locator(".status")).toHaveText("Available");119 await expect(card(mobile, "astra").locator(".status")).toHaveText("Coming Soon");120 await expect(card(mac, "astra").locator(".tag").filter({ hasText: /^v\d/ })).toHaveCount(1);121 await expect(card(mobile, "astra").locator(".tag").filter({ hasText: /^v\d/ })).toHaveCount(0);122 // ORIX Navigator too: a beta for Mac, coming soon on iPhone and iPad, where it offers nothing to install.123 await expect(card(mac, "navigator").locator(".status")).toHaveText("Available");124 await expect(card(mobile, "navigator").locator(".status")).toHaveText("Coming Soon");125 await expect(card(mobile, "navigator").locator(".tag").filter({ hasText: /^v\d/ })).toHaveCount(0);126 await expect(card(mobile, "navigator").getByRole("link", { name: /Download|TestFlight|App Store/ })).toHaveCount(0);127 for (const slug of MAC_LINEUP.filter((s) => AVAILABLE.includes(s))) await expect(card(mac, slug).locator(".status"), slug).toHaveText("Available");128 // The released iPhone apps lead to their App Store page; no real Mac app offers an image this site has not verified.129 for (const [slug, url] of Object.entries(APP_STORE)) {130 await expect(card(mobile, slug).locator(".status"), slug).toHaveText("Available");131 await expect(card(mobile, slug).getByRole("link", { name: "View on the App Store" }), slug).toHaveAttribute("href", url);132 }133 await expect(mobile.getByRole("link", { name: "View on the App Store" })).toHaveCount(Object.keys(APP_STORE).length);134 for (const slug of MAC_LINEUP) await expect(card(mac, slug).getByRole("link", { name: /Download|TestFlight|App Store/ }), slug).toHaveCount(0);135 await expect(card(mac, "fixture-mac").getByRole("link", { name: "Download for Mac" })).toHaveAttribute("href", "/download/fixture-mac/1.2.0/ORIXFixture.dmg");136 await expect(card(mobile, "fixture-ios").getByRole("link", { name: "Join TestFlight" })).toHaveAttribute("href", "https://testflight.apple.com/join/E2Efixt1");137 // The icon band between the two families names every application once for assistive technology.138 await expect(page.getByTestId("icon-band")).toBeVisible();139 // The retired applications are gone from the page, in both languages, and from the site.140 for (const path of ["/", "/fr"]) {141 const html = await (await page.request.get(path)).text();142 for (const slug of RETIRED) { expect(html, `${path} ${slug}`).not.toContain(`/apps/${slug}"`); expect(html, `${path} ${slug}`).not.toContain(`data-slug="${slug}"`); }143 expect(html).not.toMatch(/ORIX (DJ|Secure)\b/);144 }145 for (const slug of RETIRED) { await expect(page.locator(`[data-slug="${slug}"], [data-testid="orb-${slug}"]`)).toHaveCount(0); expect((await page.request.get(`/apps/${slug}`)).status(), slug).toBe(404); }146 await page.goto("/fr");147 await expect(page.getByTestId("lineup-mobile").locator('[data-testid="app-card"][data-slug="alarm"] .status')).toHaveText("À venir");148 });149 test("downloads page lists verified images only, with their checksum", async ({ page }) => {150 await page.goto("/downloads");151 await expect(page.getByRole("heading", { level: 1 })).toContainText("Download ORIX for Mac");152 const cards = page.getByTestId("release-card");153 await expect(cards).toHaveCount(1);154 await expect(cards.first()).toHaveAttribute("data-slug", "fixture-mac");155 await expect(cards.first()).toContainText(state().sha);156 await expect(cards.first()).toContainText("Notarized by Apple");157 await page.goto("/fr/downloads");158 await expect(page.getByTestId("release-card").first().getByRole("link", { name: "Télécharger pour Mac" })).toBeVisible();159 expect((await page.request.get("/sitemap.xml").then((r) => r.text()))).toContain("/downloads");160 });161 test("universe: filter dims other platforms, pointing reveals the app, clicking opens its page", async ({ page }) => {162 await page.goto("/");163 const universe = page.getByTestId("universe");164 await universe.scrollIntoViewIfNeeded();165 await page.getByRole("button", { name: "Pause motion" }).click();166 await page.getByTestId("universe-filter-macos").click();167 const macApps = DOCS.filter((d) => d.platforms.includes("macos")).length + FIXTURES.mac.length;168 await expect(page.locator('.orb[data-dim="true"]')).toHaveCount(TOTAL - macApps); // the applications for iPhone and iPad only169 await expect(page.locator('.orb[data-dim="false"]')).toHaveCount(macApps);170 await expect(page.locator(".orb")).toHaveCount(TOTAL);171 await page.getByTestId("orb-monitor").hover();172 await expect(page.getByTestId("universe-detail")).toContainText("ORIX Monitor");173 await expect(page.getByTestId("universe-detail")).toContainText("Available");174 await page.getByTestId("universe-detail").getByRole("link", { name: "Open product page" }).click();175 await expect(page).toHaveURL(/\/apps\/monitor$/);176 });177 test("universe: released applications ride the two inner orbits, the others the outer one", async ({ page }) => {178 await page.goto("/");179 // Each icon follows the ellipse of its orbit; its horizontal radius tells which one (205, 345 or 478).180 const radius = (slug: string) => page.getByTestId(`orb-${slug}`).evaluate((e) => Number(/M (\d+)/.exec((e.closest(".orb") as HTMLElement).style.offsetPath)![1]) - 540);181 for (const slug of AVAILABLE) expect([205, 345], slug).toContain(await radius(slug));182 for (const slug of [...COMING, ...FIXTURES.ios]) expect(await radius(slug), slug).toBe(478);183 const inner = await Promise.all(AVAILABLE.map(radius));184 expect(inner.filter((r) => r === 205).length).toBe(4);185 });186 test("reduced motion: nothing moves, content is fully visible", async ({ browser }) => {187 const ctx = await browser.newContext({ reducedMotion: "reduce" });188 const page = await ctx.newPage();189 await page.goto("/");190 const states = await page.locator(".orb").evaluateAll((els) => els.map((e) => getComputedStyle(e).animationPlayState));191 expect(states.length).toBeGreaterThan(0);192 expect(states.every((s) => s.split(", ").every((x) => x === "paused"))).toBe(true);193 const spread = await page.locator(".orb").evaluateAll((els) => new Set(els.map((e) => Math.round(e.getBoundingClientRect().x))).size);194 expect(spread).toBeGreaterThan(5); // frozen, but still spread around their orbits195 expect(await page.locator(".reveal").first().evaluate((e) => getComputedStyle(e).opacity)).toBe("1");196 await ctx.close();197 });198});199200test.describe("catalog", () => {201 test("lists every application with its real status and no unverified action", async ({ page }) => {202 await page.goto("/apps");203 await expect(page.getByTestId("app-card")).toHaveCount(TOTAL);204 expect(await realSlugs(page.getByTestId("app-card"))).toEqual(REAL);205 for (const slug of REAL) {206 const card = page.locator(`[data-testid="app-card"][data-slug="${slug}"]`);207 await expect(card.getByRole("link", { name: /Download|TestFlight/ }), slug).toHaveCount(0);208 await expect(card.locator(".status"), slug).toHaveText(AVAILABLE.includes(slug) ? "Available" : "Coming Soon");209 // The App Store button exists exactly where the catalogue holds a public App Store page.210 if (APP_STORE[slug]) await expect(card.getByRole("link", { name: "View on the App Store" }), slug).toHaveAttribute("href", APP_STORE[slug]);211 else await expect(card.getByRole("link", { name: /App Store/ }), slug).toHaveCount(0);212 }213 expect(REAL.filter((s) => !AVAILABLE.includes(s))).toEqual(expect.arrayContaining(COMING));214 for (const slug of RETIRED) await expect(page.locator(`[data-slug="${slug}"]`)).toHaveCount(0);215 await expect(page.locator('[data-slug="fixture-mac"]').getByRole("link", { name: "Download for Mac" })).toHaveAttribute("href", "/download/fixture-mac/1.2.0/ORIXFixture.dmg");216 await expect(page.locator('[data-slug="fixture-ios"]').getByRole("link", { name: "Join TestFlight" })).toHaveAttribute("href", "https://testflight.apple.com/join/E2Efixt1");217 });218 test("search, platform, status and sort filters, kept in the address", async ({ page }) => {219 await page.goto("/apps");220 await page.getByLabel("Search apps").fill("orix sonata");221 await expect(page.getByTestId("app-card")).toHaveCount(1);222 await expect(page.getByTestId("app-card")).toHaveAttribute("data-slug", "sonata");223 await expect(page.getByTestId("catalog-count")).toHaveText("1 application");224 await expect(page).toHaveURL(/q=orix(\+|%20)sonata/);225 await page.getByLabel("Search apps").fill("no-such-thing");226 await expect(page.getByTestId("catalog-empty")).toBeVisible();227 await page.getByRole("button", { name: "Clear filters" }).click();228 await page.getByTestId("platform-ios").click();229 await expect(page.getByTestId("app-card")).toHaveCount(MOBILE_LINEUP.length + FIXTURES.ios.length);230 // Status is the application's own: ORIX Astra (released for Mac) and the App Store apps leave, as does the beta fixture.231 const comingOnIos = MOBILE_LINEUP.filter((s) => COMING.includes(s));232 await page.getByTestId("filter-status").selectOption("coming-soon");233 await expect(page.getByTestId("app-card")).toHaveCount(comingOnIos.length);234 await expect(page).toHaveURL(/platform=ios/); await expect(page).toHaveURL(/status=coming-soon/);235 await page.reload(); // the filtered view is a shareable address236 await expect(page.getByTestId("app-card")).toHaveCount(comingOnIos.length);237 expect((await realSlugs(page.getByTestId("app-card"))).sort()).toEqual([...comingOnIos].sort());238 await page.getByTestId("filter-status").selectOption("beta");239 await expect(page.getByTestId("app-card")).toHaveCount(FIXTURES.ios.length); // no real application is a beta any more240 await expect(page.getByTestId("app-card")).toHaveAttribute("data-slug", "fixture-ios");241 await page.goto("/apps?sort=name");242 const names = await page.getByTestId("app-card").locator("h2").allTextContents();243 expect(names).toEqual([...names].sort((a, b) => a.localeCompare(b)));244 await page.locator('[data-slug="audio"] h2 a').click();245 await expect(page).toHaveURL(/\/apps\/audio$/);246 });247});248249test.describe("product pages", () => {250 test("every real application has a complete page and no download or TestFlight link", async ({ page }) => {251 for (const slug of REAL) {252 const res = await page.goto(`/apps/${slug}`);253 expect(res?.status(), slug).toBe(200);254 await expect(page.getByTestId("app-page")).toHaveAttribute("data-slug", slug);255 await expect(page.getByTestId("specs")).toBeVisible();256 // Checked in the page's own sections (the "More from ORIX" cards may show a fixture application).257 const own = page.locator("article > header, #downloads, #changelog");258 expect(await own.locator('a[href^="/download/"]').count(), `${slug} download link`).toBe(0);259 expect(await own.locator('a[href*="testflight.apple.com"]').count(), `${slug} testflight link`).toBe(0);260 const ld = JSON.parse((await page.locator('script[type="application/ld+json"]').first().textContent())!);261 expect(ld["@type"]).toBe("SoftwareApplication");262 for (const k of ["aggregateRating", "review", "offers", "downloadUrl", "softwareVersion"]) expect(ld[k], `${slug} ${k}`).toBeUndefined();263 }264 });265 test("coming-soon application whose public invitation has not been verified by the server shows no link", async ({ page }) => {266 await page.goto("/apps/scan");267 await expect(page.locator("article > header .status").first()).toHaveText("Coming Soon");268 await expect(page.getByTestId("hero-availability")).toHaveText("Coming Soon");269 await expect(page.getByTestId("platform-status")).toHaveCount(0); // one status for every platform: no extra chip270 await expect(page.getByTestId("dl-testflight").getByTestId("tf-unavailable")).toBeVisible();271 await expect(page.getByTestId("changelog")).toContainText("1.0.0");272 await expect(page.getByTestId("verification")).toContainText("Not yet validated on a physical device");273 });274 test("released Mac application whose image is not verified here yet shows no download", async ({ page }) => {275 await page.goto("/apps/monitor");276 await expect(page.getByTestId("hero-availability")).toHaveText("Release Not Available");277 await expect(page.getByTestId("dl-mac-none").getByTestId("dl-unavailable")).toHaveText("Release Not Available");278 await expect(page.getByTestId("changelog")).toContainText("1.0.0");279 });280 test("application released on one platform only says so, per platform", async ({ page }) => {281 await page.goto("/apps/astra");282 await expect(page.locator("article > header .status").first()).toHaveText("Available");283 await expect(page.getByTestId("platform-status")).toHaveCount(1);284 // The chip names the platforms the application really has: ORIX Astra is for iPhone, with no iPad version listed.285 const devices = DOCS.find((d) => d.slug === "astra")!.platforms.includes("ipados") ? "iPhone · iPad" : "iPhone";286 await expect(page.getByTestId("platform-status")).toHaveText(`${devices} — Coming Soon`);287 await expect(page.getByTestId("platform-status")).toHaveAttribute("data-s", "coming-soon");288 // Its Mac image is not mirrored in this database: no download, and no App Store or TestFlight link for the iPhone version to come.289 await expect(page.getByTestId("hero-availability")).toHaveText("Release Not Available");290 await expect(page.locator("article > header, #downloads").locator('a[href*="apps.apple.com"], a[href*="testflight.apple.com"], a[href^="/download/"]')).toHaveCount(0);291 await page.goto("/fr/apps/astra");292 await expect(page.getByTestId("platform-status")).toHaveText(`${devices} — À venir`);293 });294 test("application on the App Store: its page leads there, and nowhere unverified", async ({ page }) => {295 for (const [slug, url] of Object.entries(APP_STORE)) {296 await page.goto(`/apps/${slug}`);297 await expect(page.locator("article > header .status").first(), slug).toHaveText("Available");298 await expect(page.getByTestId("hero-availability"), slug).toHaveCount(0);299 const link = page.locator("article > header").getByRole("link", { name: "View on the App Store" });300 await expect(link, slug).toHaveAttribute("href", url);301 await expect(link, slug).toHaveAttribute("rel", /noopener/);302 await expect(page.locator("#downloads").locator(`a[href="${url}"]`), slug).toHaveCount(1);303 }304 });305 test("gallery: full-screen preview with keyboard navigation", async ({ page }) => {306 await page.goto("/apps/scan");307 const shots = page.getByTestId("shot");308 await expect(shots).toHaveCount(10);309 await shots.first().click();310 const box = page.getByTestId("lightbox");311 await expect(box).toBeVisible();312 await expect(box).toContainText("Screenshot 1 of 10");313 await page.keyboard.press("ArrowRight");314 await expect(box).toContainText("Screenshot 2 of 10");315 await page.keyboard.press("ArrowLeft"); await page.keyboard.press("ArrowLeft");316 await expect(box).toContainText("Screenshot 10 of 10");317 await page.keyboard.press("Escape");318 await expect(box).toBeHidden();319 await expect(shots.first()).toBeFocused();320 });321 test("published macOS image: verified metadata and byte-exact download", async ({ page, request }) => {322 await page.goto("/apps/fixture-mac");323 const panel = page.getByTestId("dl-mac");324 await expect(panel).toContainText("1.2.0");325 await expect(panel).toContainText("Notarized by Apple");326 await expect(page.getByTestId("dl-sha")).toHaveText(state().sha);327 const href = await panel.getByRole("link", { name: "Download for Mac" }).getAttribute("href");328 const res = await request.get(href!);329 expect(res.status()).toBe(200);330 expect(res.headers()["content-disposition"]).toContain("ORIXFixture.dmg");331 const body = await res.body();332 expect(body.length).toBe(state().size);333 expect(createHash("sha256").update(body).digest("hex")).toBe(state().sha);334 const ld = JSON.parse((await page.locator('script[type="application/ld+json"]').first().textContent())!);335 expect(ld.softwareVersion).toBe("1.2.0"); expect(ld.downloadUrl).toContain("/download/fixture-mac/1.2.0/ORIXFixture.dmg");336 });337 test("an unapproved release and unknown paths cannot be downloaded", async ({ request }) => {338 for (const p of ["/download/fixture-review/2.1.0/ORIXReview.dmg", "/download/fixture-mac/1.2.0/..%2F..%2Forix.db", "/download/scan/1.0.0/ORIXScan.dmg", "/media/scan/..%2Forix.db"]) expect((await request.get(p)).status(), p).toBe(404);339 });340 test("open public beta: Join TestFlight with installation steps", async ({ page }) => {341 await page.goto("/apps/fixture-ios");342 const tf = page.getByTestId("dl-testflight");343 await expect(tf.getByRole("link", { name: "Join TestFlight" })).toHaveAttribute("href", "https://testflight.apple.com/join/E2Efixt1");344 await expect(tf.getByRole("link", { name: "Join TestFlight" })).toHaveAttribute("rel", /noopener/);345 await expect(tf).toContainText("Install TestFlight");346 });347 test("compare shows verified attributes side by side", async ({ page }) => {348 await page.goto("/compare?apps=scan,monitor");349 const table = page.getByTestId("compare-table");350 await expect(table.locator("thead th")).toHaveCount(2);351 await expect(table).toContainText("iOS 18.0"); await expect(table).toContainText("macOS 15.0");352 await expect(table).toContainText("Not released"); // the seed carries an invitation but no verification, so nothing is offered353 });354});355356test.describe("languages, appearance, errors", () => {357 test("French-Canadian pages with hreflang and a language switch that keeps the page", async ({ page }) => {358 await page.goto("/fr/apps/scan");359 await expect(page.locator("html")).toHaveAttribute("lang", "fr-CA");360 await expect(page.getByTestId("hero-availability")).toHaveText("À venir");361 await expect(page.locator('link[rel="alternate"][hreflang="en"]')).toHaveAttribute("href", /\/apps\/scan$/);362 await expect(page.locator('link[rel="canonical"]')).toHaveAttribute("href", /\/fr\/apps\/scan$/);363 await page.getByTestId("locale-switch").click();364 await expect(page).toHaveURL(/\/apps\/scan$/);365 await expect(page.locator("html")).toHaveAttribute("lang", "en");366 expect((await page.request.get("/en/apps", { maxRedirects: 0 })).status()).toBe(308);367 });368 test("light and dark appearance follow the system and the toggle, and persist", async ({ browser }) => {369 const ctx = await browser.newContext({ colorScheme: "light" });370 const page = await ctx.newPage();371 await page.goto("/");372 const bg = () => page.evaluate(() => getComputedStyle(document.documentElement).backgroundColor);373 expect(await bg()).toBe("rgb(245, 245, 242)");374 await page.getByTestId("theme-toggle").click();375 expect(await bg()).toBe("rgb(6, 7, 10)");376 await page.reload();377 expect(await bg()).toBe("rgb(6, 7, 10)");378 await ctx.close();379 });380 test("unknown pages answer 404 in the right language", async ({ page }) => {381 expect((await page.goto("/apps/nope"))?.status()).toBe(404);382 await expect(page.getByTestId("not-found")).toContainText("not in orbit");383 expect((await page.goto("/fr/nope"))?.status()).toBe(404);384 await expect(page.getByTestId("not-found")).toContainText("pas en orbite");385 });386 test("keyboard: skip link first, then navigation", async ({ page }) => {387 await page.goto("/");388 await page.keyboard.press("Tab");389 await expect(page.getByRole("link", { name: "Skip to content" })).toBeFocused();390 await page.keyboard.press("Tab");391 await expect(page.getByRole("link", { name: "ORIX", exact: true })).toBeFocused();392 });393});394395test.describe("SEO and security", () => {396 test("sitemap, robots, metadata", async ({ page, request }) => {397 const sitemap = await (await request.get("/sitemap.xml")).text();398 for (const slug of REAL) { expect(sitemap).toContain(`/apps/${slug}</loc>`); expect(sitemap).toContain(`/fr/apps/${slug}</loc>`); }399 for (const slug of RETIRED) expect(sitemap, slug).not.toContain(`/apps/${slug}</loc>`);400 const robots = await (await request.get("/robots.txt")).text();401 expect(robots).toContain("Disallow: /admin"); expect(robots).toContain("Sitemap:");402 await page.goto("/apps/calc");403 await expect(page).toHaveTitle(/ORIX Calc — .+ · ORIX/);404 expect((await page.locator('meta[name="description"]').getAttribute("content"))!.length).toBeGreaterThan(40);405 await expect(page.locator('meta[property="og:image"]')).toHaveAttribute("content", /opengraph-image/);406 expect(await page.locator("h1").count()).toBe(1);407 });408 test("security headers and a CSP without third parties", async ({ request }) => {409 const h = (await request.get("/")).headers();410 expect(h["content-security-policy"]).toContain("default-src 'self'");411 expect(h["content-security-policy"]).toContain("frame-ancestors 'none'");412 expect(h["content-security-policy"]).not.toMatch(/https?:\/\//);413 expect(h["x-content-type-options"]).toBe("nosniff"); expect(h["x-frame-options"]).toBe("DENY");414 expect(h["strict-transport-security"]).toContain("max-age="); expect(h["referrer-policy"]).toBe("strict-origin-when-cross-origin");415 expect(h["x-powered-by"]).toBeUndefined(); expect(h["set-cookie"]).toBeUndefined();416 });417 test("pages load nothing from another origin", async ({ page }) => {418 const foreign: string[] = [];419 page.on("request", (r) => { const u = new URL(r.url()); if (u.protocol.startsWith("http") && u.host !== "localhost:8841") foreign.push(r.url()); });420 for (const p of ["/", "/apps", "/apps/audio", "/ecosystem"]) await page.goto(p, { waitUntil: "networkidle" });421 expect(foreign).toEqual([]);422 });423 test("webhook and admin API refuse unauthenticated requests; health is public", async ({ request }) => {424 expect((await request.post("/api/hooks/release", { data: { repo: "orix-scan" } })).status()).toBe(401);425 expect((await request.get("/api/admin/apps")).status()).toBe(401);426 expect((await request.post("/api/admin/sync", { data: {} })).status()).toBe(401);427 const health = await request.get("/api/health");428 expect(health.status()).toBe(200); expect((await health.json()).status).toBe("ok");429 });430});431432test.describe("accessibility (axe, WCAG 2.1 A/AA)", () => {433 for (const [path, scheme] of [["/", "dark"], ["/", "light"], ["/apps", "dark"], ["/apps/scan", "dark"], ["/apps/scan", "light"], ["/apps/sheet", "dark"], ["/ecosystem", "light"], ["/compare", "dark"], ["/whats-new", "light"], ["/fr/apps/audio", "dark"]] as const) {434 test(`${path} (${scheme})`, async ({ browser }) => {435 const ctx = await browser.newContext({ colorScheme: scheme, reducedMotion: "reduce" });436 const page = await ctx.newPage();437 await page.goto(path, { waitUntil: "networkidle" });438 const r = await new AxeBuilder({ page }).withTags(["wcag2a", "wcag2aa", "wcag21a", "wcag21aa"]).analyze();439 expect(r.violations.map((v) => `${v.id}: ${v.nodes.length} — ${v.nodes[0].target} — ${v.nodes[0].failureSummary?.split("\n")[1]}`)).toEqual([]);440 await ctx.close();441 });442 }443});444445test.describe("legal pages", () => {446 for (const [path, kind, title] of [["/privacy", "privacy", "Privacy Policy"], ["/terms", "terms", "Terms of Service"], ["/fr/privacy", "privacy", "Politique de confidentialité"], ["/fr/terms", "terms", "Conditions d’utilisation"]] as const) {447 test(`${path} names the publisher and every contact address`, async ({ page }) => {448 await page.goto(path);449 const doc = page.getByTestId(`legal-${kind}`);450 await expect(doc.getByRole("heading", { level: 1 })).toHaveText(title);451 await expect(doc).toContainText("Simon-Pierre Boucher");452 await expect(page.getByTestId("legal-date")).toBeVisible();453 for (const user of ["contact", "info", "support", "dev", "admin"]) await expect(page.getByTestId("legal-contacts").locator(`a[href="mailto:${user}@spboucher.ai"]`)).toHaveCount(1);454 // Every entry of the table of contents leads to a section of the page.455 const anchors = await doc.locator("nav ol a").evaluateAll((as) => as.map((a) => a.getAttribute("href")!.slice(1)));456 expect(anchors.length).toBeGreaterThan(14);457 for (const id of anchors) await expect(doc.locator(`section#${id}`)).toHaveCount(1);458 });459 }460 test("the footer links to both documents", async ({ page }) => {461 await page.goto("/");462 const footer = page.locator("footer");463 await expect(footer.locator('a[href="/privacy"]').first()).toBeVisible();464 await expect(footer.locator('a[href="/terms"]').first()).toBeVisible();465 });466});467468test.describe("support our work", () => {469 test("the tab leads to seven wallet cards whose code, address and explorer agree", async ({ page, request }) => {470 await page.goto("/");471 await page.getByTestId("nav-support").click();472 await expect(page).toHaveURL(/\/support$/);473 const cards = page.getByTestId("wallet-card");474 await expect(cards).toHaveCount(7);475 const ids = await cards.evaluateAll((els) => els.map((e) => (e as HTMLElement).dataset.wallet));476 expect(ids).toEqual(["bitcoin", "ethereum", "base", "bnb", "litecoin", "dogecoin", "bitcoin-cash"]);477 for (const id of ids) {478 const card = page.locator(`[data-wallet="${id}"]`);479 const address = (await card.getByTestId("wallet-address").textContent())!.trim();480 expect(address.length).toBeGreaterThan(25);481 // The explorer link is for the very address printed on the card.482 const explorer = await card.locator('a[target="_blank"]').getAttribute("href");483 expect(explorer).toContain(address.replace("bitcoincash:", ""));484 // The code is a real, well-formed SVG served by the site.485 const res = await request.get(`/support/qr-${id}.svg`);486 expect(res.status()).toBe(200);487 const svg = await res.text();488 expect(svg.startsWith("<svg")).toBe(true);489 expect(svg.trimEnd().endsWith("</svg>")).toBe(true);490 await expect(card.locator(`img[src="/support/qr-${id}.svg"]`)).toHaveJSProperty("complete", true);491 expect(await card.locator(`img[src="/support/qr-${id}.svg"]`).evaluate((i: HTMLImageElement) => i.naturalWidth)).toBeGreaterThan(0);492 }493 // The three EVM networks share one address.494 const evm = await Promise.all(["ethereum", "base", "bnb"].map((id) => page.locator(`[data-wallet="${id}"]`).getByTestId("wallet-address").textContent()));495 expect(new Set(evm).size).toBe(1);496 });497 test("French page and footer link", async ({ page }) => {498 await page.goto("/fr/support");499 await expect(page.getByTestId("support-page").getByRole("heading", { level: 1 })).toContainText("Offrez le don de votre choix.");500 await expect(page.locator('footer a[href="/fr/support"]')).toHaveCount(1);501 });502});503