Skip to content

Commit 4eafb47

Browse files
authored
chore: update playwright and @web/test-runner dependencies with comprehensive test refactoring (#5578)
This pull request represents a comprehensive update to testing infrastructure and dependencies across the entire Spectrum Web Components codebase. The changes include major dependency updates for Playwright and @web/test-runner packages, extensive test refactoring for improved reliability and maintainability, and enhanced CI/CD configurations. Major Dependency Updates Playwright: Updated Docker image in CI from mcr.microsoft.com/playwright:v1.44.0 to v1.53.1 Updated @playwright/test version from ^1.44.0 to ^1.53.1 @web/test-runner Ecosystem: Updated @web/test-runner from ^0.18.3 to ^0.20.2 across multiple packages Updated @web/test-runner-junit-reporter from ^0.7.2 to ^0.8.0 Updated @web/test-runner-playwright from ^0.11.0 to ^0.11.1 Updated @web/test-runner-visual-regression from ^0.9.0 to ^0.10.0 Updated wireit from ^0.14.3 to ^0.14.12 Infrastructure Improvements CI/CD Configuration: Enhanced CircleCI configuration with updated Docker images and improved parallelism Added new Chromium memory testing configuration (web-test-runner.config.ci-chromium-memory.js) Updated GitHub Actions workflows for better coverage reporting Added concurrency settings across all browser test configurations ESLint and Code Quality: Expanded ESLint coverage to include **/stories/*.ts files Updated ESM import syntax from assert { type: 'json' } to with { type: 'json' } Fixed import paths for visual regression commands Dependency Management: Added comprehensive patching system documentation in CONTRIBUTING.md Created Yarn patches for @web/test-runner-playwright and @web/test-runner-visual-regression Removed legacy patch-package dependency in favor of Yarn 4's built-in patching Comprehensive Test Suite Refactoring (132 files affected) Testing Helper Functions: Refactored mouse interaction helpers: sendMouse → mouseClickOn, mouseClickAway, mouseMoveOver, mouseMoveAway Enhanced keyboard interaction helpers: sendKeys → sendTabKey, sendShiftTabKey Improved focus management with waitForFocusEvent and waitForElementReady helpers Added resetMouse functionality for better test isolation where I could Component Test Improvements: Accordion: Enhanced keyboard navigation testing and memory management (accordion-memory.test.ts) Action Components: Improved mouse and keyboard event handling across action-bar, action-button, action-group, and action-menu Color Components: Standardized testing patterns across color-area, color-handle, color-loupe, color-slider, and color-wheel Form Components: Enhanced accessibility testing for combobox, number-field, radio, textfield, and switch components Layout Components: Improved interaction testing for tabs, table, sidenav, and split-view Overlay System: Comprehensive refactoring of overlay, dialog, tooltip, and picker components with enhanced trigger management Navigation Components: Updated menu, breadcrumbs, and top-nav testing patterns Browser Compatibility: Added WebKit and Firefox-specific test skips for flaky tests Enhanced cross-browser event handling Improved timeout management for CI stability Code Quality Improvements Error Handling: Added ResizeObserver loop error suppression in tests Improved language resolution with fallback to 'en-US' in LanguageResolution.ts Enhanced error boundaries in component lifecycle methods Performance Optimizations: Streamlined test execution with better helper functions Reduced redundant DOM queries and event handling Optimized fixture creation patterns across all components Story and Documentation Updates Storybook Enhancements: Added triggered-by attributes for better overlay interaction documentation and reduce browser logs Impact Statistics: Improved test reliability and reduced flakiness across all components Better developer experience with enhanced testing helpers Modernized ESM import syntax and dependency management
1 parent 3f33e43 commit 4eafb47

File tree

137 files changed

+6792
-12014
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

137 files changed

+6792
-12014
lines changed

.circleci/config.yml

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ version: 2.1
33
executors:
44
default:
55
docker:
6-
- image: cimg/base:stable
6+
- image: cimg/base:current
77
resource_class: medium
88
node:
99
docker:
10-
- image: mcr.microsoft.com/playwright:v1.44.0
10+
- image: mcr.microsoft.com/playwright:v1.53.1-noble
1111
resource_class: xlarge
1212
environment:
1313
NODE_ENV: development
@@ -22,7 +22,7 @@ parameters:
2222
# 3. Commit this change to the PR branch where the changes exist.
2323
current_golden_images_hash:
2424
type: string
25-
default: 100f01a7cddc798359e4b6c33ee5e118d8d8bdd8
25+
default: 96dffc61667e8758d5a5cef66bc7ac0fc609d5e3
2626
wireit_cache_name:
2727
type: string
2828
default: wireit
@@ -207,67 +207,71 @@ commands:
207207
jobs:
208208
test-chromium:
209209
executor: node
210+
parallelism: 5
210211

211212
steps:
212213
- downstream
213214
- run:
214-
name: Run unit tests
215-
command: yarn test:ci --config web-test-runner.config.ci-chromium.js --group no-memory-ci --coverage
215+
name: Run chromium tests
216+
command: |
217+
TEST=$(circleci tests glob "{packages,tools}/*/test/*.test.js" | grep -v ".*-memory\.test\.js$" | circleci tests split --split-by=timings)
218+
yarn test:start --files $TEST --config web-test-runner.config.ci-chromium.js --group unit-ci
216219
- store_test_results:
217220
path: /root/project/results/
218-
- store_artifacts:
219-
path: coverage
220221

221-
test-chromium-memory:
222+
test-chromium-coverage:
222223
executor: node
223224

224225
steps:
225226
- downstream
226227
- run:
227-
name: Run memory tests
228-
command: yarn test:ci --config web-test-runner.config.ci-chromium.js --group memory-ci
228+
name: Run chromium tests with coverage
229+
command: yarn test:focus unit --config web-test-runner.config.ci-chromium.js --coverage
229230
- store_test_results:
230231
path: /root/project/results/
231232

232-
test-firefox:
233+
test-chromium-memory:
233234
executor: node
234235
parallelism: 5
235236

236237
steps:
237238
- downstream
238239
- run:
239-
name: Run tests
240+
name: Run memory tests
240241
command: |
241-
TEST=$(circleci tests glob packages/*/test/*.test.js | circleci tests split --split-by=timings)
242-
yarn test:start --files $TEST --config web-test-runner.config.ci-firefox.js --group unit-ci
242+
TEST=$(circleci tests glob "{packages,tools}/*/test/*-memory.test.js" | grep -v "packages/color-.*/test/.*-memory\.test\.js" | grep -v "tools/grid/test/.*-memory\.test\.js" | circleci tests split --split-by=timings)
243+
echo $TEST
244+
yarn test:start --files $TEST --config web-test-runner.config.ci-chromium-memory.js --group unit-ci
243245
- store_test_results:
244246
path: /root/project/results/
245247

246-
test-webkit:
248+
test-firefox:
247249
executor: node
248250
parallelism: 5
249251

250252
steps:
251253
- downstream
252254
- run:
253-
name: Run tests
255+
name: Run firefox tests
254256
command: |
255-
TEST=$(circleci tests glob packages/*/test/*.test.js | circleci tests split --split-by=timings)
256-
yarn test:start --files $TEST --config web-test-runner.config.ci-webkit.js --group unit-ci
257+
TEST=$(circleci tests glob "{packages,tools}/*/test/*.test.js" | grep -v ".*-memory\.test\.js$" | circleci tests split --split-by=timings)
258+
yarn test:start --files $TEST --config web-test-runner.config.ci-firefox.js --group unit-ci
257259
- store_test_results:
258260
path: /root/project/results/
259261

260-
lint:
262+
test-webkit:
261263
executor: node
264+
parallelism: 5
262265

263266
steps:
264267
- downstream
265268
- run:
266-
name: Lint
267-
command: yarn lint
268-
- run:
269-
name: Are there changes?
270-
command: git diff-files --exit-code
269+
name: Run webkit tests
270+
command: |
271+
TEST=$(circleci tests glob "{packages,tools}/*/test/*.test.js" | grep -v ".*-memory\.test\.js$" | circleci tests split --split-by=timings)
272+
yarn test:start --files $TEST --config web-test-runner.config.ci-webkit.js --group unit-ci
273+
- store_test_results:
274+
path: /root/project/results/
271275

272276
beta-docs:
273277
executor: node
@@ -455,6 +459,7 @@ workflows:
455459
- test-chromium-memory
456460
- test-firefox
457461
- test-webkit
462+
- test-chromium-coverage
458463
- hcm-visual:
459464
filters:
460465
branches:

.cursor/rules/github-description.mdc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Use these syntax rules when writing GitHub descriptions:
3434
## Description structure
3535

3636
- Present title, labels, and type before description content
37+
- Description format and structure should follow the pull request template in the Templates section below
3738
- Include links to related issues, RFCs, or documentation when applicable
3839
- All descriptions must include clear acceptance criteria or expected outcomes
3940
- Provide enough context so anyone can understand the objective

.github/workflows/coveralls.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
run: yarn playwright install --with-deps
2424

2525
- name: Run unit tests with coverage
26-
run: yarn test:ci --config web-test-runner.config.ci-chromium.js --group coveralls-ci --coverage
26+
run: yarn test:ci --config web-test-runner.config.ci-chromium.js --group unit --coverage
2727
continue-on-error: true
2828

2929
- name: Upload coverage to Coveralls

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@
1212
"**/*.test-vrt.ts": true
1313
},
1414
"typescript.tsdk": "node_modules/typescript/lib",
15-
"lit-plugin.strict": true
15+
"lit-plugin.strict": true,
16+
"cSpell.words": ["activedescendant", "coachmark", "valuetext"]
1617
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/dist/PlaywrightLauncherPage.js b/dist/PlaywrightLauncherPage.js
2+
index 25ee08570e75005ce1100c52fa8dc1ac08e05109..8030b543e72815e55bfce78d6929c33a48022d88 100644
3+
--- a/dist/PlaywrightLauncherPage.js
4+
+++ b/dist/PlaywrightLauncherPage.js
5+
@@ -31,7 +31,7 @@ class PlaywrightLauncherPage {
6+
: undefined;
7+
// navigate to an empty page to kill any running code on the page, stopping timers and
8+
// breaking a potential endless reload loop
9+
- await this.playwrightPage.goto('about:blank');
10+
+ // await this.playwrightPage.goto('about:blank');
11+
await this.playwrightContext.close();
12+
return { testCoverage };
13+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
diff --git a/index.d.ts b/index.d.ts
2+
index f54053805353acd94b798642c7e7cadb9d54239e..5198ffac424cbaa0274ca67a99e1d5120ef091db 100644
3+
--- a/index.d.ts
4+
+++ b/index.d.ts
5+
@@ -1,2 +1,2 @@
6+
// this file is autogenerated with the generate-mjs-dts-entrypoints script
7+
-export * from './browser/commands.mjs';
8+
+export * from './browser/commands';

0 commit comments

Comments
 (0)