Skip to content

Commit

Permalink
[CCK] Update compatibility with messages:12.3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
mpkorstanje committed Jul 30, 2020
1 parent 3d26856 commit 0bfbf34
Show file tree
Hide file tree
Showing 16 changed files with 112 additions and 71 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased] (In Git)

### Added
* Include SourceReferences in message output ([#2064](https://github.com/cucumber/cucumber-jvm/issues/2064) M.P. Korstanje)
* Enable searching and filtering in html report ([cucumber/#1111](https://github.com/cucumber/cucumber/pull/1111) Vincent Psarga)
* [Core] Include SourceReferences in message output ([#2064](https://github.com/cucumber/cucumber-jvm/issues/2064) M.P. Korstanje)
* [Core] Enable searching and filtering in html report ([cucumber/#1111](https://github.com/cucumber/cucumber/pull/1111) Vincent Psarga)

### Changed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,18 @@ public void theStringIsLogged(String text) {
scenario.log(text);
}

@When("an array with {int} bytes are attached as {string}")
@When("text with ANSI escapes is logged")
public void theTextWithANSIEscapesIsLogged() {
scenario.log(
"This displays a \u001b[31mr\u001b[0m\u001b[91ma\u001b[0m\u001b[33mi\u001b[0m\u001b[32mn\u001b[0m\u001b[34mb\u001b[0m\u001b[95mo\u001b[0m\u001b[35mw\u001b[0m");
}

@When("the following string is attached as {string}:")
public void theFollowingStringIsAttachedAs(String mediaType, String text) {
scenario.attach(text, mediaType, null);
}

@When("an array with {int} bytes is attached as {string}")
public void anArrayWithBytesAreAttachedAs(int n, String mediaType) {
byte[] bytes = new byte[n];
for (byte i = 0; i < n; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ private static List<Matcher<?>> extractExpectedFields(GeneratedMessageV3 expecte
case "cpu":
expected.add(hasEntry(is(fieldName), isA(expectedValue.getClass())));
break;

case "ci":
expected.add(not(hasKey(is(fieldName))));
break;
default:
expected.add(hasEntry(is(fieldName), aComparableValue(expectedValue, depth)));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,26 @@ Feature: Attachments

Attachments must have a body and a content type

Scenario: Strings are identity-encoded regardless of media type
Scenario: Strings can be attached with a media type
Beware that some formatters such as @cucumber/react use the media type
to determine how to display an attachment.

When the string "hello" is attached as "application/octet-stream"

Scenario: Log JSON
When the following string is attached as "application/json":
```
{"message": "The <b>big</b> question", "foo": "bar"}
```

Scenario: Log text
When the string "hello" is logged

Scenario: Log ANSI coloured text
When text with ANSI escapes is logged

Scenario: Byte arrays are base64-encoded regardless of media type
When an array with 10 bytes are attached as "text/plain"
When an array with 10 bytes is attached as "text/plain"

Scenario: Streams are always base64-encoded
When a JPEG image is attached

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{"meta":{"protocolVersion":"12.0.0","implementation":{"name":"fake-cucumber","version":"7.0.0"},"runtime":{"name":"node.js","version":"13.11.0"},"os":{"name":"darwin","version":"Darwin Kernel Version 19.3.0: Thu Jan 9 20:58:23 PST 2020; root:xnu-6153.81.5~1/RELEASE_X86_64"},"cpu":{"name":"x64"}}}
{"meta":{"protocolVersion":"12.1.1","implementation":{"name":"fake-cucumber","version":"7.0.0"},"runtime":{"name":"node.js","version":"12.16.2"},"os":{"name":"linux","version":"4.19.76-linuxkit"},"cpu":{"name":"x64"},"ci":{"name":"GitHub Actions","url":"https://github.com/cucumber/cucumber-ruby/actions/runs/140170388","git":{"remote":"https://github.com/cucumber/cucumber-ruby.git","revision":"the-revision","tag":"the-tag"}}}}
{"source":{"uri":"features/data-tables/data-tables.feature","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"}}
{"gherkinDocument":{"uri":"features/data-tables/data-tables.feature","feature":{"location":{"line":1,"column":1},"language":"en","keyword":"Feature","name":"Data Tables","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.","children":[{"scenario":{"location":{"line":6,"column":3},"keyword":"Scenario","name":"transposed table","steps":[{"location":{"line":7,"column":5},"keyword":"When ","text":"the following table is transposed:","dataTable":{"location":{"line":8,"column":7},"rows":[{"location":{"line":8,"column":7},"cells":[{"location":{"line":8,"column":9},"value":"a"},{"location":{"line":8,"column":13},"value":"b"}],"id":"2"},{"location":{"line":9,"column":7},"cells":[{"location":{"line":9,"column":9},"value":"1"},{"location":{"line":9,"column":13},"value":"2"}],"id":"3"}]},"id":"4"},{"location":{"line":10,"column":5},"keyword":"Then ","text":"it should be:","dataTable":{"location":{"line":11,"column":7},"rows":[{"location":{"line":11,"column":7},"cells":[{"location":{"line":11,"column":9},"value":"a"},{"location":{"line":11,"column":13},"value":"1"}],"id":"5"},{"location":{"line":12,"column":7},"cells":[{"location":{"line":12,"column":9},"value":"b"},{"location":{"line":12,"column":13},"value":"2"}],"id":"6"}]},"id":"7"}],"id":"8"}}]}}}
{"pickle":{"id":"11","uri":"features/data-tables/data-tables.feature","name":"transposed table","language":"en","steps":[{"text":"the following table is transposed:","argument":{"dataTable":{"rows":[{"cells":[{"value":"a"},{"value":"b"}]},{"cells":[{"value":"1"},{"value":"2"}]}]}},"id":"9","astNodeIds":["4"]},{"text":"it should be:","argument":{"dataTable":{"rows":[{"cells":[{"value":"a"},{"value":"1"}]},{"cells":[{"value":"b"},{"value":"2"}]}]}},"id":"10","astNodeIds":["7"]}],"astNodeIds":["8"]}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{"meta":{"protocolVersion":"12.0.0","implementation":{"name":"fake-cucumber","version":"7.0.0"},"runtime":{"name":"node.js","version":"13.11.0"},"os":{"name":"darwin","version":"Darwin Kernel Version 19.3.0: Thu Jan 9 20:58:23 PST 2020; root:xnu-6153.81.5~1/RELEASE_X86_64"},"cpu":{"name":"x64"}}}
{"meta":{"protocolVersion":"12.1.1","implementation":{"name":"fake-cucumber","version":"7.0.0"},"runtime":{"name":"node.js","version":"12.16.2"},"os":{"name":"linux","version":"4.19.76-linuxkit"},"cpu":{"name":"x64"},"ci":{"name":"GitHub Actions","url":"https://github.com/cucumber/cucumber-ruby/actions/runs/140170388","git":{"remote":"https://github.com/cucumber/cucumber-ruby.git","revision":"the-revision","tag":"the-tag"}}}}
{"source":{"uri":"features/examples-tables/examples-tables.feature","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 Examples: These are passing\n | start | eat | left |\n | 12 | 5 | 7 |\n | 20 | 5 | 15 |\n\n Examples: These are failing\n | start | eat | left |\n | 12 | 20 | 0 |\n | 0 | 1 | 0 |\n\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"}}
{"gherkinDocument":{"uri":"features/examples-tables/examples-tables.feature","feature":{"location":{"line":1,"column":1},"language":"en","keyword":"Feature","name":"Examples Tables","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.","children":[{"scenario":{"location":{"line":7,"column":3},"keyword":"Scenario Outline","name":"eating cucumbers","steps":[{"location":{"line":8,"column":5},"keyword":"Given ","text":"there are <start> cucumbers","id":"3"},{"location":{"line":9,"column":5},"keyword":"When ","text":"I eat <eat> cucumbers","id":"4"},{"location":{"line":10,"column":5},"keyword":"Then ","text":"I should have <left> cucumbers","id":"5"}],"examples":[{"location":{"line":12,"column":5},"keyword":"Examples","name":"These are passing","tableHeader":{"location":{"line":13,"column":7},"cells":[{"location":{"line":13,"column":9},"value":"start"},{"location":{"line":13,"column":17},"value":"eat"},{"location":{"line":13,"column":23},"value":"left"}],"id":"6"},"tableBody":[{"location":{"line":14,"column":7},"cells":[{"location":{"line":14,"column":12},"value":"12"},{"location":{"line":14,"column":19},"value":"5"},{"location":{"line":14,"column":26},"value":"7"}],"id":"7"},{"location":{"line":15,"column":7},"cells":[{"location":{"line":15,"column":12},"value":"20"},{"location":{"line":15,"column":19},"value":"5"},{"location":{"line":15,"column":25},"value":"15"}],"id":"8"}],"id":"9"},{"location":{"line":17,"column":5},"keyword":"Examples","name":"These are failing","tableHeader":{"location":{"line":18,"column":7},"cells":[{"location":{"line":18,"column":9},"value":"start"},{"location":{"line":18,"column":17},"value":"eat"},{"location":{"line":18,"column":23},"value":"left"}],"id":"10"},"tableBody":[{"location":{"line":19,"column":7},"cells":[{"location":{"line":19,"column":12},"value":"12"},{"location":{"line":19,"column":18},"value":"20"},{"location":{"line":19,"column":26},"value":"0"}],"id":"11"},{"location":{"line":20,"column":7},"cells":[{"location":{"line":20,"column":13},"value":"0"},{"location":{"line":20,"column":19},"value":"1"},{"location":{"line":20,"column":26},"value":"0"}],"id":"12"}],"id":"13"},{"location":{"line":22,"column":5},"keyword":"Examples","name":"These are undefined because the value is not an {int}","tableHeader":{"location":{"line":23,"column":7},"cells":[{"location":{"line":23,"column":9},"value":"start"},{"location":{"line":23,"column":17},"value":"eat"},{"location":{"line":23,"column":26},"value":"left"}],"id":"14"},"tableBody":[{"location":{"line":24,"column":7},"cells":[{"location":{"line":24,"column":12},"value":"12"},{"location":{"line":24,"column":17},"value":"banana"},{"location":{"line":24,"column":29},"value":"12"}],"id":"15"},{"location":{"line":25,"column":7},"cells":[{"location":{"line":25,"column":13},"value":"0"},{"location":{"line":25,"column":22},"value":"1"},{"location":{"line":25,"column":26},"value":"apple"}],"id":"16"}],"id":"17"}],"id":"18"}}]}}}
{"pickle":{"id":"22","uri":"features/examples-tables/examples-tables.feature","name":"eating cucumbers","language":"en","steps":[{"text":"there are 12 cucumbers","id":"19","astNodeIds":["3","7"]},{"text":"I eat 5 cucumbers","id":"20","astNodeIds":["4","7"]},{"text":"I should have 7 cucumbers","id":"21","astNodeIds":["5","7"]}],"astNodeIds":["18","7"]}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{"meta":{"protocolVersion":"12.0.0","implementation":{"name":"fake-cucumber","version":"7.0.0"},"runtime":{"name":"node.js","version":"13.11.0"},"os":{"name":"darwin","version":"Darwin Kernel Version 19.3.0: Thu Jan 9 20:58:23 PST 2020; root:xnu-6153.81.5~1/RELEASE_X86_64"},"cpu":{"name":"x64"}}}
{"meta":{"protocolVersion":"12.1.1","implementation":{"name":"fake-cucumber","version":"7.0.0"},"runtime":{"name":"node.js","version":"12.16.2"},"os":{"name":"linux","version":"4.19.76-linuxkit"},"cpu":{"name":"x64"},"ci":{"name":"GitHub Actions","url":"https://github.com/cucumber/cucumber-ruby/actions/runs/140170388","git":{"remote":"https://github.com/cucumber/cucumber-ruby.git","revision":"the-revision","tag":"the-tag"}}}}
{"source":{"uri":"features/hooks/hooks.feature","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","mediaType":"text/x.cucumber.gherkin+plain"}}
{"gherkinDocument":{"uri":"features/hooks/hooks.feature","feature":{"location":{"line":1,"column":1},"language":"en","keyword":"Feature","name":"Hooks","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","children":[{"scenario":{"location":{"line":5,"column":3},"keyword":"Scenario","name":"no tags, passed step","steps":[{"location":{"line":6,"column":5},"keyword":"When ","text":"a step passes","id":"5"}],"id":"6"}},{"scenario":{"location":{"line":8,"column":3},"keyword":"Scenario","name":"no tags, failed step","steps":[{"location":{"line":9,"column":5},"keyword":"When ","text":"a step throws an exception","id":"7"}],"id":"8"}},{"scenario":{"location":{"line":11,"column":3},"keyword":"Scenario","name":"no tags, undefined step","steps":[{"location":{"line":12,"column":5},"keyword":"When ","text":"a step throws an exception","id":"9"}],"id":"10"}},{"scenario":{"location":{"line":15,"column":3},"tags":[{"location":{"line":14,"column":3},"name":"@some-tag","id":"12"}],"keyword":"Scenario","name":"with a tag, passed step","steps":[{"location":{"line":16,"column":5},"keyword":"When ","text":"a step passes","id":"11"}],"id":"13"}}]}}}
{"pickle":{"id":"15","uri":"features/hooks/hooks.feature","name":"no tags, passed step","language":"en","steps":[{"text":"a step passes","id":"14","astNodeIds":["5"]}],"astNodeIds":["6"]}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{"meta":{"protocolVersion":"12.0.0","implementation":{"name":"fake-cucumber","version":"7.0.0"},"runtime":{"name":"node.js","version":"13.11.0"},"os":{"name":"darwin","version":"Darwin Kernel Version 19.3.0: Thu Jan 9 20:58:23 PST 2020; root:xnu-6153.81.5~1/RELEASE_X86_64"},"cpu":{"name":"x64"}}}
{"meta":{"protocolVersion":"12.1.1","implementation":{"name":"fake-cucumber","version":"7.0.0"},"runtime":{"name":"node.js","version":"12.16.2"},"os":{"name":"linux","version":"4.19.76-linuxkit"},"cpu":{"name":"x64"},"ci":{"name":"GitHub Actions","url":"https://github.com/cucumber/cucumber-ruby/actions/runs/140170388","git":{"remote":"https://github.com/cucumber/cucumber-ruby.git","revision":"the-revision","tag":"the-tag"}}}}
{"source":{"uri":"features/minimal/minimal.feature","data":"Feature: minimal\n \n Cucumber doesn't execute this markdown, but @cucumber/react renders it\n \n * This is\n * a bullet\n * list\n \n Scenario: cukes\n Given I have 42 cukes in my belly\n","mediaType":"text/x.cucumber.gherkin+plain"}}
{"gherkinDocument":{"uri":"features/minimal/minimal.feature","feature":{"location":{"line":1,"column":1},"language":"en","keyword":"Feature","name":"minimal","description":" Cucumber doesn't execute this markdown, but @cucumber/react renders it\n \n * This is\n * a bullet\n * list","children":[{"scenario":{"location":{"line":9,"column":3},"keyword":"Scenario","name":"cukes","steps":[{"location":{"line":10,"column":5},"keyword":"Given ","text":"I have 42 cukes in my belly","id":"1"}],"id":"2"}}]}}}
{"pickle":{"id":"4","uri":"features/minimal/minimal.feature","name":"cukes","language":"en","steps":[{"text":"I have 42 cukes in my belly","id":"3","astNodeIds":["1"]}],"astNodeIds":["2"]}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{"meta":{"protocolVersion":"12.0.0","implementation":{"name":"fake-cucumber","version":"7.0.0"},"runtime":{"name":"node.js","version":"13.11.0"},"os":{"name":"darwin","version":"Darwin Kernel Version 19.3.0: Thu Jan 9 20:58:23 PST 2020; root:xnu-6153.81.5~1/RELEASE_X86_64"},"cpu":{"name":"x64"}}}
{"meta":{"protocolVersion":"12.1.1","implementation":{"name":"fake-cucumber","version":"7.0.0"},"runtime":{"name":"node.js","version":"12.16.2"},"os":{"name":"linux","version":"4.19.76-linuxkit"},"cpu":{"name":"x64"},"ci":{"name":"GitHub Actions","url":"https://github.com/cucumber/cucumber-ruby/actions/runs/140170388","git":{"remote":"https://github.com/cucumber/cucumber-ruby.git","revision":"the-revision","tag":"the-tag"}}}}
{"source":{"uri":"features/parameter-types/parameter-types.feature","data":"Feature: Parameter Types\n Cucumber lets you define your own parameter types, which can be used\n in Cucumber Expressions. This lets you define a precise domain-specific\n vocabulary which can be used to generate a glossary with examples taken\n from your scenarios. They also let you transform strings and tables into\n rich types.\n\n Scenario: flights\n Given LHR-CDG has been delayed 45 minutes\n","mediaType":"text/x.cucumber.gherkin+plain"}}
{"gherkinDocument":{"uri":"features/parameter-types/parameter-types.feature","feature":{"location":{"line":1,"column":1},"language":"en","keyword":"Feature","name":"Parameter Types","description":" Cucumber lets you define your own parameter types, which can be used\n in Cucumber Expressions. This lets you define a precise domain-specific\n vocabulary which can be used to generate a glossary with examples taken\n from your scenarios. They also let you transform strings and tables into\n rich types.","children":[{"scenario":{"location":{"line":8,"column":3},"keyword":"Scenario","name":"flights","steps":[{"location":{"line":9,"column":5},"keyword":"Given ","text":"LHR-CDG has been delayed 45 minutes","id":"2"}],"id":"3"}}]}}}
{"pickle":{"id":"5","uri":"features/parameter-types/parameter-types.feature","name":"flights","language":"en","steps":[{"text":"LHR-CDG has been delayed 45 minutes","id":"4","astNodeIds":["2"]}],"astNodeIds":["3"]}}
Expand Down
Loading

0 comments on commit 0bfbf34

Please sign in to comment.