Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Execute tests one by one even across browsers

I am writing my E2E tests with testcafe against a test backend that doesn't support concurrency, i.e. if two tests execute in parallel, the test backend blows up.

When I am testing against one browser only, the tests execute serially. However, when I specify multiple browsers, the tests run serially per browser, but the tests get started in each browser at the same time.

I want testcafe to first execute all the tests in one browser, then open the next browser and execute all tests in it, etc.

Is this possible?

like image 292
Daniel Hilgarth Avatar asked Oct 17 '22 06:10

Daniel Hilgarth


1 Answers

TestCafe doesn't have a built-in options for that. But you can configure it manually. For example you can setup running in the package.json with the npm-run-all module:

  "scripts": {
    "test:chrome": "testcafe chrome c:/temp/test.js",
    "test:ie": "testcafe ie c:/temp/test.js",
    "test": "run-s test:chrome test:ie -c"
  }

Also you can setup it in the node.js script with TestCafe Programming API.

like image 68
Alexander Moskovkin Avatar answered Oct 21 '22 00:10

Alexander Moskovkin