summaryrefslogtreecommitdiffstats
path: root/remote/test/puppeteer/test/src/device-request-prompt.spec.ts
blob: e6e2cdd65ee14639e17a08e1e6bbf8742c492a05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/**
 * @license
 * Copyright 2023 Google Inc.
 * SPDX-License-Identifier: Apache-2.0
 */
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 () => {
    state.context = await state.browser.createIncognitoBrowserContext();
    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);
  });
});