In TestCafé, I want to run a test in different browsers in parallel. Each session should sign up and log in with a different user account.
I tried to achieve this with the before
hook:
let user = null;
fixture("My fixture")
.page("http://localhost:8080")
.before(() => {
user = faker.internet.email();
});
test("login", async t => {
// using user in here
});
However, this hook is just executed once for all browsers, I need to run it for each browser so that I can have different credentials each time.
Is this feasible?
This is the NPM script:
testcafe firefox,chrome,edge tests.js
Yes, you can use the beforeEach
hook for this.
https://devexpress.github.io/testcafe/documentation/test-api/test-code-structure.html#test-hooks