aboutsummaryrefslogtreecommitdiffstats
path: root/tools/pos-test.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-11-15 14:32:10 -0700
committerAdam Soltys <[email protected]>2026-11-15 14:32:10 -0700
commit5cc640839a14f7a1c821b3630a591bca76717243 (patch)
treecf831f0c50571fdded5f0f9d6089a0adf0d22bd2 /tools/pos-test.js
parent513fd7db08fb3c7e89fe651ac70913264a4bff22 (diff)
downloadcoinosv3-5cc640839a14f7a1c821b3630a591bca76717243.tar.gz
coinosv3-5cc640839a14f7a1c821b3630a591bca76717243.zip
Receive → Amount: ask for a sum with the point of sale's pad. "Add an 'Amount' button to receive that basically brings up the PoS screen" (Adam, 2026-11-15). Under the payment address on Spending's Receive (and under the Ark address where there's no name), Amount opens the till's amount screen as "Request an amount": the same pad, a What it's for note, Create invoice → the QR and amount → paid, then Done back to Receive. It leaves the till out: no tip prompt, no tip settings, no day's sales, and its invoices are marked so the till's sales list doesn't count them. Also: the HISTORY heading under Receive/Send no longer stands over an empty wallet (the last change hid the 'No transactions yet' card but not its heading). pos-test (request mode: no tips, straight to the invoice, Done, kept out of the sales) and signup-quick (Amount on Receive, opens the pad, Back; no History heading) pass, with footer-support and features-smoke
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VMan6SwkivduFDDkMmnXjZ
Diffstat (limited to 'tools/pos-test.js')
-rw-r--r--tools/pos-test.js20
1 files changed, 19 insertions, 1 deletions
diff --git a/tools/pos-test.js b/tools/pos-test.js
index 55349cb..2b6a0b7 100644
--- a/tools/pos-test.js
+++ b/tools/pos-test.js
@@ -30,7 +30,7 @@ const ctx = {
};
const feature = posFeature(ctx); window.__feature = feature;
function render() { document.querySelector('#app').replaceChildren(feature.screenView() || h('div', { id: 'closed' }, 'closed')); }
-window.test = { open: () => { feature.openPos(); }, init: () => { feature.init(); render(); },
+window.test = { open: () => { feature.openPos(); }, request: () => { feature.openAmountRequest(); }, init: () => { feature.init(); render(); },
cards: () => { document.querySelector('#app').replaceChildren(...feature.posSettingsCards()); }, settle: (ok) => { const w = watch; watch = null; w.cb({ step: ok ? 'done' : 'failed' }); }, get watch() { return watch && watch.id; }, get cancelled() { return cancelled; }, get sales() { return (state.pos || {}).sales || []; }, ui };
render();
`;
@@ -128,6 +128,24 @@ try {
check("the old device-wide flag is dropped on start (it can't say whose it was)", await page.evaluate(() => (test.ui.pos = null, true)) && (await boot('owner')) && await page.evaluate(() => localStorage.getItem('btc-wallet-pos-mode') === null));
check('another wallet on the same device does not start in point of sale', !(await boot('someone-else')));
check('the owner still does, after anyone else has been in', await boot('owner'));
+
+ console.log('\n[Receive → Amount]');
+ await page.evaluate(() => { localStorage.removeItem('btc-wallet-pos-mode:owner'); test.ui.pos = null; test.request(); }); await pause(50);
+ let rq = await text();
+ check('opens as Request an amount, without the till around it', /Request an amount/.test(rq) && !/ask for a tip|Tips today|Sales today/i.test(rq) && !(await page.$('.pos-sale')), rq.slice(0, 200));
+ const before = await page.evaluate(() => test.sales.length);
+ await type('.pos-amount', '2100');
+ await page.click('#pos-charge'); await pause(100);
+ rq = await text();
+ check('straight to the invoice, no tip prompt', /Scan to pay/i.test(rq) && /2,100/.test(rq) && !!(await page.$('.pos-qr')), rq.slice(0, 200));
+ const req = await page.evaluate(() => test.sales[test.sales.length - 1]);
+ check('the request is for the amount, no tip, and marked', req.billSat === 2100 && req.tipSat === 0 && req.request === true, JSON.stringify(req));
+ await page.evaluate(() => test.settle(true)); await pause(100);
+ check('paid, with Done back to Receive', /Done/.test(await text()) && !/New sale/.test(await text()));
+ await click('Done'); await pause(50);
+ check('Done closes it', !!(await page.$('#closed')));
+ await page.evaluate(() => { test.ui.pos = null; test.open(); }); await pause(50);
+ check("the till's sales list leaves requests out", !(await text()).includes('2,100'), String(before));
check('no browser errors', errors.length === 0);
} finally { await browser.close(); server.stop(true); }
console.log('\n✅ point of sale');