stale-optician-85950
09/21/2022, 10:24 PMalias
a specific value returned from cy.session()
?
Seen in my code as .as('jwtToken')
, when I do this the whole response is aliased and not just the cookie I need for later usage.
cy.session('session caching', () => {
cy.request({
method: 'POST',
url: `${urlUnderTest.origin}/auth/`,
failOnStatusCode: false,
body: {
password: Cypress.env('AUTH_PASSWORD'),
},
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
}).then(({ allRequestResponses }) => {
cy.wrap(allRequestResponses[0]['Response Headers']['set-cookie'][0]).as('jwtToken');
});
});
cy.visit(urlUnderTest.toString());