test: add test for playing audio (#10890)

This commit is contained in:
Max Schmitt 2021-12-13 15:02:06 -08:00 committed by GitHub
parent a2a8967bed
commit 40bd156173
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

BIN
tests/assets/example.mp3 Normal file

Binary file not shown.

View file

@ -83,6 +83,19 @@ it('should play video', async ({ page, asset, browserName, platform }) => {
await page.$eval('video', v => v.pause()); await page.$eval('video', v => v.pause());
}); });
it('should play audio', async ({ page, server, browserName, platform }) => {
it.fixme(browserName === 'firefox' && platform === 'win32', 'https://github.com/microsoft/playwright/issues/10887');
it.fixme(browserName === 'firefox' && platform === 'linux', 'https://github.com/microsoft/playwright/issues/10887');
it.fixme(browserName === 'webkit' && platform === 'win32', 'https://github.com/microsoft/playwright/issues/10892');
it.fixme(browserName === 'webkit' && platform === 'darwin', 'https://github.com/microsoft/playwright/issues/10892');
await page.goto(server.EMPTY_PAGE);
await page.setContent(`<audio src="${server.PREFIX}/example.mp3"></audio>`);
await page.$eval('audio', e => e.play());
await page.waitForTimeout(1000);
await page.$eval('audio', e => e.pause());
expect(await page.$eval('audio', e => e.currentTime)).toBeGreaterThan(0.5);
});
it('should support webgl', async ({ page, browserName, headless }) => { it('should support webgl', async ({ page, browserName, headless }) => {
it.fixme(browserName === 'firefox' && headless); it.fixme(browserName === 'firefox' && headless);