-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
π What did you see?
I recently upgraded to Cucumber 10.1 and found that the reports from the external html-report formatter do not work the same way the native html formatter did in previous versions of cucumber.
Attachments attached in hooks (such as AfterStep) are dumped at the end of the scenario.
I have included the JSON and message output as well if it might be helpful. I did have to redact them so some messages might be missing, but it should get the point across.

β What did you expect to see?
I was expecting something like this:

where each attachment is shown preceding the step it was hooked on which is how it behaved before I upgraded Cucumber to 10.1:
The report also does not really seem to look like what react-components' demo shows: https://cucumber-react-preview.netlify.app/?story=app--report--hooks-attachment although I will mention I don't really like how they collapse the hooks, but at least the attachments are shown where they were made.
π¦ Which tool/library version are you using?
cucumber (10.1.1)
cucumber-ci-environment (10.0.1)
cucumber-core (15.3.0)
cucumber-cucumber-expressions (18.0.1)
cucumber-gherkin (34.0.0)
cucumber-html-formatter (21.15.1)
cucumber-messages (27.2.0)
cucumber-tag-expressions (8.0.0)
Ruby MRI 3.4.2
Worked as expected on:
cucumber (3.2.0)
cucumber-core (3.2.1)
cucumber-expressions (6.0.1)
cucumber-tag_expressions (1.1.1)
cucumber-wire (0.0.1)
gherkin (5.1.0)
Ruby MRI 3.4.2
π¬ How could we reproduce it?
test.feature:
Feature: Attachments in Cucumber Reports
Scenario: Attaching attachments in multiple steps in a Scenario
Given I open a web browser
When I go to the "about:license" page
And I go to the "about:logo" page
Then I go to the "about:robots" pagestep_definitions/test.rb:
Given(/^I open a web browser$/) do
# code to open a browser
end
When(/^I go to the "(.+)" page$/) do |page|
# code to go to a page
endsupport/env.rb:
AfterStep do |scenario|
screenshot = @browser.save_screenshot
attach(screenshot, 'image/png')
end
After do |scenario|
screenshot = @browser.save_screenshot
attach(screenshot, 'image/png')
endπ Any additional context?
Seems to be similar to the problem described in #1645
Similar to the reporter above, the attachments are not helpful if dumped at the end. In my usage, there may be several attachments per-hook or step.
The problem is even worse if Scenario Outline is used, all of the attachments for all of the examples are lumped together which makes it hard to find the attachments for a specific example:
Which differs from react-components' demo: https://cucumber-react-preview.netlify.app/?story=app--report--examples-tables-attachment
