Skip to content

expect-puppeteer does not support Bidi Page #614

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
nickkoul opened this issue Apr 4, 2025 · 0 comments
Open

expect-puppeteer does not support Bidi Page #614

nickkoul opened this issue Apr 4, 2025 · 0 comments

Comments

@nickkoul
Copy link

nickkoul commented Apr 4, 2025

🐛 Bug Report

When using Puppeteer Core with a Webdriver Bidi connection Puppeteer creates Bidi Page objects as such:

https://github.com/puppeteer/puppeteer/blob/6aa964cabf15ece0cb664294d8a64f290d7380cc/packages/puppeteer-core/src/bidi/Page.ts#L73

But expect-puppeteer explicitly checks for CDPPage objects here:

instance?.constructor?.name === "CdpPage")

Latest versions of Firefox do not support CDP so Webdriver Bidi must be used. This means that as of today expect-puppeteer will not work with this.

To Reproduce

  1. Initiate a connection with firefox over webDriverBiDi something like
module.exports = {
  defaultBrowser: 'firefox',
  launch: undefined,
  connect: {
    protocol: 'webDriverBiDi',
    browserWSEndpoint: 'ws://127.0.0.1:9222/session',
  },
}

  1. Attempt to use expect-puppeteer on any objects.

  2. You get a runtime error something like this

    BidiPage is not supported

    > 53 |   await expect(page).toMatchElement('[data-e2e=guest-login-button]')
         |         ^
      54 |   await expect(page).toClick('[data-e2e=guest-login-button] > button')
      55 |   await page.waitForSelector('[data-e2e=get-ready-to-start-shopping-text]')
      56 |   await page.waitForSelector('[data-e2e=instruction-place-personal-items-in-cart]')

      at puppeteerExpect (node_modules/expect-puppeteer/dist/index.js:438:49)
      at expectPuppeteer (node_modules/expect-puppeteer/dist/index.js:464:26)
      at loginAsGuest (helpers/login.ts:53:9)
      at Object.<anonymous> (test/login/login.spec.ts:46:23)

Expected behavior

expect-puppeteer should be able to handle a BidiPage object

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant