mirror of
https://github.com/tgeorgiadis/quiver-launcher.git
synced 2026-12-01 17:33:40 -05:00
* Move a folder two library entries share once, and know every Quiver 3 apps folder - Two library entries can point at one folder (a catalog entry renamed, kept beside the one it became). Moving the apps folder, Move to… and sorting into console folders now move it once and record both where it went, instead of the second failing with "No such file or directory" and losing track of the app. - An app in any Quiver 3 apps folder on the computer counts as in an apps folder, though the library brought over doesn't list it (another 3.x copy's), so it moves with that folder instead of being taken for one the player placed. - The data folder's own apps folder is made at start, so Settings no longer says "Not found. Is its drive connected?" before the first app installs. * Link a player's game folder without a command line, and keep their copies through updates - A folder copy is linked with the system call (the junction crate), never through cmd, and a catalog destination can only be plain file names. In the system's folders it must be inside a folder of the app's, and no folder there is moved aside. - A folder inside the place it's linked to, or around it, is refused instead of leaving a broken link; an update never writes through the link into the player's folder. - An update keeps the player's copies, and a move or rename knows where a copy in the app's folder is now. - Try again installs in the folder chosen with Install to…; Report a problem no longer opens after a sign-in long after it was asked for; ticking a filter keeps a pick the list no longer shows. - The nightly live-catalog test finds elements again after the page redraws, and scrolls a card into view before pressing it. * Let a single copy go straight in the system's data folders, as a catalog app needs Super Mario World Remastered Plus reads baserom.sfc from the data folder itself. Only a folder has to be inside a folder of the app's there; a file already in its place is kept beside it, as in the app's folder.
170 lines
9.6 KiB
JavaScript
170 lines
9.6 KiB
JavaScript
/**
|
|
* Against the real catalog (read-only: no account, nothing written to the
|
|
* site). Runs once a day in CI on Linux and Windows (live.yml), where
|
|
* quiverlauncher.com's catalog API is reachable, and reports how fast the
|
|
* catalog shows.
|
|
*/
|
|
import { after, before, test } from "node:test";
|
|
import assert from "node:assert/strict";
|
|
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
import { join } from "node:path";
|
|
import { launch } from "./session.js";
|
|
|
|
let s;
|
|
before(async () => {
|
|
s = await launch({ env: { QUIVER_API: "https://api.quiverlauncher.com/api/v1", QUIVER_CONVEX: "https://convex.quiverlauncher.com" } });
|
|
});
|
|
after(() => s?.close());
|
|
|
|
const cards = () => s.app.execute(() => [...document.querySelectorAll("article")].map((e) => e.dataset.slug));
|
|
|
|
test("the real catalog shows quickly, and all of it pages in", async () => {
|
|
const { app, until } = s;
|
|
await until(async () => (await app.$$("article")).length > 0, 30000);
|
|
// Milliseconds since the page started loading, on the app's own clock.
|
|
console.log(`first ports shown ${Math.round(await app.execute(() => performance.now()))} ms after the page started`);
|
|
// Each page comes as the end of the last nears the screen (the spinner, then Show more, there till the last).
|
|
for (let more = await app.$(".more"); await more.isExisting(); more = await app.$(".more")) {
|
|
const before = (await cards()).length;
|
|
const started = Date.now();
|
|
await app.execute(() => document.querySelector(".more")?.scrollIntoView());
|
|
await until(async () => (await cards()).length > before || !(await app.$(".more").isExisting()), 20000);
|
|
console.log(`next page: ${(await cards()).length} ports after ${Date.now() - started} ms`);
|
|
}
|
|
console.log(`whole catalog for this computer: ${(await cards()).length} ports`);
|
|
await app.execute(() => document.querySelector(".shell > main").scrollTo(0, 0));
|
|
});
|
|
|
|
test("real apps and games open as pages, and going back never blanks the window", async () => {
|
|
const { app, until } = s;
|
|
const page = () => app.$(".page-layer:not([hidden]) .app-page");
|
|
const heading = () => page().then((p) => p.$("h1")).then((h) => h.getText()).catch(() => "");
|
|
const filled = () => app.execute(() => document.getElementById("root").childElementCount > 0);
|
|
// A page that fails shows a message in its place and logs it; neither may happen with real data.
|
|
const problems = async () => {
|
|
const log = join(s.data, "quiver.log");
|
|
const logged = existsSync(log) ? readFileSync(log, "utf8").split("\n").filter((line) => / ui: /.test(line)) : [];
|
|
const shown = await app.execute(() => [...document.querySelectorAll('[role="alert"] h2')].map((h) => h.textContent));
|
|
return [...logged, ...shown];
|
|
};
|
|
await until(async () => (await app.$$("article")).length > 0, 30000);
|
|
// The first few apps of the catalog open, and Back returns to the catalog.
|
|
for (const slug of (await cards()).slice(0, 3)) {
|
|
await (await (await app.$(`article[data-slug="${slug}"]`)).$(".card-open")).click();
|
|
await until(async () => (await heading()) !== "", 20000);
|
|
console.log(`${slug}: page "${await heading()}"`);
|
|
// Its README and repository arrive after the first paint.
|
|
await new Promise((r) => setTimeout(r, 2000));
|
|
assert.deepEqual(await problems(), [], `${slug}'s page hit a problem`);
|
|
await (await (await page()).$("button.back-link")).click();
|
|
await (await app.$(`article[data-slug="${slug}"]`)).waitForDisplayed({ timeout: 10000 });
|
|
assert.ok(await filled(), `the window went blank after ${slug}`);
|
|
}
|
|
// As on quiverlauncher.com: searching "mario" shows Mario's Tennis among the games, with its page.
|
|
// Found again each time: the search's results are drawn anew as they arrive and when the page over them closes,
|
|
// and the one from before isn't in the window any more.
|
|
const box = () => app.$("input[placeholder^=Search]");
|
|
const game = () => app.$('.search-games button[data-game="marios-tennis"]');
|
|
const shown = (el) => el().then((e) => e.isDisplayed()).catch(() => false);
|
|
await (await box()).setValue("mario");
|
|
await until(() => shown(game), 20000);
|
|
await until(async () => /Mario's Tennis[\s\S]*ways? to play →/.test(await (await game()).getText().catch(() => "")), 10000);
|
|
await (await game()).click();
|
|
await until(async () => (await heading()) === "Mario's Tennis", 20000);
|
|
await (await (await page()).$(".catalog-grid article")).waitForDisplayed({ timeout: 20000 });
|
|
assert.match(await (await (await page()).$(".detail-tags")).getText(), /Virtual Boy/);
|
|
const ways = await app.execute(() => [...document.querySelectorAll(".game-page article")].map((a) => a.dataset.slug));
|
|
console.log(`Mario's Tennis: ${ways.join(", ")}`);
|
|
assert.ok(ways.includes("marios-tennis-mariotennisvirtualboyrecomp"));
|
|
// One of its apps, with its README from the site, then back through the game to the search.
|
|
await (await (await app.$('.game-page article[data-slug="marios-tennis-mariotennisvirtualboyrecomp"]')).$(".card-open")).click();
|
|
await until(async () => (await heading()) === "MarioTennisVirtualBoyRecomp", 20000);
|
|
await (await (await page()).$(".readme")).waitForDisplayed({ timeout: 20000 });
|
|
await (await (await page()).$("button.back-link")).click();
|
|
await until(async () => (await heading()) === "Mario's Tennis", 20000);
|
|
await (await (await page()).$("button.back-link")).click();
|
|
await until(() => shown(game), 10000);
|
|
assert.ok(await filled());
|
|
await (await box()).click();
|
|
await app.keys(["Control", "a"]);
|
|
await app.keys("Backspace");
|
|
await until(async () => !(await app.$(".search-games").isExisting()), 20000);
|
|
assert.deepEqual(await problems(), []);
|
|
});
|
|
|
|
test("a real app's player feedback shows as on the website", async () => {
|
|
const { app, until } = s;
|
|
const box = await app.$("input[placeholder^=Search]");
|
|
await box.setValue("ConkerBFDReloaded");
|
|
const card = await app.$('article[data-slug="conker-s-bad-fur-day-conkerbfdreloaded"]');
|
|
await card.waitForDisplayed({ timeout: 20000 });
|
|
await (await card.$(".card-open")).click();
|
|
const page = () => app.$(".page-layer:not([hidden]) .app-page");
|
|
// Its Player feedback tab, with the count the website shows.
|
|
let count = "";
|
|
await until(async () => {
|
|
for (const t of await (await page()).$$("button[role=tab]")) {
|
|
const label = await t.getText();
|
|
if (label.startsWith("Player feedback")) return (count = label.replace("Player feedback", "").trim()), await t.click(), true;
|
|
}
|
|
return false;
|
|
}, 20000);
|
|
const reviews = () =>
|
|
app.execute(() => [...document.querySelectorAll(".page-layer:not([hidden]) .feedback article.review")].map((r) => r.querySelector(".review-author strong").textContent));
|
|
await until(async () => (await reviews()).length >= 2, 20000);
|
|
console.log(`ConkerBFDReloaded: ${count} on the tab, ${(await reviews()).length} shown (${(await reviews()).join(", ")})`);
|
|
assert.ok(Number(count) >= 2);
|
|
await app.keys("Escape");
|
|
await box.click();
|
|
await app.keys(["Control", "a"]);
|
|
await app.keys("Backspace");
|
|
// The whole catalog back, or the next test picks from what's left of the search.
|
|
await until(async () => (await cards()).length > 1, 20000);
|
|
});
|
|
|
|
test("Add then Install installs verified ports, and Play starts one", async () => {
|
|
const { app, until } = s;
|
|
const results = [];
|
|
for (const slug of (await cards()).slice(0, 8)) {
|
|
// Found again each time: the card is drawn anew as the download goes, and an old one never shows Play.
|
|
const card = () => app.$(`article[data-slug="${slug}"]`);
|
|
// In the middle of the window first: a card under the top bar, or beside the last one's error, can't be clicked.
|
|
const press = async (button) => {
|
|
await app.execute((el) => el.scrollIntoView({ block: "center" }), button);
|
|
await button.click();
|
|
};
|
|
const add = await (await card()).$("button=Add");
|
|
if (!(await add.isExisting())) continue;
|
|
await press(add);
|
|
// In the library now: Install takes Add's place.
|
|
await until(async () => (await (await card()).$("button=Install")).isExisting(), 10000);
|
|
const get = await (await card()).$("button=Install");
|
|
const started = Date.now();
|
|
await press(get);
|
|
// Wait for Play, an error, or a choice between files.
|
|
await until(async () => {
|
|
const choose = await app.$('[role="dialog"][aria-label="Choose a download"] button');
|
|
if (await choose.isExisting()) await choose.click();
|
|
return (await (await card()).$("button*=Play").isExisting()) || (await (await card()).$('[role="alert"]').isExisting());
|
|
}, 300000);
|
|
const error = await (await card()).$('[role="alert"] p');
|
|
const outcome = (await error.isExisting()) ? await error.getText() : "installed";
|
|
console.log(`${slug}: ${outcome} (${Math.round((Date.now() - started) / 1000)} s)`);
|
|
results.push({ slug, outcome });
|
|
assert.doesNotMatch(outcome, /doesn't match the file Quiver checked/, `${slug} failed its checksum`);
|
|
if (results.filter((r) => r.outcome === "installed").length >= 2) break;
|
|
}
|
|
assert.ok(results.some((r) => r.outcome === "installed"), JSON.stringify(results));
|
|
const installed = readdirSync(s.apps).filter((d) => existsSync(join(s.apps, d, ".quiver-version")));
|
|
console.log(`installed folders: ${installed.join(", ")}`);
|
|
assert.ok(installed.length > 0);
|
|
|
|
// Play the first one: it starts without the launcher reporting a problem.
|
|
const played = await app.$(`article[data-slug="${results.find((r) => r.outcome === "installed").slug}"]`);
|
|
await (await played.$("button*=Play")).click();
|
|
await new Promise((r) => setTimeout(r, 3000));
|
|
const problem = await played.$('[role="alert"] p');
|
|
assert.ok(!(await problem.isExisting()), (await problem.isExisting()) ? await problem.getText() : "");
|
|
console.log("Play started it");
|
|
});
|