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

Only run visual regression tests if there are code changes that might cause a visual change #2864

Open
1 task
36degrees opened this issue Sep 20, 2022 · 7 comments · Fixed by #2878
Open
1 task
Labels

Comments

@36degrees
Copy link
Contributor

What

Only run Percy's visual regression tests if there are code changes that might cause a visual change.

As a (non-exhaustive) example, do not run visual regression tests if the only files changed in a PR are tests, docs, internal tooling, or in the dist and package folder.

Why

We have a limited number of screenshots available to us in any given billing period. Only running the visual regression tests when they are useful helps us to burning through our included screenshots too quickly, allowing us to remain on a cheaper plan.

Who needs to work on this

Developers

Who needs to review this

Developers

Done when

  • Percy's visual regression tests are only run if there are code changes that might cause a visual change
@36degrees
Copy link
Contributor Author

We could also only do the split JS/non-JS variants for components that have JavaScript.

@36degrees 36degrees self-assigned this Sep 21, 2022
@colinrotherham
Copy link
Contributor

Some suggestions from me:

  1. Adding Jest --changedSince flag (via commit hash)
    Percy has PERCY_PARTIAL_BUILD and we could skip components that were already tested

  2. Adding GitHub workflow path filters
    So only component Nunjucks/JavaScript (or their tests) trigger Percy

@colinrotherham
Copy link
Contributor

We're also running the Tests workflow twice for every push to a pull request

.github/workflows/tests.yml
Triggers on pushes twice if a pull request is also open

on: [push, pull_request]

@36degrees 36degrees removed their assignment Sep 21, 2022
@36degrees
Copy link
Contributor Author

I think this closed by #2878.

@colinrotherham
Copy link
Contributor

Going to reopen this one as we've still running Percy for code changes that don't affect component UI

@colinrotherham
Copy link
Contributor

We're now running git diff on our npm package:

We could use this information (e.g. no diff, nothing has changed) to prevent Percy from running

@colinrotherham
Copy link
Contributor

Some time later, but here's an example of how to use git diff to conditionally skip tests:

      - name: Run backstop
        run: npm run test:visual
+       if: ${{ steps.changes.outputs.changes == 'true' }}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

Successfully merging a pull request may close this issue.

2 participants