Files
webstudio/packages/sdk-components-react/package.json
T
Oleg Isonen 8718feb465 test: simplify browser testing infrastructure (#6271)
## Summary

Unifies frontend testing around three intentional boundaries:

- Vitest Node projects for pure and server tests
- Vitest Browser Mode with Playwright/Chromium for DOM and component
tests
- Playwright Test for Builder end-to-end workflows

The Builder no longer uses jsdom. Ordinary E2E workflows use an
automatically managed isolated `page` fixture; explicit contexts remain
only for simultaneous identities and suite-scoped setup.

## Technical choices

- Split Builder tests into one Node project and independent browser
projects so each Chromium/Vite process has a bounded workload.
- Added shared Browser Mode configuration for the affected SDK React
packages.
- Preserve the Builder's production top-window bridge ownership; Browser
Mode uses explicit test-only installation seams.
- Centralized Playwright context options and kept action/navigation
timeouts bounded.
- Validate Playwright filters before Docker, migrations, browser
installation, or Builder builds start.
- Preserve the first failed E2E attempt's report, traces, screenshots,
and videos when CI retries a shard.
- Split static checks, typechecks, CLI tests, core package tests,
browser package tests, and Builder projects into parallel CI jobs with
five-minute hard ceilings.
- Distribute Builder E2E tests across ten isolated shards with two
workers; parallel suites create unique per-worker setup data.
- Reuse color contrast DOM/canvas samples so the exhaustive theme sweep
takes about four seconds instead of timing out at 30 seconds.
- The removed cost is jsdom behavior drift, oversized serial check jobs,
and unnecessary E2E startup for empty selections. Real browser startup
and E2E environment setup remain.

## Todo

- [x] Split Builder pure/server tests from browser/component tests.
- [x] Migrate Builder DOM tests from jsdom to Vitest Browser Mode.
- [x] Migrate affected SDK React DOM tests to the shared Browser Mode
setup.
- [x] Remove jsdom annotations, dependencies, and compatibility setup.
- [x] Replace ordinary manual E2E contexts with the isolated `page`
fixture.
- [x] Keep explicit contexts only for concurrent identities and
`beforeAll` setup.
- [x] Preserve setup authentication isolation from workflow pages.
- [x] Add bounded Playwright action and navigation timeouts.
- [x] Preserve first-attempt E2E failure evidence across CI retry.
- [x] Reject empty E2E selections before expensive environment setup.
- [x] Parallelize repository checks into bounded CI shards.
- [x] Isolate parallel E2E setup data across workers.
- [x] Remove the color contrast sweep bottleneck.
- [x] Update E2E contributor documentation.
- [x] Review product documentation impact; no user-facing product docs
are affected.
- [x] Run the full repository tests and typechecks.
- [x] Run formatting, lint, package-boundary, generated-file, and
fixture checks.
- [x] Complete final correctness and simplification review.

## Verification

- `pnpm --filter @webstudio-is/builder test`
- `pnpm -r typecheck`
- `pnpm lint`
- `pnpm check:package-boundaries`
- `pnpm check:generated-api`
- `pnpm check:generated-docs`
- `pnpm fixtures`
- Design-system: 222 tests pass locally.
- Builder: all seven Vitest projects pass locally.
- The formerly slow E2E shard passes locally in 1m55s.
- Full database-backed Builder E2E execution passes in CI.
- All CI jobs pass; the slowest completed in 4m58s.
- No fixture inputs/outputs or generated files changed.

Ref #6270
2026-08-31 17:17:28 +02:00

120 lines
3.9 KiB
JSON

{
"name": "@webstudio-is/sdk-components-react",
"version": "0.0.0-webstudio-version",
"description": "Webstudio default library for react",
"author": "Webstudio <github@webstudio.is>",
"homepage": "https://webstudio.is",
"license": "AGPL-3.0-or-later",
"private": false,
"type": "module",
"sideEffects": false,
"files": [
"lib/*",
"!*.{test,stories}.*"
],
"exports": {
".": {
"webstudio": "./src/index.ts",
"types": "./lib/types/index.d.ts",
"import": "./lib/index.js"
},
"./components": {
"webstudio": "./src/components.ts",
"types": "./lib/types/components.d.ts",
"import": "./lib/components.js"
},
"./code-text": {
"webstudio": "./src/code-text/index.tsx",
"types": "./lib/types/code-text/index.d.ts",
"import": "./lib/code-text/index.js"
},
"./code-text/build": {
"webstudio": "./src/code-text/build.ts",
"types": "./lib/types/code-text/build.d.ts",
"import": "./lib/code-text/build.js"
},
"./build-hooks": {
"webstudio": "./src/build-hooks.ts",
"types": "./lib/types/build-hooks.d.ts",
"import": "./lib/build-hooks.js"
},
"./canvas-components": {
"webstudio": "./src/canvas-components.ts",
"types": "./lib/types/canvas-components.d.ts",
"import": "./lib/canvas-components.js"
},
"./metas": {
"webstudio": "./src/metas.ts",
"types": "./lib/types/metas.d.ts",
"import": "./lib/metas.js"
},
"./hooks": {
"webstudio": "./src/hooks.ts",
"types": "./lib/types/hooks.d.ts",
"import": "./lib/hooks.js"
},
"./markdown": {
"webstudio": "./src/markdown.ts",
"types": "./lib/types/markdown.d.ts",
"import": "./lib/markdown.js"
},
"./templates": {
"webstudio": "./src/templates.ts",
"types": "./lib/types/templates.d.ts",
"import": "./lib/templates.js"
}
},
"scripts": {
"build": "vite build --config ../../vite.sdk-components.config.ts",
"build:args": "NODE_OPTIONS=--conditions=webstudio generate-arg-types './src/*.tsx !./src/*.stories.tsx !./src/*.test.{ts,tsx} !./src/*.ws.ts !./src/*.template.tsx' && oxfmt \"**/*.props.ts\"",
"build:stories": "tsx --conditions=webstudio src/generate-stories.ts && oxfmt \"src/__generated__/*.stories.tsx\"",
"dts": "tsc --project tsconfig.dts.json",
"test": "vitest run",
"typecheck": "tsc --noEmit"
},
"peerDependencies": {
"react": "18.3.0-canary-14898b6a9-20240318",
"react-dom": "18.3.0-canary-14898b6a9-20240318"
},
"dependencies": {
"@react-aria/utils": "^3.27.0",
"@shikijs/langs": "4.4.1",
"@shikijs/themes": "4.4.1",
"@webstudio-is/icons": "workspace:*",
"@webstudio-is/image": "workspace:*",
"@webstudio-is/react-sdk": "workspace:*",
"@webstudio-is/sdk": "workspace:*",
"await-interaction-response": "^0.0.2",
"colord": "^2.9.3",
"github-slugger": "2.0.0",
"hast-util-to-jsx-runtime": "^2.3.6",
"mdast-util-from-markdown": "2.0.3",
"mdast-util-frontmatter": "2.0.1",
"mdast-util-to-string": "4.0.0",
"micromark": "^4.0.2",
"micromark-extension-frontmatter": "2.0.0",
"micromark-extension-gfm": "^3.0.0",
"sanitize-html": "2.17.5",
"shiki": "4.4.1"
},
"devDependencies": {
"@testing-library/dom": "^10.4.0",
"@testing-library/react": "^16.2.0",
"@types/react": "^18.2.70",
"@types/react-dom": "^18.2.25",
"@types/sanitize-html": "2.16.1",
"@vitest/browser": "3.1.1",
"@webstudio-is/design-system": "workspace:*",
"@webstudio-is/generate-arg-types": "workspace:*",
"@webstudio-is/sdk-cli": "workspace:*",
"@webstudio-is/template": "workspace:*",
"@webstudio-is/tsconfig": "workspace:*",
"micromark-util-types": "2.0.2",
"nanostores": "^0.11.3",
"playwright": "1.50.1",
"react": "18.3.0-canary-14898b6a9-20240318",
"react-dom": "18.3.0-canary-14898b6a9-20240318",
"vitest": "3.1.1"
}
}