Site: read the newest version from Gitea; links follow releases/latest [skip ci]

A worker answers /release.json from the Gitea API (Gitea sends no
CORS headers, so the page cannot ask it directly).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ZacharyZhang-NYandClaude Opus 5.5 committed 2026-10-13 13:35:58 -04:00
1 parent 48306fcd16
commit 87c42fde0e
14 files changed
+76 -16

No files matched your search

+1 -1
View File
@@ -1,4 +1,4 @@
import { expect, test, type Page } from "@playwright/test";
import { expect, test, type Page } from "./fixtures.ts";
const PAGE = "/";
+16
View File
@@ -0,0 +1,16 @@
import { test as base } from "@playwright/test";
export { expect, type Page } from "@playwright/test";
export const VERSION = "9.9.9";
// Every page reads this version.
export const test = base.extend<{ release: void }>({
release: [
async ({ context }, use) => {
await context.route("**/release.json", (r) => r.fulfill({ json: { version: VERSION } }));
await use();
},
{ auto: true },
],
});
+1 -1
View File
@@ -1,4 +1,4 @@
import { expect, test, type Page } from "@playwright/test";
import { expect, test, type Page } from "./fixtures.ts";
const PAGE = "/";
const DESK = { light: "rgb(230, 230, 226)", dark: "rgb(58, 58, 58)" };
+1 -1
View File
@@ -1,4 +1,4 @@
import { expect, test, type Page } from "@playwright/test";
import { expect, test, type Page } from "./fixtures.ts";
const TREE = "Open a Markdown file's history in ElyTree.";
+1 -1
View File
@@ -1,4 +1,4 @@
import { expect, test, type Page } from "@playwright/test";
import { expect, test, type Page } from "./fixtures.ts";
const APPS = ["ElyDoc", "ElyTable", "ElyShow", "ElyPDF", "ElyTree", "ElyMark"];
+16 -2
View File
@@ -1,9 +1,9 @@
import { expect, test, type Page } from "@playwright/test";
import { expect, test, VERSION, type Page } from "./fixtures.ts";
import { TEXT, type Key, type Lang } from "../src/text.ts";
const REPO = "https://git.zacharyzhang.com/ZacharyZhang-NY/ElyOffice";
const APPS = ["ElyDoc", "ElyTable", "ElyShow", "ElyPDF", "ElyTree", "ElyMark"];
const RELEASES = `${REPO}/releases/tag/v0.1.4`;
const RELEASES = `${REPO}/releases/latest`;
test.use({ reducedMotion: "reduce" });
@@ -93,6 +93,20 @@ test.describe("English locale", () => {
expect(files).toEqual([]);
});
test("the download area names the newest version", async ({ page }) => {
await page.goto("/");
await expect(page.locator("#download h2")).toHaveText(`Ely Office ${VERSION}`);
});
test("a failed version read shows as an error", async ({ page }) => {
await page.route("**/release.json", (r) => r.fulfill({ status: 502, body: "Gitea answered 500" }));
await page.goto("/");
await expect.poll(() => errors.length).toBe(1);
expect(errors[0]).toContain("Gitea answered 500");
await expect(page.locator("#download h2")).toHaveText("Ely Office");
errors = [];
});
test("every external link answers @net", async ({ page, request }) => {
await page.goto("/");
const hrefs = await page.locator("a[href^='http']").evaluateAll((as) => as.map((a) => (a as HTMLAnchorElement).href));
+1 -1
View File
@@ -1,4 +1,4 @@
import { expect, test, type Page } from "@playwright/test";
import { expect, test, type Page } from "./fixtures.ts";
const CELL = 28;
const APPS = ["ElyDoc", "ElyTable", "ElyShow", "ElyPDF", "ElyTree", "ElyMark"];
+1 -1
View File
@@ -1,4 +1,4 @@
import { expect, test, type Page } from "@playwright/test";
import { expect, test, type Page } from "./fixtures.ts";
const APPS = ["ElyDoc", "ElyTable", "ElyShow", "ElyPDF", "ElyTree", "ElyMark"];