landing.e2e.ts
This file
Path
apps/web/e2e/landing.e2e.ts
77 lines · 2.2 KiB · TypeScript
Last changed by
Merge build/comments-web-rest into mainoscabrielbefore adoption0eb1248
History of this fileTake it
Merge build/1311-landing into mainoscabrielbefore adoption18b5418
lines 1–20why, one step back1import { expect, test } from "@playwright/test";2import { Config, Effect, Option } from "effect";34import { axeOn, sideways } from "./axe.ts";56const web = Effect.runSync(7 Config.option(Config.NonEmptyString("WEB_URL")).pipe(8 Effect.map(Option.map((url) => url.replace(/\/+$/u, "")))9 )10);1112const at = (path: string) => `${Option.getOrElse(web, () => "")}${path}`;1314const NARROWEST = 360;1516test.describe("the landing", () => {17 test.skip(18 Option.isNone(web),19 "WEB_URL is not set: point it at a web's origin to run this check"20 );Merge build/landing-ceiling into mainoscabrielbefore adoption1b5d02e
line 21why, one step back21Merge build/comments-web-rest into mainoscabrielbefore adoption0eb1248
line 22why, one step back22 // A platform with no project yet sends an empty list, which is a page of its own.Merge build/landing-ceiling into mainoscabrielbefore adoption1b5d02e
lines 23–35why, one step back23 test("names its projects in the page as sent, before any script runs", ({24 page,25 }) =>26 Effect.runPromise(27 Effect.gen(function* () {28 const response = yield* Effect.promise(() => page.request.get(at("/")));29 const html = yield* Effect.promise(() => response.text());3031 expect(response.status()).toBe(200);32 expect(html).toMatch(/data-project="[^"]+"/u);33 expect(html).toMatch(/data-posture="[^"]+"/u);34 })35 ));Merge build/1311-landing into mainoscabrielbefore adoption18b5418
lines 36–77why, one step back3637 test("leads to the open asks", ({ page }) =>38 Effect.runPromise(39 Effect.gen(function* () {40 yield* Effect.promise(() => page.goto(at("/")));4142 yield* Effect.promise(() =>43 page.getByRole("link", { name: "See the open asks" }).click()44 );4546 yield* Effect.promise(() => page.waitForURL(at("/asks")));4748 yield* Effect.promise(() =>49 expect(50 page.getByRole("heading", { level: 1, name: "Open asks" })51 ).toBeVisible()52 );53 })54 ));5556 for (const scheme of ["light", "dark"] as const) {57 test(`fits ${NARROWEST} px with no serious violation, ${scheme}`, ({58 page,59 }) =>60 Effect.runPromise(61 Effect.gen(function* () {62 yield* Effect.promise(() =>63 page.setViewportSize({ height: 900, width: NARROWEST })64 );6566 yield* Effect.promise(() =>67 page.emulateMedia({ colorScheme: scheme })68 );6970 yield* Effect.promise(() => page.goto(at("/")));7172 expect(yield* sideways(page)).toBe(0);73 expect(yield* axeOn(page)).toStrictEqual([]);74 })75 ));76 }77});