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

Add golden tests #726

Open
chalin opened this issue Oct 15, 2021 · 4 comments
Open

Add golden tests #726

chalin opened this issue Oct 15, 2021 · 4 comments

Comments

@chalin
Copy link
Collaborator

chalin commented Oct 15, 2021

As a followup to #540 (comment), and in conjunction with #725, I believe that docsy could benefit from some CI testing. It would probably be easiest to add some golden tests. That is, have test site(s) containing test pages, then generate the site files and compare the results against the golden files. This would help us avoid features being overwritten or just plain reverted by mistake.

Thoughts?

Related:

/cc @emckean @nate-double-u @celestehorgan

@emckean
Copy link
Collaborator

emckean commented Oct 15, 2021

Thanks Patrice! This is an excellent idea! I'm working on setting up screenshot tests w/Percy -- you can see my in-progress stuff here, I'd love feedback! https://github.com/emckean/docsy/actions

@chalin
Copy link
Collaborator Author

chalin commented Oct 15, 2021

Cool!

I was going to suggest that the golden files be HTML (generated test site files) rather than screenshots. That makes it much easier to review.

@emckean
Copy link
Collaborator

emckean commented Oct 29, 2021

I've been poking around to see if there's a GitHub action for easily diffing the generated HTML—do you have a tool you recommend?

I agree that HTML makes it easier to see what changed in the markup, but I think the screenshots make it slightly easier to notice CSS weirdness?

@chalin
Copy link
Collaborator Author

chalin commented Nov 2, 2021

I've been poking around to see if there's a GitHub action for easily diffing the generated HTML—do you have a tool you recommend?

What I've done before is to use a simple script to regenerate the golden files and then use git status (during CI) to detect if anything has changed -- and fail the build if something has changed.

I agree that HTML makes it easier to see what changed in the markup, but I think the screenshots make it slightly easier to notice CSS weirdness?

Right, both are useful.

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

No branches or pull requests

2 participants