Questions tagged [jest-puppeteer]
121 questions
16
votes
1 answer
Run jest unit tests in real browser environment with window access using puppeteer
What i want
My code widely depends on global window object (and it's methods) which isn't fully implemented by jsdom, but available in real browser environment. So i want to run unit tests inside puppeteer page context environment so covered code…

user3388811
- 318
- 3
- 13
8
votes
1 answer
Jest + puppeteer best architecture practices
I just entered the world of testing with puppeteer and jest, and I was wondering what the best practice was in terms of folder architecture and logic.
I've never done testing before and I think I'm getting a little lost in the different principles…

Nuzzob
- 371
- 1
- 4
- 23
6
votes
2 answers
Jest-Puppeteer test randomly fails without output
I have the following testcase:
it('User can logout', async () => {
await helper.navClick('.header-user-action__logout');
const url = page.url();
console.log(url)
await expect(url).toContain('auth');
});
helper.navClick is just a…

Jonas S.
- 121
- 2
- 5
5
votes
0 answers
Jest testing errors after upgrading to Big Sur
After upgrading to Big Sur, some of my jest tests throws this error. It also spams the console with
Chromium[29916:572689] Warning: Expected min height of view: () to be less than or equal to 30 but got a height of…

Zandew
- 98
- 1
- 8
5
votes
3 answers
How to get text from xPath in Puppeteer node js
I need to get a text from the span tag and to verify whether the text equals to "check".
How can I achieve this in puppeteer?
Below is the example of the code I've written, if anyone could put me help me figure this out, please.
const puppeteer =…

Rajesh G
- 473
- 3
- 6
- 20
5
votes
1 answer
Puppeteer methods for typing never complete typing the full strings passed to them
Problem
Summary of problem: I'm writing several test suites (using Jest and Puppeteer) to automate tests of my AngularJS app's home page. Many of the tests I'd like to automate involve filling out forms with 's wherein strings (of varying…

ElsaInSpirit
- 341
- 6
- 16
4
votes
1 answer
Jest puppeteer typescript reference error Page not found
Trying to setup typescript jest with puppeteer
i following step by step instructions as mentioned below
Jest-puppeteer with typescript configuration
there is a simple test
describe('Google', () => {
beforeAll(async () => {
await…

d-man
- 57,473
- 85
- 212
- 296
4
votes
2 answers
Preset jest-puppeteer is invalid
in a working jest + puppeteer project,
i'm moving to jest-circus in order to use the jest-circus retry feature.
As documented, i installed jest-circus and i set as runner but running test as usual i obtain
Validation Error:
Preset jest-puppeteer…

Andrea Bisello
- 1,077
- 10
- 23
4
votes
0 answers
Generating documentation on the jest puppeteer tests
I am using jest puppeteer for browser tests. I want to generate documentation around the test names in order to know what all tests I have in my suite.
One test file can have n number of tests. In the below example, i have 2 tests in one js…

Saurabh
- 930
- 2
- 17
- 39
4
votes
5 answers
Why do I need to "reinstall" Puppeteer by running `node install.js` after `npm install`? (Error: Chromium revision is not downloaded.)
Otherwise, when I try to run tests using Puppeteer, I get Error: Chromium revision is not downloaded. Run "npm install" or "yarn install"
It would seem that npm i with Puppeteer in my deps would be enough, but after install completes, I need to cd…

Jazzy
- 6,029
- 11
- 50
- 74
3
votes
0 answers
Is it possible to enable in browser settings 'On startup - Continue where you left off' with Puppeteer?
I need to open a browser and switch to the current page (e.g. stackoverflow.com) then close the browser and open it again with this saved page (e.g. stackoverflow.com).
I know that in the browser settings you can make it so that when you open it you…

Trinity
- 81
- 3
3
votes
2 answers
Unhandled error while running jest-puppeteer test
I am trying to set up testing for my puppeteer project. I was following a basic guide and the test passes but there is 2 console errors in the terminal.
The error doesn't show up when using https://google.com or https://youtube.com. So it looks like…

unknownbuckeye
- 31
- 4
3
votes
1 answer
Jest Puppeteer - Setup Visual Studio Code for it
I'm planning to setup env for testing in Visual Studio Code IDE.
The problem that I have is that VS Code in any XXX.test.js file don't know what is browser or page variable. I'm receiving such errors:
'page' is not defined.eslint(no-undef)
Is this…

Marcin Kapusta
- 5,076
- 3
- 38
- 55
3
votes
3 answers
Run E2E tests in IDE or command line
I'm using Stencil.js to create a web component library and I'm heavily relying on E2E tests. As they're rather slow it becomes more and more cumbersome to run the entire test suite (using the Stencil.js CLI) while developing new components.
However,…

Daniel
- 874
- 10
- 31
2
votes
1 answer
Using Jest with Puppeteer : EReferenceError : xxx is not defined
when learn puppeteer/jest, many tutorial articles example are the same,like:
const timeout = 10000;
beforeAll(async () => {
await page.goto(URL, { waitUntil: "domcontentloaded" });
});
describe("Test title and header of the homepage", () => {
…

Michael.Andromeda
- 56
- 4