Provides testing strategies for Angular applications using CometChat, including mocking the SDK for unit tests and E2E testing with Playwright.
- GitHub stars
- 171
- Files
- 1
- Last commit
- Oct 15, 2026
- License
- MIT
- Allowed tools
- —
What does the cometchat-angular-v5-testing skill do?
cometchat-angular-v5-testing provides testing strategies for Angular applications using CometChat, including mocking the SDK for unit tests and E2E testing with Playwright.
Summary generated from the skill's SKILL.md.
About the cometchat-angular-v5-testing skill
Developers building Angular applications with CometChat can use this skill to implement testing strategies that prevent tests from hanging or failing due to network dependencies. It provides specific guidance on how to mock the CometChat SDK for unit testing using Jest, Karma, or Vitest, ensuring that developers only fake the network layer while keeping real component classes intact via requireActual. This approach allows for testing application logic, routing, and state without triggering real socket connections or polluting live data.
For end-to-end testing, the skill outlines how to use Playwright against a real development application with seeded users. It emphasizes asserting the state of the ChatStateService and verifying visual elements, such as ensuring message list heights are non-zero, rather than testing the internal DOM of the third-party kit. This skill is designed for engineers working with Angular versions 17 through 21 and the CometChat UI Kit version 5, helping them avoid common pitfalls like unmocked initialization or brittle assertions that break during kit updates.
What an agent can do with it
- 1Diagnosing hanging test suitesIdentify why Angular tests are hanging by checking if the CometChat initialization is properly mocked.
Written from the skill's SKILL.md. Every use case is checked against a quote from it.
How to install the cometchat-angular-v5-testing skill
Each command copies the skill folder into the client's skills directory. Restart the client or start a new session to load it.Install the cometchat-angular-v5-testing skill in Plugin
/plugin marketplace add cometchat/cometchat-skills /plugin install cometchat-skills@cometchat
Install the cometchat-angular-v5-testing skill in Claude Code
~/.claude/skills/cometchat-angular-v5-testing/SKILL.md
$ npx degit cometchat/cometchat-skills/skills/cometchat-angular-v5-testing ~/.claude/skills/cometchat-angular-v5-testingInstall the cometchat-angular-v5-testing skill in Claude Code (project)
.claude/skills/cometchat-angular-v5-testing/SKILL.md
$ npx degit cometchat/cometchat-skills/skills/cometchat-angular-v5-testing .claude/skills/cometchat-angular-v5-testingInstall the cometchat-angular-v5-testing skill in Codex
~/.agents/skills/cometchat-angular-v5-testing/SKILL.md
$ npx degit cometchat/cometchat-skills/skills/cometchat-angular-v5-testing ~/.agents/skills/cometchat-angular-v5-testingInstall the cometchat-angular-v5-testing skill in Gemini CLI
~/.gemini/skills/cometchat-angular-v5-testing/SKILL.md
$ npx degit cometchat/cometchat-skills/skills/cometchat-angular-v5-testing ~/.gemini/skills/cometchat-angular-v5-testingInstall the cometchat-angular-v5-testing skill in Claude.ai
npx degit cometchat/cometchat-skills/skills/cometchat-angular-v5-testing cometchat-angular-v5-testing && zip -r cometchat-angular-v5-testing.zip cometchat-angular-v5-testing # claude.ai → Customize → Skills → + → Create skill → Upload a skill → cometchat-angular-v5-testing.zip
Automated checks
Ran Nov 14, 2026Full report →Passed our automated checks. That is not a security audit: read the scripts before you let an agent run them. How checks work · What to fix for more points
- Source repository linked and reachablecometchat/cometchat-skills/skills/cometchat-angular-v5-testing is public and reachablegithub.com/cometchat/cometchat-skills/tree/HEAD/skills/comet ↗Pass
- Open source license (OSI)MITspdx.org/licenses/MIT.html ↗Pass
- Commit or release in the last yearLast commit 2026-10-15github.com/cometchat/cometchat-skills/commits ↗Pass
- No download-and-run or credential theft in scriptsNo scripts in the skill folderPass
- No hidden instructions in SKILL.mdNo override phrases, safeguard switches, credential requests or hidden charactersgithub.com/cometchat/cometchat-skills/blob/HEAD/skills/comet ↗Pass
- Pre-approved tools are scopedNo pre-approved tools; the agent asks before using onegithub.com/cometchat/cometchat-skills/blob/HEAD/skills/comet ↗Pass
- SKILL.md follows the Agent Skills formatthe description does not say when to use the skillgithub.com/cometchat/cometchat-skills/blob/HEAD/skills/comet ↗Finding
SKILL.md
View on GitHubGround truth:
@cometchat/chat-uikit-angular@5(5.1.0–5.2.0 verified). The Angular UI Kit docs have no testing page — the strategy here is the pack's own, and is labelled as such rather than presented as documented (a tracked DOCS GAP). Any kit symbol a test mocks must still exist in theangular-v5catalog, and its real shape comes from the component's.mdtwin viacometchat-angular-v5-core/references/docs-map.md— mock the API the kit actually exposes, never one invented to fit the test.
Companion skills (read first)
cometchat-angular-v5-core— init/login lifecycle, which is what makes tests hang if unmocked.
Use this skill when
Writing tests for a component that renders kit components, or diagnosing tests that hang or fail on network.
Decide what you are testing
| Testing | Approach |
|---|---|
| Your logic — selection, routing, state | Unit test with CometChat mocked |
| Kit component internals | Don't. It is a third-party dependency with its own tests |
| Your app's chat flow end-to-end | Playwright against a real dev app, two accounts |
| Realtime delivery | Manual, two browsers. Not automatable cheaply |
The common mistake is unit-testing kit internals. Test the seam: given a click, does your component set the right active chat?
Mock CometChat in unit tests
Kit components open sockets and call the API at construction. Left real, tests hang, fail offline, and pollute a live app with test data.
// src/testing/cometchat.mock.ts
export const cometChatUIKitMock = {
initFromSettings: jest.fn().mockResolvedValue({}),
login: jest.fn().mockResolvedValue({ getUid: () => 'test-uid' }),
loginWithAuthToken: jest.fn().mockResolvedValue({ getUid: () => 'test-uid' }),
logout: jest.fn().mockResolvedValue(undefined),
getLoggedInUser: jest.fn().mockReturnValue({ getUid: () => 'test-uid' }),
isInitialized: jest.fn().mockReturnValue(true),
isCallingEnabled: jest.fn().mockReturnValue(false),
};
Point the module at it (Jest):
jest.mock('@cometchat/chat-uikit-angular', () => ({
...jest.requireActual('@cometchat/chat-uikit-angular'),
CometChatUIKit: cometChatUIKitMock,
}));
Keep requireActual so real component classes and ChatStateService still exist — you want your own wiring exercised, only the network faked.
TestBed with standalone kit components
They are standalone, so they go in imports, exactly as in the app:
import { TestBed } from '@angular/core/testing';
import { ChatComponent } from './chat.component';
beforeEach(async () => {
await TestBed.configureTestingModule({ imports: [ChatComponent] }).compileComponents();
});
If a test fails with "is not a known element", the component under test is missing it from its own imports — a real bug the test just caught, not a test problem.
Prefer testing ChatStateService over the DOM
Assert state, not kit markup. Kit internals change between releases; your wiring should not.
it('sets the active group when a group conversation is clicked', () => {
const fixture = TestBed.createComponent(ChatComponent);
const cmp = fixture.componentInstance;
// Mock the SHAPE the kit actually emits: a Conversation whose subject is a Group.
// Handing open() a bare { getGuid } instead lets a duck-typing bug pass the test
// while every group chat throws "getUid is not a function" in the browser.
const group = new CometChat.Group('g1', 'Team', CometChat.GROUP_TYPE.PUBLIC);
const conversation = { getConversationType: () => 'group', getConversationWith: () => group };
cmp.open(conversation as unknown as CometChat.Conversation);
expect(cmp.chatState.getActiveGroup()).toBeTruthy();
expect(cmp.chatState.getActiveUser()).toBeFalsy(); // the group must NOT land in the user slot
});
Mock the emitted shape, not the shape your code happens to check. A mock built backwards from the implementation can only confirm the implementation — including its bugs.
(itemClick)emits aConversation; a test that passes anything else is not exercising the wiring.
E2E with Playwright
Use a real dev app and two seeded users. What is worth asserting:
- The conversation list renders rows
- Clicking one opens header + list + composer
- Sending text makes it appear
- No console errors — the kit fails quietly, so this catches a lot
- Nothing collapsed — assert the message list's height is non-zero; a zero-height pane is the most common silent break
const box = await page.locator('cometchat-message-list').boundingBox();
expect(box!.height).toBeGreaterThan(100);
Seed users and conversations through the REST API in setup, not the UI.
Not worth automating
Realtime delivery between two clients, calls (needs media permissions and two peers), and push (needs a real device and a backgrounded app). Verify these manually and say so in the test plan rather than writing brittle automation.
Common pitfalls
- Unmocked CometChat in unit tests → hangs, flakes, offline failures.
- Mocking the whole module without
requireActual→ your own wiring never runs. - Asserting kit DOM internals → breaks on every kit release.
- Tests against a production app → real users, real data.
- No zero-height assertion in E2E → the most common visual break goes unnoticed.
- No teardown in tests → leaked listeners bleed across specs.
Verify it works
Unit tests pass offline · no test opens a real socket · a missing imports entry fails a test · E2E asserts non-zero height and no console errors · manual checks are documented, not faked.
Files in this skill
1cometchat-angular-v5-testing skill questions
How do I install the cometchat-angular-v5-testing skill in Claude Code?
Run npx degit cometchat/cometchat-skills/skills/cometchat-angular-v5-testing ~/.claude/skills/cometchat-angular-v5-testing. Claude Code loads skills from ~/.claude/skills (all projects) or .claude/skills (one project) and uses a skill when its description matches the task.
Which clients can use the cometchat-angular-v5-testing skill?
Any client that reads the Agent Skills format: Claude Code, Codex, Gemini CLI and claude.ai (upload as a ZIP). Scripts in the skill run only where the client allows code execution.
How do I prevent my CometChat unit tests from hanging?
Unit tests hang because kit components open sockets and call APIs at construction. You must mock the CometChat UIKit to avoid real network calls and socket connections.
How can I ensure the chat UI is actually visible in E2E tests?
Assert that the message list's height is non-zero, as a zero-height pane is a common silent failure in the kit.
Should I automate realtime delivery testing?
No, realtime delivery between two clients is not worth automating cheaply; it is better to verify this manually and document it in your test plan.