argos-ci / jest-puppeteer

Run tests using Jest & Puppeteer 🎪✨
MIT License
3.53k stars 289 forks source link

Puppeteer 21 regression: `[object Object] is not supported` #565

Closed fregante closed 1 year ago

fregante commented 1 year ago

🐛 Bug Report

This works in Puppeteer 20, but not 21. The error appears with toMatchElement and toMatchTextContent


  ● static: iframe › should load iframe page

    [object Object] is not supported

      59 |  });
      60 |  it('should load iframe page', async () => {
    > 61 |      await expect(iframe).toMatchTextContent('Framed page');
         |            ^
      62 |  });
      63 |
      64 |  it('should load the content script, once', async () => {

      at expectPuppeteerInstance (node_modules/expect-puppeteer/dist/index.js:488:11)
      at expectPuppeteer (node_modules/expect-puppeteer/dist/index.js:492:26)
      at Object.expect (test/browser.js:61:9)

To Reproduce

I think:

await page.goto('https://static-ephiframe.vercel.app/Parent-page?iframe=./Framed-page');
const elementHandle = await page.waitForSelector('iframe');
const iframe = await elementHandle.contentFrame();
await expect(iframe).toMatchTextContent('Framed page');

Expected behavior

The test should pass

Run npx envinfo --system --binaries --npmPackages expect-puppeteer,jest-dev-server,jest-environment-puppeteer,jest-puppeteer,spawnd --markdown --clipboard

Paste the results here:


## System:
 - OS: macOS 13.4.1
 - CPU: (16) x64 Intel(R) Core(TM) i9
 - Memory: 100.70 MB / 16.00 GB
 - Shell: 3.6.1 - /usr/local/bin/fish
## Binaries:
 - Node: 20.6.1 - /usr/local/bin/node
 - Yarn: 1.22.11 - /usr/local/bin/yarn
 - npm: 10.1.0 - /usr/local/bin/npm
## npmPackages:
 - expect-puppeteer: ^8.0.3 => 9.0.0 
 - jest-puppeteer: ^8.0.4 => 9.0.0 

Slightly more information can be found at:

fregante commented 1 year ago

Since v21 has been released after the last jest-puppeteer release, I assume this version hasn't been tested here.

jamesgpearce commented 1 year ago

This started happening again with puppeteer 21.2.1.

(It looks like 21.1.1 is OK, so should be easier to downgrade and bisect.)

gregberge commented 1 year ago

Hi, if we can do something in this repository to fix it, feel free to submit a PR.

swissspidy commented 1 year ago

https://github.com/argos-ci/jest-puppeteer/pull/566 should fix this