Drive the first-run experience in a real browser
e2e-setup-browser.sh signs a user with no organisation into the real web console, creates a farm, copies the gateway settings the page shows, connects a stand-in gateway configured from exactly those settings, adds a printer through the form, gets a failed-print alert and dismisses it, then removes the printer. Afterwards it searches every table and the backend log for the access code the browser typed. No printer is touched and dispatch is off. The e2e scripts that start the real proxy also give it its own store file in the scratch directory.
This commit is contained in:
@@ -2,6 +2,10 @@
|
||||
* A stand-in gateway that stays connected and answers printer provisioning,
|
||||
* for scripts/e2e-provision.sh.
|
||||
*
|
||||
* With TELEMETRY_AFTER_PROVISION=1 it also reports each provisioned printer
|
||||
* (running, then failed a few seconds later), so the console has something to
|
||||
* alert on.
|
||||
*
|
||||
* Needs FARM_ID in the environment (the hello must name the token's farm).
|
||||
*
|
||||
* Usage: bun scripts/fake-gateway-serve.ts <ws-url> <edge-jwt> <seconds> <frames-file> [refuse-access-code]
|
||||
@@ -33,6 +37,14 @@ ws.onmessage = (event) => {
|
||||
const message = JSON.parse(String(event.data));
|
||||
if (message.type !== "provision_printer" && message.type !== "remove_printer") return;
|
||||
appendFileSync(framesFile, JSON.stringify(message) + "\n");
|
||||
if (message.type === "provision_printer" && process.env.TELEMETRY_AFTER_PROVISION === "1") {
|
||||
const id = message.printer.id;
|
||||
const report = (state: string) =>
|
||||
ws.send(JSON.stringify({ type: "telemetry", printers: [{ printer_id: id, name: message.printer.name, state, percent: 40, print_error: 0 }] }));
|
||||
setTimeout(() => report("RUNNING"), 1500);
|
||||
setTimeout(() => report("RUNNING"), 3000);
|
||||
setTimeout(() => report("FAILED"), 4500);
|
||||
}
|
||||
const refused = message.type === "provision_printer" && refuseCode && message.printer.access_code === refuseCode;
|
||||
ws.send(
|
||||
JSON.stringify({
|
||||
|
||||
Reference in New Issue
Block a user