Managing Cookies in Cypress tests #30413
Unanswered
williamtaggart97
asked this question in
Questions and Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm working through setting up login for my E2E tests, but the login/callback relies on an
oauth-state
cookie that isn't there when I log in via Cypress.Here's the login code:
And here's the next route that's throwing an error (I've confirmed that the query params for
code
andstate
are coming through correctly)My question is: How can I make sure that the
canvas-oauth-state
cookie is successfully passed to the callback route?I've tried looking through the cookies using
Cypress.Cookies.debug(true)
and I've tried logging cookies at different steps in the process and it's really weird. When I am going through the log in process, I see that the debug logs remove an old cookie and set a new cookie, so I know it exists somewhere in the process. HOWEVER, whenever I try to add manual logs in my login action to see if I can manipulate that cookie, it's not there...I've used
cy.getCookies
,cy.getAllCookies
andcy.getCookie('canvas-oauth-state')
and they never return the object you see in the screenshot below.Any input on the discrepancies between the debug logs and
cy.getCookie
would be appreciated. I've been thinking about maybe a change in domain, but I'm lost...Beta Was this translation helpful? Give feedback.
All reactions