Files
magpie/internal/gui/tests/about-website.test.cjs
T
yetone 97332140ae settings: About links the website, usemagpie.ai
About had Discord and GitHub but nothing pointing to usemagpie.ai (the
owner, with a screenshot). A Website row above Community names the
site and its Open opens it; en, zh, zh-TW, ja and de.

app.js grows 213 bytes (budgets 1,310,460 and 1,526,556, said in
core_budget_test.go), Settings' own row, with no room added.

Run at this head (origin/main + this):
- go test ./internal/gui/: ok.
- GUI, chromium + webkit: about-website (new, every language at 1100
  and 420), i18n-keys, public-url-default, settings-sections, cli-path:
  81 pass, 1 fail. The fail is i18n-keys "a plugin's words are its own"
  on "Runs as", red on main since 7f827b3b0, filed as #3897.
- Broken by hand: without the row, about-website is red.
- Looked at in a zh dark screenshot of About.
Not run: the full GUI suite and go test ./...; not tried in the real
app.
2026-10-28 00:07:58 +08:00

40 lines
2.0 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
const assert = require("node:assert/strict");
const { test } = require("node:test");
const { chromium, webkit } = require("playwright");
const { fixture } = require("./fixtures/caller-keys.cjs");
const { openPart } = require("./reader.cjs");
// Settings › About had Discord and GitHub but no link to usemagpie.ai (the
// owner). Its Website row names the site and opens it, in every language and
// at the tray panel's width.
const words = {
en: "Website", zh: "官网", "zh-TW": "官網", ja: "公式サイト", de: "Website",
};
for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", "webkit"])) {
for (const lang of Object.keys(words)) {
for (const width of [1100, 420]) {
test(`${engine} ${lang} ${width}: About links the website`, async (t) => {
const browser = await (engine === "webkit" ? webkit.launch() : chromium.launch({ channel: "chromium" }));
t.after(() => browser.close());
const page = await (await browser.newContext({ viewport: { width, height: 800 }, reducedMotion: "reduce" })).newPage();
page.setDefaultTimeout(6000);
const errors = [];
page.on("pageerror", (e) => errors.push(e.message));
await page.route("**/*", fixture(lang, "light", []));
await page.goto("http://magpie.test/");
await page.locator("#prefs").click();
await openPart(page, "about");
const row = page.locator("#about .row", { has: page.locator(".who", { hasText: words[lang] }) });
await row.waitFor();
assert.equal(await row.locator("code").textContent(), "usemagpie.ai");
const opened = page.waitForRequest((r) => r.url().includes("/api/open"));
await row.locator("button.text").click();
assert.equal(JSON.parse((await opened).postData()).url, "https://usemagpie.ai");
assert.equal(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth), true, "About wider than the window");
assert.deepEqual(errors, []);
});
}
}
}