Files
buzz/desktop/tests/e2e/key-import-reveal.spec.ts
klopez4212 81fba7bda4 Refresh desktop onboarding flow (#7528)
## Summary
- apply the refreshed card layout across desktop onboarding
- update identity backup, recovery, and key presentation flows
- clarify AI connection choices and default model settings
- simplify the backup ceremony from creation through optional
verification
- bring the harness and provider setup flow forward with validation,
preserved state, and consistent navigation
- fix action alignment and stray card scrolling in the refreshed layout

## Validation
- pre-push desktop lint, typecheck, frontend tests, and native tests
passed
- focused onboarding Playwright coverage passed
- manually reviewed the refreshed onboarding and backup flow in the
native app
- just ci passed all sections except one unchanged process-cleanup
timing test; its exact rerun passed

---------

Signed-off-by: kenny lopez <klopez4212@gmail.com>
Signed-off-by: Princess Donut <b238ea756dee4d98afa5883fc7f1de61eeabe65bf700e3a5a5a80db5e42e2c2b@buzz.block.builderlab.xyz>
Signed-off-by: Clay Delk <clay.delk@gmail.com>
Co-authored-by: Princess Donut <b238ea756dee4d98afa5883fc7f1de61eeabe65bf700e3a5a5a80db5e42e2c2b@buzz.block.builderlab.xyz>
Co-authored-by: Clay Delk <clay.delk@gmail.com>
2026-09-15 05:58:16 -04:00

68 lines
2.4 KiB
TypeScript

import { expect, test } from "@playwright/test";
import { waitForAnimations } from "../helpers/animations";
import { installMockBridge } from "../helpers/bridge";
const SAMPLE_NSEC =
"nsec1u70xptkumvfc4k4hu0rc4fnzcexvw63zvq2ng9vmqujsaayhparqu8eju9";
test("key import masks the key with a reveal toggle", async ({ page }) => {
await page.setViewportSize({ width: 1280, height: 800 });
await installMockBridge(page, undefined, {
skipCommunitySeed: true,
skipOnboardingSeed: true,
});
await page.goto("/");
await page.getByRole("button", { name: "Use an existing key" }).click();
const input = page.getByTestId("nostr-import-nsec-input");
await expect(input).toBeVisible();
await waitForAnimations(page);
// Masked by default; no toggle until there is input. The refreshed card
// keeps key text on the standard foreground token.
const toggle = page.getByTestId("nostr-import-reveal-toggle");
await expect(input).toHaveAttribute("type", "password");
await expect(toggle).toHaveCSS("opacity", "0");
await expect(input).toHaveAttribute(
"class",
/text-\[oklch\(0\.22213_0_0\)\]/,
);
// The toggle is absolutely positioned: its appearance must not resize the
// input or shift the centered text.
const widthBefore = await input.evaluate(
(el) => el.getBoundingClientRect().width,
);
await input.fill(SAMPLE_NSEC);
await expect(toggle).toHaveCSS("opacity", "1");
const widthAfter = await input.evaluate(
(el) => el.getBoundingClientRect().width,
);
expect(widthAfter).toBe(widthBefore);
// Reveal, then clear: a sticky reveal must never carry over to newly
// pasted content, so the next key starts masked again.
await toggle.click();
await expect(input).toHaveAttribute("type", "text");
await input.fill("");
await expect(toggle).toHaveCSS("opacity", "0");
await input.fill(SAMPLE_NSEC);
await expect(input).toHaveAttribute("type", "password");
// Re-masking via the toggle still works.
await toggle.click();
await expect(input).toHaveAttribute("type", "text");
await toggle.click();
await expect(input).toHaveAttribute("type", "password");
// Narrow viewport: the absolutely positioned toggle must not cause
// horizontal overflow.
await page.setViewportSize({ width: 720, height: 620 });
await waitForAnimations(page);
const overflow = await page.evaluate(
() => document.documentElement.scrollWidth > window.innerWidth,
);
expect(overflow).toBe(false);
});