1

Am trying to use the before() at TestCafe Fixture level.

My Goal is : Create Before() at fixture level, and this contains login Page scripts. So my plan is to run before() method before all other tests. I have 3 groups of code

1) Before() -- login code. 
2) test1() -- sample code-1
3) test2() -- sample code-2

My requirement is: once the login is succeeded then test1(), test2() should use the same login which is defined in before(). Can you please help me here, note: i tried using Testcafe-Live but did not succeed.

my test scenarios are: Before the test login method should be executed one time before executing test1 and test2. Also, the browser window should not close after each test

Alex Skorkin
  • 4,264
  • 3
  • 25
  • 47
Yuvaraja KS
  • 151
  • 1
  • 7

1 Answers1

3

Similar question: How to do 'beforeEach' only at Fixture level and not for each test under that fixture

You could achieve this by using .beforeEach() on the Fixture and then using 'preserve url' option on the UserRole: TestCafe's documentation explains it here: https://devexpress.github.io/testcafe/documentation/test-api/authentication/user-roles.html#optionspreserveurl

TallKU
  • 179
  • 12