2023-10-16 13:50:54 +00:00
|
|
|
/**
|
2024-01-03 10:11:33 +00:00
|
|
|
* @license
|
|
|
|
* Copyright 2023 Google Inc.
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
2023-10-16 13:50:54 +00:00
|
|
|
*/
|
|
|
|
import expect from 'expect';
|
|
|
|
import {TimeoutError} from 'puppeteer';
|
|
|
|
|
|
|
|
import {launch} from './mocha-utils.js';
|
|
|
|
|
|
|
|
describe('device request prompt', function () {
|
|
|
|
let state: Awaited<ReturnType<typeof launch>>;
|
|
|
|
|
|
|
|
before(async () => {
|
|
|
|
state = await launch(
|
|
|
|
{
|
|
|
|
args: ['--enable-features=WebBluetoothNewPermissionsBackend'],
|
|
|
|
ignoreHTTPSErrors: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
after: 'all',
|
|
|
|
}
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
after(async () => {
|
|
|
|
await state.close();
|
|
|
|
});
|
|
|
|
|
|
|
|
beforeEach(async () => {
|
2024-02-05 09:43:37 +00:00
|
|
|
state.context = await state.browser.createBrowserContext();
|
2023-10-16 13:50:54 +00:00
|
|
|
state.page = await state.context.newPage();
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(async () => {
|
|
|
|
await state.context.close();
|
|
|
|
});
|
|
|
|
|
|
|
|
// Bug: #11072
|
|
|
|
it('does not crash', async function () {
|
|
|
|
this.timeout(1_000);
|
|
|
|
|
|
|
|
const {page, httpsServer} = state;
|
|
|
|
|
|
|
|
await page.goto(httpsServer.EMPTY_PAGE);
|
|
|
|
|
|
|
|
await expect(
|
|
|
|
page.waitForDevicePrompt({
|
|
|
|
timeout: 10,
|
|
|
|
})
|
|
|
|
).rejects.toThrow(TimeoutError);
|
|
|
|
});
|
|
|
|
});
|