While running the tests, cypress is redirecting - cypress

while I am running the tests in cypress, it is redirecting to login page, then remaining tests become fails . What is the reason for that

If the login page in your tests contains another domain - cypress fails the test and stop the scenario.
Here link: https://docs.cypress.io/guides/guides/web-security#Limitations

Related

Data appear in Chrome but not in Cypress test runner

My problem is that when im opening website on my computer by chorme everything works fine. But when im using Cypress cy.visit() to reach this endpoint by Cypress test runner, the data not appear..
in runner i always get Null response and have no idea why.
ill try to wait for page to load but its not working. click for module im interested, post and get endpoint. nothing works, table in test runner still opens empty

Why Cypress gives success after second attempt?

In my Cypress tests, I create some data in before block and then my test script is run that locates in it block. I checked business side flow and it seems like there is no error about app side. I just want to understand that why my test's result is success after second attempt. Does Cypress has this kind of solution to handle an error maybe?
Cypress has the ability to automatically retry any failed tests. I would check your Cypress configuration's value for retries.openMode.

Cypress Tests throw Error: Exceeded maxRedirects. Probably stuck in a redirect loop

I have cypress UI tests running remotely. Our authentication team has recently made a change that redirects the page twice, previously only once. This change has caused my tests to fail at cy.visit('/') with error "Exceeded maxRedirects. Probably stuck in a redirect loop https://mybetawebsite/redirect=signin&redirect=signin"
When I asked them about this erorr, they told me to follow the redirect a second time.
I know cy.visit follows redirects
(https://docs.cypress.io/api/commands/visit#Redirects) , but it does only once or multiple times?
Previously, when my tests were passing, I could see 302(redirection) at cy.visit (to different url for auth) and test used to continue and pass.
in my cypress.json,
baseUrl: https://mybetawebsite
How do I handle second redirect?

How can I 'Do something' if protractor test case fails?

I have a test suite of around 1000 test cases, but sometimes if one test case fails due to some unclosed popup window, all of the subsequent test cases will also fail because the popup modal will not allow protractor to interact with page elements.(My app is that way)
So I want to create some condition such as i will refresh the page if a test case fails or I will go to my homepage link if test case fails as all tc's start from same starting point.
This will prevent all my subsequent test cases from failing. This method was called recovery scenario in QTP/UFT days.
I was also facing these kind of issue that if one test case fails subsequent all test cases will fail,Not sure if there is any recovery scenarios available in protractor but I am using before all, after all, before each and after each to start my each test from a clean state. I have added a helper function to navigate to Home page and I call every time this function from before each.
this is helpful link

close browser upon test error - protractor

i'm running protractor tests. if angular is not found or some exception is thrown, the test finishes however, the browser is not closed. this is a problem when running protractor in CI.
i tried using the onCleanUp function in the config file with no success.
any ideas how to close the browser after tests finished?
thanks you

Resources