-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
Copy pathhook_timeouts.feature
79 lines (66 loc) · 1.94 KB
/
hook_timeouts.feature
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
Feature: Step definition timeouts
Background:
Given a file named "features/step_definitions/cucumber_steps.js" with:
"""
const {Before, Given, setDefaultTimeout} = require('@cucumber/cucumber')
setDefaultTimeout(500);
Before({tags: '@slow-with-increased-timeout', timeout: 1500}, function(scenario, callback) {
setTimeout(callback, 1000)
})
Before({tags: '@slow'}, function(scenario, callback) {
setTimeout(callback, 1000)
})
Before({tags: '@disabled', timeout: -1}, function(scenario, callback) {
setTimeout(callback, 1000)
})
Given(/^a passing step$/, function() {})
"""
Scenario: slow hooks timeout
Given a file named "features/a.feature" with:
"""
Feature:
@slow
Scenario:
Given a passing step
"""
When I run cucumber-js
Then it fails
And the output contains the text:
"""
function timed out, ensure the callback is executed within 500 milliseconds
"""
Scenario: slow hooks can increase their timeout
Given a file named "features/a.feature" with:
"""
Feature:
@slow-with-increased-timeout
Scenario:
Given a passing step
"""
When I run cucumber-js
Then it passes
Scenario: changing hooks timeouts does not effect other hooks
Given a file named "features/a.feature" with:
"""
Feature:
@slow
@slow-with-increased-timeout
Scenario:
Given a passing step
"""
When I run cucumber-js
Then it fails
And the output contains the text:
"""
function timed out, ensure the callback is executed within 500 milliseconds
"""
Scenario: hooks can disable timeouts
Given a file named "features/a.feature" with:
"""
Feature:
@disabled
Scenario:
Given a passing step
"""
When I run cucumber-js
Then it passes