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

Save HTML report when an audit test fails #16

Open
joshmcarthur opened this issue Jan 28, 2021 · 3 comments
Open

Save HTML report when an audit test fails #16

joshmcarthur opened this issue Jan 28, 2021 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@joshmcarthur
Copy link
Contributor

As a developer

When an audit test fails

I want to be able to view the lighthouse report for the failure

So that I can see the exact reason for the failure


Lighthouse supports multiple output formats - this would be --output=[JSON,HTML]
JSON outputs to STDOUT by default - would need to check what it does with HTML output

Ideally we would export the HTML report to a file, while capturing JSON to STDOUT. If we can't do this, we can export both HTML and JSON to a file, and read the file to grab the results. If the audit passes, we can clean up the test artifacts. If the audit fails, we can let the user know where to find the HTML report.

@joshmcarthur joshmcarthur added the enhancement New feature or request label Jan 28, 2021
@fractalcactus fractalcactus self-assigned this Jan 28, 2021
@joshmcarthur
Copy link
Contributor Author

Confirming that --output json --output html --output-path='lighthouse_results.html' outputs lighthouse_results.report.json and lighthouse_results.report.html - so no STDOUT for JSON anymore, but it would allow us to read the JSON result and discard the files if the audit passes.

RSpec examples have metadata we can use to get information about the test. We should look at how Capybara's save_screenshot gets the filename, since that would be a good one to use.

@joshmcarthur
Copy link
Contributor Author

Maybe I spoke to soon, Capybara's implementation is pretty basic: https://github.com/teamcapybara/capybara/blob/8c4bffda867c9edc4c5a7b8d37738065775f9945/lib/capybara/session.rb#L876

@G-Rath
Copy link
Contributor

G-Rath commented Jun 22, 2024

@robotdana did something like this in #32, which I've since cherry-picked out into another branch as it was useful for debugging - it outputs JSON not HTML, but I think it's probably a good place to start

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants