@cometchat/skills 4.1.0 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (257) hide show
  1. package/bin/install.js +298 -41
  2. package/package.json +1 -1
  3. package/skills/cometchat/SKILL.md +146 -27
  4. package/skills/cometchat-a11y/SKILL.md +476 -0
  5. package/skills/cometchat-android-v5/SKILL.md +1 -1
  6. package/skills/cometchat-android-v5-calls/SKILL.md +413 -0
  7. package/skills/cometchat-android-v5-calls/references/README.md +53 -0
  8. package/skills/cometchat-android-v5-calls/references/add-calls-to-existing-chat.md +195 -0
  9. package/skills/cometchat-android-v5-calls/references/audio-controls.md +91 -0
  10. package/skills/cometchat-android-v5-calls/references/background-handling.md +168 -0
  11. package/skills/cometchat-android-v5-calls/references/call-layouts.md +123 -0
  12. package/skills/cometchat-android-v5-calls/references/call-logs.md +113 -0
  13. package/skills/cometchat-android-v5-calls/references/call-session.md +274 -0
  14. package/skills/cometchat-android-v5-calls/references/custom-ui.md +150 -0
  15. package/skills/cometchat-android-v5-calls/references/event-listeners.md +123 -0
  16. package/skills/cometchat-android-v5-calls/references/group-calls.md +205 -0
  17. package/skills/cometchat-android-v5-calls/references/idle-timeout.md +111 -0
  18. package/skills/cometchat-android-v5-calls/references/in-call-chat.md +134 -0
  19. package/skills/cometchat-android-v5-calls/references/join-session.md +120 -0
  20. package/skills/cometchat-android-v5-calls/references/migration-v4-to-v5.md +206 -0
  21. package/skills/cometchat-android-v5-calls/references/participant-management.md +110 -0
  22. package/skills/cometchat-android-v5-calls/references/picture-in-picture.md +106 -0
  23. package/skills/cometchat-android-v5-calls/references/raise-hand.md +242 -0
  24. package/skills/cometchat-android-v5-calls/references/recording.md +101 -0
  25. package/skills/cometchat-android-v5-calls/references/ringing-integration.md +152 -0
  26. package/skills/cometchat-android-v5-calls/references/screen-sharing.md +82 -0
  27. package/skills/cometchat-android-v5-calls/references/server-fcm-voip.md +215 -0
  28. package/skills/cometchat-android-v5-calls/references/session-settings.md +121 -0
  29. package/skills/cometchat-android-v5-calls/references/setup.md +137 -0
  30. package/skills/cometchat-android-v5-calls/references/share-invite.md +151 -0
  31. package/skills/cometchat-android-v5-calls/references/video-controls.md +87 -0
  32. package/skills/cometchat-android-v5-calls/references/voip-calling.md +526 -0
  33. package/skills/cometchat-android-v5-components/SKILL.md +1 -1
  34. package/skills/cometchat-android-v5-core/SKILL.md +1 -1
  35. package/skills/cometchat-android-v5-customization/SKILL.md +1 -1
  36. package/skills/cometchat-android-v5-extensions/SKILL.md +1 -1
  37. package/skills/cometchat-android-v5-features/SKILL.md +1 -1
  38. package/skills/cometchat-android-v5-placement/SKILL.md +1 -1
  39. package/skills/cometchat-android-v5-production/SKILL.md +1 -1
  40. package/skills/cometchat-android-v5-push/SKILL.md +1 -1
  41. package/skills/cometchat-android-v5-testing/SKILL.md +1 -1
  42. package/skills/cometchat-android-v5-theming/SKILL.md +1 -1
  43. package/skills/cometchat-android-v5-troubleshooting/SKILL.md +1 -1
  44. package/skills/cometchat-android-v6/SKILL.md +1 -1
  45. package/skills/cometchat-android-v6-builder-settings/SKILL.md +1 -1
  46. package/skills/cometchat-android-v6-calls/SKILL.md +375 -0
  47. package/skills/cometchat-android-v6-calls/references/add-calls-to-existing-chat.md +97 -0
  48. package/skills/cometchat-android-v6-calls/references/call-layouts.md +91 -0
  49. package/skills/cometchat-android-v6-calls/references/call-session.md +163 -0
  50. package/skills/cometchat-android-v6-calls/references/device-management.md +171 -0
  51. package/skills/cometchat-android-v6-calls/references/group-calls.md +191 -0
  52. package/skills/cometchat-android-v6-calls/references/idle-timeout.md +107 -0
  53. package/skills/cometchat-android-v6-calls/references/in-call-chat.md +136 -0
  54. package/skills/cometchat-android-v6-calls/references/raise-hand.md +186 -0
  55. package/skills/cometchat-android-v6-calls/references/ringing-integration.md +176 -0
  56. package/skills/cometchat-android-v6-calls/references/server-fcm-voip.md +127 -0
  57. package/skills/cometchat-android-v6-calls/references/share-invite.md +105 -0
  58. package/skills/cometchat-android-v6-compose-components/SKILL.md +2 -2
  59. package/skills/cometchat-android-v6-compose-customization/SKILL.md +1 -1
  60. package/skills/cometchat-android-v6-compose-placement/SKILL.md +1 -1
  61. package/skills/cometchat-android-v6-compose-theming/SKILL.md +1 -1
  62. package/skills/cometchat-android-v6-core/SKILL.md +1 -1
  63. package/skills/cometchat-android-v6-events/SKILL.md +1 -1
  64. package/skills/cometchat-android-v6-extensions/SKILL.md +1 -1
  65. package/skills/cometchat-android-v6-features/SKILL.md +1 -1
  66. package/skills/cometchat-android-v6-kotlin-components/SKILL.md +1 -1
  67. package/skills/cometchat-android-v6-kotlin-customization/SKILL.md +1 -1
  68. package/skills/cometchat-android-v6-kotlin-placement/SKILL.md +1 -1
  69. package/skills/cometchat-android-v6-kotlin-theming/SKILL.md +1 -1
  70. package/skills/cometchat-android-v6-migration/SKILL.md +398 -0
  71. package/skills/cometchat-android-v6-production/SKILL.md +1 -1
  72. package/skills/cometchat-android-v6-push/SKILL.md +1 -1
  73. package/skills/cometchat-android-v6-testing/SKILL.md +1 -1
  74. package/skills/cometchat-android-v6-troubleshooting/SKILL.md +1 -1
  75. package/skills/cometchat-angular-calls/SKILL.md +511 -0
  76. package/skills/cometchat-angular-calls/references/add-calls-to-existing-chat.md +95 -0
  77. package/skills/cometchat-angular-calls/references/call-layouts.md +106 -0
  78. package/skills/cometchat-angular-calls/references/call-session.md +167 -0
  79. package/skills/cometchat-angular-calls/references/custom-ui.md +231 -0
  80. package/skills/cometchat-angular-calls/references/device-management.md +135 -0
  81. package/skills/cometchat-angular-calls/references/group-calls.md +412 -0
  82. package/skills/cometchat-angular-calls/references/idle-timeout.md +145 -0
  83. package/skills/cometchat-angular-calls/references/in-call-chat.md +148 -0
  84. package/skills/cometchat-angular-calls/references/lazy-loading-pitfalls.md +205 -0
  85. package/skills/cometchat-angular-calls/references/migration-v4-to-v5.md +53 -0
  86. package/skills/cometchat-angular-calls/references/ngzone-and-async-callbacks.md +183 -0
  87. package/skills/cometchat-angular-calls/references/picture-in-picture.md +285 -0
  88. package/skills/cometchat-angular-calls/references/raise-hand.md +167 -0
  89. package/skills/cometchat-angular-calls/references/recording-screen-share.md +267 -0
  90. package/skills/cometchat-angular-calls/references/ringing-integration.md +131 -0
  91. package/skills/cometchat-angular-calls/references/server-web-push-vapid.md +100 -0
  92. package/skills/cometchat-angular-calls/references/share-invite.md +116 -0
  93. package/skills/cometchat-angular-components/SKILL.md +1 -1
  94. package/skills/cometchat-angular-core/SKILL.md +1 -1
  95. package/skills/cometchat-angular-customization/SKILL.md +1 -1
  96. package/skills/cometchat-angular-features/SKILL.md +1 -1
  97. package/skills/cometchat-angular-patterns/SKILL.md +1 -1
  98. package/skills/cometchat-angular-placement/SKILL.md +1 -1
  99. package/skills/cometchat-angular-production/SKILL.md +1 -1
  100. package/skills/cometchat-angular-push/SKILL.md +403 -0
  101. package/skills/cometchat-angular-testing/SKILL.md +333 -0
  102. package/skills/cometchat-angular-theming/SKILL.md +1 -1
  103. package/skills/cometchat-angular-troubleshooting/SKILL.md +1 -1
  104. package/skills/cometchat-astro-patterns/SKILL.md +1 -1
  105. package/skills/cometchat-calls/SKILL.md +358 -0
  106. package/skills/cometchat-calls/references/use-case-broadcast.md +194 -0
  107. package/skills/cometchat-calls/references/use-case-marketplace.md +158 -0
  108. package/skills/cometchat-calls/references/use-case-support.md +190 -0
  109. package/skills/cometchat-calls/references/use-case-team.md +169 -0
  110. package/skills/cometchat-calls/references/use-case-telehealth.md +154 -0
  111. package/skills/cometchat-components/SKILL.md +1 -1
  112. package/skills/cometchat-core/SKILL.md +1 -1
  113. package/skills/cometchat-customization/SKILL.md +2 -2
  114. package/skills/cometchat-features/SKILL.md +2 -2
  115. package/skills/cometchat-flutter-v5/SKILL.md +1 -1
  116. package/skills/cometchat-flutter-v5-calls/SKILL.md +325 -94
  117. package/skills/cometchat-flutter-v5-calls/references/add-calls-to-existing-chat.md +169 -0
  118. package/skills/cometchat-flutter-v5-calls/references/call-layouts.md +98 -0
  119. package/skills/cometchat-flutter-v5-calls/references/call-session.md +330 -0
  120. package/skills/cometchat-flutter-v5-calls/references/device-management.md +120 -0
  121. package/skills/cometchat-flutter-v5-calls/references/group-calls.md +187 -0
  122. package/skills/cometchat-flutter-v5-calls/references/idle-timeout.md +97 -0
  123. package/skills/cometchat-flutter-v5-calls/references/in-call-chat.md +132 -0
  124. package/skills/cometchat-flutter-v5-calls/references/migration-v4-to-v5.md +160 -0
  125. package/skills/cometchat-flutter-v5-calls/references/raise-hand.md +244 -0
  126. package/skills/cometchat-flutter-v5-calls/references/ringing-integration.md +193 -0
  127. package/skills/cometchat-flutter-v5-calls/references/server-push-bridge.md +101 -0
  128. package/skills/cometchat-flutter-v5-calls/references/share-invite.md +142 -0
  129. package/skills/cometchat-flutter-v5-conversations/SKILL.md +1 -1
  130. package/skills/cometchat-flutter-v5-core/SKILL.md +1 -1
  131. package/skills/cometchat-flutter-v5-customization/SKILL.md +1 -1
  132. package/skills/cometchat-flutter-v5-events/SKILL.md +1 -1
  133. package/skills/cometchat-flutter-v5-messages/SKILL.md +1 -1
  134. package/skills/cometchat-flutter-v5-production/SKILL.md +1 -1
  135. package/skills/cometchat-flutter-v5-push/SKILL.md +1 -1
  136. package/skills/cometchat-flutter-v5-testing/SKILL.md +390 -0
  137. package/skills/cometchat-flutter-v5-theming/SKILL.md +1 -1
  138. package/skills/cometchat-flutter-v5-troubleshooting/SKILL.md +1 -1
  139. package/skills/cometchat-flutter-v5-users-groups/SKILL.md +1 -1
  140. package/skills/cometchat-flutter-v6/SKILL.md +1 -1
  141. package/skills/cometchat-flutter-v6-calls/SKILL.md +308 -243
  142. package/skills/cometchat-flutter-v6-calls/references/add-calls-to-existing-chat.md +134 -0
  143. package/skills/cometchat-flutter-v6-calls/references/call-layouts.md +102 -0
  144. package/skills/cometchat-flutter-v6-calls/references/call-session.md +229 -0
  145. package/skills/cometchat-flutter-v6-calls/references/device-management.md +99 -0
  146. package/skills/cometchat-flutter-v6-calls/references/group-calls.md +190 -0
  147. package/skills/cometchat-flutter-v6-calls/references/idle-timeout.md +80 -0
  148. package/skills/cometchat-flutter-v6-calls/references/in-call-chat.md +122 -0
  149. package/skills/cometchat-flutter-v6-calls/references/raise-hand.md +268 -0
  150. package/skills/cometchat-flutter-v6-calls/references/ringing-integration.md +171 -0
  151. package/skills/cometchat-flutter-v6-calls/references/server-push-bridge.md +93 -0
  152. package/skills/cometchat-flutter-v6-calls/references/share-invite.md +102 -0
  153. package/skills/cometchat-flutter-v6-components/SKILL.md +1 -1
  154. package/skills/cometchat-flutter-v6-conversations/SKILL.md +1 -1
  155. package/skills/cometchat-flutter-v6-core/SKILL.md +1 -1
  156. package/skills/cometchat-flutter-v6-customization/SKILL.md +1 -1
  157. package/skills/cometchat-flutter-v6-events/SKILL.md +1 -1
  158. package/skills/cometchat-flutter-v6-features/SKILL.md +1 -1
  159. package/skills/cometchat-flutter-v6-messages/SKILL.md +1 -1
  160. package/skills/cometchat-flutter-v6-migration/SKILL.md +1 -1
  161. package/skills/cometchat-flutter-v6-placement/SKILL.md +1 -1
  162. package/skills/cometchat-flutter-v6-production/SKILL.md +1 -1
  163. package/skills/cometchat-flutter-v6-push/SKILL.md +452 -0
  164. package/skills/cometchat-flutter-v6-testing/SKILL.md +319 -0
  165. package/skills/cometchat-flutter-v6-theming/SKILL.md +1 -1
  166. package/skills/cometchat-flutter-v6-troubleshooting/SKILL.md +1 -1
  167. package/skills/cometchat-flutter-v6-users-groups/SKILL.md +1 -1
  168. package/skills/cometchat-i18n/SKILL.md +358 -0
  169. package/skills/cometchat-ios/SKILL.md +5 -5
  170. package/skills/cometchat-ios-calls/SKILL.md +409 -0
  171. package/skills/cometchat-ios-calls/references/add-calls-to-existing-chat.md +172 -0
  172. package/skills/cometchat-ios-calls/references/avaudiosession-routing.md +189 -0
  173. package/skills/cometchat-ios-calls/references/call-layouts.md +136 -0
  174. package/skills/cometchat-ios-calls/references/call-session.md +221 -0
  175. package/skills/cometchat-ios-calls/references/callkit-and-pushkit.md +353 -0
  176. package/skills/cometchat-ios-calls/references/custom-ui.md +322 -0
  177. package/skills/cometchat-ios-calls/references/device-management.md +171 -0
  178. package/skills/cometchat-ios-calls/references/group-calls.md +396 -0
  179. package/skills/cometchat-ios-calls/references/idle-timeout.md +185 -0
  180. package/skills/cometchat-ios-calls/references/in-call-chat.md +183 -0
  181. package/skills/cometchat-ios-calls/references/migration-v4-to-v5.md +138 -0
  182. package/skills/cometchat-ios-calls/references/picture-in-picture.md +246 -0
  183. package/skills/cometchat-ios-calls/references/raise-hand.md +239 -0
  184. package/skills/cometchat-ios-calls/references/recording-screen-share.md +339 -0
  185. package/skills/cometchat-ios-calls/references/ringing-integration.md +142 -0
  186. package/skills/cometchat-ios-calls/references/server-apns-pushkit.md +267 -0
  187. package/skills/cometchat-ios-calls/references/share-invite.md +152 -0
  188. package/skills/cometchat-ios-calls/references/swiftui-uikit-hosting.md +246 -0
  189. package/skills/cometchat-ios-calls/references/voip-cert-setup.md +166 -0
  190. package/skills/cometchat-ios-components/SKILL.md +1 -1
  191. package/skills/cometchat-ios-core/SKILL.md +1 -1
  192. package/skills/cometchat-ios-customization/SKILL.md +1 -1
  193. package/skills/cometchat-ios-features/SKILL.md +1 -1
  194. package/skills/cometchat-ios-placement/SKILL.md +1 -1
  195. package/skills/cometchat-ios-production/SKILL.md +1 -1
  196. package/skills/cometchat-ios-push/SKILL.md +1 -1
  197. package/skills/cometchat-ios-testing/SKILL.md +371 -0
  198. package/skills/cometchat-ios-theming/SKILL.md +1 -1
  199. package/skills/cometchat-ios-troubleshooting/SKILL.md +1 -1
  200. package/skills/cometchat-native-bare-patterns/SKILL.md +45 -3
  201. package/skills/cometchat-native-calls/SKILL.md +599 -0
  202. package/skills/cometchat-native-calls/references/add-calls-to-existing-chat.md +203 -0
  203. package/skills/cometchat-native-calls/references/call-layouts.md +124 -0
  204. package/skills/cometchat-native-calls/references/call-session.md +182 -0
  205. package/skills/cometchat-native-calls/references/custom-ui.md +250 -0
  206. package/skills/cometchat-native-calls/references/device-management.md +135 -0
  207. package/skills/cometchat-native-calls/references/expo-vs-bare.md +179 -0
  208. package/skills/cometchat-native-calls/references/group-calls.md +291 -0
  209. package/skills/cometchat-native-calls/references/idle-timeout.md +128 -0
  210. package/skills/cometchat-native-calls/references/in-call-chat.md +143 -0
  211. package/skills/cometchat-native-calls/references/migration-v4-to-v5.md +72 -0
  212. package/skills/cometchat-native-calls/references/picture-in-picture.md +276 -0
  213. package/skills/cometchat-native-calls/references/raise-hand.md +203 -0
  214. package/skills/cometchat-native-calls/references/recording-screen-share.md +290 -0
  215. package/skills/cometchat-native-calls/references/ringing-integration.md +118 -0
  216. package/skills/cometchat-native-calls/references/server-push-bridge.md +135 -0
  217. package/skills/cometchat-native-calls/references/server-push-payloads.md +193 -0
  218. package/skills/cometchat-native-calls/references/share-invite.md +144 -0
  219. package/skills/cometchat-native-calls/references/voip-push-end-to-end.md +317 -0
  220. package/skills/cometchat-native-components/SKILL.md +1 -1
  221. package/skills/cometchat-native-core/SKILL.md +1 -1
  222. package/skills/cometchat-native-customization/SKILL.md +1 -1
  223. package/skills/cometchat-native-expo-patterns/SKILL.md +18 -1
  224. package/skills/cometchat-native-features/SKILL.md +1 -1
  225. package/skills/cometchat-native-placement/SKILL.md +1 -1
  226. package/skills/cometchat-native-production/SKILL.md +1 -1
  227. package/skills/cometchat-native-push/SKILL.md +1 -1
  228. package/skills/cometchat-native-testing/SKILL.md +1 -1
  229. package/skills/cometchat-native-theming/SKILL.md +1 -1
  230. package/skills/cometchat-native-troubleshooting/SKILL.md +1 -1
  231. package/skills/cometchat-nextjs-patterns/SKILL.md +1 -1
  232. package/skills/cometchat-placement/SKILL.md +1 -1
  233. package/skills/cometchat-production/SKILL.md +1 -1
  234. package/skills/cometchat-react-calls/SKILL.md +539 -0
  235. package/skills/cometchat-react-calls/references/add-calls-to-existing-chat.md +145 -0
  236. package/skills/cometchat-react-calls/references/call-layouts.md +161 -0
  237. package/skills/cometchat-react-calls/references/call-session.md +235 -0
  238. package/skills/cometchat-react-calls/references/custom-ui.md +201 -0
  239. package/skills/cometchat-react-calls/references/device-management.md +206 -0
  240. package/skills/cometchat-react-calls/references/group-calls.md +262 -0
  241. package/skills/cometchat-react-calls/references/idle-timeout.md +175 -0
  242. package/skills/cometchat-react-calls/references/in-call-chat.md +212 -0
  243. package/skills/cometchat-react-calls/references/migration-v4-to-v5.md +172 -0
  244. package/skills/cometchat-react-calls/references/picture-in-picture.md +245 -0
  245. package/skills/cometchat-react-calls/references/raise-hand.md +238 -0
  246. package/skills/cometchat-react-calls/references/recording-screen-share.md +143 -0
  247. package/skills/cometchat-react-calls/references/ringing-integration.md +255 -0
  248. package/skills/cometchat-react-calls/references/server-web-push-vapid.md +241 -0
  249. package/skills/cometchat-react-calls/references/share-invite.md +176 -0
  250. package/skills/cometchat-react-calls/references/testing-calls-on-web.md +198 -0
  251. package/skills/cometchat-react-calls/references/voip-and-web-push.md +165 -0
  252. package/skills/cometchat-react-patterns/SKILL.md +1 -1
  253. package/skills/cometchat-react-push/SKILL.md +448 -0
  254. package/skills/cometchat-react-router-patterns/SKILL.md +1 -1
  255. package/skills/cometchat-react-testing/SKILL.md +404 -0
  256. package/skills/cometchat-theming/SKILL.md +3 -3
  257. package/skills/cometchat-troubleshooting/SKILL.md +2 -2
@@ -0,0 +1,404 @@
1
+ ---
2
+ name: cometchat-react-testing
3
+ description: Testing patterns for CometChat React UI Kit v6 in Vite / Next.js / React Router / Astro projects. Covers Vitest + React Testing Library setup, mocking @cometchat/chat-sdk-javascript and @cometchat/chat-uikit-react, Playwright e2e for full chat flows, the chat-specific assertions (init resolves before render, error UI visible, no Auth Key in test files, css-variables.css imported once), and CI configuration. Sister skill of cometchat-react-calls/references/testing-calls-on-web.md.
4
+ license: "MIT"
5
+ compatibility: "React >= 18, Vitest >= 1, Vite >= 5, @testing-library/react >= 14, Playwright >= 1.40; @cometchat/chat-uikit-react ^6.x"
6
+ allowed-tools: "shell, file-read, file-search, file-list, ask-user"
7
+ metadata:
8
+ author: "CometChat"
9
+ version: "4.0.0"
10
+ tags: "cometchat react testing vitest react-testing-library playwright e2e mocking jsdom websocket nextjs astro"
11
+ ---
12
+
13
+ ## Purpose
14
+
15
+ Test recipes for CometChat React UI Kit integrations. Three layers — unit, component, e2e — three different mocking strategies. This skill writes the configuration and the canonical assertions; real test bodies are app-specific.
16
+
17
+ **Read these other skills first:**
18
+ - `cometchat-core` — init, login, provider patterns the tests assert against
19
+ - `cometchat-{react,nextjs,react-router,astro}-patterns` — framework-specific render gates
20
+ - `cometchat-react-calls/references/testing-calls-on-web.md` — the calls-specific testing patterns (this skill is for chat)
21
+
22
+ **Ground truth:**
23
+ - Vitest docs — https://vitest.dev/
24
+ - React Testing Library — https://testing-library.com/docs/react-testing-library/intro
25
+ - Playwright — https://playwright.dev/
26
+
27
+ ---
28
+
29
+ ## 1. Vitest setup
30
+
31
+ ### Install
32
+
33
+ ```bash
34
+ npm install -D vitest @testing-library/react @testing-library/jest-dom @testing-library/user-event jsdom
35
+ ```
36
+
37
+ ### `vitest.config.ts`
38
+
39
+ ```ts
40
+ import { defineConfig } from "vitest/config";
41
+ import react from "@vitejs/plugin-react";
42
+
43
+ export default defineConfig({
44
+ plugins: [react()],
45
+ test: {
46
+ environment: "jsdom",
47
+ globals: true,
48
+ setupFiles: ["./vitest.setup.ts"],
49
+ css: false, // skip CSS imports — we test behavior, not styles
50
+ exclude: ["**/node_modules/**", "**/e2e/**"], // e2e runs separately under Playwright
51
+ },
52
+ });
53
+ ```
54
+
55
+ ### `vitest.setup.ts`
56
+
57
+ ```ts
58
+ import "@testing-library/jest-dom/vitest";
59
+ import { vi, beforeAll, afterEach } from "vitest";
60
+ import { cleanup } from "@testing-library/react";
61
+
62
+ afterEach(() => cleanup());
63
+
64
+ // jsdom doesn't have WebSocket — polyfill if any test code reaches that far
65
+ if (!("WebSocket" in globalThis)) {
66
+ (globalThis as Record<string, unknown>).WebSocket = class FakeWS {
67
+ addEventListener() {}
68
+ removeEventListener() {}
69
+ send() {}
70
+ close() {}
71
+ };
72
+ }
73
+
74
+ // Polyfill matchMedia for component tests using responsive UI Kit components
75
+ beforeAll(() => {
76
+ Object.defineProperty(window, "matchMedia", {
77
+ writable: true,
78
+ value: vi.fn().mockImplementation((query: string) => ({
79
+ matches: false,
80
+ media: query,
81
+ onchange: null,
82
+ addEventListener: vi.fn(),
83
+ removeEventListener: vi.fn(),
84
+ dispatchEvent: vi.fn(),
85
+ })),
86
+ });
87
+ });
88
+ ```
89
+
90
+ ---
91
+
92
+ ## 2. Mocking the SDK
93
+
94
+ ### Hoisted module mock
95
+
96
+ ```ts
97
+ // __tests__/mocks/cometchat.ts
98
+ import { vi } from "vitest";
99
+
100
+ export const mockUser = { uid: "cometchat-uid-1", name: "Alice" };
101
+
102
+ vi.mock("@cometchat/chat-sdk-javascript", () => ({
103
+ CometChat: {
104
+ init: vi.fn().mockResolvedValue(true),
105
+ login: vi.fn().mockResolvedValue(mockUser),
106
+ logout: vi.fn().mockResolvedValue(true),
107
+ getLoggedinUser: vi.fn().mockResolvedValue(mockUser),
108
+ addMessageListener: vi.fn(),
109
+ removeMessageListener: vi.fn(),
110
+ AppSettingsBuilder: class {
111
+ subscribePresenceForAllUsers() { return this; }
112
+ setRegion() { return this; }
113
+ build() { return {}; }
114
+ },
115
+ REGION: { US: "us", EU: "eu", IN: "in" },
116
+ },
117
+ }));
118
+
119
+ vi.mock("@cometchat/chat-uikit-react", () => ({
120
+ CometChatUIKit: {
121
+ init: vi.fn().mockResolvedValue(true),
122
+ login: vi.fn().mockResolvedValue(mockUser),
123
+ getLoggedinUser: vi.fn().mockResolvedValue(mockUser),
124
+ },
125
+ UIKitSettingsBuilder: class {
126
+ setAppId() { return this; }
127
+ setRegion() { return this; }
128
+ setAuthKey() { return this; }
129
+ subscribePresenceForAllUsers() { return this; }
130
+ build() { return {}; }
131
+ },
132
+ CometChatConversations: () => null,
133
+ CometChatMessageList: () => null,
134
+ CometChatMessageHeader: () => null,
135
+ CometChatMessageComposer: () => null,
136
+ CometChatUsers: () => null,
137
+ CometChatGroups: () => null,
138
+ CometChatIncomingCall: () => null,
139
+ CometChatThemeProvider: ({ children }: { children: React.ReactNode }) => children,
140
+ }));
141
+ ```
142
+
143
+ Import this from any test file:
144
+
145
+ ```ts
146
+ import "./mocks/cometchat";
147
+ ```
148
+
149
+ ### Per-test override
150
+
151
+ Override specific behaviors:
152
+
153
+ ```ts
154
+ import { CometChat } from "@cometchat/chat-sdk-javascript";
155
+
156
+ it("shows error when login fails", async () => {
157
+ vi.mocked(CometChat.login).mockRejectedValueOnce(new Error("401 Unauthorized"));
158
+ render(<CometChatProvider />);
159
+ await screen.findByText(/login failed/i);
160
+ });
161
+ ```
162
+
163
+ ---
164
+
165
+ ## 3. Component-test assertions
166
+
167
+ ### Init resolves before children render
168
+
169
+ ```tsx
170
+ import { render, screen } from "@testing-library/react";
171
+ import { CometChat } from "@cometchat/chat-sdk-javascript";
172
+ import { CometChatProvider } from "../src/cometchat/CometChatProvider";
173
+
174
+ it("does not render children until login resolves", async () => {
175
+ let resolveLogin: (user: unknown) => void = () => {};
176
+ vi.mocked(CometChat.login).mockImplementation(() =>
177
+ new Promise((resolve) => { resolveLogin = resolve; })
178
+ );
179
+
180
+ render(
181
+ <CometChatProvider>
182
+ <div data-testid="children">app contents</div>
183
+ </CometChatProvider>
184
+ );
185
+
186
+ // Children should NOT be present yet
187
+ expect(screen.queryByTestId("children")).not.toBeInTheDocument();
188
+
189
+ // Resolve login
190
+ resolveLogin({ uid: "cometchat-uid-1" });
191
+
192
+ await screen.findByTestId("children");
193
+ });
194
+ ```
195
+
196
+ ### Error UI visible on init failure
197
+
198
+ ```tsx
199
+ it("renders red error UI when init fails", async () => {
200
+ vi.mocked(CometChat.init).mockRejectedValueOnce(new Error("Network down"));
201
+
202
+ render(<CometChatProvider><div>app</div></CometChatProvider>);
203
+
204
+ const error = await screen.findByText(/network down/i);
205
+ expect(error).toBeInTheDocument();
206
+ // The skill's rule: errors must be visible in red — assert color
207
+ expect(error.closest("[style*='color']")).toHaveStyle("color: red");
208
+ });
209
+ ```
210
+
211
+ ### No Auth Key in test files
212
+
213
+ A meta-test that runs against the project's source:
214
+
215
+ ```ts
216
+ import { readFileSync } from "node:fs";
217
+ import { glob } from "glob";
218
+
219
+ it("no Auth Key hardcoded in source files", async () => {
220
+ const files = await glob("src/**/*.{ts,tsx,js,jsx}");
221
+ const hexKeyPattern = /[a-f0-9]{32,}/;
222
+
223
+ for (const file of files) {
224
+ const content = readFileSync(file, "utf8");
225
+ const matches = content.match(hexKeyPattern);
226
+ if (matches) {
227
+ // Allow comment / env var name mentions
228
+ const lines = content.split("\n");
229
+ const realHits = lines.filter(line =>
230
+ hexKeyPattern.test(line) && !line.trim().startsWith("//") && !line.includes("AUTH_KEY")
231
+ );
232
+ expect(realHits, `Possible Auth Key in ${file}: ${realHits.join("\n")}`).toHaveLength(0);
233
+ }
234
+ }
235
+ });
236
+ ```
237
+
238
+ ### `css-variables.css` imported exactly once
239
+
240
+ ```ts
241
+ it("css-variables.css imported exactly once", async () => {
242
+ const files = await glob("src/**/*.{ts,tsx,css}");
243
+ let count = 0;
244
+
245
+ for (const file of files) {
246
+ const content = readFileSync(file, "utf8");
247
+ if (content.includes("@cometchat/chat-uikit-react/css-variables.css")) {
248
+ count++;
249
+ }
250
+ }
251
+
252
+ expect(count).toBe(1);
253
+ });
254
+ ```
255
+
256
+ ---
257
+
258
+ ## 4. Playwright e2e
259
+
260
+ ### Install
261
+
262
+ ```bash
263
+ npm install -D @playwright/test
264
+ npx playwright install
265
+ ```
266
+
267
+ ### `playwright.config.ts`
268
+
269
+ ```ts
270
+ import { defineConfig, devices } from "@playwright/test";
271
+
272
+ export default defineConfig({
273
+ testDir: "./e2e",
274
+ use: {
275
+ baseURL: process.env.E2E_BASE_URL ?? "http://localhost:5173",
276
+ trace: "on-first-retry",
277
+ },
278
+ projects: [
279
+ { name: "chromium", use: devices["Desktop Chrome"] },
280
+ { name: "firefox", use: devices["Desktop Firefox"] },
281
+ ],
282
+ webServer: {
283
+ command: "npm run dev",
284
+ url: "http://localhost:5173",
285
+ reuseExistingServer: !process.env.CI,
286
+ },
287
+ });
288
+ ```
289
+
290
+ ### Two-page chat smoke test
291
+
292
+ ```ts
293
+ import { test, expect, type Page } from "@playwright/test";
294
+
295
+ async function loginAs(page: Page, uid: string) {
296
+ await page.goto("/");
297
+ await page.evaluate((uid) => localStorage.setItem("cc-test-uid", uid), uid);
298
+ await page.reload();
299
+ await expect(page.getByText("Welcome")).toBeVisible({ timeout: 10_000 });
300
+ }
301
+
302
+ test("two users send messages back and forth", async ({ browser }) => {
303
+ const aliceCtx = await browser.newContext();
304
+ const bobCtx = await browser.newContext();
305
+ const alice = await aliceCtx.newPage();
306
+ const bob = await bobCtx.newPage();
307
+
308
+ await loginAs(alice, "cometchat-uid-1");
309
+ await loginAs(bob, "cometchat-uid-2");
310
+
311
+ await alice.goto("/messages");
312
+ await alice.getByRole("button", { name: "cometchat-uid-2" }).click();
313
+ await alice.getByPlaceholder("Type a message").fill("Hello Bob");
314
+ await alice.getByRole("button", { name: "Send" }).click();
315
+
316
+ await bob.goto("/messages");
317
+ await bob.getByRole("button", { name: "cometchat-uid-1" }).click();
318
+ await expect(bob.getByText("Hello Bob")).toBeVisible({ timeout: 10_000 });
319
+ });
320
+ ```
321
+
322
+ The 10-second timeout is generous — message delivery via WebSocket is usually <500ms but CI hosts have variable latency.
323
+
324
+ ### Test users
325
+
326
+ CometChat dev mode pre-seeds five test users (`cometchat-uid-1` through `cometchat-uid-5`). Use them in e2e — never create new users in the test app via `Auth Key` flows that leak credentials.
327
+
328
+ ---
329
+
330
+ ## 5. CI configuration
331
+
332
+ ### GitHub Actions
333
+
334
+ ```yaml
335
+ name: tests
336
+ on: [push, pull_request]
337
+
338
+ jobs:
339
+ unit:
340
+ runs-on: ubuntu-latest
341
+ steps:
342
+ - uses: actions/checkout@v4
343
+ - uses: actions/setup-node@v4
344
+ with: { node-version: 20, cache: npm }
345
+ - run: npm ci
346
+ - run: npm run test # Vitest
347
+ env:
348
+ # Test app credentials — never your prod app
349
+ VITE_COMETCHAT_APP_ID: ${{ secrets.TEST_COMETCHAT_APP_ID }}
350
+ VITE_COMETCHAT_REGION: ${{ secrets.TEST_COMETCHAT_REGION }}
351
+ VITE_COMETCHAT_AUTH_KEY: ${{ secrets.TEST_COMETCHAT_AUTH_KEY }}
352
+
353
+ e2e:
354
+ runs-on: ubuntu-latest
355
+ needs: unit
356
+ steps:
357
+ - uses: actions/checkout@v4
358
+ - uses: actions/setup-node@v4
359
+ with: { node-version: 20, cache: npm }
360
+ - run: npm ci
361
+ - run: npx playwright install --with-deps chromium firefox
362
+ - run: npm run test:e2e
363
+ env:
364
+ VITE_COMETCHAT_APP_ID: ${{ secrets.TEST_COMETCHAT_APP_ID }}
365
+ VITE_COMETCHAT_REGION: ${{ secrets.TEST_COMETCHAT_REGION }}
366
+ VITE_COMETCHAT_AUTH_KEY: ${{ secrets.TEST_COMETCHAT_AUTH_KEY }}
367
+ - if: failure()
368
+ uses: actions/upload-artifact@v4
369
+ with:
370
+ name: playwright-report
371
+ path: playwright-report/
372
+ ```
373
+
374
+ **Critical:** use a **dedicated test app** (Dashboard → New App → "ci-tests") for CI. Never share with production. Rotate Auth Key if a CI log accidentally captures it.
375
+
376
+ ---
377
+
378
+ ## 6. Anti-patterns
379
+
380
+ 1. **Mocking `<CometChatConversations />`** with a real implementation. Tests pass because your mock works; production breaks because the real component doesn't. Mock as `() => null` and test the wiring around it.
381
+ 2. **Skipping `cleanup()` between tests.** State leaks between tests; flakes appear. Always run `afterEach(cleanup)`.
382
+ 3. **Asserting on internal CSS classes** like `.cc-message-list__bubble`. Brittle to UI Kit upgrades. Assert on text/role/test-id instead.
383
+ 4. **Hardcoding the Auth Key** in test files. Even if the test app is throwaway, code grep eventually exposes it. Use env vars + GitHub secrets.
384
+ 5. **Running e2e against the same app as dev.** Test data piles up in your dashboard. Separate apps.
385
+ 6. **Skipping the "init resolves before render" assertion.** Catches the most common production bug — a component that mounts before login finishes and throws. Worth its weight every time.
386
+
387
+ ## 7. Verification checklist
388
+
389
+ - [ ] `vitest.config.ts` with `environment: "jsdom"`
390
+ - [ ] `vitest.setup.ts` with cleanup + matchMedia polyfill
391
+ - [ ] Hoisted SDK mock module (don't repeat per-test)
392
+ - [ ] At least one test for "init resolves before children render"
393
+ - [ ] At least one test for "error UI visible on init failure"
394
+ - [ ] Meta-test: no Auth Key in source
395
+ - [ ] Meta-test: css-variables.css imported once
396
+ - [ ] Playwright config + at least one two-page chat smoke
397
+ - [ ] CI config separates unit + e2e, uses dedicated test app credentials
398
+ - [ ] No `.skip()` / `.only()` left in committed test files
399
+
400
+ ## 8. Pointers
401
+
402
+ - `cometchat-react-calls/references/testing-calls-on-web.md` — calls-specific testing patterns
403
+ - `cometchat-core` — init/login patterns the tests assert against
404
+ - `cometchat-troubleshooting` — when tests pass but the integration is still broken
@@ -3,7 +3,7 @@ name: cometchat-theming
3
3
  description: Customize CometChat UI to match the user's app design system. Covers the CSS variable cascade, preset themes, brand color overrides, design system extraction, dark mode, and framework-specific override locations.
4
4
  license: "MIT"
5
5
  compatibility: "Node.js >=18; @cometchat/chat-uikit-react ^6; integration must already be applied"
6
- allowed-tools: "executeBash, readFile, fileSearch, listDirectory, grepSearch"
6
+ allowed-tools: "shell, file-read, file-search, file-list, grep"
7
7
  metadata:
8
8
  author: "CometChat"
9
9
  version: "3.1.0"
@@ -126,7 +126,7 @@ tag or a CSS import within the component.
126
126
  The user wants to customize the look and feel of an already-integrated
127
127
  CometChat UI. Trigger phrases:
128
128
 
129
- - `/cometchat theming`, `/cometchat theme`
129
+ - `/cometchat theming`, `/cometchat theme` (or invoke the cometchat-theming skill via your agent's mechanism — keyword "cometchat theming" or "match brand colors" works in most agents)
130
130
  - "match my brand colors"
131
131
  - "make cometchat dark mode"
132
132
  - "change the chat colors"
@@ -193,7 +193,7 @@ precedence. If the project imports the CometChat CSS in a TSX file
193
193
  If the user already specified a preset name, brand color, or pointed
194
194
  to a design system file, skip to Step 2.
195
195
 
196
- Otherwise use `AskUserQuestion`:
196
+ Otherwise ask the user (preserve the structured shape — `question`/`header`/`multiSelect`/`options[].label`/`options[].description`):
197
197
  - **question:** "How do you want to theme CometChat?"
198
198
  - **header:** "Theme"
199
199
  - **multiSelect:** false
@@ -3,7 +3,7 @@ name: cometchat-troubleshooting
3
3
  description: Diagnose and fix problems with a CometChat integration. Runs verify checks, detects drift, queries the docs MCP for symptom-to-cause lookups, and proposes targeted fixes. Works on any state — broken, missing, or drifted integrations.
4
4
  license: "MIT"
5
5
  compatibility: "Node.js >=18; @cometchat/chat-uikit-react ^6"
6
- allowed-tools: "executeBash, readFile, fileSearch, listDirectory, grepSearch"
6
+ allowed-tools: "shell, file-read, file-search, file-list, grep"
7
7
  metadata:
8
8
  author: "CometChat"
9
9
  version: "3.0.0"
@@ -30,7 +30,7 @@ problems (wrong init sequence, missing CSS import, drift).
30
30
 
31
31
  The user has a problem with their CometChat integration. Trigger phrases:
32
32
 
33
- - `/cometchat troubleshoot`
33
+ - `/cometchat troubleshoot` (or invoke the cometchat-troubleshooting skill via your agent's mechanism — keyword "cometchat troubleshoot" or "fix chat" works in most agents)
34
34
  - `/cometchat fix`
35
35
  - `/cometchat fix <symptom>`
36
36
  - "chat isn't loading"