Questions tagged [cypress-session]

13 questions
2
votes
1 answer

Cypress session tests not working for the second time

I am using the following code in cypress version 12 on mac OS. The issue with my test is that it is only running for the first time when the session is running the setup() function, but when I re-run the same test and the session is restored the…
1
vote
1 answer

Cy.Session() Fails Some times When cookie expires

I am logging into application by using Cy.session() . it stores the session and restore the session for Next tests But some times when Cypress test runner automatically reloads on code update then it does not login and gives Error. May be the…
1
vote
2 answers

Cypress: Is it possible to navigate to a web page and leave it opened for the next tests?

I am planning to update the Cypress version of an existing project from 6.9.1 to 12.6.0. Currently we are navigating to a web page and logging in with ntlm-auth in a before() hook. After that the web page remains opened and can be used in all tests…
Petar
  • 13
  • 5
1
vote
0 answers

cy.session() with cy.request() does not log in user

I set up (in my cypress commands): Cypress.Commands.add("loginByApi1", (username1, password1, TrackingId1) => { cy.session([username1, password1, TrackingId1], () => { cy.request({ method: 'POST', url:…
1
vote
2 answers

Use cy.session across multiple tests in Cypress

In latest version of Cypress Cookie preserve is deprecated so I wish to us cy.session. However I can't get this to work across multiple tests as cy.session needs to be inside a test 'it', example of how my tests are currently set up. …
1
vote
1 answer

Cypress: Using same fixture file in multiple test

I need to pass the url and other variable in multiple tests[it-function]. For 1st test code run successfully but for 2nd test it showing error. Is there any workaround or solution? My code is as follows describe('Document Upload', function() { …
mishu
  • 11
  • 1
1
vote
2 answers

How to implement Cypress v10 session() to persist cookies that are not initially available

I am running cypress v10 on a react front-end and trying to get my cookies to persist through some of my tests. I am testing the flow of logging in and out of my app. As of V10 cy.session() appears to be the way to go. However, most of the examples…
Hank
  • 2,456
  • 3
  • 35
  • 83
0
votes
1 answer

I want to login everytime with new user but Cy.session recreate session with same user again

I Have pageObject Login File in which I am creating a session while login login(username,password){ cy.session('sessionId', () => { cy.visit('/'); this.getUsername().type(username); …
0
votes
0 answers

Switching Sessions inside the tests in Cypress (cy.session)

This is my scenario: User A logs in and performs some actions on the webpage. After completing the actions, User B logs in to check if the changes made by User A are reflected on the webpage. I wanted to use the cy.sessions method, but it is…
0
votes
2 answers

How to save data in variables and reuse it in other block in Cypress?

If it possible in Cypress.io to save data in variables and reuse it in other block For example, I have a special name of device. I want to recieve this data and after clicking on it, check if title in new window contains that special name of…
Yaroslav
  • 21
  • 2
0
votes
0 answers

sessionStorage.getItem is coming as null in cypress

I tried to set the session as in a custom command and called it in beforeall block Cypress.Commands.add('cLogin', (win: any) => { cy.request({ method: 'POST', url: `loginAPIURL`, body: { …
0
votes
2 answers

Cypress: preserve cookies in version 10+

We used to login into our application using the cy.request() method and here the JSESSIONID cookie is set. login(): void { cy.clearCookie('JSESSIONID'); cy.request({ method: 'POST', url: `${apiUrl()}/sessions`, body: { …
Jonas
  • 166
  • 1
  • 13