Questions tagged [cypress-intercept]

111 questions
0
votes
1 answer

I want to write cypress script to intercept an API response and store the json response in a variable, and extract specific values from the response

My goal is to land on a page Ex: www.example.com When I land on this page a particular API is hit, I want to intercept that API and store the json response in a variable and extract specific values from the response. I have tried this code but it…
suresh
  • 1
  • 2
0
votes
2 answers

Wrong Cypress intercept being hit

I have set up a number of intercepts in the body of my tests. Here they are, pasted from the Cypress log, with the alias added cy:intercept ➟ // alias: getRecipesSku(971520) Method: GET Matcher:…
Jonathan Tuzman
  • 11,568
  • 18
  • 69
  • 129
0
votes
2 answers

Way to log API response time in Cypress

I was trying to log the API response time in Cypress, but could not find any solution. What to use, cy.intercept() or cy.request()? I was trying to use the advice like this: cy.intercept('POST', '**/create-insurance-view-model', (req) => { …
FitFju
  • 17
  • 4
0
votes
2 answers

How to read a response in Cypress?

I am trying to write an E2E test using Cypress 12.3 for a web application. During a certain part of the journey, the app makes a GET request to the endpoint "api/v2/accountApplication/getApplicationInfo?uuid=xxxxxxx". The response from this request…
ImranR
  • 516
  • 2
  • 13
  • 30
0
votes
2 answers

same api, but different response in cypress

Can cypress version 6 handle same api, but diff responses? If yes, is the following correct? If we cannot, will cypress version 9 support this? // * same api for each test, but diff response const api = '/v1/test'; it('test 1', () => { …
kenpeter
  • 7,404
  • 14
  • 64
  • 95
0
votes
1 answer

Cypress, not able to intercept a call

I am trying to intercept following call, that gets executed after click on SAVE operation. Its a POST 201 call. Sample request URL is : https://www.test.com/abc/def/ghi/jkl/1234/mno/pqr/stu/9876 where 1234 and 9876 are dynamic changing parts of…
0
votes
0 answers

Cypress test do not run using Jenkins but run fine from command line. Throws Failed to construct 'URL': Invalid URL Error

We run our E2E tests against Chrome 70 on windows machine in headed mode using command npm install && cypress run --browser chrome --headed "--config" "baseUrl=http:serveraddress:8080" "--env" "Host=serveraddress". The tests connect to a server url…
0
votes
1 answer

Want to use result of one request in a second request, for API testing with Cypress

I want to test API endpoint using cypress and want do mocking for AUTH token because it's coming from another API cy.intercept({ method:'get', url:'/first…
0
votes
1 answer

Cypress giving error "WebSocket is closed before the connection is established"

When i visit baseURL, it will navigate to keycloak login, after entering login details, then it will navigate to production URL. So, I'm navigating back to baseURL. At that time, it will throw below error in console. Hence Page is keep on…
0
votes
0 answers

There is any solution to generate the authorization token for the API testing globally?

There is any solution to generate the authorization token for the API testing globally in order to use it on different specs ? There is any solution to generate the authorization token for the API testing globally in order to use it on different…
0
votes
1 answer

after hook doesn't work for the first time in cypress

after hook doesnt work for the first time in cypress but when i retry, it works. in the after hook i call a cy.request and i get a token from another request . i run the token request in before all the tests to make sure i got the token here is the…
soso
  • 1
0
votes
1 answer

Cypress: Cannot create property 'errors' on string

I created a sample project and the URL I wish to navigate is https://www.nasa.gov/ but it fails with the error 'Cannot create property 'errors' on string ''... I was able to run this earlier but now all of a sudden, it is throwing this error..…
0
votes
2 answers

Is there a way to fail a Cypress test on CONREFUSED?

I'm using the new Cypress component test option for my frontend tests, and I absolutely love it. I'm using it as an integration test solution, mounting the root component of my react app and using Cypress to test extensive user interactivity with…
craigmiller160
  • 5,751
  • 9
  • 41
  • 75
0
votes
0 answers

Cypress with same url but different parameters

As I am new to Cypress and need information on how to handle when same url with different parameter called. Ex: Cypress multiple url(s) Real time application multiple same url(s) with different parameters How should I proceed or any way to tackle…
SVinayaka
  • 3
  • 1
  • 2
  • 4
0
votes
2 answers

Cypress - intercept two endpoints in same spec file

I am having trouble intercepting 2 api's in the same spec file. The endpoints are client/users client/users/ipuser Issue: It captures the users response in ipuser json. Can someone please help on how to use regex in the…
140218-M
  • 29
  • 1
  • 6