Skip to content

test: add token snapshot tests #8050

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

Merged
merged 14 commits into from
Nov 22, 2023
Merged

test: add token snapshot tests #8050

merged 14 commits into from
Nov 22, 2023

Conversation

alisonailea
Copy link
Contributor

Related Issue: n/a

Summary

Adds a debugger script for calcite-design-tokens in VSCode (launch.json)
Adds snapshot tests to enforce token output

@alisonailea alisonailea self-assigned this Oct 24, 2023
@github-actions github-actions bot added the testing Issues related to automated or manual testing. label Oct 24, 2023
@alisonailea alisonailea added skip visual snapshots Pull requests that do not need visual regression testing. low risk Issues with low risk for consideration in low risk milestones labels Oct 24, 2023
Copy link
Member

@jcfranco jcfranco left a comment

Choose a reason for hiding this comment

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

Noice. I might be missing something, but I do have some questions:

  1. What is the expected code change/PR review/test workflow? It's comparing against all output targets, so does this mean any change to tokens could potentially cause a test failure?
  2. If ☝️ is yes, what is the difference between a. reviewing a change to the design tokens package source and b. accepting the diff from the updated snapshot? There might be a bit of redundancy between a and b.
  3. What is the main objective of these tests? If it's to make sure the generated files are not impacted in a major way, would the components package testing help catch this type of change? If it's to make sure all changes get double checked, how can we make sure it won't get noisy and reviews will be effective?
  4. Is there an alternative that wouldn't require us to keep a copy of all output targets as the base for snapshot tests? This would only grow as we add more tokens and output targets, right?

@alisonailea
Copy link
Contributor Author

  • What is the expected code change/PR review/test workflow? It's comparing against all output targets, so does this mean any change to tokens could potentially cause a test failure?

Yes any change to platform outputs will cause a test failure.

  • If ☝️ is yes, what is the difference between a. reviewing a change to the design tokens package source and b. accepting the diff from the updated snapshot? There might be a bit of redundancy between a and b.

Because changes may be made to the token transformer which would cause a change in the output even if the tokens themselves remain the same. This also helps future proof tokens so changes aren't accidentally made in Figma and pushed up. It's a lot easier to miss mistakes on the design side.

  • What is the main objective of these tests? If it's to make sure the generated files are not impacted in a major way, would the components package testing help catch this type of change? If it's to make sure all changes get double checked, how can we make sure it won't get noisy and reviews will be effective?

The main objective is to catch changes made to the platform output of tokens.

  • Is there an alternative that wouldn't require us to keep a copy of all output targets as the base for snapshot tests? This would only grow as we add more tokens and output targets, right?

Along with being the only way to fully test tokens prior to building calcite-components as well, keeping a static record of how we expect tokens to look is valuable because it allows us to review token output from Github without pulling the branch down and building locally.

@alisonailea alisonailea requested a review from jcfranco October 30, 2023 17:46
@alisonailea
Copy link
Contributor Author

alisonailea commented Oct 30, 2023

#7984 relies on this PR for verification. It would also help for verifying #7986. And #7986, #7984, and this PR are required to accomplish #7325

@jcfranco
Copy link
Member

Thanks for the additional context. Agreed that this would be super useful for token test coverage. 🎉

I am curious to see what the update workflow ends up looking like since the snapshot test base is volatile.

Copy link
Member

@jcfranco jcfranco left a comment

Choose a reason for hiding this comment

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

👍

Copy link
Contributor

github-actions bot commented Nov 8, 2023

This PR has been automatically marked as stale because it has not had recent activity. Please close your PR if it is no longer relevant. Thank you for your contributions.

@github-actions github-actions bot added the Stale Issues or pull requests that have not had recent activity. label Nov 8, 2023
@alisonailea alisonailea removed the Stale Issues or pull requests that have not had recent activity. label Nov 21, 2023
@alisonailea alisonailea changed the base branch from main to astump/7325-reduce-tokens-output November 22, 2023 20:08
@alisonailea alisonailea changed the base branch from astump/7325-reduce-tokens-output to main November 22, 2023 20:16
@alisonailea alisonailea merged commit a7aeb37 into main Nov 22, 2023
@alisonailea alisonailea deleted the astump/token-snapshot-tests branch November 22, 2023 21:06
@github-actions github-actions bot added this to the 2023 December Priorities milestone Nov 22, 2023
benelan added a commit that referenced this pull request Nov 23, 2023
* origin/main: (30 commits)
  test: add token snapshot tests (#8050)
  chore: release next
  fix(color-picker, popover, shell-panel, slider, tooltip): Register events on the window instead of the document (#8247)
  fix(list-item): Reserve space for empty open lists. (#8239)
  fix: dragging floating ui components (#8230)
  fix(list-item): an item with an empty slotted list should be openable. (#8240)
  fix(input): prevents mutating value on `blur` when `type="number"` (#8245)
  chore: release main (#8092)
  chore: downgrade eslint plugin after reverting breaking change (#8238)
  refactor(combobox): fix linting errors (#8235)
  chore: downgrade packages after reverting 2.0.0-next.0 change (#8237)
  chore: release next
  revert: feat(stepper-item)!: remove support for previousStep and nextStep in messages (#8222) (#8232)
  feat(stepper): enable responsive layout (#7744)
  feat(combobox): limit display of selected items with new selection-display prop (#7912)
  chore: release next
  build: update browserslist db (#8218)
  fix(list-item): fix rendering of open icon. (#8207)
  revert: feat(alert): make component responsive (#8195)
  fix(input-number): prevents mutating value on blur (#8226)
  ...
benelan added a commit that referenced this pull request Nov 23, 2023
* origin/main: (30 commits)
  test: add token snapshot tests (#8050)
  chore: release next
  fix(color-picker, popover, shell-panel, slider, tooltip): Register events on the window instead of the document (#8247)
  fix(list-item): Reserve space for empty open lists. (#8239)
  fix: dragging floating ui components (#8230)
  fix(list-item): an item with an empty slotted list should be openable. (#8240)
  fix(input): prevents mutating value on `blur` when `type="number"` (#8245)
  chore: release main (#8092)
  chore: downgrade eslint plugin after reverting breaking change (#8238)
  refactor(combobox): fix linting errors (#8235)
  chore: downgrade packages after reverting 2.0.0-next.0 change (#8237)
  chore: release next
  revert: feat(stepper-item)!: remove support for previousStep and nextStep in messages (#8222) (#8232)
  feat(stepper): enable responsive layout (#7744)
  feat(combobox): limit display of selected items with new selection-display prop (#7912)
  chore: release next
  build: update browserslist db (#8218)
  fix(list-item): fix rendering of open icon. (#8207)
  revert: feat(alert): make component responsive (#8195)
  fix(input-number): prevents mutating value on blur (#8226)
  ...
benelan pushed a commit that referenced this pull request Nov 24, 2023
**Related Issue:** n/a

## Summary

Adds a debugger script for calcite-design-tokens in VSCode (launch.json)
Adds snapshot tests to enforce token output
benelan pushed a commit that referenced this pull request Nov 24, 2023
**Related Issue:** n/a

## Summary

Adds a debugger script for calcite-design-tokens in VSCode (launch.json)
Adds snapshot tests to enforce token output
benelan pushed a commit that referenced this pull request Nov 26, 2023
**Related Issue:** n/a

## Summary

Adds a debugger script for calcite-design-tokens in VSCode (launch.json)
Adds snapshot tests to enforce token output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
low risk Issues with low risk for consideration in low risk milestones skip visual snapshots Pull requests that do not need visual regression testing. testing Issues related to automated or manual testing.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants