aboutsummaryrefslogtreecommitdiffstats
path: root/tools/amber-login-test.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-10-07 08:22:58 -0700
committerAdam Soltys <[email protected]>2026-10-07 08:22:58 -0700
commitfdb044b44019d45bf8f849a4cf64a56efbc54ada (patch)
treec6fdb70985603445e6365c8a0af3579b5faf3b28 /tools/amber-login-test.js
parentaf30d3cdc7da7f9e60bc552282f08ea7def3c0dd (diff)
downloadcoinosv3-fdb044b44019d45bf8f849a4cf64a56efbc54ada.tar.gz
coinosv3-fdb044b44019d45bf8f849a4cf64a56efbc54ada.zip
padlock-flow, onboard-backup, amber-login tests follow today's UI
- padlock-flow: the padlock lives behind the balance card's gear (wallet settings), declining lands back there; another wallet is added from the profile's 'Sign into another account' (import tab) and counted in the identity switcher, since the Accounts list is no longer reached from the wallet - onboard-backup: the welcome card lost its blurb (42c8d4e); the way in now says what the wallet is by putting the twelve words on screen at once - amber-login: the starter follows wait on the deep contact-list lookup (follows-overwrite fix), so their signature can come after the wallet opens; keep answering sign requests until things go quiet Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'tools/amber-login-test.js')
-rw-r--r--tools/amber-login-test.js26
1 files changed, 18 insertions, 8 deletions
diff --git a/tools/amber-login-test.js b/tools/amber-login-test.js
index 7439f0d..0b4c3c9 100644
--- a/tools/amber-login-test.js
+++ b/tools/amber-login-test.js
@@ -73,15 +73,25 @@ try {
// walked through
const signedKinds = [];
let signedUrls = 1;
+ // answer the next sign_event intent, if one is waiting
+ const signNext = async () => {
+ const pend = (await urls()).filter((u) => /type=sign_event/.test(u));
+ if (pend.length <= signedUrls) return false;
+ const u = pend[signedUrls]; signedUrls++;
+ const ev = JSON.parse(decodeURIComponent(u.slice('nostrsigner:'.length).split('?')[0]));
+ signedKinds.push(ev.kind);
+ await deliver(JSON.stringify(finalizeEvent({ kind: ev.kind, created_at: ev.created_at, tags: ev.tags, content: ev.content }, SK)));
+ return true;
+ };
for (let i = 0; i < 80 && !(await page.evaluate(() => document.body.innerText.toLowerCase().includes('receive'))); i++) {
- const us = await urls();
- const pend = us.filter((u) => /type=sign_event/.test(u));
- if (pend.length > signedUrls) {
- const u = pend[signedUrls]; signedUrls++;
- const ev = JSON.parse(decodeURIComponent(u.slice('nostrsigner:'.length).split('?')[0]));
- signedKinds.push(ev.kind);
- await deliver(JSON.stringify(finalizeEvent({ kind: ev.kind, created_at: ev.created_at, tags: ev.tags, content: ev.content }, SK)));
- } else { await click('later') || await click('skip verification') || await click("i've written it down") || await click('continue'); }
+ if (!(await signNext())) { await click('later') || await click('skip verification') || await click("i've written it down") || await click('continue'); }
+ await sleep(500);
+ }
+ // The starter follows wait on a deep look for a list this key may already
+ // have (2026-10-02 follows-overwrite fix), so their signature can arrive
+ // after the wallet is open: keep answering until things go quiet.
+ for (let i = 0, idle = 0; i < 60 && idle < 8; i++) {
+ if (await signNext()) idle = 0; else if (signedKinds.length) idle++;
await sleep(500);
}
if (!(await page.evaluate(() => document.body.innerText.toLowerCase().includes('receive')))) console.log(' DEBUG loop end:', JSON.stringify(await page.evaluate(() => ({ btns: [...document.querySelectorAll('button')].map((b) => b.textContent.trim()).filter(Boolean).slice(0, 12), text: document.body.innerText.slice(0, 160).replace(/\n+/g, ' | ') }))));