question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add new testIsolation configuration option

See original GitHub issue

What would you like?

What I would suggest to be improved is when we are using the cy.session() command or to be more specific experimentalSessionAndOrigin=true, currently the state between the tests within one cy/spec file is cleaned and we need to reset everything, but when we do not use this flag the state is kept and we can link together some tests. It would be great to be able to keep the state as we do without the flag and not set the page url to _blank_

Why is this needed?

This would save a lot of execution time for tests where we do need to stay on the same page, or depend on some setup from the previous test where instead of logging in, setting everything up again, we can just continue where we left off (like we do when experimentalSessionAndOrigin is false)

Other

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:2
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
emilyrohrboughcommented, Jun 16, 2022

Test isolation is writing tests such that tests to no rely on the test before it. Clearing the page and setting the url to about:blank is one mechanism Cypress used to ensure test isolation. This behavior allows each test to have a clean slate without app state leaking, whether initially or unexpectedly, into the next test.

In general, we recommend writing tests that do no rely on each other, but with this said, we recognized there are use-cases where clearing the app’s current state is undesirable.

The request to add a new configuration option to opt-out of test isolation when experimentalSessionAndOrigin=true has been taken into consideration. There are plans to add a new configuration optional which will give you the flexibility to turn this behavior off.

@vergjor Can you create a separate issue to discuss your request to remove the clear page after the session validation is ran? We need evaluate it independently since it alters the existing behaviors of the cy.session() command.

1reaction
jnsrnhldcommented, Jun 15, 2022

Totally agree on this. I have to test a long chain of forms and with the new session behavior I have to slam all assertions and actions into one huge test or the setup effort for each test gets huge.

I suggest, for example, to add a flag to the spec context that enables to stay on the current page instead of starting with a blank page for each test. So the new behavior can be kept, but the old can still be enabled via a flag.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Test Isolation - Cypress Documentation
The test isolation is a global configuration and can be overridden for end-to-end testing at the describe level with the testIsolation option.
Read more >
Test different configurations - Azure Test Plans | Microsoft Learn
Select the + icon and select New test configuration. Screenshot shows the New test configuration option in the New menu. Type a name...
Read more >
End-to-end Testing with Cypress Series: 05 Isolate Test State
In this video, learn how to isolate test state by adding another ... test with `it.only` 02:19 How to fill in setup code...
Read more >
Add Microsoft Fakes (Unit Test Isolation) to Professional or ...
Microsoft Professional does not support Fakes and it should. This is not an enterprise feature, but a necessity. The option goes from 1...
Read more >
Spring-boot multi-module configuration and test isolation
class for you all your springboottests in your application, and you don't have 3000 tests failing whenever you add a new spring bean...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found