Reputation: 493
Some background: before loading my website I need to obtain an oauth token from a 3rd party provider. This requires visiting a new URL, entering in some test credentials, clicking sign-in, and then pulling the oauth token back. Once I have this oauth token I can then load our website and store it in localStorage and proceed with the test.
However, whenever I visit a page in cypress I then cannot visit any other domains or I receive a CORS error (seems this is intended by cypress). Is there any way to do this? Is there a way to visit a website one time before my tests run, login, and then run my tests?
Upvotes: 0
Views: 1334
Reputation: 674
Cypress does not support visiting different domains in one test. Instead of opening the page, use cy.request()
to obtain needed token.
Further read:
Upvotes: 1