chromaui / chromatic-e2e

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

Cypress support (basic) #29

Closed skitterm closed 8 months ago

skitterm commented 8 months ago

Issue: #AP-3733

What Changed

Adds support for Cypress at a very basic level:

Chromatic options are theoretically supported but haven't been tested yet (can't skip snapshots yet)

Details

Because Cypress runs its tests in the browser, I'm using their built-in cy.intercept() mechanism to listen to network requests and thus archive resources.

We then pass these resources and snapshots to the server via a custom Cypress task, cy.archiveCypress().

After that, we do minimal massaging of data and then send it to be written from disk (at that point reusing existing Playwright-e2e code)

Limitations

Because we are likely to split out Cypress and Playwright implementations into separate NPM packages, I haven't worried about type correctness in the Cypress files yet, nor have I made great attempts to reuse code between Playwright and Cypress. I figure that could come in future PRs after we decide how to package these (so we don't cause disruptions for existing Playwright users).

Eventually we'll want cypress to be a peer dependency for the Cypress users (and we'll want to import Cypress typings), but I didn't want to put that as a peer dependency now since Playwright users certainly don't need Cypress.

How to test

I'm happy to pair on the below QA to save you time, if Cypress is new for you.

Manual snapshots

Playwright's still ok (no regressions)

Change Type

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

@tevanoff @tmeasday this is ready for your re-review, and if one of you can QA that'd be great! (Happy to pair on the QA)

thafryer commented 8 months ago

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