Skip to content

feat(ct): type the mount fixture via story template argument#41920

Merged
pavelfeldman merged 1 commit into
microsoft:mainfrom
pavelfeldman:mount-typed
Jul 21, 2026
Merged

feat(ct): type the mount fixture via story template argument#41920
pavelfeldman merged 1 commit into
microsoft:mainfrom
pavelfeldman:mount-typed

Conversation

@pavelfeldman

Copy link
Copy Markdown
Member

Summary

  • mount is now generic over the story: mount<typeof MyStory>(id, props) type-checks props and update() against the story component signature (React function/class components, Vue components; a plain props type works for other frameworks)
  • document mount officially in class-fixtures.md
  • use the typed form in the web and html-reporter component tests and in the component-testing skill references

Make the mount fixture generic over the story: mount<typeof MyStory>()
type-checks props and update() against the story component signature.
Works for React function/class components and Vue components; a plain
props type can be passed directly for other frameworks. Document mount
officially in class-fixtures.md.
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "MCP"

2 failed
❌ [chrome] › mcp/annotate.spec.ts:446 › should switch screencast to -s session on show --annotate @mcp-windows-latest-chrome
❌ [webkit] › mcp/cli-killall.spec.ts:42 › kill-all kills filtered dashboard pid @mcp-windows-latest-webkit

7790 passed, 1269 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

Hi, I'm the Playwright bot and I took a look at the failing CI.

🟢 CI is clear — both failures are pre-existing MCP flakes

The two red tests are mcp/annotate.spec.ts and mcp/cli-killall.spec.ts. This PR only types the mount fixture (docs, test.d.ts, and component-test specs) — it doesn't touch the MCP tools those tests exercise. Both flip verdict across hundreds of unrelated SHAs, so this is noise, not regression.

Details

Pre-existing flake / infra

  • [chrome] › mcp/annotate.spec.ts:446 › should switch screencast to -s session on show --annotate — flaky across the whole MCP matrix on SHAs unrelated to this PR: e.g. mcp-macos-latest-firefox failed 20 runs across 20 SHAs, mcp-macos-latest-chromium 13/13, mcp-macos-latest-webkit 11/11, plus ubuntu/windows hits. Nothing in this diff reaches the show --annotate screencast path.

  • [webkit] › mcp/cli-killall.spec.ts:42 › kill-all kills filtered dashboard pid — same story: fails on many other SHAs and OSes, e.g. mcp-macos-latest-chromium 12/12, mcp-ubuntu-latest-firefox 11/11, mcp-ubuntu-latest-webkit 9/9, mcp-ubuntu-latest-chrome 7/7. Process kill-all timing, not the mount typing change.

Both were the only failures on their respective mcp-windows-latest-* bots for this run, against a clean history there — the classic one-off flake shape.

Triaged by the Playwright bot - agent run

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

5 flaky ⚠️ [chromium-library] › library/video.spec.ts:736 › screencast › should work with video+trace `@realtime-time-library-chromium-linux`
⚠️ [chromium-library] › library/video.spec.ts:664 › screencast › should capture full viewport `@chromium-ubuntu-22.04-node24`
⚠️ [firefox-page] › page/page-emulate-media.spec.ts:144 › should keep reduced motion and color emulation after reload `@firefox-ubuntu-22.04-node20`
⚠️ [firefox-page] › page/page-event-request.spec.ts:181 › should return response body when Cross-Origin-Opener-Policy is set `@firefox-ubuntu-22.04-node20`
⚠️ [playwright-test] › ui-mode-test-watch.spec.ts:185 › should watch new file `@ubuntu-latest-node26`

50043 passed, 1190 skipped


Merge workflow run.

Comment thread docs/src/test-components-js.md
await expect(component).toContainText('override initialState');
});
```
Yes — that is the core of the design. The gallery is served by your own dev server, so whatever your app can render, your stories can render. There is no second bundler config to keep in sync.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"...There is no second bundler config to keep in sync." - drop this part, we don't need to reference old implementation.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is benign


test('should not report changes when read-only', async ({ mount, page }) => {
const component = await mount('components/codeMirrorWrapper/Editable', { readOnly: true });
const component = await mount<typeof Editable>('components/codeMirrorWrapper/Editable', { readOnly: true });

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we make it work without typeof everywhere?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not seeing the way currently.

@pavelfeldman
pavelfeldman merged commit 4a0c4e4 into microsoft:main Jul 21, 2026
49 of 51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants