// Adding a second wallet accepts a password different from the first one's // with nothing on screen saying the two are separate — each wallet has its // own encryptedSecret, so per-wallet passwords are by design, but the add // screen said only "Choose a password" // (https://git.eeqj.de/sneak/AutistMask/issues/374). // // The fix is copy: a note on the password screen that says each wallet has // its own password and this one need not match. It is only meaningful once // a wallet exists — on the very first wallet there is no other password to // be separate from — so it is shown then and hidden otherwise. These boot // the real popup and reach the add-wallet screen through the same button a // user presses, so the note's visibility is decided by the real show(). const { bootPopup, cleanupPopup, unversionedValidProfile, POPUP_HTML, } = require("./support/popupBoot"); const NOTE = "add-wallet-separate-password-note"; afterEach(() => { cleanupPopup(); }); describe("second-wallet password note", () => { test("hidden while onboarding the first wallet", async () => { const page = await bootPopup(undefined); expect(page.pageErrors).toEqual([]); await page.click("btn-welcome-add"); expect(page.visibleViews()).toContain("add-wallet"); expect(page.hidden(NOTE)).toBe(true); }); test("shown when a wallet already exists", async () => { const page = await bootPopup(unversionedValidProfile()); expect(page.pageErrors).toEqual([]); await page.click("btn-main-add-wallet"); expect(page.visibleViews()).toContain("add-wallet"); expect(page.hidden(NOTE)).toBe(false); }); // The copy states the two facts the definition of done asks for — each // wallet has its own password, and this one need not match — and stays // consistent with the no-password-reset reality of // https://git.eeqj.de/sneak/AutistMask/issues/312 by not promising any // recovery or reset here. test("the note says the password is per-wallet and need not match", () => { const note = /id="add-wallet-separate-password-note"[^>]*>([^]*?)<\/p>/ .exec(POPUP_HTML)[1] .replace(/\s+/g, " ") .trim(); expect(note).toContain("its own"); expect(note).toContain("need not match"); expect(note).not.toMatch(/recover|reset/i); }); });