realtimekit-test-setup
Skill76 starsChanged 6 days agoApache-2.0View on GitHub
Use with writing-tests for realtimekit-ui tests. Covers Stencil/Jest component specs, core e2e tests, script tests, workspace lint commands, and local test setup.
In this repository14 other files it gives its agents.
- AGENTS.mdAGENTS.md
- packages/core/AGENTS.mdAGENTS.md
- packages/core/src/components/AGENTS.mdAGENTS.md
- packages/core/src/lib/AGENTS.mdAGENTS.md
- packages/core/src/utils/AGENTS.mdAGENTS.md
- breaking-changesSkill
- code-first-workflowSkill
- minimal-changesSkill
- no-guessingSkill
- plain-markdownSkill
- realtimekit-jsdocSkill
- realtimekit-sdk-mapSkill
- strict-namingSkill
- writing-testsSkill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 1 is distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 8
Read writing-tests for the rules.
- Very specific: line 35
Do not install packages just to make a test run without permission (see minimal-changes).
- Very specific: line 48
Search nearby *.spec.tsx files for fixtures and stubs already in use.
- Distinctive: line 49
If one spec needs a small fixture, keep it local.
- Very specific: line 51
Use Jest mocks (jest.fn(), jest.spyOn(), jest.mock()) where appropriate.
- Very specific: line 56
After changing props or events, use page.waitForChanges() before checking updated DOM.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
UI Kit test setup
Read writing-tests for the rules. This skill gives the places and commands for this repo.
Basics
- Core component and utility specs live next to source as
*.spec.tsxor*.spec.ts. Example:packages/core/src/components/rtk-meeting/rtk-meeting.spec.tsx. - Core e2e tests live in
packages/core/e2e/. Script tests live inscripts/*.test.js. - Stencil uses Jest. Import
newSpecPageornewE2EPagefrom@stencil/core/testing; usedescribe,itortest,expect, andjest.fn()as in nearby specs. - For component specs, render the real Stencil component with
newSpecPage({ components: [...], template: ... }). Check props, shadow DOM, emitted events, and cleanup as needed.
Commands
Commands are from the repo root unless noted. Check the root and workspace package.json before using a command.
| Goal | Command |
| Lint core TypeScript | npm run lint -w @cloudflare/realtimekit-ui |
| Lint all workspaces with lint scripts | npm run lint |
| Run one core spec once | npm exec -w @cloudflare/realtimekit-ui -- stencil test --spec --runInBand --testPathPattern=rtk-meeting.spec.tsx (replace the filename) |
| Run core specs and e2e tests | npm test -w @cloudflare/realtimekit-ui |
| Run all workspace tests and script tests | npm test |
| Run core spec coverage (single run) | npm run test:coverage -w @cloudflare/realtimekit-ui |
| Run script tests only | npm run test:scripts |
npm run test:spec -w @cloudflare/realtimekit-uiuses--watchAll. Do not use it for a single-run check.- The core
testscript runsstencil test --spec --e2e; e2e tests may need a browser environment. Report environment failures instead of claiming tests pass. packages/react-libraryhas a lint placeholder, not a real linter.packages/angular-libraryusesnode test.js, which skips when it finds no Angular specs.- There is no standalone root or core type-check script. Do not run
npm run build,npm run generate, ornpm run docs:generate; the developer runs builds and generators. - Do not install packages just to make a test run without permission (see
minimal-changes).
Where shared mocks live
| You need | Use | How |
| A Stencil component page | newSpecPage from @stencil/core/testing | Pass the real component class and render it with a template or HTML. |
| A browser-level component page | newE2EPage from @stencil/core/testing | Put e2e tests in packages/core/e2e/. |
| Meeting or device state | A small local fixture or an existing helper in the spec | Stub only the needed SDK boundary with jest.fn() and check what the component renders. |
| A common mock shared by several specs | A shared helper near the affected specs | Search existing specs before adding a new mock module or helper. |
Add a new shared mock
- Search nearby
*.spec.tsxfiles for fixtures and stubs already in use. - If one spec needs a small fixture, keep it local. If several specs need the same setup, use or add a shared helper without moving unrelated tests.
- Mock only the boundary that the UI needs, such as an SDK meeting method or a browser device API. Keep the component under test real.
- Use Jest mocks (
jest.fn(),jest.spyOn(),jest.mock()) where appropriate. Do not copy Vitestvicalls into this repo.
Things that go wrong
newSpecPagerenders components in a test DOM; inspectpage.rootandpage.root.shadowRootrather than testing a private method when the DOM result is visible.- After changing props or events, use
page.waitForChanges()before checking updated DOM. - A mocked helper does not run its real logic. Test shared
UIConfigor utility changes through their real exported functions. - Clean up listeners or page roots when the component registers browser or meeting listeners. Follow the nearby spec pattern.
Think from the UI Kit
Load realtimekit-sdk-map. Name tests for what an app sees: the component's props, shadow DOM, emitted event detail, or exported helper result. Cover alternate states or sizes when the changed UI behaves differently there. Follow AGENTS.md for the component and package you change.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

