question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Simplify and improve E2E Puppeteer Config

See original GitHub issue

Bug Description

As pointed out by @aaemnnosttv, @wordpress/scripts already supports passing some custom configs to Puppeteer, so that we don’t actually need to maintain a custom jest-puppeteer.config.js file.

More specifically, it allows setting PUPPETEER_HEADLESS to disable headless mode and PUPPETEER_SLOWMO to slow down tests.

Example:

PUPPETEER_HEADLESS=false npm run test:e2e
PUPPETEER_SLOWMO=200 npm run test:e2e

There’s also a third option, passing a --puppeteer-interactive argument to the command that would result in non-headless mode with a slowMo value of 80. In other words, npm run test:e2e -- --puppeteer-interactive is equivalent to running

PUPPETEER_HEADLESS=false PUPPETEER_SLOWMO=80 npm run test:e2e

Second, the default config also ensures that the --runInBand argument is always passed to Jest, which can speed up tests on CI servers in some cases.


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

  • More straightforward and better documented way of running E2E tests
  • Tests run serially on Travis CI

Implementation Brief

  • Remove custom jest-puppeteer.config.js file.
  • Alter documentation to suggest using PUPPETEER_HEADLESS / PUPPETEER_SLOWMO or the --puppeteer-interactive argument.
  • Add new npm script npm run test:e2e:interactive that runs npm run test:e2e -- --puppeteer-interactive
  • Add new npm script npm run test:e2e:ci that runs npm run test:e2e -- --runInBand
  • Change .travis.yml to use npm run test:e2e:ci

Changelog entry

  • N/A

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
circlecubecommented, Aug 5, 2019

That’s right, sorry for the lapse, thanks for providing the link @swissspidy.

Ready for CR and added suggestions to the contributor handbook doc.

1reaction
swissspidycommented, Aug 5, 2019

Current documentation is in the contributor handbook: https://docs.google.com/document/d/1M1gUI0FKnP3RcbgMsU6YltEtNCHaH_9YGbH8F-7JefA/edit#heading=h.21tk21w0qtqj

My understanding is that this doc will be moved to the wiki here on GitHub eventually.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Improving End-to-End Testing at Coursera using Puppeteer ...
Recently, we revamped our end-to-end testing system using Puppeteer and Jest. We added tools to improve the development workflow, and made ...
Read more >
React E2E testing with Puppeteer in CI - habx
First we need to be able to run puppeteer and user actions in a test environment. This is already done by smooth-code with...
Read more >
End to End tests with Google's Puppeteer - Tyler Clark
JavaScript Testing Introduction Tutorial - Unit Tests, Integration Tests & e2e Tests · Modern Web Testing and Automation with Puppeteer (Google I ...
Read more >
Set Up End-to-End Tests with Puppeteer and Mocha
Recently, I managed to set up end-to-end tests on Puppeteer and Mocha ... It's a simplified version of the configuration, without cache and ......
Read more >
End-to-end Testing - Stencil.js
End-to-end tests require a fresh build, dev-server, and puppeteer browser instance created before the tests can actually run.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found