chromaui / chromatic-e2e

Archive end-to-end tests to be replayed in Storybook and Chromatic
MIT License
21 stars 4 forks source link

Write archives to Playwright-created folder #17

Closed skitterm closed 1 year ago

skitterm commented 1 year ago

What Changed

Writes archives to the playwright-created directory (test-results by default, the value of outputDir if specified in the playwright.config.js).

Previously we wrote to the test-archives storybook, putting tests in a timestamped folder and symlinking the latest timestamped folder to /latest. However, if tests didn't all run at the same time, they'd end up in different timestamped folders, thus /latest wouldn't have all of the archives (and thus the storybook wouldn't be complete).

Since the playwright-managed test-results directory is destroyed at the beginning of each test run, we can be sure any archives written there are from the same run.

We put these archives in test-results/chromatic-archives (so the archives aren't rummaged in whatever playwright is creating/reading from at the test-results level).

This needs to release at the same time as the corresponding archive-storybook change.

How to test

On an e2e project depending on this library:

  1. Create multiple tests in multiple files
  2. Run yarn playwright test
  3. Verify that the archives are written to test-results/chromatic-archives directory
  4. Verify that that folder contains the archives/DOM representations of all the tests
  5. In playwright.config.js, tell Playwright to write test results to a custom directory (outputDir option)
  6. Run yarn playwright test
  7. Verify that the archives are written to this custom directory instead

Change Type

📦 Published PR as canary version: 0.0.21--canary.17.ec4768b.0
:sparkles: Test out this PR locally via: ```bash npm install @chromaui/test-archiver@0.0.21--canary.17.ec4768b.0 # or yarn add @chromaui/test-archiver@0.0.21--canary.17.ec4768b.0 ```
thafryer commented 1 year ago

:rocket: PR was released in v0.0.21 :rocket:

skitterm commented 1 year ago

cc @jwir3