Skip to content

Commit cddc5a5

Browse files
authored
Simplify tests (#4)
Cleaning up feature file
1 parent 865894f commit cddc5a5

File tree

1 file changed

+11
-45
lines changed

1 file changed

+11
-45
lines changed

features/parallel_custom_assign.feature

Lines changed: 11 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -50,33 +50,7 @@ Feature: Running scenarios in parallel with custom assignment
5050
When I run cucumber-js with `--parallel 2`
5151
Then it passes
5252

53-
Scenario: assignment is appropriately applied and fails at last processed scenario 'a'
54-
Given a file named "features/step_definitions/cucumber_steps.js" with:
55-
"""
56-
const {Given, setParallelCanAssign} = require('@cucumber/cucumber')
57-
let flag = true
58-
setParallelCanAssign(() => (flag = !flag))
59-
Given(/^scenario (\d+)$/, function(scenario, cb) {
60-
setTimeout(cb, 150)
61-
})
62-
"""
63-
And a file named "features/a.feature" with:
64-
"""
65-
Feature: adheres to setParallelCanAssign handler
66-
Scenario: a
67-
Given scenario 1
68-
69-
Scenario: b
70-
Given scenario 2
71-
72-
Scenario: c
73-
Given scenario 3
74-
"""
75-
When I run cucumber-js with `--parallel 2`
76-
Then it passes
77-
And it runs tests in order b, c, a
78-
79-
Scenario: assignment is appropriately applied and fails at last processed scenario 'a'
53+
Scenario: assignment is appropriately applied
8054
Given a file named "features/step_definitions/cucumber_steps.js" with:
8155
"""
8256
const {Given, setParallelCanAssign} = require('@cucumber/cucumber')
@@ -87,49 +61,41 @@ Feature: Running scenarios in parallel with custom assignment
8761
setParallelCanAssign((pickleInQuestion, picklesInProgress) => _.isEmpty(pickleInQuestion.tags)
8862
|| _.every(picklesInProgress, ({tags}) => _.isEmpty(tags) || tags[0].name !== pickleInQuestion.tags[0].name))
8963
90-
function step_def(name, delay) {
91-
return function(scenario, cb) {
92-
if (worker == null) worker = name;
93-
if (processed !== 3) {
94-
expect(worker).to.eq(name)
95-
expect(scenario).to.eq(++processed)
96-
} else {
97-
// Scenario 3 might get picked up by B as both are ready at this point
98-
expect(scenario).to.eq(processed++)
99-
}
64+
function step_def(delay) {
65+
return function(cb) {
10066
setTimeout(cb, delay)
10167
}
10268
}
10369
104-
Given(/^scenario complex (\d+)$/, step_def('A', 300))
105-
Given(/^scenario simple (\d+)$/, step_def('B', 200))
70+
Given(/^complex step$/, step_def(300))
71+
Given(/^simple step$/, step_def(200))
10672
"""
10773
And a file named "features/a.feature" with:
10874
"""
10975
Feature: adheres to setParallelCanAssign handler
11076
@complex
11177
Scenario: 1
112-
Given scenario complex 1
78+
Given complex step
11379
11480
@complex
11581
Scenario: 2
116-
Given scenario complex 2
82+
Given complex step
11783
11884
@complex
11985
Scenario: 3
120-
Given scenario complex 3
86+
Given complex step
12187
12288
@simple
12389
Scenario: 4
124-
Given scenario simple 1
90+
Given simple step
12591
12692
@simple
12793
Scenario: 5
128-
Given scenario simple 2
94+
Given simple step
12995
13096
@simple
13197
Scenario: 6
132-
Given scenario simple 3
98+
Given simple step
13399
"""
134100
When I run cucumber-js with `--parallel 2`
135101
Then it passes

0 commit comments

Comments
 (0)