-
Notifications
You must be signed in to change notification settings - Fork 403
/
Copy pathattachments.feature
67 lines (63 loc) · 1.99 KB
/
attachments.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
Feature: attachments
Background:
Given additional preprocessor configuration
"""
{
"json": {
"enabled": true
}
}
"""
And I've ensured cucumber-json-formatter is installed
Scenario: string identity
Given a file named "cypress/e2e/a.feature" with:
"""
Feature: a feature
Scenario: a scenario
Given a step
"""
And a file named "cypress/support/step_definitions/steps.js" with:
"""
const { Given, attach } = require("@klaveness/cypress-cucumber-preprocessor");
Given("a step", function() {
attach("foobar")
})
"""
When I run cypress
Then it passes
And there should be a JSON output similar to "fixtures/attachments/string.json"
Scenario: array buffer
Given a file named "cypress/e2e/a.feature" with:
"""
Feature: a feature
Scenario: a scenario
Given a step
"""
And a file named "cypress/support/step_definitions/steps.js" with:
"""
const { Given, attach } = require("@klaveness/cypress-cucumber-preprocessor");
Given("a step", function() {
attach(new TextEncoder().encode("foobar").buffer, "text/plain")
})
"""
When I run cypress
Then it passes
And there should be a JSON output similar to "fixtures/attachments/string.json"
Scenario: string encoded
Given a file named "cypress/e2e/a.feature" with:
"""
Feature: a feature
Scenario: a scenario
Given a step
"""
And a file named "cypress/support/step_definitions/steps.js" with:
"""
const { fromByteArray } = require("base64-js");
const { Given, attach } = require("@klaveness/cypress-cucumber-preprocessor");
Given("a step", function() {
attach(fromByteArray(new TextEncoder().encode("foobar")), "base64:text/plain")
})
"""
When I run cypress
Then it passes
And there should be a JSON output similar to "fixtures/attachments/string.json"