-
Notifications
You must be signed in to change notification settings - Fork 659
/
test.js
54 lines (45 loc) · 1.72 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
const path = require('path');
const createTestCafe = require('../../../../../lib');
const { createReporter } = require('../../../utils/reporter');
const { expect } = require('chai');
let testCafe = null;
let runner = null;
let errors = null;
const reporter = createReporter({
reportTestDone (_, testRunInfo) {
errors = testRunInfo.errs;
},
});
const run = (pathToTest, concurrency) => {
const src = path.join(__dirname, pathToTest);
return createTestCafe('127.0.0.1', 1335, 1336)
.then(tc => {
testCafe = tc;
})
.then(() => {
runner = testCafe.createRunner();
return runner
.src(src)
.browsers(`chrome:headless`)
.reporter(reporter)
.concurrency(concurrency)
.run();
})
.then(() => {
testCafe.close();
});
};
describe('[Regression](GH-2011)', function () {
it('Should execute all fixture\'s test with disableConcurrency in one browser', function () {
return run('./testcafe-fixtures/concurrency-mode-with-disable-concurrency-fixture-test.js', 3)
.then(() => expect(errors.length).eql(0));
});
it('Should execute all fixture\'s in different browser', function () {
return run('./testcafe-fixtures/concurrency-mode-with-disable-concurrency-fixture-all-test.js', 3)
.then(() => expect(errors.length).eql(0));
});
it('Should execute all fixture\'s test in one browser', function () {
return run('./testcafe-fixtures/concurrency-mode-with-disable-concurrency-and-one-fixture-test.js', 3)
.then(() => expect(errors.length).eql(0));
});
});