aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/zap-feedback-test.js7
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(() => {