fix: Back from Settings no longer lands on a secret screen left by the gear (closes #461)
Leaving the private key export or recovery phrase screen drops the selection it was showing, but the settings gear had just pushed the screen onto the Back stack, so Back from Settings landed on a password prompt that could only fail. Each screen's leave handler now also takes it off the top of the stack, which is what a reopened popup already does to these screens. Back from Settings goes to the address screen for the export screen; for the recovery phrase screen, opened from Settings, it stays on Settings once, as after a reopen. Jest tests drive the gear and then Back, and each screen's own Back, for both screens; leavePrivkeyScreen() in the e2e suite expects the address screen. Model: opus-5-5
This commit is contained in:
@@ -336,6 +336,36 @@ describe("opening the screen again in the same popup session", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("Back from Settings after leaving by the settings gear", () => {
|
||||
// https://git.eeqj.de/sneak/AutistMask/issues/461: leaving drops the
|
||||
// address selection, so Back onto this screen showed a password prompt
|
||||
// that could only answer "No address is selected."
|
||||
test("goes to the address screen it was opened from", () => {
|
||||
const { helpers, state, exportPrivkey } = load();
|
||||
state.viewStack = ["main"];
|
||||
exportPrivkey.show(0, 0);
|
||||
// The settings gear: push the current view, then show Settings.
|
||||
helpers.pushCurrentView();
|
||||
helpers.showView("settings");
|
||||
|
||||
helpers.goBack();
|
||||
|
||||
expect(state.currentView).toBe("address");
|
||||
expect(state.viewStack).toEqual(["main"]);
|
||||
});
|
||||
|
||||
test("its own Back button leaves the rest of the stack alone", async () => {
|
||||
const { state, exportPrivkey } = load();
|
||||
state.viewStack = ["main"];
|
||||
exportPrivkey.show(0, 0);
|
||||
|
||||
await click("btn-export-privkey-back");
|
||||
|
||||
expect(state.currentView).toBe("address");
|
||||
expect(state.viewStack).toEqual(["main"]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("views the popup may reopen onto", () => {
|
||||
// Restoring onto this screen would put a private key on display with no
|
||||
// password prompt in front of it, on a popup reopened by accident.
|
||||
|
||||
Reference in New Issue
Block a user