Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

feat(Report): support linking to an individual feature or scenario #64

Merged
merged 4 commits into from
Jan 3, 2021

Conversation

jkuester
Copy link
Collaborator

@jkuester jkuester commented Dec 21, 2020

Adds some link icons that show up when you mouse-over the feature/scenario icons. When you click the icons it gives you a link to that particular feature/scenario.

This will give users the ability to precisely reference specific parts of the report. See the attached example report for a demo!

cucumber-forge-report-generator.zip

Closes #40

@jkuester jkuester requested a review from a team December 21, 2020 22:26
@@ -14,11 +14,21 @@ class CustomWorld {
this.exceptionScenario = false;
}

createWindow(url, outputConsole) {
const virtualConsole = new VirtualConsole();
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I made this change with the virtualConsole to help clean up the test logs a bit. Basically when we use this function here: https://github.com/cerner/cucumber-forge-report-generator/pull/64/files#diff-6605869b51324cd7403d348bda4f58fcef198b8edcffd1d7f3a9040c65bc51d5R69 to create a new window for a report with a particular hash location the report will automatically try to scrollIntoView the linked scenario/feature. However, the headless Jsdom testing framework we are using does not natively support scrollIntoView. In other places we are able to mock the function before it is called so that things are properly handled, but in this case I cannot access dom elements without the window and I cannot create the window without it running the init script which is what triggers the scrollIntoView call.

When a scenario calls createWindow without providing an outputConsole param, then all the output from jsdom will get sent to this virtualConsole and will not be printed to the node console. This keeps the errors around the undefined scrollIntoView function from cluttering up the logs. (Also, to be clear, the scenarios that call createWindow without providing an outputConsole param do not really need to test the scrollIntoView function so I think this is an acceptable tradeoff.)

@TobiTenno
Copy link
Member

This is cool, you might want to see if there's a good way of unfocusing it once you open in a new tab.

@jkuester
Copy link
Collaborator Author

jkuester commented Dec 24, 2020

This is cool, you might want to see if there's a good way of unfocusing it once you open in a new tab.

@TobiTenno after a bunch of tinkering, I never did figure out how to unfocus the anchor but still have everything work correctly. Instead I settled on just removing the outline from the anchors so that it is not displayed when they are focused.

I have updated the attached zip with the new report.

@TobiTenno TobiTenno merged commit 6925967 into cerner:main Jan 3, 2021
@jkuester
Copy link
Collaborator Author

jkuester commented Jan 3, 2021

🎉 This PR is included in version 1.4.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@jkuester jkuester deleted the support_links branch January 4, 2021 14:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support linking to sub-headers within the report
2 participants