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

Rename all snapshots to "light" #4914

Merged
merged 3 commits into from
Sep 14, 2024
Merged

Rename all snapshots to "light" #4914

merged 3 commits into from
Sep 14, 2024

Conversation

obulat
Copy link
Contributor

@obulat obulat commented Sep 11, 2024

Fixes

Related to #4305 by @zackkrida

Description

Most of the changes in this PR are renaming of the snapshots: from "...-linux.png" to "...-light.png". In the follow-up PR, the "-dark.png" snapshots will be added.

This PR removes the -linux platform suffix from the snapshot names. This will enable someone on a different system to easily compare the snapshots to the linux ones in the repository, instead of creating new snapshots that cannot be compared. this change was removed to prevent flakiness in the future, as per @sarayourfriend's comment below.

Testing Instructions

The code changes should make sense, and the snapshots should only be renamed, not changed.

Checklist

  • My pull request has a descriptive title (not a vague title likeUpdate index.md).
  • My pull request targets the default branch of the repository (main) or a parent feature branch.
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added or updated tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no visible errors.
  • I ran the DAG documentation generator (ov just catalog/generate-docs for catalog
    PRs) or the media properties generator (ov just catalog/generate-docs media-props
    for the catalog or ov just api/generate-docs for the API) where applicable.

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

@openverse-bot openverse-bot added 🧱 stack: frontend Related to the Nuxt frontend 🚦 status: awaiting triage Has not been triaged & therefore, not ready for work labels Sep 11, 2024
@obulat obulat added 🟧 priority: high Stalls work on the project or its dependents 💻 aspect: code Concerns the software code in the repository 🧰 goal: internal improvement Improvement that benefits maintainers, not users and removed 🚦 status: awaiting triage Has not been triaged & therefore, not ready for work labels Sep 11, 2024
@obulat obulat force-pushed the add/color-mode-VR-tests branch 4 times, most recently from 2567791 to bfa076e Compare September 11, 2024 19:38
@zackkrida zackkrida self-requested a review September 11, 2024 20:07
Base automatically changed from set-dark-mode-to-on-in-staging to main September 12, 2024 02:32
@obulat obulat force-pushed the add/color-mode-VR-tests branch 2 times, most recently from 1b312d1 to 07284b8 Compare September 12, 2024 03:33
@@ -21,6 +21,8 @@ const pwCommand = process.env.FASTSTART !== "false" ? "dev" : "prod:playwright"

