Questions tagged [jest-puppeteer]

121 questions
0
votes
1 answer

Testing - How to split up pre-commit unit tests and CI end-to-end tests

Scenario I'm working on an app that has fast unit/functional jest tests along with slower end-to-end jest-puppeteer tests. I would like to split those up so that I can run the faster tests as part of a git pre-commit hook and leave the end-to-end…
Jacksonkr
  • 31,583
  • 39
  • 180
  • 284
0
votes
1 answer

How can I find if a certain exists after getting the page response with node and puppeteer?

I am scraping some sites to check if they are blocked so I compare different responses. I came to a conclusion that some have a specific function inside a script tag, and I don't know how to catch that. I tried several ways of parsing the response…
0
votes
1 answer

How to get oauth access token using puppeteer?

I need to first fetch the oauth access token and then pass it as a parameter to my post request, please let me know how this can be achieved using puppeteer. I am new to puppeteer and I am stuck kindly assist.
Harish
  • 11
  • 8
0
votes
1 answer

Jest-Puppeteer -Expected one assertion to be called but received zero assertion calls

This script is logging in to a site. This is my first jest test. The last line before the test clicks a li in a ul dropdown list. We then navigate to a new page with url https://uat2.onplanapp.com/#/ As a simple test I am trying to check that this…
0
votes
0 answers

Jest-Puppeteer test fails - target closed

This is my first jest test with puppeteer. I am trying to log in to a site and test that the title of the first page after log in is correct. This is being done in headful mode. I can see that the login is successful. However the test fails and the…
0
votes
1 answer

xpath-puppeteer- cannot click on the element

I'm trying to click on the element using xpath on puppeteer. It actually didn't throw any errors, its just that the puppeteer won't click on the element. I don't know if there's something wrong with my code.I'll be showing the element that I'm…
0
votes
0 answers

puppeteer page.goto api unable to load a URL

I'm setting up integration test workflow in my current project. For that I'm using jest-puppeteer and writing test cases in typescript. But await page.goto(url, {waitUntil:'networkidle2'}) is unable to load any URL. I have reproduced the issue…
Dip686
  • 641
  • 6
  • 16
0
votes
1 answer

Puppeteer: Storing and accessing contextual or meta data per page visit

I'm experimenting with auto-generating outcomes using @xstate/test and combining it with puppeteer and jest. Using jest's beforeAll and afterAll hooks I'm calling page.setRequestInterception and registering a callback to intercept network requests…
chautelly
  • 447
  • 3
  • 14
0
votes
1 answer

Puppeteer: input field selected by ID returns undefined

Above, you can see the input element with the #account_email selector. But a jest functional test which awaits selection and typing in this field fails every time. I can't understand why. Is there a syntax error below? Is this type of selection…
Sean D
  • 3,810
  • 11
  • 45
  • 90
0
votes
0 answers

How to test the application in Incognito mode using puppetter?

When ever I tried using the below code, it launches a second window in incognito mode. const context = await browser.createIncognitoBrowserContext(); const page = await context.newPage(); When I tried the below code, it launches the Incognito…
Rajesh G
  • 473
  • 3
  • 6
  • 20
0
votes
1 answer

limit scope to an array of elementHandles (for selection/click/etc)

I'm using --> arrayOfHandles = await page.$x({SOME XPATH EXPRESSION}); To create an array of elementHandles to loop through and limit scope in the loop to each Handle: But It is not working!!!!! Given the following snippet of code:
Jeuke
  • 133
  • 1
  • 10
0
votes
1 answer

When is an elementHandle not an elementHandle

In the puppeteer api docs an ElementHandle is defined: ElementHandle represents an in-page DOM element. ElementHandles can be created with the page.$ method. So given an ElementHandle I should be able to do all the basic functions you can do with…
Jeuke
  • 133
  • 1
  • 10
0
votes
0 answers

How to handle multiple windows in puppeteer?

Like how we handle window handling in selenium.. Switching between parent window and child window. Can this be done in puppeteer ? When I click on the link, it opens in a new tab, where I'll be doing some operations. Then I need to close that…
Rajesh G
  • 473
  • 3
  • 6
  • 20
0
votes
2 answers

Click using Xpath is not working when called from a function in puppeteer

Trying to click on an element using $x but throws error. Tried different ways but no luck, can anyone let me know what is the mistake with the below code or any other way to click using xpath. Error: Protocol error (Runtime.callFunctionOn): Target…
Vincent
  • 484
  • 4
  • 6
  • 21
0
votes
1 answer

How to click link that contains text

I want to click a link that contains certain text. I have tried using an X-Path expression and that is not working. The application I am testing is Multi Page Application so I am not sure if the new page is generated. The HTML:
Tim
  • 15
  • 3
1 2 3
8 9