aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/gift-profile-setup-test.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/tools/gift-profile-setup-test.js b/tools/gift-profile-setup-test.js
index 67da261..9304d1a 100644
--- a/tools/gift-profile-setup-test.js
+++ b/tools/gift-profile-setup-test.js
@@ -33,11 +33,16 @@ const waitText = async (page, re, ms = 30000) => {
for (let t = 0; t < ms; t += 250) { if (re.test(await text(page))) return true; await sleep(250); }
return false;
};
-async function toSeed(page) {
+async function toSeed(page, note) {
await page.goto(server.url.href);
await page.evaluate(() => { localStorage.clear(); localStorage.setItem('btc-wallet-network', 'mutinynet'); });
- await page.goto(server.url.href + 'ag/' + giftCode());
+ await page.goto(server.url.href + 'ag/' + giftCode() + (note ? '#m=' + encodeURIComponent(note) : ''));
check('the gift opens: the server sees no coin behind it', await waitText(page, /aren.t visible/i));
+ if (note) {
+ const q = await page.evaluate(() => document.querySelector('.gift-note')?.textContent || null);
+ check('the sender\'s note shows on the gift', q === note, String(q));
+ check('...and leaves the address bar with the code', await page.evaluate(() => location.pathname === '/' && !location.hash));
+ }
await click(page, 'claim');
check('...so the claim finds it taken', await waitText(page, /create a wallet anyway/i));
check('...create a wallet anyway shows the seed', await click(page, 'create a wallet anyway') && await waitText(page, /recovery phrase/i, 10000));
@@ -47,7 +52,7 @@ try {
const errors = [];
page.on('pageerror', (e) => errors.push(String(e)));
await page.setViewport({ width: 390, height: 844, deviceScaleFactor: 2 });
- await toSeed(page);
+ await toSeed(page, 'Happy birthday! 🎂 <b>not bold</b>');
await click(page, 'skip verification');
check('the seed done: the wizard asks for a username', await waitText(page, /now pick a username/i, 10000), (await text(page)).slice(0, 200));
check('...with the claim form (or its wait) and Not now', await page.evaluate(() => !!document.querySelector('.onb')) && /not now/i.test(await text(page)));