Fix e2e (Playwright) output dir handling#1312
Open
sentience wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes two issues in the E2E (Playwright) build path when using npm (e.g. when using
chromaui/action@latestin GitHub Actions withplaywright: true):--output-dircorrectly tobuild-archive-storybookProblem
For E2E (Playwright) builds, Chromatic currently constructs the npm command to build a Storybook archive from Playwright test results like this:
npm exec build-archive-storybook --output-dir=/tmp/chromatic-...With npm, that does not reliably pass
--output-dirto the binary, so the build output ends up in./storybook-staticinstead of the expected temp dir.chromatic-cli already has a fallback for that case, where it detects the correct output directory by finding it in the Storybook CLI build log, but the parser only recognizes an older one-line log format (which seems to have been the format produced by Storybook 8). @chromatic-com/playwright@0.13.* has recently upgraded to Storybook 10, which outputs the build directory in a different, multi-line format, which chromatic-cli's fallback fails to parse. As a result, chromatic-cli cannot find the Storybook build output, and fails to find/validate the built test suite output with a message like this:
Here's a sample build failure on one of my own projects triggered by the upgrade to @chromatic-com/playwright@0.13.x.
Fix
This PR fixes both issues:
npm exec -- ...Output directory: /pathOutput directory:followed by the path on the next lineWhy
This showed up for me when upgrading
@chromatic-com/playwright, which moved the embedded Storybook version forward. The underlying npm forwarding issue was already there, but the newer Storybook log format stopped the existing recovery path from working. I originally reported it as chromaui/chromatic-e2e#312, mistaking it for a@chromatic-com/playwrightissue, but on further investigation I traced the root cause to these issues inchromatic-cli– they were only triggered by the Storybook 10 upgrade in@chromatic-com/playwright.