Skip to content

Commit b4b279f

Browse files
added support of named attachments (#31)
1 parent 4aa9c41 commit b4b279f

File tree

10 files changed

+200
-180
lines changed

10 files changed

+200
-180
lines changed

CHANGELOG.MD

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# 0.14.0
2+
- added support of named attachments
3+
14
# 0.13.0
25
- replaced legacy json formatter with custom one based on cucumber messages
36
- added support of named hooks

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,13 @@ or pass `--format @qavajs/html-formatter:report.html` in cli
3131

3232
Kudos to https://github.com/epam/UUI for providing components
3333

34+
## Development
35+
36+
`npm install`
37+
38+
`npm run report:generate`
39+
40+
`npm run report:compile:dev`
41+
42+
`npm start`
43+

package-lock.json

Lines changed: 158 additions & 168 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@qavajs/html-formatter",
3-
"version": "0.13.0",
3+
"version": "0.14.0",
44
"main": "formatter/formatter.js",
55
"scripts": {
66
"report:compile": "node test/compile_report.js",
@@ -39,17 +39,17 @@
3939
],
4040
"devDependencies": {
4141
"@babel/core": "^7.21.0",
42-
"@cucumber/cucumber": "^9.1.0",
42+
"@cucumber/cucumber": "^9.3.0",
4343
"@epam/assets": "^4.10.1-beta.1",
4444
"@epam/promo": "^4.10.1-beta.1",
4545
"@epam/uui-components": "^4.10.1-beta.1",
4646
"@epam/uui-core": "^4.10.1-beta.1",
4747
"@pmmmwh/react-refresh-webpack-plugin": "0.4.3",
48-
"@qavajs/cli": "^0.26.0",
49-
"@qavajs/console-formatter": "^0.2.1",
50-
"@qavajs/memory": "^1.5.1",
51-
"@qavajs/po-playwright": "^0.0.9",
52-
"@qavajs/steps-playwright": "^0.26.0",
48+
"@qavajs/cli": "^0.27.0",
49+
"@qavajs/console-formatter": "^0.5.0",
50+
"@qavajs/memory": "^1.6.1",
51+
"@qavajs/po-playwright": "^0.11.0",
52+
"@qavajs/steps-playwright": "^0.29.1",
5353
"@qavajs/xunit-formatter": "^0.0.4",
5454
"@svgr/webpack": "5.5.0",
5555
"@testing-library/jest-dom": "^5.16.5",

src/App.module.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,7 @@ footer {
9898
.div[role=table] > div:first-child {
9999
z-index: 0;
100100
}
101+
102+
.stepText {
103+
margin-right: 10px;
104+
}

src/components/Step.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,10 @@ export const Step = ({step}: {step: any}) => {
7474
const logs = step.embeddings
7575
? step.embeddings.filter((embedding: any) => embedding.mime_type === 'text/x.cucumber.log+plain')
7676
: [];
77-
7877
return <div style={{display: 'block'}}>
7978
<div style={{display: 'inline-flex'}}>
8079
{icon(step.result.status)}
81-
<Text fontSize='16'>{`${step.name ?? step.keyword}`}</Text>
80+
<Text fontSize='16' cx={css.stepText}>{`${step.name ?? step.keyword}`}</Text>
8281
{step.result.status === 'failed' && step.result.error_message && <IconButton
8382
icon={ ErrorIcon }
8483
color='red'
@@ -94,7 +93,7 @@ export const Step = ({step}: {step: any}) => {
9493
.map((embedding: any, index: any) => <LinkButton
9594
key={index}
9695
icon={ AttachmentIcon }
97-
caption={ embedding.mime_type }
96+
caption={ embedding.fileName ?? embedding.mime_type }
9897
onClick={ handleAttachmentClick(embedding, svc) }
9998
/>)
10099
}

test-e2e/features/Attachment.feature

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,8 @@ Feature: Attachment
5252
And I click 'Feature > #multiple attachments in Scenarios > #multiple attachments in Steps > #2 of Attachments'
5353
And I expect text of 'Attachment Overlay > Title' to be equal 'Attachment'
5454
And I expect 'src' attribute of 'Attachment Overlay > Image' to be equal 'data:image/png;base64,{$pngFullSizeBase64}'
55+
56+
Scenario: verify named attachment
57+
When I click 'Main > Features Table > #ATTACHMENT in Rows > Name'
58+
And I click 'Feature > #named attachment in Scenarios > Title'
59+
And I expect text of 'Feature > #named attachment in Scenarios > #Attachment in Steps > #1 of Attachments' to be equal 'Named Attachment'

test/features/Attachment.feature

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,6 @@ Feature: Attachments
2727

2828
Scenario: unsupported attachments
2929
When unsupported base64 attachment
30+
31+
Scenario: named attachment
32+
When named attachment

test/report.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ const common = {
44
'test/step_definitions/custom_steps.ts'
55
],
66
format: [
7-
'json:test/report.json',
87
'./formatter/formatter:test/report.html',
9-
'./formatter/json_formatter:test/report_new.json'
8+
'./formatter/json_formatter:test/report.json'
109
],
1110
formatOptions: {
1211
htmlConfig: {

test/step_definitions/custom_steps.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ When('json attachment', function () {
3535
}), 'application/json');
3636
});
3737

38+
When('named attachment', function () {
39+
this.attach('I\'m base 64 encoded text', {
40+
mediaType: 'base64:text/plain',
41+
fileName: 'Named Attachment'
42+
});
43+
});
44+
3845
When('text base64 attachment', function () {
3946
this.attach('I\'m base 64 encoded text', 'base64:text/plain');
4047
});

0 commit comments

Comments
 (0)