Commit c178bf2
authored
♻️ Migrate Storybook & Static-Site SDKs from Puppeteer to Playwright (#193)
## Summary
This PR fixes critical screenshot timeout issues in CI and dramatically
improves performance by migrating both the Storybook and Static-Site
SDKs from Puppeteer to Playwright.
**Root cause:** Puppeteer's new headless mode has known issues with
parallel screenshot capture causing timeouts. Playwright's
BrowserContext provides proper isolation for parallel workers.
**Results:**
- Screenshots now complete in <1 second instead of timing out after 60+
seconds
- Client-side navigation for Storybook provides ~47x speedup (94s → 2s
for 10 screenshots)
## Changes
### Puppeteer → Playwright Migration
- Replace `puppeteer` with `playwright-core` in both SDKs
- Migrate from tab-based pooling to BrowserContext-based pooling for
proper isolation
- Update API calls: `setViewport()` → `setViewportSize()`,
`networkidle2` → `networkidle`
- Fix `page.evaluate()` syntax: Playwright uses object destructuring `({
args }) => {}, { args }`
### Chrome Browser Flags Audit
- Remove deprecated flags causing hangs (`--disable-gpu` +
`--disable-software-rasterizer`)
- Remove flags deprecated since 2017-2019 (`--disable-translate`,
`--safebrowsing-disable-auto-update`)
- Use modern
`--disable-features=Translate,OptimizationHints,MediaRouter` approach
- Add screenshot consistency flags (`--force-color-profile=srgb`,
`--hide-scrollbars`)
- Document flags in `docs/browser-flags.md` with source of truth
references
### Storybook Client-Side Navigation
- Use `__STORYBOOK_PREVIEW__.channel.emit('setCurrentStory')` instead of
full page reloads
- First story per tab: Full page load to initialize Storybook
- Subsequent stories: Client-side navigation + wait for `storyRendered`
event
- Sort tasks by viewport to minimize resize operations
### Plugin System Enhancement
- Support `vizzlyPlugin` field in package.json for plugin registration
### CI Improvements
- Update E2E workflow for Playwright browser installation
- Restructure SDK E2E tests to match real user workflow
- Add proper build steps before E2E tests
## Test plan
- [x] All unit tests pass
- [x] Storybook E2E: 5 screenshots in 0s (TDD mode)
- [x] Storybook E2E: 5 screenshots in 0s (Cloud mode) - previously ALL
timed out
- [x] Static-Site E2E: 5 screenshots in 1s (TDD mode)
- [x] Static-Site E2E: Works (Cloud mode) - previously slow/timing out
- [x] CI passes for all SDK E2E jobs1 parent daa9fa1 commit c178bf2
35 files changed
Lines changed: 1377 additions & 2010 deletions
File tree
- .github/workflows
- clients
- static-site
- src
- utils
- tests
- utils
- storybook
- example-storybook
- src
- utils
- tests
- docs
- src
- client
- server/handlers
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
148 | 152 | | |
149 | 153 | | |
150 | 154 | | |
151 | | - | |
| 155 | + | |
152 | 156 | | |
153 | 157 | | |
154 | 158 | | |
155 | 159 | | |
156 | 160 | | |
157 | 161 | | |
158 | | - | |
| 162 | + | |
159 | 163 | | |
160 | 164 | | |
161 | 165 | | |
162 | 166 | | |
163 | | - | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
164 | 172 | | |
165 | 173 | | |
166 | 174 | | |
167 | 175 | | |
168 | 176 | | |
169 | 177 | | |
| 178 | + | |
170 | 179 | | |
171 | 180 | | |
172 | 181 | | |
173 | 182 | | |
174 | 183 | | |
175 | 184 | | |
| 185 | + | |
176 | 186 | | |
177 | 187 | | |
178 | 188 | | |
| |||
202 | 212 | | |
203 | 213 | | |
204 | 214 | | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
205 | 219 | | |
206 | 220 | | |
207 | 221 | | |
208 | | - | |
| 222 | + | |
209 | 223 | | |
210 | 224 | | |
211 | 225 | | |
212 | 226 | | |
213 | 227 | | |
214 | 228 | | |
215 | | - | |
| 229 | + | |
216 | 230 | | |
217 | 231 | | |
218 | 232 | | |
219 | 233 | | |
220 | | - | |
| 234 | + | |
221 | 235 | | |
222 | 236 | | |
223 | 237 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
0 commit comments