@@ -50,33 +50,7 @@ Feature: Running scenarios in parallel with custom assignment
50
50
When I run cucumber-js with `--parallel 2`
51
51
Then it passes
52
52
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
80
54
Given a file named "features/step_definitions/cucumber_steps.js" with:
81
55
"""
82
56
const {Given, setParallelCanAssign} = require('@cucumber/cucumber')
@@ -87,49 +61,41 @@ Feature: Running scenarios in parallel with custom assignment
87
61
setParallelCanAssign((pickleInQuestion, picklesInProgress) => _.isEmpty(pickleInQuestion.tags)
88
62
|| _.every(picklesInProgress, ({tags}) => _.isEmpty(tags) || tags[0].name !== pickleInQuestion.tags[0].name))
89
63
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) {
100
66
setTimeout(cb, delay)
101
67
}
102
68
}
103
69
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))
106
72
"""
107
73
And a file named "features/a.feature" with:
108
74
"""
109
75
Feature: adheres to setParallelCanAssign handler
110
76
@complex
111
77
Scenario: 1
112
- Given scenario complex 1
78
+ Given complex step
113
79
114
80
@complex
115
81
Scenario: 2
116
- Given scenario complex 2
82
+ Given complex step
117
83
118
84
@complex
119
85
Scenario: 3
120
- Given scenario complex 3
86
+ Given complex step
121
87
122
88
@simple
123
89
Scenario: 4
124
- Given scenario simple 1
90
+ Given simple step
125
91
126
92
@simple
127
93
Scenario: 5
128
- Given scenario simple 2
94
+ Given simple step
129
95
130
96
@simple
131
97
Scenario: 6
132
- Given scenario simple 3
98
+ Given simple step
133
99
"""
134
100
When I run cucumber-js with `--parallel 2`
135
101
Then it passes
0 commit comments