Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions apps/desktop/e2e/access-account-recovery.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ async function mockAccountRecovery(page: Page, state: LockedState, options: {
if (options.failSnapshot) throw "snapshot_unavailable";
return snapshot;
}
if (command === "desktop_install_diagnostic") return {
schema: "simplicio.desktop-install-attempt/v1", status: "clear", error: null,
};
if (command === "desktop_logout") {
await new Promise<void>((resolve) => Object.assign(window, { __accessFinishLogout: resolve }));
if (options.failLogout) throw "logout_unconfirmed";
Expand Down
3 changes: 3 additions & 0 deletions apps/desktop/e2e/access-update-recovery.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ async function mockAccessUpdates(page: Page, state: "signed_out" | "unknown" | "
}
if (command === "plugin:event|unlisten") return;
if (command === "desktop_snapshot") return snapshots[state];
if (command === "desktop_install_diagnostic") return {
schema: "simplicio.desktop-install-attempt/v1", status: "clear", error: null,
};
if (command === "refresh_desktop_snapshot") return authOnlyUnsupported ? snapshots.unknown : snapshots[state];
if (command === "desktop_login" && authOnlyUnsupported) throw "runtime_auth_only_unsupported";
if (command === "desktop_logout" && authOnlyUnsupported) return snapshots.signed_out;
Expand Down
3 changes: 3 additions & 0 deletions apps/desktop/e2e/account-effect-verification.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ async function mockAccountEffects(page: Page, options: {
invoke: async (command: string) => {
calls.push(command);
if (command === "desktop_snapshot") return states[current];
if (command === "desktop_install_diagnostic") return {
schema: "simplicio.desktop-install-attempt/v1", status: "clear", error: null,
};
if (command === "desktop_login") {
// OAuth completed, but its following snapshot was not confirmed.
current = "active";
Expand Down
23 changes: 18 additions & 5 deletions apps/desktop/e2e/install-partial-diagnostic.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,26 @@ test("a typed partial receipt shows sanitized steps without enabling another ins
const snapshot = createDemoSnapshot("active");
snapshot.source = "runtime";
await page.addInitScript(({ snapshot }) => {
let applications = 0;
Object.assign(window, { __installDiagnosticApplications: () => applications, __TAURI_INTERNALS__: {
const persistedError = {
schema: "simplicio.desktop-install-error/v1", code: "integration_install_exit_code:1",
diagnostic: { schema: "simplicio.desktop-install-diagnostic/v1", status: "partial", failedSteps: ["hermes"], unknownFailedSteps: 0 },
};
Object.assign(window, { __installDiagnosticApplications: () => Number(localStorage.getItem("install-applications") || "0"), __TAURI_INTERNALS__: {
invoke: async (command: string) => {
if (command === "desktop_snapshot" || command === "refresh_desktop_snapshot") return snapshot;
if (command === "desktop_install_diagnostic") return localStorage.getItem("install-pending") === "1"
? { schema: "simplicio.desktop-install-attempt/v1", status: "reconciliation_required", error: persistedError }
: { schema: "simplicio.desktop-install-attempt/v1", status: "clear", error: null };
if (command === "desktop_plan_integrations") return {
schema: "simplicio.desktop-integration-plan/v1", source: "runtime",
planDigest: "sha256:" + "a".repeat(64),
changes: [{ label: "hermes", exists: true, changed: true }],
};
if (command === "desktop_repair_providers") {
applications += 1;
localStorage.setItem("install-applications", String(Number(localStorage.getItem("install-applications") || "0") + 1));
localStorage.setItem("install-pending", "1");
throw {
schema: "simplicio.desktop-install-error/v1", code: "integration_install_exit_code:1",
diagnostic: { schema: "simplicio.desktop-install-diagnostic/v1", status: "partial", failedSteps: ["hermes"], unknownFailedSteps: 0 },
...persistedError,
detail: "DO_NOT_LEAK /private/test-user",
};
}
Expand Down Expand Up @@ -46,4 +52,11 @@ test("a typed partial receipt shows sanitized steps without enabling another ins
await integration.getByRole("button", { name: "Atualizar diagnóstico", exact: true }).click();
await expect(page.getByRole("heading", { name: "Runtime e diagnóstico", exact: true })).toBeVisible();
expect(await page.evaluate(() => (window as Window & { __installDiagnosticApplications: () => number }).__installDiagnosticApplications())).toBe(1);

await page.goto("/?view=setup");
await expect(page.getByRole("alert")).toContainText("Etapas com falha: Hermes.");
await expect(page.getByRole("alert")).toContainText("código 1.");
await expect(page.getByRole("button", { name: "Configurar Simplicio", exact: true })).toBeDisabled();
await expect(page.locator("body")).not.toContainText("DO_NOT_LEAK");
expect(await page.evaluate(() => (window as Window & { __installDiagnosticApplications: () => number }).__installDiagnosticApplications())).toBe(1);
});
3 changes: 3 additions & 0 deletions apps/desktop/e2e/integration-preflight-recovery.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ async function preparePreflightFailure(page: Page) {
invoke: async (command: string, args: Record<string, unknown> = {}) => {
calls.push(command);
if (command === "desktop_snapshot" || command === "refresh_desktop_snapshot") return snapshot;
if (command === "desktop_install_diagnostic") return {
schema: "simplicio.desktop-install-attempt/v1", status: "clear", error: null,
};
if (command === "desktop_plan_integrations") {
reviews += 1;
return {
Expand Down
3 changes: 3 additions & 0 deletions apps/desktop/e2e/reference-setup-recovery.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ async function prepareRecovery(page: Page, failure: string) {
invoke: async (command: string) => {
calls.push(command);
if (command === "desktop_snapshot" || command === "refresh_desktop_snapshot") return snapshot;
if (command === "desktop_install_diagnostic") return {
schema: "simplicio.desktop-install-attempt/v1", status: "clear", error: null,
};
if (command === "desktop_plan_integrations") return {
schema: "simplicio.desktop-integration-plan/v1", source: "runtime",
planDigest: "sha256:" + "a".repeat(64),
Expand Down
3 changes: 3 additions & 0 deletions apps/desktop/e2e/reference-setup.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ test("guided setup keeps progress and consent-controlled actions visible in a sh
Object.assign(window, { __referenceApplyCount: 0, __TAURI_INTERNALS__: {
invoke: async (command: string) => {
if (command === "desktop_snapshot" || command === "refresh_desktop_snapshot") return snapshot;
if (command === "desktop_install_diagnostic") return {
schema: "simplicio.desktop-install-attempt/v1", status: "clear", error: null,
};
if (command === "desktop_plan_integrations") return {
schema: "simplicio.desktop-integration-plan/v1", source: "runtime",
planDigest: "sha256:" + (applied ? "b" : "a").repeat(64),
Expand Down
3 changes: 3 additions & 0 deletions apps/desktop/e2e/runtime-integration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ async function mockNativeBridge(page: Page, options: { signedOut?: boolean; fail
if (command === "desktop_logout") signedOut = true;
if (command === "refresh_desktop_snapshot" && installed && options.failVerification) throw "test_final_snapshot_failed";
if (["desktop_snapshot", "refresh_desktop_snapshot", "desktop_logout"].includes(command)) return { ...snapshot, access: { ...snapshot.access, state: signedOut ? "signed_out" : accessState } };
if (command === "desktop_install_diagnostic") return {
schema: "simplicio.desktop-install-attempt/v1", status: "clear", error: null,
};
if (command === "desktop_plan_integrations") return { schema: "simplicio.desktop-integration-plan/v1", source: "runtime", planDigest: `sha256:${(installed ? "b" : "a").repeat(64)}`, changes: [{ label: "codex", changed: !installed, exists: true }] };
if (command === "desktop_repair_providers") {
if (options.pauseSetup) await new Promise((resolve) => Object.assign(window, { __desktopCompleteSetup: resolve }));
Expand Down
3 changes: 3 additions & 0 deletions apps/desktop/e2e/setup-plan-labels.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ test("guided setup distinguishes absent configuration from an unchanged installe
Object.assign(window, { __TAURI_INTERNALS__: {
invoke: async (command: string) => {
if (command === "desktop_snapshot" || command === "refresh_desktop_snapshot") return snapshot;
if (command === "desktop_install_diagnostic") return {
schema: "simplicio.desktop-install-attempt/v1", status: "clear", error: null,
};
if (command === "desktop_plan_integrations") return {
schema: "simplicio.desktop-integration-plan/v1", source: "runtime",
planDigest: "sha256:" + "a".repeat(64),
Expand Down
3 changes: 3 additions & 0 deletions apps/desktop/e2e/setup-post-apply-verification.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ async function mockSetupVerification(page: Page, options: { state?: Verification
invoke: async (command: string, args: Record<string, unknown> = {}) => {
calls.push(command);
if (command === "desktop_snapshot" || command === "refresh_desktop_snapshot") return snapshot;
if (command === "desktop_install_diagnostic") return {
schema: "simplicio.desktop-install-attempt/v1", status: "clear", error: null,
};
if (command === "desktop_plan_integrations") {
if (!applied) return {
schema: "simplicio.desktop-integration-plan/v1", source: "runtime", planDigest: `sha256:${"a".repeat(64)}`,
Expand Down
Loading