We're creating E2E tests in Cypress. One of our tests shows a list of banks to which you can be redirected to complete a payment. After clicking a specific bank with the following code:
cy.get('.modal')
.contains('Bunq')
.click()
The following happens:
- A request is sent to our back-end
http://localhost:4200/api/bunq
which responds with anredirect url
- The browser is redirected to the redirect URL which is another domain:
https://example.com?_id=uniqueIdGeneratedAfterButtonClick
. Please note that we can only generate this link after the user has clicked one of the options!
Obviously we could mimmic the request that happens after the click with cy.request
and check the response for validity. But I am curious if Cypress can confirm that the browser is indeed redirected to another domain (e.g. catching the error that is thrown).
cy.url()
.Refused to display 'https://api.pay.nl/xxxxxxx' in a frame because it set 'X-Frame-Options' to 'sameorigin'.
. Therefore callingcy.url()
afterwards does not give me the URL to which we are redirected in the end.