Skip to content

Conversation

@davidjgoss
Copy link
Contributor

@davidjgoss davidjgoss commented Sep 1, 2025

🤔 What's changed?

Change the way documents are rendered to be more test case centric. The main effect is:

  • Backgrounds are not shown separately but are inlined to each test case
  • Templated scenarios list each compiled pickle/test case separately, not as examples tables

A good illustration is with the examples tables sample:

Before

image

After

image

⚡️ What's your motivation?

Part of cucumber/html-formatter#283
Fixes #389

This isn't the big overhaul I thought it would be - taking the suggestion to mostly keep the Gherkin hierarchy and just shift the results rendering made this much more a cleaning up and slimming down of the current thing. It's a breaking change only because of the custom rendering - many of the components that could be overridden before are gone now, but otherwise the customisation on Gherkin elements like doc strings, tables, attachments, tags etc is the same as before.

🏷️ What kind of change is this?

  • ⚡ New feature (non-breaking change which adds new behaviour)
  • 💥 Breaking change (incompatible changes to the API)

♻️ Anything particular you want feedback on?

Backgrounds are not shown separately now as all their steps are inlined in the test cases. But there's a potential for loss of useful info if e.g. a Background includes a title and/or description. We could look to still include it in some way, maybe conditionally if there is non-empty content, but even that feels low reward to me, especially given Backgrounds are basically not recommended these days.

The search works the same way as before. There's definitely a good opportunity to rework that to be simpler and more efficient now, but this PR is already big enough so I'll take care of that in the next one.

📋 Checklist:

  • I agree to respect and uphold the Cucumber Community Code of Conduct
  • I've changed the behaviour of the code
    • I have added/updated tests to cover my changes.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.
  • Users should know about my change
    • I have added an entry to the "Unreleased" section of the CHANGELOG, linking to this pull request.

This text was originally generated from a template, then edited by hand. You can modify the template here.

@netlify
Copy link

netlify bot commented Sep 1, 2025

Deploy Preview for cucumber-react-preview ready!

Name Link
🔨 Latest commit 4110e1f
🔍 Latest deploy log https://app.netlify.com/projects/cucumber-react-preview/deploys/68c699484c5bce0008b39ff5
😎 Deploy Preview https://deploy-preview-396--cucumber-react-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Contributor Author

@davidjgoss davidjgoss Sep 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a strictly necessary refactor, but it was helpful to separate the accordion rendering from the wrangling of Gherkin documents in <GherkinDocumentList/>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copied from @cucumber/query - we should consider exposing it there as a plain function or static method.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some search tests were disabled but actually pass - they may have been fixed back in #337

@davidjgoss davidjgoss marked this pull request as ready for review September 4, 2025 17:38
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An alternate render tree for Markdown, given its pretty low adoption, is not worth the cost at this point. I think we'd be better off making the Markdown parser include extra content in the descriptions.

@mpkorstanje mpkorstanje self-requested a review September 4, 2025 18:19
@mpkorstanje
Copy link
Contributor

We could look to still include it in some way, maybe conditionally if there is non-empty content, but even that feels low reward to me, especially given Backgrounds are basically not recommended these days.

I think it would make sense to create an issue for this and then see what interest there is.

While they're not recommend, backgrounds exist long enough that someone is probably using them.

@davidjgoss
Copy link
Contributor Author

While they're not recommend, backgrounds exist long enough that someone is probably using them.

I hadn't seen your comment, but today I've pushed a change where we show just the name and description if either is populated, but not the steps. That way if there is meaningful text in a Background it doesn't get lost, but the steps are still firmly within the test cases. Let's see what the feedback is on this.

@davidjgoss davidjgoss merged commit 87b7106 into main Sep 14, 2025
6 checks passed
@davidjgoss davidjgoss deleted the test-case-centric branch September 14, 2025 10:32
@davidjgoss davidjgoss mentioned this pull request Nov 11, 2025
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scenario Outline collapsed to an Example when an example table row is clicked

3 participants