diff options
| author | Adam Soltys <[email protected]> | 2026-10-07 21:42:58 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-10-07 21:42:58 -0700 |
| commit | 9bc604bdd0359cae6c8f43bc6a6ad8b96bff4433 (patch) | |
| tree | c29a95ffd85497c5c9b4e4597670069fc445ad5c /tools | |
| parent | 654e489cb438c62c09d291cc781707323914f8f1 (diff) | |
| download | coinosv3-9bc604bdd0359cae6c8f43bc6a6ad8b96bff4433.tar.gz coinosv3-9bc604bdd0359cae6c8f43bc6a6ad8b96bff4433.zip | |
No speaker pop on opening the app: the zap sound decodes in an OfflineAudioContext and makes its real AudioContext on the first tap (one made at load ran at once in the installed app, re-opening the phone's audio output on every open/refocus), suspended again after the sound and when the app is hidden
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01PCGjEEMD23CweKrefbTDJp
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/zap-feedback-test.js | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/zap-feedback-test.js b/tools/zap-feedback-test.js index 3fdd3bc..adc7663 100644 --- a/tools/zap-feedback-test.js +++ b/tools/zap-feedback-test.js @@ -110,6 +110,10 @@ try { await page.setViewport({ width: 390, height: 844 }); await page.goto(server.url.href); await page.waitForSelector('.note-zap'); + await pause(600); + // a live AudioContext opens the phone's speaker path (a pop on every open + // or refocus of the installed app) — none may exist before a tap + check('no audio context is opened before the first tap', await page.evaluate(() => zapAudio.context === null)); await page.click('.note-zap'); let s = await state(); check('tap starts effect and adds amount before payment settles', s.effects === 1 && s.tally === '121' && s.flying && s.calls === 1); @@ -204,6 +208,9 @@ try { await page.click('.note-zap'); await pause(100); check('with the sound off a tap still strikes and counts, silently', await page.evaluate((n, c) => zapAudio.starts === n && test.calls === c + 2 && !!document.querySelector('.zap-fx'), starts, calls)); await page.evaluate(() => test.finishArk(true)); await pause(100); + // the last sound was a while ago: the speaker path is closed again + await page.waitForFunction(() => zapAudio.context.state === 'suspended', { timeout: 6000 }).catch(() => {}); + check('the audio context is suspended again once the sound has played', await page.evaluate(() => zapAudio.context.state === 'suspended')); const silentPage = await browser.newPage(); silentPage.on('pageerror', e => errors.push(e.message)); await silentPage.evaluateOnNewDocument(() => { |
