Tescafe user
Tescafe user

Reputation: 1

Testcafe tests - conditional skip/run

I have some tests added, which are related to user account. I need to confirm that the test user exists for proceeding to the further tests This is what I have done, 1.Created a method to verify whether the user exists which returns true if user exists.This is done by logging in backend . So need to run only onces. 2. Called this method in test.before But I need to run all tests only if the user exists, else skip all tests. Please help Thank you

Upvotes: 0

Views: 487

Answers (1)

AlexanderMoiseev
AlexanderMoiseev

Reputation: 556

At present, this feature is not implemented (a related issue on GitHub - https://github.com/DevExpress/testcafe/issues/1626). However, you can achieve your goal without it by splitting your test run into two separate runs. The first test part is creating a test user, the second one - all tests that required a test user. Test runs can look as follows:

testcafe chrome tests/create-test-user.js // creates the user

testcafe chrome !/tests/create-test-user.js /tests/**/*.js // run all tests except test that creates the user

Upvotes: 1

Related Questions