Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CCK] 2x Attachment bugfixes: Upload JPEG + PDF rename #52

Merged
merged 10 commits into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- [Ruby] The `meta` key was being erroneously checked when running CCK tests ([#43](https://github.com/cucumber/compatibility-kit/pull/43))
- [Ruby] All messages were being analysed as `attachment` when running CCK tests ([#45](https://github.com/cucumber/compatibility-kit/pull/45))
- [Ruby] Added in missing step definition for `Attaching a document with a filename` ([#48](https://github.com/cucumber/compatibility-kit/pull/48))
- NB: This is currently not "permissible" in the ruby flavour of cucumber, but will be enabled shortly
- Fixed attach a JPEG scenario to attach a JPEG (Instead of a PNG) ([#52](https://github.com/cucumber/compatibility-kit/pull/52))
- Fixed attach and rename a PDF scenario to rename the PDF (It didn't rename it) ([#52](https://github.com/cucumber/compatibility-kit/pull/52))

## [12.0.0] - 2023-07-08
### Changed
Expand Down
File renamed without changes.
11 changes: 7 additions & 4 deletions devkit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,23 @@ been changed.

## Getting Started

This project is designed to be ran on Node 18 LTS or higher, with NPM v9+. Using anything
lower than this will likely lead to issues when running the NPM commands

As any NPM project, you first need to run `npm install`. To make sure everything
is going well, run `npm test`.

## Contributing to the Compability Kit
## Contributing to the Compatibility Kit

The files delivered as part ot fhe kit - the feature files and the ndjson files -
The files delivered as part of the kit - the feature files and the ndjson files -
can be found in the [`samples`](./samples) folder.

The [`src`](.src) folder contains source code used by the NPM scripts of the devkit.
For example it contains a [`validate.ts`](./samples/validate.ts) file which is
used by the `test` NPM script. That `test` script make sure the `.ndjson` files
are valid regarding the schema of the Cucumber Messages protocol.

### Adding a new feature
### Adding a feature

To add a new feature in the kit, create a new folder in [`samples`](./samples).
Put the feature here, and its step definitions implemented in TypeScript, and
Expand All @@ -29,7 +32,7 @@ If you need to provide extra arguments to fake-cucumber for your suite, you can

Once your feature is ready, you can generate the messages.

### Generating the Messages
### Regenerating the Messages

Once you have added a new feature or updated an existing one, or if you need
to regenerate the Messages due to an update in the Messages protocol, run the
Expand Down
4 changes: 2 additions & 2 deletions devkit/samples/attachments/attachments.feature
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ Feature: Attachments
| image |
| cucumber.png |

Scenario: Attaching a document with a filename
When a PDF document is attached with a filename
Scenario: Attaching a document with a different filename
When a PDF document is attached and renamed
14 changes: 7 additions & 7 deletions devkit/samples/attachments/attachments.feature.ndjson

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions devkit/samples/attachments/attachments.feature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ When(
)

When('a JPEG image is attached', async function () {
await this.attach(fs.createReadStream(__dirname + '/cucumber.png'), 'image/png')
await this.attach(fs.createReadStream(__dirname + '/cucumber.jpeg'), 'image/jpeg')
})

When('the {word} png is attached', async function (filename) {
await this.attach(fs.createReadStream(__dirname + `/${filename}`), 'image/png')
})

When('a PDF document is attached with a filename', async function () {
await this.attach(fs.createReadStream(__dirname + '/document.pdf'), 'application/pdf', 'document.pdf')
When('a PDF document is attached and renamed', async function () {
await this.attach(fs.createReadStream(__dirname + '/document.pdf'), 'application/pdf', 'renamed.pdf')
})
Binary file added devkit/samples/attachments/cucumber.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion devkit/samples/cdata/cdata.feature.ndjson
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{"meta":{"ci":{"buildNumber":"154666429","git":{"remote":"https://github.com/cucumber-ltd/shouty.rb.git","revision":"99684bcacf01d95875834d87903dcb072306c9ad"},"name":"GitHub Actions","url":"https://github.com/cucumber-ltd/shouty.rb/actions/runs/154666429"},"cpu":{"name":"x64"},"implementation":{"name":"fake-cucumber","version":"16.3.0"},"os":{"name":"darwin","version":"22.4.0"},"protocolVersion":"22.0.0","runtime":{"name":"node.js","version":"19.7.0"}}}
{"meta":{"ci":{"buildNumber":"154666429","git":{"remote":"https://github.com/cucumber-ltd/shouty.rb.git","revision":"99684bcacf01d95875834d87903dcb072306c9ad"},"name":"GitHub Actions","url":"https://github.com/cucumber-ltd/shouty.rb/actions/runs/154666429"},"cpu":{"name":"x64"},"implementation":{"name":"fake-cucumber","version":"16.3.0"},"os":{"name":"linux","version":"5.15.0-84-generic"},"protocolVersion":"22.0.0","runtime":{"name":"node.js","version":"18.18.0"}}}
{"source":{"data":"Feature: cdata\n \n Cucumber xml formatters should be able to handle xml cdata elements\n\n Scenario: cdata\n Given I have 42 <![CDATA[cukes]]> in my belly\n","mediaType":"text/x.cucumber.gherkin+plain","uri":"samples/cdata/cdata.feature"}}
{"gherkinDocument":{"comments":[],"feature":{"children":[{"scenario":{"description":"","examples":[],"id":"2","keyword":"Scenario","location":{"column":3,"line":5},"name":"cdata","steps":[{"id":"1","keyword":"Given ","keywordType":"Context","location":{"column":5,"line":6},"text":"I have 42 <![CDATA[cukes]]> in my belly"}],"tags":[]}}],"description":" Cucumber xml formatters should be able to handle xml cdata elements","keyword":"Feature","language":"en","location":{"column":1,"line":1},"name":"cdata","tags":[]},"uri":"samples/cdata/cdata.feature"}}
{"pickle":{"astNodeIds":["2"],"id":"4","language":"en","name":"cdata","steps":[{"astNodeIds":["1"],"id":"3","text":"I have 42 <![CDATA[cukes]]> in my belly","type":"Context"}],"tags":[],"uri":"samples/cdata/cdata.feature"}}
Expand Down
2 changes: 1 addition & 1 deletion devkit/samples/data-tables/data-tables.feature.ndjson
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{"meta":{"ci":{"buildNumber":"154666429","git":{"remote":"https://github.com/cucumber-ltd/shouty.rb.git","revision":"99684bcacf01d95875834d87903dcb072306c9ad"},"name":"GitHub Actions","url":"https://github.com/cucumber-ltd/shouty.rb/actions/runs/154666429"},"cpu":{"name":"x64"},"implementation":{"name":"fake-cucumber","version":"16.3.0"},"os":{"name":"darwin","version":"22.4.0"},"protocolVersion":"22.0.0","runtime":{"name":"node.js","version":"19.7.0"}}}
{"meta":{"ci":{"buildNumber":"154666429","git":{"remote":"https://github.com/cucumber-ltd/shouty.rb.git","revision":"99684bcacf01d95875834d87903dcb072306c9ad"},"name":"GitHub Actions","url":"https://github.com/cucumber-ltd/shouty.rb/actions/runs/154666429"},"cpu":{"name":"x64"},"implementation":{"name":"fake-cucumber","version":"16.3.0"},"os":{"name":"linux","version":"5.15.0-84-generic"},"protocolVersion":"22.0.0","runtime":{"name":"node.js","version":"18.18.0"}}}
{"source":{"data":"Feature: Data Tables\n Data Tables can be places underneath a step and will be passed as the last\n argument to the step definition. They can be used to represent richer data\n structures, and can also be transformed to other types.\n\n Scenario: transposed table\n When the following table is transposed:\n | a | b |\n | 1 | 2 |\n Then it should be:\n | a | 1 |\n | b | 2 |\n","mediaType":"text/x.cucumber.gherkin+plain","uri":"samples/data-tables/data-tables.feature"}}
{"gherkinDocument":{"comments":[],"feature":{"children":[{"scenario":{"description":"","examples":[],"id":"8","keyword":"Scenario","location":{"column":3,"line":6},"name":"transposed table","steps":[{"dataTable":{"location":{"column":7,"line":8},"rows":[{"cells":[{"location":{"column":9,"line":8},"value":"a"},{"location":{"column":13,"line":8},"value":"b"}],"id":"2","location":{"column":7,"line":8}},{"cells":[{"location":{"column":9,"line":9},"value":"1"},{"location":{"column":13,"line":9},"value":"2"}],"id":"3","location":{"column":7,"line":9}}]},"id":"4","keyword":"When ","keywordType":"Action","location":{"column":5,"line":7},"text":"the following table is transposed:"},{"dataTable":{"location":{"column":7,"line":11},"rows":[{"cells":[{"location":{"column":9,"line":11},"value":"a"},{"location":{"column":13,"line":11},"value":"1"}],"id":"5","location":{"column":7,"line":11}},{"cells":[{"location":{"column":9,"line":12},"value":"b"},{"location":{"column":13,"line":12},"value":"2"}],"id":"6","location":{"column":7,"line":12}}]},"id":"7","keyword":"Then ","keywordType":"Outcome","location":{"column":5,"line":10},"text":"it should be:"}],"tags":[]}}],"description":" Data Tables can be places underneath a step and will be passed as the last\n argument to the step definition. They can be used to represent richer data\n structures, and can also be transformed to other types.","keyword":"Feature","language":"en","location":{"column":1,"line":1},"name":"Data Tables","tags":[]},"uri":"samples/data-tables/data-tables.feature"}}
{"pickle":{"astNodeIds":["8"],"id":"11","language":"en","name":"transposed table","steps":[{"argument":{"dataTable":{"rows":[{"cells":[{"value":"a"},{"value":"b"}]},{"cells":[{"value":"1"},{"value":"2"}]}]}},"astNodeIds":["4"],"id":"9","text":"the following table is transposed:","type":"Action"},{"argument":{"dataTable":{"rows":[{"cells":[{"value":"a"},{"value":"1"}]},{"cells":[{"value":"b"},{"value":"2"}]}]}},"astNodeIds":["7"],"id":"10","text":"it should be:","type":"Outcome"}],"tags":[],"uri":"samples/data-tables/data-tables.feature"}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{"meta":{"ci":{"buildNumber":"154666429","git":{"remote":"https://github.com/cucumber-ltd/shouty.rb.git","revision":"99684bcacf01d95875834d87903dcb072306c9ad"},"name":"GitHub Actions","url":"https://github.com/cucumber-ltd/shouty.rb/actions/runs/154666429"},"cpu":{"name":"x64"},"implementation":{"name":"fake-cucumber","version":"16.3.0"},"os":{"name":"darwin","version":"22.4.0"},"protocolVersion":"22.0.0","runtime":{"name":"node.js","version":"19.7.0"}}}
{"meta":{"ci":{"buildNumber":"154666429","git":{"remote":"https://github.com/cucumber-ltd/shouty.rb.git","revision":"99684bcacf01d95875834d87903dcb072306c9ad"},"name":"GitHub Actions","url":"https://github.com/cucumber-ltd/shouty.rb/actions/runs/154666429"},"cpu":{"name":"x64"},"implementation":{"name":"fake-cucumber","version":"16.3.0"},"os":{"name":"linux","version":"5.15.0-84-generic"},"protocolVersion":"22.0.0","runtime":{"name":"node.js","version":"18.18.0"}}}
{"source":{"data":"Feature: Examples Tables\n Sometimes it can be desireable to run the same scenario multiple times\n with different data each time. This can be done by placing an Examples\n section with an Examples Table underneath a Scenario, and use <placeholders>\n in the Scenario, matching the table headers.\n\n Scenario Outline: eating cucumbers\n Given there are <start> cucumbers\n When I eat <eat> cucumbers\n Then I should have <left> cucumbers\n\n @passing\n Examples: These are passing\n | start | eat | left |\n | 12 | 5 | 7 |\n | 20 | 5 | 15 |\n\n @failing\n Examples: These are failing\n | start | eat | left |\n | 12 | 20 | 0 |\n | 0 | 1 | 0 |\n\n @undefined\n Examples: These are undefined because the value is not an {int}\n | start | eat | left |\n | 12 | banana | 12 |\n | 0 | 1 | apple |\n","mediaType":"text/x.cucumber.gherkin+plain","uri":"samples/examples-tables/examples-tables.feature"}}
{"gherkinDocument":{"comments":[],"feature":{"children":[{"scenario":{"description":"","examples":[{"description":"","id":"10","keyword":"Examples","location":{"column":5,"line":13},"name":"These are passing","tableBody":[{"cells":[{"location":{"column":12,"line":15},"value":"12"},{"location":{"column":19,"line":15},"value":"5"},{"location":{"column":26,"line":15},"value":"7"}],"id":"7","location":{"column":7,"line":15}},{"cells":[{"location":{"column":12,"line":16},"value":"20"},{"location":{"column":19,"line":16},"value":"5"},{"location":{"column":25,"line":16},"value":"15"}],"id":"8","location":{"column":7,"line":16}}],"tableHeader":{"cells":[{"location":{"column":9,"line":14},"value":"start"},{"location":{"column":17,"line":14},"value":"eat"},{"location":{"column":23,"line":14},"value":"left"}],"id":"6","location":{"column":7,"line":14}},"tags":[{"id":"9","location":{"column":5,"line":12},"name":"@passing"}]},{"description":"","id":"15","keyword":"Examples","location":{"column":5,"line":19},"name":"These are failing","tableBody":[{"cells":[{"location":{"column":12,"line":21},"value":"12"},{"location":{"column":18,"line":21},"value":"20"},{"location":{"column":26,"line":21},"value":"0"}],"id":"12","location":{"column":7,"line":21}},{"cells":[{"location":{"column":13,"line":22},"value":"0"},{"location":{"column":19,"line":22},"value":"1"},{"location":{"column":26,"line":22},"value":"0"}],"id":"13","location":{"column":7,"line":22}}],"tableHeader":{"cells":[{"location":{"column":9,"line":20},"value":"start"},{"location":{"column":17,"line":20},"value":"eat"},{"location":{"column":23,"line":20},"value":"left"}],"id":"11","location":{"column":7,"line":20}},"tags":[{"id":"14","location":{"column":5,"line":18},"name":"@failing"}]},{"description":"","id":"20","keyword":"Examples","location":{"column":5,"line":25},"name":"These are undefined because the value is not an {int}","tableBody":[{"cells":[{"location":{"column":12,"line":27},"value":"12"},{"location":{"column":17,"line":27},"value":"banana"},{"location":{"column":29,"line":27},"value":"12"}],"id":"17","location":{"column":7,"line":27}},{"cells":[{"location":{"column":13,"line":28},"value":"0"},{"location":{"column":22,"line":28},"value":"1"},{"location":{"column":26,"line":28},"value":"apple"}],"id":"18","location":{"column":7,"line":28}}],"tableHeader":{"cells":[{"location":{"column":9,"line":26},"value":"start"},{"location":{"column":17,"line":26},"value":"eat"},{"location":{"column":26,"line":26},"value":"left"}],"id":"16","location":{"column":7,"line":26}},"tags":[{"id":"19","location":{"column":5,"line":24},"name":"@undefined"}]}],"id":"21","keyword":"Scenario Outline","location":{"column":3,"line":7},"name":"eating cucumbers","steps":[{"id":"3","keyword":"Given ","keywordType":"Context","location":{"column":5,"line":8},"text":"there are <start> cucumbers"},{"id":"4","keyword":"When ","keywordType":"Action","location":{"column":5,"line":9},"text":"I eat <eat> cucumbers"},{"id":"5","keyword":"Then ","keywordType":"Outcome","location":{"column":5,"line":10},"text":"I should have <left> cucumbers"}],"tags":[]}}],"description":" Sometimes it can be desireable to run the same scenario multiple times\n with different data each time. This can be done by placing an Examples\n section with an Examples Table underneath a Scenario, and use <placeholders>\n in the Scenario, matching the table headers.","keyword":"Feature","language":"en","location":{"column":1,"line":1},"name":"Examples Tables","tags":[]},"uri":"samples/examples-tables/examples-tables.feature"}}
{"pickle":{"astNodeIds":["21","7"],"id":"25","language":"en","name":"eating cucumbers","steps":[{"astNodeIds":["3","7"],"id":"22","text":"there are 12 cucumbers","type":"Context"},{"astNodeIds":["4","7"],"id":"23","text":"I eat 5 cucumbers","type":"Action"},{"astNodeIds":["5","7"],"id":"24","text":"I should have 7 cucumbers","type":"Outcome"}],"tags":[{"astNodeId":"9","name":"@passing"}],"uri":"samples/examples-tables/examples-tables.feature"}}
Expand Down
2 changes: 1 addition & 1 deletion devkit/samples/hooks/hooks.feature.ndjson
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{"meta":{"ci":{"buildNumber":"154666429","git":{"remote":"https://github.com/cucumber-ltd/shouty.rb.git","revision":"99684bcacf01d95875834d87903dcb072306c9ad"},"name":"GitHub Actions","url":"https://github.com/cucumber-ltd/shouty.rb/actions/runs/154666429"},"cpu":{"name":"x64"},"implementation":{"name":"fake-cucumber","version":"16.3.0"},"os":{"name":"darwin","version":"22.4.0"},"protocolVersion":"22.0.0","runtime":{"name":"node.js","version":"19.7.0"}}}
{"meta":{"ci":{"buildNumber":"154666429","git":{"remote":"https://github.com/cucumber-ltd/shouty.rb.git","revision":"99684bcacf01d95875834d87903dcb072306c9ad"},"name":"GitHub Actions","url":"https://github.com/cucumber-ltd/shouty.rb/actions/runs/154666429"},"cpu":{"name":"x64"},"implementation":{"name":"fake-cucumber","version":"16.3.0"},"os":{"name":"linux","version":"5.15.0-84-generic"},"protocolVersion":"22.0.0","runtime":{"name":"node.js","version":"18.18.0"}}}
{"source":{"data":"Feature: Hooks\n Hooks are special steps that run before or after each scenario's steps.\n They can also conditionally target specific scenarios, using tag expressions\n\n Scenario: no tags, passed step\n When a step passes\n\n Scenario: no tags, failed step\n When a step throws an exception\n\n Scenario: no tags, undefined step\n When a step throws an exception\n\n @some-tag\n Scenario: with a tag, passed step\n When a step passes\n\n @with-attachment\n Scenario: with an attachment in the hook\n When a step passes","mediaType":"text/x.cucumber.gherkin+plain","uri":"samples/hooks/hooks.feature"}}
{"gherkinDocument":{"comments":[],"feature":{"children":[{"scenario":{"description":"","examples":[],"id":"8","keyword":"Scenario","location":{"column":3,"line":5},"name":"no tags, passed step","steps":[{"id":"7","keyword":"When ","keywordType":"Action","location":{"column":5,"line":6},"text":"a step passes"}],"tags":[]}},{"scenario":{"description":"","examples":[],"id":"10","keyword":"Scenario","location":{"column":3,"line":8},"name":"no tags, failed step","steps":[{"id":"9","keyword":"When ","keywordType":"Action","location":{"column":5,"line":9},"text":"a step throws an exception"}],"tags":[]}},{"scenario":{"description":"","examples":[],"id":"12","keyword":"Scenario","location":{"column":3,"line":11},"name":"no tags, undefined step","steps":[{"id":"11","keyword":"When ","keywordType":"Action","location":{"column":5,"line":12},"text":"a step throws an exception"}],"tags":[]}},{"scenario":{"description":"","examples":[],"id":"15","keyword":"Scenario","location":{"column":3,"line":15},"name":"with a tag, passed step","steps":[{"id":"13","keyword":"When ","keywordType":"Action","location":{"column":5,"line":16},"text":"a step passes"}],"tags":[{"id":"14","location":{"column":3,"line":14},"name":"@some-tag"}]}},{"scenario":{"description":"","examples":[],"id":"18","keyword":"Scenario","location":{"column":3,"line":19},"name":"with an attachment in the hook","steps":[{"id":"16","keyword":"When ","keywordType":"Action","location":{"column":5,"line":20},"text":"a step passes"}],"tags":[{"id":"17","location":{"column":3,"line":18},"name":"@with-attachment"}]}}],"description":" Hooks are special steps that run before or after each scenario's steps.\n They can also conditionally target specific scenarios, using tag expressions","keyword":"Feature","language":"en","location":{"column":1,"line":1},"name":"Hooks","tags":[]},"uri":"samples/hooks/hooks.feature"}}
{"pickle":{"astNodeIds":["8"],"id":"20","language":"en","name":"no tags, passed step","steps":[{"astNodeIds":["7"],"id":"19","text":"a step passes","type":"Action"}],"tags":[],"uri":"samples/hooks/hooks.feature"}}
Expand Down
Loading