jest-puppeteer icon indicating copy to clipboard operation
jest-puppeteer copied to clipboard

expect-puppeteer .toMatch() fails when JavaScript is disabled

Open developit opened this issue 6 years ago • 1 comments
trafficstars

🐛 Bug Report

When page.setJavaScriptEnabled(false) has been called, expect(page).toMatch(..) fails.

Contrasting this with Puppeteer's own API, page.content() returns the serialized DOM string even when JavaScript is disabled.

To Reproduce

test('repro', () => {
  page.setJavaScriptEnabled(false);
  page.goto('https://example.com');
  expect(page).toMatch('Example');
});

Expected behavior

The above should pass, but it fails since the function passed to puppeteer's evaluate() is never executed.

Environment Info

(affects all versions/envs)

System:

  • OS: macOS 10.14.5
  • Shell: 3.2.57 - /bin/bash

Binaries:

  • Node: 10.15.0 - /usr/local/bin/node
  • npm: 6.9.0 - /usr/local/bin/npm

npmPackages:

  • jest-puppeteer: ^4.2.0 => 4.2.0

developit avatar Jul 08 '19 18:07 developit

Hello @developit, I am thinking about moving to @testing-library instead of maintaining expect-puppeteer. What do you think?

gregberge avatar Jul 14 '19 21:07 gregberge

Please upgrade to v8 and reopen submit a new issue if you experience this problem.

gregberge avatar Mar 07 '23 08:03 gregberge