why.e2e.ts
This file
Path
apps/web/e2e/why.e2e.ts
69 lines · 2.0 KiB · TypeScript
Last changed by
Merge build/comments-web-rest into mainoscabrielbefore adoption0eb1248
History of this fileTake it
Merge branch 'build/912-why-per-line'oscabrielbefore adoption635c3c7
line 1why, one step back1import { expect, test } from "@playwright/test";Default the deployed why check to burrow's own opening's fileoscabrielbefore adoption4a23695
line 2why, one step back2import { Brand } from "@repo/brand";Merge build/1499-w14-integration into mainoscabrielbefore adoptioncb4fcca
line 3why, one step back3import { ProjectName } from "@repo/protocol/ids";Merge branch 'build/912-why-per-line'oscabrielbefore adoption635c3c7
lines 4–7why, one step back4import { Config, Effect, Option } from "effect";56const settings = Effect.runSync(7 Effect.gen(function* () {Merge build/1499-w14-integration into mainoscabrielbefore adoptioncb4fcca
lines 8–9why, one step back8 const project = yield* Config.schema(ProjectName, "WEB_PROJECT").pipe(9 Config.withDefault(ProjectName.make("oscabriel/datekit"))Default the deployed why check to burrow's own opening's fileoscabrielbefore adoption4a23695
lines 10–11why, one step back10 );11Merge branch 'build/912-why-per-line'oscabrielbefore adoption635c3c7
lines 12–13why, one step back12 return {13 path: yield* Config.NonEmptyString("WEB_WHY_PATH").pipe(Default the deployed why check to burrow's own opening's fileoscabrielbefore adoption4a23695
line 14why, one step back14 Config.withDefault(Merge build/1499-w14-integration into mainoscabrielbefore adoptioncb4fcca
line 15why, one step back15 project === "oscabriel/burrow"Default the deployed why check to burrow's own opening's fileoscabrielbefore adoption4a23695
lines 16–18why, one step back16 ? `${Brand.configDir}/asks/drop-legacy-fetch.ask.ts`17 : "src/format.ts"18 )Merge branch 'build/912-why-per-line'oscabrielbefore adoption635c3c7
line 19why, one step back19 ),Default the deployed why check to burrow's own opening's fileoscabrielbefore adoption4a23695
line 20why, one step back20 project,Merge branch 'build/912-why-per-line'oscabrielbefore adoption635c3c7
lines 21–40why, one step back21 web: Option.map(22 yield* Config.option(Config.NonEmptyString("WEB_URL")),23 (url) => url.replace(/\/+$/u, "")24 ),25 };26 })27);2829const { path, project } = settings;3031const out = decodeURIComponent(new URL("out/", import.meta.url).pathname);3233const UNREACHABLE = "The platform did not answer";3435test.describe("the deployed why page", () => {36 test.skip(37 Option.isNone(settings.web),38 "WEB_URL is not set: point it at a deployed web's origin to run this check"39 );40Merge build/1002oscabrielbefore adoption1a364b9
line 41why, one step back41 test(`${project}'s ${path} names the landing behind its lines, with the ask it links`, ({Merge branch 'build/912-why-per-line'oscabrielbefore adoption635c3c7
lines 42–69why, one step back42 page: browser,43 }) =>44 Effect.runPromise(45 Effect.gen(function* () {46 const web = Option.getOrElse(settings.web, () => "");4748 const response = yield* Effect.promise(() =>49 browser.goto(`${web}/${project}/why/main/${path}`)50 );5152 expect(response?.status()).toBe(200);5354 yield* Effect.promise(() =>55 expect(56 browser.locator(`[data-range] a[href^="/${project}/asks/"]`).first()57 ).toBeVisible()58 );5960 yield* Effect.promise(() =>61 expect(browser.getByText(UNREACHABLE)).toHaveCount(0)62 );6364 yield* Effect.promise(() =>65 browser.screenshot({ fullPage: true, path: `${out}why.png` })66 );67 })68 ));69});