fix(POSTV1-02): 修复便携版网页入口门禁
Dada P0-A isolated Windows CI / validate-and-package (push) Waiting to run

This commit is contained in:
suyx
2026-08-05 12:58:28 +08:00
parent fd0003a804
commit 99fd3b1802
5 changed files with 47 additions and 12 deletions
+9 -7
View File
@@ -125,18 +125,20 @@ test("portable package serves the product and keeps SQLite data across API resta
let api = startApi(configPath, dataRoot);
try {
await waitForHealth(api);
const initialPage = await fetch(`http://127.0.0.1:${port}/`, { headers: { host: `127.0.0.1:${port}` } });
assert.equal(initialPage.status, 200);
assert.match(await initialPage.text(), /当前浏览器无法使用 Dada/);
const support = await fetch(`http://127.0.0.1:${port}/api/v1/support/check`, {
method: "POST",
headers: { host: `127.0.0.1:${port}`, origin: `http://127.0.0.1:${port}`, "content-type": "application/json", "sec-ch-ua": '"Google Chrome";v="150"', "sec-ch-ua-full-version-list": '"Google Chrome";v="150.0.0.0"', "sec-ch-ua-platform": '"Windows"' },
body: JSON.stringify({ brands: [{ brand: "Google Chrome", version: "150" }], full_version_list: [{ brand: "Google Chrome", version: "150.0.0.0" }], platform: "Windows" }),
});
assert.ok([200, 426].includes(support.status));
if (support.status === 200) {
const cookie = support.headers.get("set-cookie")?.split(";", 1)[0];
const page = await fetch(`http://127.0.0.1:${port}/app`, { headers: { host: `127.0.0.1:${port}`, cookie } });
assert.equal(page.status, 200);
assert.match(await page.text(), /<div id="root"><\/div>/);
}
assert.equal(support.status, 200);
const cookie = support.headers.get("set-cookie")?.split(";", 1)[0];
assert.ok(cookie);
const page = await fetch(`http://127.0.0.1:${port}/app`, { headers: { host: `127.0.0.1:${port}`, cookie, "sec-ch-ua": '"Google Chrome";v="150"' } });
assert.equal(page.status, 200);
assert.match(await page.text(), /<div id="root"><\/div>/);
assert.ok(existsSync(join(dataRoot, "db", "dada.sqlite3")));
await verifyWorkerStartup(configPath);
} finally {