Using Jest with Puppeteer and create-react-app
See original GitHub issueUsing Jest with Puppeteer can be great, for example I like to take screenshot from the headless browser to test regression of the user interface.
The result is just right here
The problem
Everything is working perfectly, the problem is that for each test file including puppeteer
a new instance of Chrome is loaded, and of course it’s the slowest part of the process.
Jest documentation links us to this repo with a perfect example of integration with Puppeteer. It is initialised inside globalSetup
and killed in globalTeardown
. But they are not available in create-react-app
.
The available src/setupTests.js
is not enough to do this properly.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:15
- Comments:9 (1 by maintainers)
Top Results From Across the Web
React end-to-end testing with Jest and Puppeteer
In React, E2E testing with Jest and Puppeteer helps to ensure that the code you wrote is functional and your app works as...
Read more >Adding Puppeteer to create-react-app generated projects
This post looks at adding Puppeteer to a create-react-app generated app, and shows how easy it is to get Puppeteer up and running....
Read more >How not to despair while setting up Puppeteer and Jest on a ...
Here's today's tale of woe: setting up my create-react-app for end-to-end testing. Background. We have a number of React clients in our ...
Read more >Testing your React App with Puppeteer and Jest | by Rajat S
How to use Puppeteer and Jest to perform End-to-End Testing on your React App ... Go to src/App and create a new file...
Read more >Testing React App With Jest & Puppeteer - DEV Community
This application is created using create-react-app. The application folder will be structured as shown below. ├── e2e │ ├── custom- ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
u can create a separate test runner for tests with puppeteer
How is this working for you guys? CRA uses Jest 20 and it’s not recognizing
globalSetup
norglobalTeardown
options. I’ve also tried to update react-scripts but mine is on1.1.4
which seems to be the latest version, so I don’t see how would I even have Jest 22. What am I missing?