Files
quiver-launcher/e2e/web/startup-failure.test.js
T
Thomas Georgiadis ba7c6c34cf Report failed installs, launches and updates, and startup errors, to Sentry (#293)
Sentry only saw uncaught errors in the window once the launcher had fully
started. Failures players were told about never reached it, and neither did
anything from a launch that stopped early.

Failures installing, launching, reinstalling or uninstalling an app, or
updating the launcher, are now reported with what was being done. Those that
aren't the launcher's to fix aren't: no connection, a service that's down or
limiting requests, a full disk, or a message already worded for the player.

Errors from before the player's choices are known wait in memory until they
are. A launch that can't get that far, or opens on Recovery, sends them only
if usage data was allowed the last time the launcher ran, which turning it off
clears, so nothing goes on a first launch.

Saved state that can't be loaded now shows the last-resort message instead of
a blank window. quiver.log also keeps the message on WebKit, whose stacks leave
it out, and the usage data doc lists the events it was missing.
2026-11-04 20:54:15 +11:00

33 lines
1.4 KiB
JavaScript

/**
* A launch that can't get as far as the launcher itself: a message and a way on, never a blank window.
*/
import { after, test } from "node:test";
import assert from "node:assert/strict";
import { openApp, stop } from "./app.js";
after(stop);
test("saved state that can't be loaded shows the problem and a way to reload, and it's written to the log", async () => {
const s = await openApp({ state: { stateFailure: "The data folder can't be read." }, ready: '[role="alert"]' });
try {
const alert = s.page.locator('[role="alert"]');
assert.match(await alert.innerText(), /Quiver Launcher hit a problem/);
assert.match(await alert.innerText(), /The data folder can't be read\./);
await alert.getByRole("button", { name: "Reload" }).waitFor();
const logged = await s.page.evaluate(() => window.__calls.filter((c) => c.cmd === "log_error").map((c) => c.args.message));
assert.ok(logged.some((m) => m.includes("The data folder can't be read.")), "in quiver.log");
} finally {
await s.close();
}
});
test("a damaged saved file still opens on Recovery", async () => {
const s = await openApp({ state: { stateProblems: [{ name: "library", problem: "damaged" }] }, ready: ".recovery" });
try {
assert.match(await s.page.locator(".recovery").innerText(), /The file with your library is damaged\./);
assert.deepEqual(s.errors, []);
} finally {
await s.close();
}
});