-
-
Notifications
You must be signed in to change notification settings - Fork 750
Expand file tree
/
Copy pathonly_test.js
More file actions
43 lines (36 loc) · 1.61 KB
/
only_test.js
File metadata and controls
43 lines (36 loc) · 1.61 KB
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
const path = require('path')
const exec = require('child_process').exec
const assert = require('assert')
const runner = path.join(__dirname, '/../../bin/codecept.js')
const codecept_dir = path.join(__dirname, '/../data/sandbox/configs/only')
const codecept_run = `${runner} run --config ${codecept_dir}/codecept.conf.js `
describe('Feature.only', () => {
it('should run only scenarios in Feature.only and skip other features', done => {
exec(`${codecept_run} only_test.js`, (err, stdout, stderr) => {
stdout.should.include('Only Scenario 1 was executed')
stdout.should.include('Only Scenario 2 was executed')
stdout.should.include('Only Scenario 3 was executed')
stdout.should.not.include('Regular Scenario 1 should NOT execute')
stdout.should.not.include('Regular Scenario 2 should NOT execute')
stdout.should.not.include('Another Regular Scenario should NOT execute')
// Should show 3 passing tests
stdout.should.include('3 passed')
assert(!err)
done()
})
})
it('should work when there are multiple features with Feature.only selecting one', done => {
exec(`${codecept_run} only_test.js`, (err, stdout, stderr) => {
// Should only run the @OnlyFeature scenarios
stdout.should.include('@OnlyFeature --')
stdout.should.include('✔ @OnlyScenario1')
stdout.should.include('✔ @OnlyScenario2')
stdout.should.include('✔ @OnlyScenario3')
// Should not include other features
stdout.should.not.include('@RegularFeature')
stdout.should.not.include('@AnotherRegularFeature')
assert(!err)
done()
})
})
})