Nirupama Velagapudi
Nirupama Velagapudi

Reputation: 27

Testcafe - Fresh browser session is launched for each test in a fixture. How can we avoid this

I have a scenario which is an end to end testing.

test1 - Add a setup

test2 - Generate template for the data

test3 - Link Github to the setup

test4 - perform some actions in Github and validate data

I created a fixture with test1, test2, test3, and test4. But observed that fresh browser session is launched for each test. How can I continue my testing from test1 to test4 without interrupting the browser session

Upvotes: 1

Views: 657

Answers (1)

Alex Skorkin
Alex Skorkin

Reputation: 4274

Each test starts with a clean browser state. Cookies and storages are reset, an empty user profile is used, and the tested page is reloaded. This helps prevent interference between tests without extra boilerplate code.

Avoid creating test cases that depend on each other. The functional tests' best practice is to write test cases independently. You can use the Test Hooks feature to setup and tear down logic for each of your test cases. For instance, in the 'before each' hook, you can 'add a setup' for each test case.

Upvotes: 1

Related Questions