swr
swr copied to clipboard
test: setup playwright component test
Motivation
This pr intends to setup playwright component test for swr. So we can add e2e test easily in the future. Also swr uses a lot of navigator specific APIs. It would be batter if we could use real browser enviorment for testing.
Benefit
When Playwright Test is used to test web components, tests run in Node.js, while components run in the real browser. This brings together the best of both worlds: components run in the real browser environment, real events are triggered. At the same time, test can use all the powers of Node.js as well as all the Playwright Test features.
related: #1240 #350
https://playwright.dev/docs/test-components
This pull request is automatically built and testable in CodeSandbox.
To see build info of the built libraries, click here or the icon next to each commit SHA.
Latest deployment of this branch, based on commit 195e614e62f76d21064389dfe61c4d20d1c3c5a3:
Sandbox | Source |
---|---|
SWR-Basic | Configuration |
SWR-States | Configuration |
SWR-Infinite | Configuration |
SWR-SSR | Configuration |
Can we add some description for this PR like:
- what the e2e suite does?
- what kind of the cases are covered?
- why we need to have this? (benefits or comparsion with current UT suite)
It's super helpful and convenient for others who are not familiar with it to get more insights