Skip to content

Commit 6e60c40

Browse files
twometresteveSteve Kirkland
andauthored
Replace "the test should run in this browser" steps with Cucumber tags (#2626)
* Helper class for determining browser support for various features * Replace cucumber step with tag to only run when the browser supports the feature * More scenarios converted * Correct logic for version override --------- Co-authored-by: Steve Kirkland <steve.kirkland@smartbear.com>
1 parent 24d3d4c commit 6e60c40

33 files changed

Lines changed: 527 additions & 420 deletions

File tree

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
@auto_detect_errors
22
Feature: Switching off automatic reporting
33

4-
Scenario: setting autoDetectErrors option to false
5-
When I navigate to the test URL "/auto_detect_errors/script/autodetect_false.html"
6-
Then I wait to receive an error
7-
And the error is a valid browser payload for the error reporting API
8-
And the event "unhandled" is false
9-
And the exception "errorClass" equals "Error"
10-
And the exception "message" equals "manual notify does work"
11-
And the exception "type" equals "browserjs"
4+
Scenario: setting autoDetectErrors option to false
5+
When I navigate to the test URL "/auto_detect_errors/script/autodetect_false.html"
6+
Then I wait to receive an error
7+
And the error is a valid browser payload for the error reporting API
8+
And the event "unhandled" is false
9+
And the exception "errorClass" equals "Error"
10+
And the exception "message" equals "manual notify does work"
11+
And the exception "type" equals "browserjs"
1212

13-
Scenario: setting enabledErrorTypes.unhandledExceptions option to false
14-
When I navigate to the test URL "/auto_detect_errors/script/unhandled_exceptions_false.html"
15-
Then I wait to receive an error
16-
And the error is a valid browser payload for the error reporting API
17-
And the event "unhandled" is false
18-
And the exception "errorClass" equals "Error"
19-
And the exception "message" equals "manual notify does work"
20-
And the exception "type" equals "browserjs"
13+
Scenario: setting enabledErrorTypes.unhandledExceptions option to false
14+
When I navigate to the test URL "/auto_detect_errors/script/unhandled_exceptions_false.html"
15+
Then I wait to receive an error
16+
And the error is a valid browser payload for the error reporting API
17+
And the event "unhandled" is false
18+
And the exception "errorClass" equals "Error"
19+
And the exception "message" equals "manual notify does work"
20+
And the exception "type" equals "browserjs"
2121

22-
Scenario: setting enabledErrorTypes.unhandledRejections option to false
23-
When I navigate to the test URL "/auto_detect_errors/script/unhandled_rejections_false.html"
24-
And the test should run in this browser
25-
Then I wait to receive an error
26-
And the error is a valid browser payload for the error reporting API
27-
And the event "unhandled" is false
28-
And the exception "errorClass" equals "Error"
29-
And the exception "message" equals "manual notify does work"
30-
And the exception "type" equals "browserjs"
22+
@requires_promise
23+
Scenario: setting enabledErrorTypes.unhandledRejections option to false
24+
When I navigate to the test URL "/auto_detect_errors/script/unhandled_rejections_false.html"
25+
Then I wait to receive an error
26+
And the error is a valid browser payload for the error reporting API
27+
And the event "unhandled" is false
28+
And the exception "errorClass" equals "Error"
29+
And the exception "message" equals "manual notify does work"
30+
And the exception "type" equals "browserjs"
Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
11
@skip_ie_8 @skip_ie_9 @skip_ie_10 @skip_ie_11 @skip_firefox_30 @skip_safari_6
22
Feature: Error.cause
33

4-
Scenario: Error thrown with an assigned Error cause property
5-
When I navigate to the test URL "/cause/script/property.html"
6-
And the test should run in this browser
7-
And I wait to receive an error
8-
Then the error is a valid browser payload for the error reporting API
9-
And the error payload field "events.0.exceptions" is an array with 2 elements
10-
And the error payload field "events.0.exceptions.0.errorClass" equals "Error"
11-
And the error payload field "events.0.exceptions.0.message" equals "I am the error"
12-
And the error payload field "events.0.exceptions.0.type" equals "browserjs"
13-
And the error payload field "events.0.exceptions.0.stacktrace" is a non-empty array
14-
And the error payload field "events.0.exceptions.1.errorClass" equals "Error"
15-
And the error payload field "events.0.exceptions.1.message" equals "I am the cause"
16-
And the error payload field "events.0.exceptions.1.type" equals "browserjs"
17-
And the error payload field "events.0.exceptions.1.stacktrace" is a non-empty array
4+
@requires_error_cause
5+
Scenario: Error thrown with an assigned Error cause property
6+
When I navigate to the test URL "/cause/script/property.html"
7+
And I wait to receive an error
8+
Then the error is a valid browser payload for the error reporting API
9+
And the error payload field "events.0.exceptions" is an array with 2 elements
10+
And the error payload field "events.0.exceptions.0.errorClass" equals "Error"
11+
And the error payload field "events.0.exceptions.0.message" equals "I am the error"
12+
And the error payload field "events.0.exceptions.0.type" equals "browserjs"
13+
And the error payload field "events.0.exceptions.0.stacktrace" is a non-empty array
14+
And the error payload field "events.0.exceptions.1.errorClass" equals "Error"
15+
And the error payload field "events.0.exceptions.1.message" equals "I am the cause"
16+
And the error payload field "events.0.exceptions.1.type" equals "browserjs"
17+
And the error payload field "events.0.exceptions.1.stacktrace" is a non-empty array
1818

19-
Scenario: Error thrown with an Error cause in the constructor
20-
When I navigate to the test URL "/cause/script/constructor.html"
21-
And the test should run in this browser
22-
And I wait to receive an error
23-
Then the error is a valid browser payload for the error reporting API
24-
And the error payload field "events.0.exceptions" is an array with 2 elements
25-
And the error payload field "events.0.exceptions.0.errorClass" equals "Error"
26-
And the error payload field "events.0.exceptions.0.message" equals "I am the error"
27-
And the error payload field "events.0.exceptions.0.type" equals "browserjs"
28-
And the error payload field "events.0.exceptions.0.stacktrace" is a non-empty array
29-
And the error payload field "events.0.exceptions.1.errorClass" equals "Error"
30-
And the error payload field "events.0.exceptions.1.message" equals "I am the cause"
31-
And the error payload field "events.0.exceptions.1.type" equals "browserjs"
32-
And the error payload field "events.0.exceptions.1.stacktrace" is a non-empty array
19+
@requires_error_cause
20+
Scenario: Error thrown with an Error cause in the constructor
21+
When I navigate to the test URL "/cause/script/constructor.html"
22+
And I wait to receive an error
23+
Then the error is a valid browser payload for the error reporting API
24+
And the error payload field "events.0.exceptions" is an array with 2 elements
25+
And the error payload field "events.0.exceptions.0.errorClass" equals "Error"
26+
And the error payload field "events.0.exceptions.0.message" equals "I am the error"
27+
And the error payload field "events.0.exceptions.0.type" equals "browserjs"
28+
And the error payload field "events.0.exceptions.0.stacktrace" is a non-empty array
29+
And the error payload field "events.0.exceptions.1.errorClass" equals "Error"
30+
And the error payload field "events.0.exceptions.1.message" equals "I am the cause"
31+
And the error payload field "events.0.exceptions.1.type" equals "browserjs"
32+
And the error payload field "events.0.exceptions.1.stacktrace" is a non-empty array

test/browser/features/fixtures/auto_detect_errors/script/unhandled_rejections_false.html

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,6 @@
1515
</script>
1616
</head>
1717
<body>
18-
<pre id="bugsnag-test-should-run">PENDING</pre>
19-
<script>
20-
var el = document.getElementById('bugsnag-test-should-run')
21-
el.textContent = el.innerText = (typeof Promise !== 'undefined' && 'onunhandledrejection' in window)
22-
? 'YES'
23-
: 'NO'
24-
</script>
2518
<script>
2619
Promise.reject(new Error('auto detect errors does not work'))
2720
</script>

test/browser/features/fixtures/cause/script/constructor.html

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,10 @@
1717
</head>
1818

1919
<body>
20-
<pre id="bugsnag-test-should-run">PENDING</pre>
21-
<script>
22-
function shouldRun() {
23-
var err = new Error('error', { cause: new Error('cause') })
24-
return !!err.cause
25-
}
26-
var el = document.getElementById('bugsnag-test-should-run')
27-
el.textContent = el.innerText = shouldRun()
28-
? 'YES'
29-
: 'NO'
30-
</script>
3120
<script>
3221
var originalCause = new Error('I am the cause')
3322
throw new Error('I am the error', { cause: originalCause })
3423
</script>
3524
</body>
3625

37-
</html>
26+
</html>

test/browser/features/fixtures/cause/script/property.html

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,11 @@
1717
</head>
1818

1919
<body>
20-
<pre id="bugsnag-test-should-run">PENDING</pre>
21-
<script>
22-
function shouldRun() {
23-
var err = new Error('error')
24-
err.cause = new Error('cause')
25-
return !!err.cause
26-
}
27-
var el = document.getElementById('bugsnag-test-should-run')
28-
el.textContent = el.innerText = shouldRun()
29-
? 'YES'
30-
: 'NO'
31-
</script>
3220
<script>
3321
var error = new Error("I am the error")
3422
error.cause = new Error("I am the cause")
3523
throw error
3624
</script>
3725
</body>
3826

39-
</html>
27+
</html>

test/browser/features/fixtures/handled/browserify/promise_catch.html

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,5 @@
55
<script src="dist/promise_catch.js"></script>
66
</head>
77
<body>
8-
<pre id="bugsnag-test-should-run">PENDING</pre>
9-
<script>
10-
var el = document.getElementById('bugsnag-test-should-run')
11-
el.textContent = el.innerText = typeof Promise !== 'undefined'
12-
? 'YES'
13-
: 'NO'
14-
</script>
158
</body>
169
</html>

test/browser/features/fixtures/handled/rollup/promise_catch.html

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,5 @@
55
<script src="dist/promise_catch.js"></script>
66
</head>
77
<body>
8-
<pre id="bugsnag-test-should-run">PENDING</pre>
9-
<script>
10-
var el = document.getElementById('bugsnag-test-should-run')
11-
el.textContent = el.innerText = typeof Promise !== 'undefined'
12-
? 'YES'
13-
: 'NO'
14-
</script>
158
</body>
169
</html>

test/browser/features/fixtures/handled/script/promise_catch.html

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,6 @@
1414
</script>
1515
</head>
1616
<body>
17-
<pre id="bugsnag-test-should-run">PENDING</pre>
18-
<script>
19-
var el = document.getElementById('bugsnag-test-should-run')
20-
el.textContent = el.innerText = typeof Promise !== 'undefined'
21-
? 'YES'
22-
: 'NO'
23-
</script>
2417
<script>
2518
go()
2619
.then(function () {})

test/browser/features/fixtures/handled/typescript/promise_catch.html

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,6 @@
55
<script src="/docs/node_modules/@bugsnag/browser/dist/bugsnag.min.js"></script>
66
</head>
77
<body>
8-
<pre id="bugsnag-test-should-run">PENDING</pre>
9-
<script>
10-
var el = document.getElementById('bugsnag-test-should-run')
11-
el.textContent = el.innerText = typeof Promise !== 'undefined'
12-
? 'YES'
13-
: 'NO'
14-
</script>
158
<script src="dist/promise_catch.js"></script>
169
</body>
1710
</html>

test/browser/features/fixtures/handled/webpack3/promise_catch.html

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,5 @@
55
<script src="dist/promise_catch.js"></script>
66
</head>
77
<body>
8-
<pre id="bugsnag-test-should-run">PENDING</pre>
9-
<script>
10-
var el = document.getElementById('bugsnag-test-should-run')
11-
el.textContent = el.innerText = typeof Promise !== 'undefined'
12-
? 'YES'
13-
: 'NO'
14-
</script>
158
</body>
169
</html>

0 commit comments

Comments
 (0)