chromaui / chromatic-e2e

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

Allow archiving from specified external domains #37

Closed skitterm closed 8 months ago

skitterm commented 8 months ago

Issue: #CAP-1124

What Changed

Allows users to specify which external (to the site being tested) domains whose resources will be archived. This is done by specifying the allowedArchiveDomains value in the user's playwright.config.js file.

I've updated the calling code from Cypress to still work, but it doesn't pass this config option through yet.

I've also inlined more of the test's expected values, both to limit how much test-specific logic we have and to make it more explicit what the test expects.

How it works

We now (internally) make note of what URL the test is being run against. We then compare URLs against our external-domain-allow-list and archive resources from the origins that match.

When archiving other-domain URLs, we prepend their file path with the host.

How to test

  1. Use this version of the package in your Playwright test
  2. Create a test that references multiple assets (like images) from another domain
  3. In the playwright.config.js file, specify one of these domains
  4. Run npx playwright test
  5. Verify that the asset at this domain has been archived
  6. Run archive-storybook
  7. Verify that the asset loads in as expected

Change Type

📦 Published PR as canary version: 0.0.39--canary.37.88cfa0f.0
:sparkles: Test out this PR locally via: ```bash npm install @chromaui/test-archiver@0.0.39--canary.37.88cfa0f.0 # or yarn add @chromaui/test-archiver@0.0.39--canary.37.88cfa0f.0 ```
thafryer commented 8 months ago

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