const config: PlaywrightTestConfig = {
forbidOnly: !!process.env.CI,
snapshotPathTemplate:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

By default, this is '{snapshotDir}/{testFileDir}/{testFileName}-snapshots/{arg}{-projectName}{-snapshotSuffix}{ext}'

snapshotSuffix is the platform (linux), project is a logical group of tests running in the same browser (context). Since we only have one project, we don't need this.

https://github.com/microsoft/playwright/blob/a4bd551597f0161a853f7bdb725e738544db2130/packages/playwright/src/common/config.ts#L166

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed this in 6395b2c

@obulat obulat marked this pull request as ready for review September 12, 2024 03:39
@obulat obulat requested a review from a team as a code owner September 12, 2024 03:39
Copy link
Contributor

@sarayourfriend sarayourfriend left a comment

Choose a reason for hiding this comment

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

Add light to the snapshot names makes sense to me 👍

However, I do not believe we should remove the platform indication from the filename. You mention in the PR body that they make it hard to compare snapshots generated across platforms... but that is intentional, it's the reason the platform is indicated. All the major browsers behave differently between platforms, especially and importantly in font rendering. Indicating the platform the snapshot was generated under ensures that when comparisons do happen, there is no possibility for platform-specific variations to cause noise in the diff.

We run playwright tests inside the Docker container for that reason, to eliminate that noise. We really should not compare screenshots from different OSs. If there are devex issues with the Playwright container that make it necessary to run the visual regression tests outside the Playwright container such that the platform indication would not be linux, then we need to fix those issues. Making it easy to do a faulty comparison (screenshots across OSs) is not an appropriate solution to that problem.

This is a blocker because while we can easily revert the change and add the platform name back, doing this at all sets an incorrect precedence about what kinds of comparisons are valid, and could very easily cause significant confusion, and even introduce flakiness in CI. For example, if a screenshot is generated outside the container, with a different platform and browser version, and then were committed, small font rendering and layout variations could cause difficult to understand flakiness in the screenshots.

Copy link
Contributor

@sarayourfriend sarayourfriend left a comment

Choose a reason for hiding this comment

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

Just reviewing the diffs of screenshots. Some storybook ones are actually changed, rather than just renamed. Almost all of these with changes have visible differences, and some seem incorrect, so I wanted to confirm they are intentional changes.

The button screenshots have a variety of differences. Some have significantly different colours, like frontend/test/storybook/visual-regression/v-button.spec.ts-snapshots/filled-pink-8-resting-linux.png:

image

Some have the same colours, but show ~2px of difference in the width of the button, like frontend/test/storybook/visual-regression/v-button.spec.ts-snapshots/filled-dark-resting-linux.png and frontend/test/storybook/visual-regression/v-button.spec.ts-snapshots/filled-pink-8-hovered-linux.png (although the latter also has the colour difference issue).

By the name frontend/test/storybook/visual-regression/v-button.spec.ts-snapshots/filled-white-hovered-linux.png and frontend/test/storybook/visual-regression/v-button.spec.ts-snapshots/transparent-dark-hovered-linux.png would appear to be white and dark-transparent, but both don't match my expectations of what a white or transparent button would be (including in their versions on main, so something is wrong here overall, maybe).

frontend/test/storybook/visual-regression/v-icon-button.spec.ts-snapshots/v-icon-button-sizes-linux.png is completely broken and doesn't show the components anymore:

image

@obulat obulat changed the base branch from main to fix/storybook-snapshots September 12, 2024 13:48
@obulat
Copy link
Contributor Author

obulat commented Sep 12, 2024

Just reviewing the diffs of screenshots. Some storybook ones are actually changed, rather than just renamed. Almost all of these with changes have visible differences, and some seem incorrect, so I wanted to confirm they are intentional changes.

Sorry for clicking "rerequest review" too early. I noticed that the storybook snapshots are off, and I extracted #4919 out of this PR. Since the Storybook tests had maxDiffPixelRatio set, they were not updated when the colors were updated during the dark theme project. It would be good to audit all the colors/focus rings/snapshots, but I think it should be done later. This specific PR is necessary to set up the light/dark tests, which will make fixing that easier, later :)

Copy link
Member

@zackkrida zackkrida left a comment

Choose a reason for hiding this comment

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

This looks good. Every snapshot is renamed without changes, with the (correct) exception of the additions:

  • frontend/test/storybook/visual-regression/v-icon-button.spec.ts-snapshots/v-icon-button-sizes-light-linux.png
  • frontend/test/storybook/visual-regression/focus.spec.ts-snapshots/focus-colored-light-linux.png

@sarayourfriend
Copy link
Contributor

Sounds good! LGTM

@obulat obulat force-pushed the fix/storybook-snapshots branch 3 times, most recently from 7e1245e to 718a383 Compare September 13, 2024 08:23
@obulat obulat force-pushed the add/color-mode-VR-tests branch 2 times, most recently from 2b2a017 to 85a0666 Compare September 13, 2024 10:56
@obulat obulat force-pushed the add/color-mode-VR-tests branch 7 times, most recently from c635aa1 to 7e5228a Compare September 13, 2024 18:16
@obulat obulat changed the base branch from fix/storybook-snapshots to main September 14, 2024 05:15
@obulat obulat merged commit cdb7a48 into main Sep 14, 2024
44 checks passed
@obulat obulat deleted the add/color-mode-VR-tests branch September 14, 2024 05:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💻 aspect: code Concerns the software code in the repository 🧰 goal: internal improvement Improvement that benefits maintainers, not users 🟧 priority: high Stalls work on the project or its dependents 🧱 stack: frontend Related to the Nuxt frontend
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants