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

Using playwright to generate snapshots #1589

Merged
merged 33 commits into from
Nov 10, 2022
Merged

Using playwright to generate snapshots #1589

merged 33 commits into from
Nov 10, 2022

Conversation

jonrohan
Copy link
Member

@jonrohan jonrohan commented Nov 9, 2022

Description

This is a retry of the code removed in #1555. However it uses a different system playwright.

Following the lead of @joshblack in primer/react#2520 I'm setting up playwright to run our lookbook server and take screenshots of our previews.

Currently it takes a screenshot of the default preview, then tabs to focus the first focuable element on the page and takes another screenshot.

I'd hope to add these extra features in follow up PRs.

  • Themes, take screenshots of components in different themes.
  • Specialized playwright tests for components that need more interaction to see, like dialog, autocomplete

Integration

Does this change require any updates to code in production?

No

Merge checklist

  • Added/updated tests
  • Added/updated documentation
  • Added/updated previews

@changeset-bot
Copy link

changeset-bot bot commented Nov 9, 2022

⚠️ No Changeset found

Latest commit: b9325cb

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@jonrohan jonrohan temporarily deployed to review-pr-1589 November 9, 2022 18:48 Inactive
@jonrohan jonrohan temporarily deployed to github-pages November 9, 2022 18:54 Inactive
@jonrohan jonrohan temporarily deployed to review-pr-1589 November 9, 2022 19:01 Inactive
@jonrohan jonrohan temporarily deployed to github-pages November 9, 2022 19:05 Inactive
@jonrohan jonrohan temporarily deployed to review-pr-1589 November 9, 2022 19:21 Inactive
@jonrohan jonrohan temporarily deployed to github-pages November 9, 2022 19:26 Inactive
@jonrohan jonrohan temporarily deployed to review-pr-1589 November 9, 2022 19:31 Inactive
@jonrohan jonrohan temporarily deployed to github-pages November 9, 2022 19:37 Inactive
@github-actions
Copy link
Contributor

github-actions bot commented Nov 9, 2022

⚠️ Visual differences found

Our visual comparison tests found UI differences. Please review the differences by viewing the files changed tab to ensure that the changes were intentional.

Review visual differences

@jonrohan jonrohan temporarily deployed to review-pr-1589 November 9, 2022 20:27 Inactive
@jonrohan jonrohan temporarily deployed to github-pages November 9, 2022 20:31 Inactive
@jonrohan jonrohan temporarily deployed to review-pr-1589 November 9, 2022 21:34 Inactive
@jonrohan jonrohan temporarily deployed to github-pages November 10, 2022 00:48 Inactive
@github-actions github-actions bot added the css Pull requests that update CSS code label Nov 10, 2022
@jonrohan jonrohan temporarily deployed to github-pages November 10, 2022 00:54 Inactive
@jonrohan jonrohan temporarily deployed to review-pr-1589 November 10, 2022 02:56 Inactive
@github-actions github-actions bot removed the css Pull requests that update CSS code label Nov 10, 2022
@jonrohan jonrohan marked this pull request as ready for review November 10, 2022 03:18
@jonrohan jonrohan requested review from a team, camertron and joshblack November 10, 2022 03:18
@jonrohan jonrohan temporarily deployed to github-pages November 10, 2022 03:20 Inactive
import {componentPreviews} from './helpers'

test.beforeEach(async ({page}, testInfo) => {
testInfo.snapshotSuffix = ''
Copy link
Member

Choose a reason for hiding this comment

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

Have you had any trouble with the snapshots on macOS and ubuntu with this change? Would definitely simplify stuff if we didn't have to use docker 👀

Copy link
Member Author

Choose a reason for hiding this comment

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

I wasn't worried about it too much, in a codespace it's the same environment as CI. And if someone did run it on macos and checked it in, the ci would override them with new screenshots since we check in any changes the ci job detects.

snapshotDir: path.join(__dirname, '.playwright', 'screenshots'),

/* Run tests in files in parallel */
fullyParallel: true,
Copy link
Member

Choose a reason for hiding this comment

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

Such a good option 🔥 Did not realize that it's parallel on test files by default

Copy link
Member

@joshblack joshblack left a comment

Choose a reason for hiding this comment

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

So good 🔥

@jonrohan jonrohan merged commit 0230b73 into main Nov 10, 2022
@jonrohan jonrohan deleted the playwright_snapshots branch November 10, 2022 16:52
jonrohan added a commit that referenced this pull request Nov 10, 2022
jonrohan added a commit that referenced this pull request Nov 10, 2022
jonrohan added a commit that referenced this pull request Nov 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip changeset Pull requests that don't change the library output
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants