From 20d14fa4e0923eeebabb0143fc2531dac26eec80 Mon Sep 17 00:00:00 2001 From: Timo K Date: Mon, 11 May 2026 16:39:53 +0200 Subject: [PATCH 01/79] use vite storybook plugin for storybook tests. run via pnpm test:storybook --- .storybook/main.ts | 2 +- README.md | 2 +- package.json | 16 ++- pnpm-lock.yaml | 271 +++++++++++++++++++++++++++++++++++---------- vite.config.ts | 30 +++-- vitest.config.ts | 52 +++++++-- 6 files changed, 285 insertions(+), 88 deletions(-) diff --git a/.storybook/main.ts b/.storybook/main.ts index 977eca73..9a3f0b53 100644 --- a/.storybook/main.ts +++ b/.storybook/main.ts @@ -9,7 +9,7 @@ import type { StorybookConfig } from "@storybook/react-vite"; const config: StorybookConfig = { stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"], - addons: ["@storybook/addon-docs"], + addons: ["@storybook/addon-docs", "@storybook/addon-vitest"], framework: "@storybook/react-vite", }; export default config; diff --git a/README.md b/README.md index 0c82e4b0..167fe675 100644 --- a/README.md +++ b/README.md @@ -220,7 +220,7 @@ including federation: - Minimum TLS reverse proxy for - Synapse homeserver: `synapse.m.localhost` and `synapse.othersite.m.localhost` - MatrixRTC backend: `matrix-rtc.m.localhost` and `matrix-rtc.othersite.m.localhost` - - Local Element Call development `call.m.localhost` via `yarn dev --host ` + - Local Element Call development `call.m.localhost` via `pnpm dev --host ` - Element Web `app.m.localhost` and `app.othersite.m.localhost` - Note certificates will expire on Thr, 20 September 2035 14:27:35 CEST diff --git a/package.json b/package.json index fef415eb..336b3e66 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,8 @@ "i18n": "i18next", "i18n:check": "i18next --fail-on-warnings --fail-on-update", "test": "vitest", + "test:storybook": "vitest --project=storybook", + "test:unit": "vitest --project=unit", "test:coverage": "vitest --coverage", "backend": "docker-compose -f dev-backend-docker-compose.yml up", "backend-playwright": "docker-compose -f playwright-backend-docker-compose.yml -f playwright-backend-docker-compose.override.yml up", @@ -59,8 +61,9 @@ "@react-spring/web": "^10.0.0", "@sentry/react": "^8.0.0", "@sentry/vite-plugin": "^3.0.0", - "@storybook/addon-docs": "^10.3.3", - "@storybook/react-vite": "^10.3.3", + "@storybook/addon-docs": "^10.3.6", + "@storybook/addon-vitest": "^10.3.6", + "@storybook/react-vite": "^10.3.6", "@stylistic/eslint-plugin": "^3.0.0", "@testing-library/dom": "^10.1.0", "@testing-library/jest-dom": "^6.6.3", @@ -83,7 +86,9 @@ "@vector-im/compound-design-tokens": "^10.0.0", "@vector-im/compound-web": "^9.3.0", "@vitejs/plugin-react": "^4.0.1", + "@vitest/browser-playwright": "^4.1.5", "@vitest/coverage-v8": "^4.0.18", + "@vitest/ui": "4.1.5", "babel-plugin-transform-vite-meta-env": "^1.0.3", "classnames": "^2.3.1", "copy-to-clipboard": "^3.3.3", @@ -98,7 +103,7 @@ "eslint-plugin-react": "^7.29.4", "eslint-plugin-react-hooks": "^5.0.0", "eslint-plugin-rxjs": "^5.0.3", - "eslint-plugin-storybook": "^10.3.3", + "eslint-plugin-storybook": "^10.3.6", "eslint-plugin-unicorn": "^56.0.0", "fetch-mock": "11.1.5", "global-jsdom": "^26.0.0", @@ -116,6 +121,7 @@ "normalize.css": "^8.0.1", "observable-hooks": "^4.2.3", "pako": "^2.0.4", + "playwright": "^1.59.1", "postcss": "^8.4.41", "postcss-preset-env": "^10.0.0", "posthog-js": "1.160.3", @@ -128,7 +134,7 @@ "react-use-measure": "^2.1.1", "rxjs": "^7.8.1", "sass": "^1.42.1", - "storybook": "^10.3.3", + "storybook": "^10.3.6", "typescript": "^5.8.3", "typescript-eslint-language-service": "^5.0.5", "unique-names-generator": "^4.6.0", @@ -141,7 +147,7 @@ "vite-plugin-node-stdlib-browser": "^0.2.1", "vite-plugin-svgr": "^4.0.0", "vite-plugin-wasm": "^3.6.0", - "vitest": "^4.0.18", + "vitest": "^4.1.5", "vitest-axe": "^1.0.0-pre.3" }, "pnpm": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 544da4cb..ebb0171a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -82,11 +82,14 @@ importers: specifier: ^3.0.0 version: 3.6.1 '@storybook/addon-docs': - specifier: ^10.3.3 - version: 10.3.5(@types/react@19.2.14)(esbuild@0.28.0)(rollup@4.60.1)(storybook@10.3.5(@testing-library/dom@10.4.1)(prettier@3.8.3)(react-dom@19.2.5(react@19.2.5))(react@19.2.5))(vite@8.0.10(@types/node@24.12.2)(esbuild@0.28.0)(jiti@2.6.1)(sass@1.99.0)(terser@5.46.1)(yaml@2.8.3)) + specifier: ^10.3.6 + version: 10.3.6(@types/react@19.2.14)(esbuild@0.28.0)(rollup@4.60.1)(storybook@10.3.6(@testing-library/dom@10.4.1)(prettier@3.8.3)(react-dom@19.2.5(react@19.2.5))(react@19.2.5))(vite@8.0.10(@types/node@24.12.2)(esbuild@0.28.0)(jiti@2.6.1)(sass@1.99.0)(terser@5.46.1)(yaml@2.8.3)) + '@storybook/addon-vitest': + specifier: ^10.3.6 + version: 10.3.6(@vitest/browser-playwright@4.1.5)(@vitest/browser@4.1.5)(@vitest/runner@4.1.5)(react-dom@19.2.5(react@19.2.5))(react@19.2.5)(storybook@10.3.6(@testing-library/dom@10.4.1)(prettier@3.8.3)(react-dom@19.2.5(react@19.2.5))(react@19.2.5))(vitest@4.1.5) '@storybook/react-vite': - specifier: ^10.3.3 - version: 10.3.5(esbuild@0.28.0)(react-dom@19.2.5(react@19.2.5))(react@19.2.5)(rollup@4.60.1)(storybook@10.3.5(@testing-library/dom@10.4.1)(prettier@3.8.3)(react-dom@19.2.5(react@19.2.5))(react@19.2.5))(typescript@5.9.3)(vite@8.0.10(@types/node@24.12.2)(esbuild@0.28.0)(jiti@2.6.1)(sass@1.99.0)(terser@5.46.1)(yaml@2.8.3)) + specifier: ^10.3.6 + version: 10.3.6(esbuild@0.28.0)(react-dom@19.2.5(react@19.2.5))(react@19.2.5)(rollup@4.60.1)(storybook@10.3.6(@testing-library/dom@10.4.1)(prettier@3.8.3)(react-dom@19.2.5(react@19.2.5))(react@19.2.5))(typescript@5.9.3)(vite@8.0.10(@types/node@24.12.2)(esbuild@0.28.0)(jiti@2.6.1)(sass@1.99.0)(terser@5.46.1)(yaml@2.8.3)) '@stylistic/eslint-plugin': specifier: ^3.0.0 version: 3.1.0(eslint@8.57.1)(typescript@5.9.3) @@ -153,8 +156,14 @@ importers: '@vitejs/plugin-react': specifier: ^4.0.1 version: 4.7.0(vite@8.0.10(@types/node@24.12.2)(esbuild@0.28.0)(jiti@2.6.1)(sass@1.99.0)(terser@5.46.1)(yaml@2.8.3)) + '@vitest/browser-playwright': + specifier: ^4.1.5 + version: 4.1.5(playwright@1.59.1)(vite@8.0.10(@types/node@24.12.2)(esbuild@0.28.0)(jiti@2.6.1)(sass@1.99.0)(terser@5.46.1)(yaml@2.8.3))(vitest@4.1.5) '@vitest/coverage-v8': specifier: ^4.0.18 + version: 4.1.5(@vitest/browser@4.1.5)(vitest@4.1.5) + '@vitest/ui': + specifier: 4.1.5 version: 4.1.5(vitest@4.1.5) babel-plugin-transform-vite-meta-env: specifier: ^1.0.3 @@ -199,8 +208,8 @@ importers: specifier: ^5.0.3 version: 5.0.3(eslint@8.57.1)(typescript@5.9.3) eslint-plugin-storybook: - specifier: ^10.3.3 - version: 10.3.5(eslint@8.57.1)(storybook@10.3.5(@testing-library/dom@10.4.1)(prettier@3.8.3)(react-dom@19.2.5(react@19.2.5))(react@19.2.5))(typescript@5.9.3) + specifier: ^10.3.6 + version: 10.3.6(eslint@8.57.1)(storybook@10.3.6(@testing-library/dom@10.4.1)(prettier@3.8.3)(react-dom@19.2.5(react@19.2.5))(react@19.2.5))(typescript@5.9.3) eslint-plugin-unicorn: specifier: ^56.0.0 version: 56.0.1(eslint@8.57.1) @@ -252,6 +261,9 @@ importers: pako: specifier: ^2.0.4 version: 2.1.0 + playwright: + specifier: ^1.59.1 + version: 1.59.1 postcss: specifier: ^8.4.41 version: 8.5.11 @@ -289,8 +301,8 @@ importers: specifier: ^1.42.1 version: 1.99.0 storybook: - specifier: ^10.3.3 - version: 10.3.5(@testing-library/dom@10.4.1)(prettier@3.8.3)(react-dom@19.2.5(react@19.2.5))(react@19.2.5) + specifier: ^10.3.6 + version: 10.3.6(@testing-library/dom@10.4.1)(prettier@3.8.3)(react-dom@19.2.5(react@19.2.5))(react@19.2.5) typescript: specifier: ^5.8.3 version: 5.9.3 @@ -328,8 +340,8 @@ importers: specifier: ^3.6.0 version: 3.6.0(vite@8.0.10(@types/node@24.12.2)(esbuild@0.28.0)(jiti@2.6.1)(sass@1.99.0)(terser@5.46.1)(yaml@2.8.3)) vitest: - specifier: ^4.0.18 - version: 4.1.5(@types/node@24.12.2)(@vitest/coverage-v8@4.1.5)(jsdom@26.1.0)(vite@8.0.10(@types/node@24.12.2)(esbuild@0.28.0)(jiti@2.6.1)(sass@1.99.0)(terser@5.46.1)(yaml@2.8.3)) + specifier: ^4.1.5 + version: 4.1.5(@types/node@24.12.2)(@vitest/browser-playwright@4.1.5)(@vitest/coverage-v8@4.1.5)(@vitest/ui@4.1.5)(jsdom@26.1.0)(vite@8.0.10(@types/node@24.12.2)(esbuild@0.28.0)(jiti@2.6.1)(sass@1.99.0)(terser@5.46.1)(yaml@2.8.3)) vitest-axe: specifier: ^1.0.0-pre.3 version: 1.0.0-pre.5(vitest@4.1.5) @@ -941,6 +953,9 @@ packages: resolution: {integrity: sha512-6zABk/ECA/QYSCQ1NGiVwwbQerUCZ+TQbp64Q3AgmfNvurHH0j8TtXa1qbShXA6qqkpAj4V5W8pP6mLe1mcMqA==} engines: {node: '>=18'} + '@blazediff/core@1.9.1': + resolution: {integrity: sha512-ehg3jIkYKulZh+8om/O25vkvSsXXwC+skXmyA87FFx6A/45eqOkZsBltMw/TVteb0mloiGT8oGRTcjRAz66zaA==} + '@bufbuild/protobuf@1.10.1': resolution: {integrity: sha512-wJ8ReQbHxsAfXhrf9ixl0aYbZorRuOWpBNzm8pL8ftmSxQx/wnJD5Eg861NwJU/czy2VXFIebCeZnZrI9rktIQ==} @@ -1874,6 +1889,9 @@ packages: engines: {node: '>=18'} hasBin: true + '@polka/url@1.0.0-next.29': + resolution: {integrity: sha512-wwQAWhWSuHaag8c4q/KN/vCoeOJYshAIvMQwD4GpSb3OiZklFfvAgmj0VCBBImRpuF/aFgIRzllXlVX93Jevww==} + '@radix-ui/number@1.1.1': resolution: {integrity: sha512-MkKCwxlXTgz6CFoJx3pCwn07GKp36+aZyu/u2Ln2VrA5DcdyCZkASEDBTd8x5whTQQL5CiYf4prXKLcgQdv29g==} @@ -2679,23 +2697,41 @@ packages: '@standard-schema/spec@1.1.0': resolution: {integrity: sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==} - '@storybook/addon-docs@10.3.5': - resolution: {integrity: sha512-WuHbxia/o5TX4Rg/IFD0641K5qId/Nk0dxhmAUNoFs5L0+yfZUwh65XOBbzXqrkYmYmcVID4v7cgDRmzstQNkA==} + '@storybook/addon-docs@10.3.6': + resolution: {integrity: sha512-TvIdADVPtauxW0LzXIpIv7X6GxwetorhyNh+6+7MHC27XSBCWVxxRUwL63YeLlHTuXsIk0quG3b1xgwVRzWOJA==} peerDependencies: - storybook: ^10.3.5 + storybook: ^10.3.6 - '@storybook/builder-vite@10.3.5': - resolution: {integrity: sha512-i4KwCOKbhtlbQIbhm53+Kk7bMnxa0cwTn1pxmtA/x5wm1Qu7FrrBQV0V0DNjkUqzcSKo1CjspASJV/HlY0zYlw==} + '@storybook/addon-vitest@10.3.6': + resolution: {integrity: sha512-HXj7RrPJY+xzoNjL+xZu2oLw1fI5BA87Noh1NAXMPuECHR5R5fuRM/tTsJuIGXHFMO06FjSi/rekDIfCj1fL4w==} peerDependencies: - storybook: ^10.3.5 + '@vitest/browser': ^3.0.0 || ^4.0.0 + '@vitest/browser-playwright': ^4.0.0 + '@vitest/runner': ^3.0.0 || ^4.0.0 + storybook: ^10.3.6 + vitest: ^3.0.0 || ^4.0.0 + peerDependenciesMeta: + '@vitest/browser': + optional: true + '@vitest/browser-playwright': + optional: true + '@vitest/runner': + optional: true + vitest: + optional: true + + '@storybook/builder-vite@10.3.6': + resolution: {integrity: sha512-gpvR/sE4BcrFtmQZ+Ker7zD23oQzoVeqD9nF6cK6yzY+Q0svJXyX2EPmFG4y+EwygD5/vNzDpP84gGMut8VRwg==} + peerDependencies: + storybook: ^10.3.6 vite: ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 - '@storybook/csf-plugin@10.3.5': - resolution: {integrity: sha512-qlEzNKxOjq86pvrbuMwiGD/bylnsXk1dg7ve0j77YFjEEchqtl7qTlrXvFdNaLA89GhW6D/EV6eOCu/eobPDgw==} + '@storybook/csf-plugin@10.3.6': + resolution: {integrity: sha512-9kBf7VRdRqTSIYo+rPtVn5yjYYyK8kP2QhEYx3oiXvfwy4RexmbJnhk/tXa/lNiTqukA1TqaWQ2+5MqF4fu6YQ==} peerDependencies: esbuild: ^0.28.0 rollup: '*' - storybook: ^10.3.5 + storybook: ^10.3.6 vite: '*' webpack: '*' peerDependenciesMeta: @@ -2717,27 +2753,27 @@ packages: react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 - '@storybook/react-dom-shim@10.3.5': - resolution: {integrity: sha512-Gw8R7XZm0zSUH0XAuxlQJhmizsLzyD6x00KOlP6l7oW9eQHXGfxg3seNDG3WrSAcW07iP1/P422kuiriQlOv7g==} + '@storybook/react-dom-shim@10.3.6': + resolution: {integrity: sha512-/Tu1gPu+Fw+zOnAGmxRmOD30FX3a04LxcTAKflEtdpmtIMVR5bA3qpjy+f5YhoyDCecbXyKmL1OeIU2FIIZHqQ==} peerDependencies: react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 - storybook: ^10.3.5 + storybook: ^10.3.6 - '@storybook/react-vite@10.3.5': - resolution: {integrity: sha512-UB5sJHeh26bfd8sNMx2YPGYRYmErIdTRaLOT28m4bykQIa1l9IgVktsYg/geW7KsJU0lXd3oTbnUjLD+enpi3w==} + '@storybook/react-vite@10.3.6': + resolution: {integrity: sha512-tySQRc+8q7V2NkylQMNJjDV8zXy6tkxb8oDqw/DIhHhI9Xn77MTKVZ8Cihbo5NMm7HYTB6xDKr6wqdSMgdufYQ==} peerDependencies: react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 - storybook: ^10.3.5 + storybook: ^10.3.6 vite: ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 - '@storybook/react@10.3.5': - resolution: {integrity: sha512-tpLTLaVGoA6fLK3ReyGzZUricq7lyPaV2hLPpj5wqdXLV/LpRtAHClUpNoPDYSBjlnSjL81hMZijbkGC3mA+gw==} + '@storybook/react@10.3.6': + resolution: {integrity: sha512-oZQZ6xayWe5IdHmFUTL0TL8rX/gpNNh9gWhT2vzW5eeUvlkVG/RBKdsja6Ndrk2s1D9vcnwiI6r6CNXy3IEEmg==} peerDependencies: react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 - storybook: ^10.3.5 + storybook: ^10.3.6 typescript: '>= 4.9.x' peerDependenciesMeta: typescript: @@ -3173,6 +3209,17 @@ packages: peerDependencies: vite: ^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 + '@vitest/browser-playwright@4.1.5': + resolution: {integrity: sha512-CWy0lBQJq97nionyJJdnaU4961IXTl43a7UCu5nHy51IoKxAt6PVIJLo+76rVl7KOOgcWHNkG4kbJu/pW7knvA==} + peerDependencies: + playwright: '*' + vitest: 4.1.5 + + '@vitest/browser@4.1.5': + resolution: {integrity: sha512-iCDGI8c4yg+xmjUg2VsygdAUSIIB4x5Rht/P68OXy1hPELKXHDkzh87lkuTcdYmemRChDkEpB426MmDjzC0ziA==} + peerDependencies: + vitest: 4.1.5 + '@vitest/coverage-v8@4.1.5': resolution: {integrity: sha512-38C0/Ddb7HcRG0Z4/DUem8x57d2p9jYgp18mkaYswEOQBGsI1CG4f/hjm0ZCeaJfWhSZ4k7jgs29V1Zom7Ki9A==} peerDependencies: @@ -3217,6 +3264,11 @@ packages: '@vitest/spy@4.1.5': resolution: {integrity: sha512-2lNOsh6+R2Idnf1TCZqSwYlKN2E/iDlD8sgU59kYVl+OMDmvldO1VDk39smRfpUNwYpNRVn3w4YfuC7KfbBnkQ==} + '@vitest/ui@4.1.5': + resolution: {integrity: sha512-3Z9HNFiV0IF1fk0JPiK+7kE1GcaIPefQQIBYur6PM5yFIq6agys3uqP/0t966e1wXfmjbRCHDe7qW236Xjwnag==} + peerDependencies: + vitest: 4.1.5 + '@vitest/utils@3.2.4': resolution: {integrity: sha512-fB2V0JFrQSMsCo9HiSq3Ezpdv4iYaXRG1Sx8edX3MwxfyNn83mKiGzOcH+Fkxt4MHxr3y42fQi1oeAInqgX2QA==} @@ -4165,11 +4217,11 @@ packages: eslint: ^8.0.0 typescript: '>=4.0.0' - eslint-plugin-storybook@10.3.5: - resolution: {integrity: sha512-rEFkfU3ypF44GpB4tiJ9EFDItueoGvGi3+weLHZax2ON2MB7VIDsxdSUGvIU5tMURg+oWYlpzCyLm4TpDq2deA==} + eslint-plugin-storybook@10.3.6: + resolution: {integrity: sha512-8udrL+Rmp5LFaZvgRe4J226X1MYls25bWCyHuzR5X8s2qbFTryX+wKC+o/0Ato4A1AvwnDg8OOMPc6yWJ9JpcA==} peerDependencies: eslint: '>=8' - storybook: ^10.3.5 + storybook: ^10.3.6 eslint-plugin-unicorn@56.0.1: resolution: {integrity: sha512-FwVV0Uwf8XPfVnKSGpMg7NtlZh0G0gBarCaFcMUOoqPxXryxdYxTRRv4kH6B9TFCVIrjRXG+emcxIk2ayZilog==} @@ -4311,6 +4363,9 @@ packages: fflate@0.4.8: resolution: {integrity: sha512-FJqqoDBR00Mdj9ppamLa/Y7vxm+PRmNWA67N846RvsoYVMKB4q3y/de5PA7gUmRMYK/8CMz2GDZQmCRN1wBcWA==} + fflate@0.8.2: + resolution: {integrity: sha512-cPJU47OaAoCbg0pBvzsgpTPhmhqI5eJjh/JIu8tPj5q+T7iLvW/JAYUqmE7KOB4R1ZyEhzBaIQpQpardBF5z8A==} + file-entry-cache@6.0.1: resolution: {integrity: sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==} engines: {node: ^10.12.0 || >=12.0.0} @@ -5154,6 +5209,10 @@ packages: resolution: {integrity: sha512-Q9wJ/xhzeD9Wua1MwDN2v3ah3HENsUVSlzzL9Qw149cL9hHZkXtQGl3Eq36BbdLV+/qUwaP1WtJQ+H/+Oxso8g==} engines: {node: 20 || 22 || 24} + mrmime@2.0.1: + resolution: {integrity: sha512-Y3wQdFg2Va6etvQ5I82yUhGdsKrcYox6p7FfL1LbK2J4V01F9TGlepTIhnK24t7koZibmg82KGglhA1XK5IsLQ==} + engines: {node: '>=10'} + ms@2.0.0: resolution: {integrity: sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==} @@ -5429,6 +5488,10 @@ packages: resolution: {integrity: sha512-40QW5YalBNfQo5yRYmiw7Yz6TKKVr3h6970B2YE+3fQpsWcrbj1PzJgxeJ19DRQjhMbKPIuMY8rFaXc8moolVw==} engines: {node: '>=10.13.0'} + pngjs@7.0.0: + resolution: {integrity: sha512-LKWqWJRhstyYo9pGvgor/ivk2w94eSjE3RGVuzLGlr3NmD8bf7RcYGze1mNdEHRP6TRP6rMuDHk5t44hnTRyow==} + engines: {node: '>=14.19.0'} + possible-typed-array-names@1.1.0: resolution: {integrity: sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg==} engines: {node: '>= 0.4'} @@ -6059,6 +6122,10 @@ packages: resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==} engines: {node: '>=14'} + sirv@3.0.2: + resolution: {integrity: sha512-2wcC/oGxHis/BoHkkPwldgiPSYcpZK3JU28WoMVv55yHJgcZ8rlXvuG9iZggz+sU1d4bRgIGASwyWqjxu3FM0g==} + engines: {node: '>=18'} + sisteransi@1.0.5: resolution: {integrity: sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==} @@ -6116,14 +6183,17 @@ packages: resolution: {integrity: sha512-eLoXW/DHyl62zxY4SCaIgnRhuMr6ri4juEYARS8E6sCEqzKpOiE521Ucofdx+KnDZl5xmvGYaaKCk5FEOxJCoQ==} engines: {node: '>= 0.4'} - storybook@10.3.5: - resolution: {integrity: sha512-uBSZu/GZa9aEIW3QMGvdQPMZWhGxSe4dyRWU8B3/Vd47Gy/XLC7tsBxRr13txmmPOEDHZR94uLuq0H50fvuqBw==} + storybook@10.3.6: + resolution: {integrity: sha512-vbSz7g/1rGMC1uAULqMZjALkIuLu2QABqfhRYhyr/11kzyesi+vAmwyJLukZP1FfecxGOgMwOh6GS0YsGpHAvQ==} hasBin: true peerDependencies: prettier: ^2 || ^3 + vite-plus: ^0.1.15 peerDependenciesMeta: prettier: optional: true + vite-plus: + optional: true stream-browserify@3.0.0: resolution: {integrity: sha512-H73RAHsVBapbim0tU2JwwOiXUj+fikfiaoYAKHF3VJfA0pe2BCzkhAHBlLG6REzE+2WNZcxOXjK7lkso+9euLA==} @@ -6295,6 +6365,10 @@ packages: toggle-selection@1.0.6: resolution: {integrity: sha512-BiZS+C1OS8g/q2RRbJmy59xpyghNBqrr6k5L/uKBGRsTfxmu3ffiRnd8mlGPUVayg8pvfi5urfnu8TU7DVOkLQ==} + totalist@3.0.1: + resolution: {integrity: sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ==} + engines: {node: '>=6'} + tough-cookie@5.1.2: resolution: {integrity: sha512-FVDYdxtnj0G6Qm/DhNPSb8Ju59ULcup3tuJxkFb5K8Bv2pUXILbf0xZWU8PX8Ov19OXljbUyveOFwRMwkXzO+A==} engines: {node: '>=16'} @@ -7634,6 +7708,8 @@ snapshots: '@bcoe/v8-coverage@1.0.2': {} + '@blazediff/core@1.9.1': {} + '@bufbuild/protobuf@1.10.1': {} '@codecov/bundler-plugin-core@1.9.1': @@ -8473,6 +8549,8 @@ snapshots: dependencies: playwright: 1.59.1 + '@polka/url@1.0.0-next.29': {} + '@radix-ui/number@1.1.1': {} '@radix-ui/primitive@1.1.3': {} @@ -9139,15 +9217,15 @@ snapshots: '@standard-schema/spec@1.1.0': {} - '@storybook/addon-docs@10.3.5(@types/react@19.2.14)(esbuild@0.28.0)(rollup@4.60.1)(storybook@10.3.5(@testing-library/dom@10.4.1)(prettier@3.8.3)(react-dom@19.2.5(react@19.2.5))(react@19.2.5))(vite@8.0.10(@types/node@24.12.2)(esbuild@0.28.0)(jiti@2.6.1)(sass@1.99.0)(terser@5.46.1)(yaml@2.8.3))': + '@storybook/addon-docs@10.3.6(@types/react@19.2.14)(esbuild@0.28.0)(rollup@4.60.1)(storybook@10.3.6(@testing-library/dom@10.4.1)(prettier@3.8.3)(react-dom@19.2.5(react@19.2.5))(react@19.2.5))(vite@8.0.10(@types/node@24.12.2)(esbuild@0.28.0)(jiti@2.6.1)(sass@1.99.0)(terser@5.46.1)(yaml@2.8.3))': dependencies: '@mdx-js/react': 3.1.1(@types/react@19.2.14)(react@19.2.5) - '@storybook/csf-plugin': 10.3.5(esbuild@0.28.0)(rollup@4.60.1)(storybook@10.3.5(@testing-library/dom@10.4.1)(prettier@3.8.3)(react-dom@19.2.5(react@19.2.5))(react@19.2.5))(vite@8.0.10(@types/node@24.12.2)(esbuild@0.28.0)(jiti@2.6.1)(sass@1.99.0)(terser@5.46.1)(yaml@2.8.3)) + '@storybook/csf-plugin': 10.3.6(esbuild@0.28.0)(rollup@4.60.1)(storybook@10.3.6(@testing-library/dom@10.4.1)(prettier@3.8.3)(react-dom@19.2.5(react@19.2.5))(react@19.2.5))(vite@8.0.10(@types/node@24.12.2)(esbuild@0.28.0)(jiti@2.6.1)(sass@1.99.0)(terser@5.46.1)(yaml@2.8.3)) '@storybook/icons': 2.0.1(react-dom@19.2.5(react@19.2.5))(react@19.2.5) - '@storybook/react-dom-shim': 10.3.5(react-dom@19.2.5(react@19.2.5))(react@19.2.5)(storybook@10.3.5(@testing-library/dom@10.4.1)(prettier@3.8.3)(react-dom@19.2.5(react@19.2.5))(react@19.2.5)) + '@storybook/react-dom-shim': 10.3.6(react-dom@19.2.5(react@19.2.5))(react@19.2.5)(storybook@10.3.6(@testing-library/dom@10.4.1)(prettier@3.8.3)(react-dom@19.2.5(react@19.2.5))(react@19.2.5)) react: 19.2.5 react-dom: 19.2.5(react@19.2.5) - storybook: 10.3.5(@testing-library/dom@10.4.1)(prettier@3.8.3)(react-dom@19.2.5(react@19.2.5))(react@19.2.5) + storybook: 10.3.6(@testing-library/dom@10.4.1)(prettier@3.8.3)(react-dom@19.2.5(react@19.2.5))(react@19.2.5) ts-dedent: 2.2.0 transitivePeerDependencies: - '@types/react' @@ -9156,10 +9234,24 @@ snapshots: - vite - webpack - '@storybook/builder-vite@10.3.5(esbuild@0.28.0)(rollup@4.60.1)(storybook@10.3.5(@testing-library/dom@10.4.1)(prettier@3.8.3)(react-dom@19.2.5(react@19.2.5))(react@19.2.5))(vite@8.0.10(@types/node@24.12.2)(esbuild@0.28.0)(jiti@2.6.1)(sass@1.99.0)(terser@5.46.1)(yaml@2.8.3))': + '@storybook/addon-vitest@10.3.6(@vitest/browser-playwright@4.1.5)(@vitest/browser@4.1.5)(@vitest/runner@4.1.5)(react-dom@19.2.5(react@19.2.5))(react@19.2.5)(storybook@10.3.6(@testing-library/dom@10.4.1)(prettier@3.8.3)(react-dom@19.2.5(react@19.2.5))(react@19.2.5))(vitest@4.1.5)': dependencies: - '@storybook/csf-plugin': 10.3.5(esbuild@0.28.0)(rollup@4.60.1)(storybook@10.3.5(@testing-library/dom@10.4.1)(prettier@3.8.3)(react-dom@19.2.5(react@19.2.5))(react@19.2.5))(vite@8.0.10(@types/node@24.12.2)(esbuild@0.28.0)(jiti@2.6.1)(sass@1.99.0)(terser@5.46.1)(yaml@2.8.3)) - storybook: 10.3.5(@testing-library/dom@10.4.1)(prettier@3.8.3)(react-dom@19.2.5(react@19.2.5))(react@19.2.5) + '@storybook/global': 5.0.0 + '@storybook/icons': 2.0.1(react-dom@19.2.5(react@19.2.5))(react@19.2.5) + storybook: 10.3.6(@testing-library/dom@10.4.1)(prettier@3.8.3)(react-dom@19.2.5(react@19.2.5))(react@19.2.5) + optionalDependencies: + '@vitest/browser': 4.1.5(vite@8.0.10(@types/node@24.12.2)(esbuild@0.28.0)(jiti@2.6.1)(sass@1.99.0)(terser@5.46.1)(yaml@2.8.3))(vitest@4.1.5) + '@vitest/browser-playwright': 4.1.5(playwright@1.59.1)(vite@8.0.10(@types/node@24.12.2)(esbuild@0.28.0)(jiti@2.6.1)(sass@1.99.0)(terser@5.46.1)(yaml@2.8.3))(vitest@4.1.5) + '@vitest/runner': 4.1.5 + vitest: 4.1.5(@types/node@24.12.2)(@vitest/browser-playwright@4.1.5)(@vitest/coverage-v8@4.1.5)(@vitest/ui@4.1.5)(jsdom@26.1.0)(vite@8.0.10(@types/node@24.12.2)(esbuild@0.28.0)(jiti@2.6.1)(sass@1.99.0)(terser@5.46.1)(yaml@2.8.3)) + transitivePeerDependencies: + - react + - react-dom + + '@storybook/builder-vite@10.3.6(esbuild@0.28.0)(rollup@4.60.1)(storybook@10.3.6(@testing-library/dom@10.4.1)(prettier@3.8.3)(react-dom@19.2.5(react@19.2.5))(react@19.2.5))(vite@8.0.10(@types/node@24.12.2)(esbuild@0.28.0)(jiti@2.6.1)(sass@1.99.0)(terser@5.46.1)(yaml@2.8.3))': + dependencies: + '@storybook/csf-plugin': 10.3.6(esbuild@0.28.0)(rollup@4.60.1)(storybook@10.3.6(@testing-library/dom@10.4.1)(prettier@3.8.3)(react-dom@19.2.5(react@19.2.5))(react@19.2.5))(vite@8.0.10(@types/node@24.12.2)(esbuild@0.28.0)(jiti@2.6.1)(sass@1.99.0)(terser@5.46.1)(yaml@2.8.3)) + storybook: 10.3.6(@testing-library/dom@10.4.1)(prettier@3.8.3)(react-dom@19.2.5(react@19.2.5))(react@19.2.5) ts-dedent: 2.2.0 vite: 8.0.10(@types/node@24.12.2)(esbuild@0.28.0)(jiti@2.6.1)(sass@1.99.0)(terser@5.46.1)(yaml@2.8.3) transitivePeerDependencies: @@ -9167,9 +9259,9 @@ snapshots: - rollup - webpack - '@storybook/csf-plugin@10.3.5(esbuild@0.28.0)(rollup@4.60.1)(storybook@10.3.5(@testing-library/dom@10.4.1)(prettier@3.8.3)(react-dom@19.2.5(react@19.2.5))(react@19.2.5))(vite@8.0.10(@types/node@24.12.2)(esbuild@0.28.0)(jiti@2.6.1)(sass@1.99.0)(terser@5.46.1)(yaml@2.8.3))': + '@storybook/csf-plugin@10.3.6(esbuild@0.28.0)(rollup@4.60.1)(storybook@10.3.6(@testing-library/dom@10.4.1)(prettier@3.8.3)(react-dom@19.2.5(react@19.2.5))(react@19.2.5))(vite@8.0.10(@types/node@24.12.2)(esbuild@0.28.0)(jiti@2.6.1)(sass@1.99.0)(terser@5.46.1)(yaml@2.8.3))': dependencies: - storybook: 10.3.5(@testing-library/dom@10.4.1)(prettier@3.8.3)(react-dom@19.2.5(react@19.2.5))(react@19.2.5) + storybook: 10.3.6(@testing-library/dom@10.4.1)(prettier@3.8.3)(react-dom@19.2.5(react@19.2.5))(react@19.2.5) unplugin: 2.3.11 optionalDependencies: esbuild: 0.28.0 @@ -9183,25 +9275,25 @@ snapshots: react: 19.2.5 react-dom: 19.2.5(react@19.2.5) - '@storybook/react-dom-shim@10.3.5(react-dom@19.2.5(react@19.2.5))(react@19.2.5)(storybook@10.3.5(@testing-library/dom@10.4.1)(prettier@3.8.3)(react-dom@19.2.5(react@19.2.5))(react@19.2.5))': + '@storybook/react-dom-shim@10.3.6(react-dom@19.2.5(react@19.2.5))(react@19.2.5)(storybook@10.3.6(@testing-library/dom@10.4.1)(prettier@3.8.3)(react-dom@19.2.5(react@19.2.5))(react@19.2.5))': dependencies: react: 19.2.5 react-dom: 19.2.5(react@19.2.5) - storybook: 10.3.5(@testing-library/dom@10.4.1)(prettier@3.8.3)(react-dom@19.2.5(react@19.2.5))(react@19.2.5) + storybook: 10.3.6(@testing-library/dom@10.4.1)(prettier@3.8.3)(react-dom@19.2.5(react@19.2.5))(react@19.2.5) - '@storybook/react-vite@10.3.5(esbuild@0.28.0)(react-dom@19.2.5(react@19.2.5))(react@19.2.5)(rollup@4.60.1)(storybook@10.3.5(@testing-library/dom@10.4.1)(prettier@3.8.3)(react-dom@19.2.5(react@19.2.5))(react@19.2.5))(typescript@5.9.3)(vite@8.0.10(@types/node@24.12.2)(esbuild@0.28.0)(jiti@2.6.1)(sass@1.99.0)(terser@5.46.1)(yaml@2.8.3))': + '@storybook/react-vite@10.3.6(esbuild@0.28.0)(react-dom@19.2.5(react@19.2.5))(react@19.2.5)(rollup@4.60.1)(storybook@10.3.6(@testing-library/dom@10.4.1)(prettier@3.8.3)(react-dom@19.2.5(react@19.2.5))(react@19.2.5))(typescript@5.9.3)(vite@8.0.10(@types/node@24.12.2)(esbuild@0.28.0)(jiti@2.6.1)(sass@1.99.0)(terser@5.46.1)(yaml@2.8.3))': dependencies: '@joshwooding/vite-plugin-react-docgen-typescript': 0.7.0(typescript@5.9.3)(vite@8.0.10(@types/node@24.12.2)(esbuild@0.28.0)(jiti@2.6.1)(sass@1.99.0)(terser@5.46.1)(yaml@2.8.3)) '@rollup/pluginutils': 5.3.0(rollup@4.60.1) - '@storybook/builder-vite': 10.3.5(esbuild@0.28.0)(rollup@4.60.1)(storybook@10.3.5(@testing-library/dom@10.4.1)(prettier@3.8.3)(react-dom@19.2.5(react@19.2.5))(react@19.2.5))(vite@8.0.10(@types/node@24.12.2)(esbuild@0.28.0)(jiti@2.6.1)(sass@1.99.0)(terser@5.46.1)(yaml@2.8.3)) - '@storybook/react': 10.3.5(react-dom@19.2.5(react@19.2.5))(react@19.2.5)(storybook@10.3.5(@testing-library/dom@10.4.1)(prettier@3.8.3)(react-dom@19.2.5(react@19.2.5))(react@19.2.5))(typescript@5.9.3) + '@storybook/builder-vite': 10.3.6(esbuild@0.28.0)(rollup@4.60.1)(storybook@10.3.6(@testing-library/dom@10.4.1)(prettier@3.8.3)(react-dom@19.2.5(react@19.2.5))(react@19.2.5))(vite@8.0.10(@types/node@24.12.2)(esbuild@0.28.0)(jiti@2.6.1)(sass@1.99.0)(terser@5.46.1)(yaml@2.8.3)) + '@storybook/react': 10.3.6(react-dom@19.2.5(react@19.2.5))(react@19.2.5)(storybook@10.3.6(@testing-library/dom@10.4.1)(prettier@3.8.3)(react-dom@19.2.5(react@19.2.5))(react@19.2.5))(typescript@5.9.3) empathic: 2.0.0 magic-string: 0.30.21 react: 19.2.5 react-docgen: 8.0.3 react-dom: 19.2.5(react@19.2.5) resolve: 1.22.12 - storybook: 10.3.5(@testing-library/dom@10.4.1)(prettier@3.8.3)(react-dom@19.2.5(react@19.2.5))(react@19.2.5) + storybook: 10.3.6(@testing-library/dom@10.4.1)(prettier@3.8.3)(react-dom@19.2.5(react@19.2.5))(react@19.2.5) tsconfig-paths: 4.2.0 vite: 8.0.10(@types/node@24.12.2)(esbuild@0.28.0)(jiti@2.6.1)(sass@1.99.0)(terser@5.46.1)(yaml@2.8.3) transitivePeerDependencies: @@ -9211,15 +9303,15 @@ snapshots: - typescript - webpack - '@storybook/react@10.3.5(react-dom@19.2.5(react@19.2.5))(react@19.2.5)(storybook@10.3.5(@testing-library/dom@10.4.1)(prettier@3.8.3)(react-dom@19.2.5(react@19.2.5))(react@19.2.5))(typescript@5.9.3)': + '@storybook/react@10.3.6(react-dom@19.2.5(react@19.2.5))(react@19.2.5)(storybook@10.3.6(@testing-library/dom@10.4.1)(prettier@3.8.3)(react-dom@19.2.5(react@19.2.5))(react@19.2.5))(typescript@5.9.3)': dependencies: '@storybook/global': 5.0.0 - '@storybook/react-dom-shim': 10.3.5(react-dom@19.2.5(react@19.2.5))(react@19.2.5)(storybook@10.3.5(@testing-library/dom@10.4.1)(prettier@3.8.3)(react-dom@19.2.5(react@19.2.5))(react@19.2.5)) + '@storybook/react-dom-shim': 10.3.6(react-dom@19.2.5(react@19.2.5))(react@19.2.5)(storybook@10.3.6(@testing-library/dom@10.4.1)(prettier@3.8.3)(react-dom@19.2.5(react@19.2.5))(react@19.2.5)) react: 19.2.5 react-docgen: 8.0.3 react-docgen-typescript: 2.4.0(typescript@5.9.3) react-dom: 19.2.5(react@19.2.5) - storybook: 10.3.5(@testing-library/dom@10.4.1)(prettier@3.8.3)(react-dom@19.2.5(react@19.2.5))(react@19.2.5) + storybook: 10.3.6(@testing-library/dom@10.4.1)(prettier@3.8.3)(react-dom@19.2.5(react@19.2.5))(react@19.2.5) optionalDependencies: typescript: 5.9.3 transitivePeerDependencies: @@ -9745,7 +9837,37 @@ snapshots: transitivePeerDependencies: - supports-color - '@vitest/coverage-v8@4.1.5(vitest@4.1.5)': + '@vitest/browser-playwright@4.1.5(playwright@1.59.1)(vite@8.0.10(@types/node@24.12.2)(esbuild@0.28.0)(jiti@2.6.1)(sass@1.99.0)(terser@5.46.1)(yaml@2.8.3))(vitest@4.1.5)': + dependencies: + '@vitest/browser': 4.1.5(vite@8.0.10(@types/node@24.12.2)(esbuild@0.28.0)(jiti@2.6.1)(sass@1.99.0)(terser@5.46.1)(yaml@2.8.3))(vitest@4.1.5) + '@vitest/mocker': 4.1.5(vite@8.0.10(@types/node@24.12.2)(esbuild@0.28.0)(jiti@2.6.1)(sass@1.99.0)(terser@5.46.1)(yaml@2.8.3)) + playwright: 1.59.1 + tinyrainbow: 3.1.0 + vitest: 4.1.5(@types/node@24.12.2)(@vitest/browser-playwright@4.1.5)(@vitest/coverage-v8@4.1.5)(@vitest/ui@4.1.5)(jsdom@26.1.0)(vite@8.0.10(@types/node@24.12.2)(esbuild@0.28.0)(jiti@2.6.1)(sass@1.99.0)(terser@5.46.1)(yaml@2.8.3)) + transitivePeerDependencies: + - bufferutil + - msw + - utf-8-validate + - vite + + '@vitest/browser@4.1.5(vite@8.0.10(@types/node@24.12.2)(esbuild@0.28.0)(jiti@2.6.1)(sass@1.99.0)(terser@5.46.1)(yaml@2.8.3))(vitest@4.1.5)': + dependencies: + '@blazediff/core': 1.9.1 + '@vitest/mocker': 4.1.5(vite@8.0.10(@types/node@24.12.2)(esbuild@0.28.0)(jiti@2.6.1)(sass@1.99.0)(terser@5.46.1)(yaml@2.8.3)) + '@vitest/utils': 4.1.5 + magic-string: 0.30.21 + pngjs: 7.0.0 + sirv: 3.0.2 + tinyrainbow: 3.1.0 + vitest: 4.1.5(@types/node@24.12.2)(@vitest/browser-playwright@4.1.5)(@vitest/coverage-v8@4.1.5)(@vitest/ui@4.1.5)(jsdom@26.1.0)(vite@8.0.10(@types/node@24.12.2)(esbuild@0.28.0)(jiti@2.6.1)(sass@1.99.0)(terser@5.46.1)(yaml@2.8.3)) + ws: 8.20.0 + transitivePeerDependencies: + - bufferutil + - msw + - utf-8-validate + - vite + + '@vitest/coverage-v8@4.1.5(@vitest/browser@4.1.5)(vitest@4.1.5)': dependencies: '@bcoe/v8-coverage': 1.0.2 '@vitest/utils': 4.1.5 @@ -9757,7 +9879,9 @@ snapshots: obug: 2.1.1 std-env: 4.1.0 tinyrainbow: 3.1.0 - vitest: 4.1.5(@types/node@24.12.2)(@vitest/coverage-v8@4.1.5)(jsdom@26.1.0)(vite@8.0.10(@types/node@24.12.2)(esbuild@0.28.0)(jiti@2.6.1)(sass@1.99.0)(terser@5.46.1)(yaml@2.8.3)) + vitest: 4.1.5(@types/node@24.12.2)(@vitest/browser-playwright@4.1.5)(@vitest/coverage-v8@4.1.5)(@vitest/ui@4.1.5)(jsdom@26.1.0)(vite@8.0.10(@types/node@24.12.2)(esbuild@0.28.0)(jiti@2.6.1)(sass@1.99.0)(terser@5.46.1)(yaml@2.8.3)) + optionalDependencies: + '@vitest/browser': 4.1.5(vite@8.0.10(@types/node@24.12.2)(esbuild@0.28.0)(jiti@2.6.1)(sass@1.99.0)(terser@5.46.1)(yaml@2.8.3))(vitest@4.1.5) '@vitest/expect@3.2.4': dependencies: @@ -9810,6 +9934,17 @@ snapshots: '@vitest/spy@4.1.5': {} + '@vitest/ui@4.1.5(vitest@4.1.5)': + dependencies: + '@vitest/utils': 4.1.5 + fflate: 0.8.2 + flatted: 3.4.2 + pathe: 2.0.3 + sirv: 3.0.2 + tinyglobby: 0.2.16 + tinyrainbow: 3.1.0 + vitest: 4.1.5(@types/node@24.12.2)(@vitest/browser-playwright@4.1.5)(@vitest/coverage-v8@4.1.5)(@vitest/ui@4.1.5)(jsdom@26.1.0)(vite@8.0.10(@types/node@24.12.2)(esbuild@0.28.0)(jiti@2.6.1)(sass@1.99.0)(terser@5.46.1)(yaml@2.8.3)) + '@vitest/utils@3.2.4': dependencies: '@vitest/pretty-format': 3.2.4 @@ -10966,11 +11101,11 @@ snapshots: transitivePeerDependencies: - supports-color - eslint-plugin-storybook@10.3.5(eslint@8.57.1)(storybook@10.3.5(@testing-library/dom@10.4.1)(prettier@3.8.3)(react-dom@19.2.5(react@19.2.5))(react@19.2.5))(typescript@5.9.3): + eslint-plugin-storybook@10.3.6(eslint@8.57.1)(storybook@10.3.6(@testing-library/dom@10.4.1)(prettier@3.8.3)(react-dom@19.2.5(react@19.2.5))(react@19.2.5))(typescript@5.9.3): dependencies: - '@typescript-eslint/utils': 8.58.2(eslint@8.57.1)(typescript@5.9.3) + '@typescript-eslint/utils': 8.59.2(eslint@8.57.1)(typescript@5.9.3) eslint: 8.57.1 - storybook: 10.3.5(@testing-library/dom@10.4.1)(prettier@3.8.3)(react-dom@19.2.5(react@19.2.5))(react@19.2.5) + storybook: 10.3.6(@testing-library/dom@10.4.1)(prettier@3.8.3)(react-dom@19.2.5(react@19.2.5))(react@19.2.5) transitivePeerDependencies: - supports-color - typescript @@ -11151,6 +11286,8 @@ snapshots: fflate@0.4.8: {} + fflate@0.8.2: {} + file-entry-cache@6.0.1: dependencies: flat-cache: 3.2.0 @@ -12051,6 +12188,8 @@ snapshots: mktemp@2.0.2: {} + mrmime@2.0.1: {} + ms@2.0.0: {} ms@2.1.3: {} @@ -12381,6 +12520,8 @@ snapshots: pngjs@5.0.0: {} + pngjs@7.0.0: {} + possible-typed-array-names@1.1.0: {} postcss-attribute-case-insensitive@7.0.1(postcss@8.5.11): @@ -13141,6 +13282,12 @@ snapshots: signal-exit@4.1.0: {} + sirv@3.0.2: + dependencies: + '@polka/url': 1.0.0-next.29 + mrmime: 2.0.1 + totalist: 3.0.1 + sisteransi@1.0.5: {} slash@3.0.0: {} @@ -13195,7 +13342,7 @@ snapshots: es-errors: 1.3.0 internal-slot: 1.1.0 - storybook@10.3.5(@testing-library/dom@10.4.1)(prettier@3.8.3)(react-dom@19.2.5(react@19.2.5))(react@19.2.5): + storybook@10.3.6(@testing-library/dom@10.4.1)(prettier@3.8.3)(react-dom@19.2.5(react@19.2.5))(react@19.2.5): dependencies: '@storybook/global': 5.0.0 '@storybook/icons': 2.0.1(react-dom@19.2.5(react@19.2.5))(react@19.2.5) @@ -13429,6 +13576,8 @@ snapshots: toggle-selection@1.0.6: {} + totalist@3.0.1: {} + tough-cookie@5.1.2: dependencies: tldts: 6.1.86 @@ -13788,9 +13937,9 @@ snapshots: axe-core: 4.11.3 chalk: 5.6.2 lodash-es: 4.18.1 - vitest: 4.1.5(@types/node@24.12.2)(@vitest/coverage-v8@4.1.5)(jsdom@26.1.0)(vite@8.0.10(@types/node@24.12.2)(esbuild@0.28.0)(jiti@2.6.1)(sass@1.99.0)(terser@5.46.1)(yaml@2.8.3)) + vitest: 4.1.5(@types/node@24.12.2)(@vitest/browser-playwright@4.1.5)(@vitest/coverage-v8@4.1.5)(@vitest/ui@4.1.5)(jsdom@26.1.0)(vite@8.0.10(@types/node@24.12.2)(esbuild@0.28.0)(jiti@2.6.1)(sass@1.99.0)(terser@5.46.1)(yaml@2.8.3)) - vitest@4.1.5(@types/node@24.12.2)(@vitest/coverage-v8@4.1.5)(jsdom@26.1.0)(vite@8.0.10(@types/node@24.12.2)(esbuild@0.28.0)(jiti@2.6.1)(sass@1.99.0)(terser@5.46.1)(yaml@2.8.3)): + vitest@4.1.5(@types/node@24.12.2)(@vitest/browser-playwright@4.1.5)(@vitest/coverage-v8@4.1.5)(@vitest/ui@4.1.5)(jsdom@26.1.0)(vite@8.0.10(@types/node@24.12.2)(esbuild@0.28.0)(jiti@2.6.1)(sass@1.99.0)(terser@5.46.1)(yaml@2.8.3)): dependencies: '@vitest/expect': 4.1.5 '@vitest/mocker': 4.1.5(vite@8.0.10(@types/node@24.12.2)(esbuild@0.28.0)(jiti@2.6.1)(sass@1.99.0)(terser@5.46.1)(yaml@2.8.3)) @@ -13814,7 +13963,9 @@ snapshots: why-is-node-running: 2.3.0 optionalDependencies: '@types/node': 24.12.2 - '@vitest/coverage-v8': 4.1.5(vitest@4.1.5) + '@vitest/browser-playwright': 4.1.5(playwright@1.59.1)(vite@8.0.10(@types/node@24.12.2)(esbuild@0.28.0)(jiti@2.6.1)(sass@1.99.0)(terser@5.46.1)(yaml@2.8.3))(vitest@4.1.5) + '@vitest/coverage-v8': 4.1.5(@vitest/browser@4.1.5)(vitest@4.1.5) + '@vitest/ui': 4.1.5(vitest@4.1.5) jsdom: 26.1.0 transitivePeerDependencies: - msw diff --git a/vite.config.ts b/vite.config.ts index 801ea79a..59781d3a 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -24,18 +24,10 @@ import react from "@vitejs/plugin-react"; import { realpathSync } from "fs"; import * as fs from "node:fs"; -// https://vitejs.dev/config/ -// Modified type helper from defineConfig to allow for packageType (see defineConfig from vite) -export default ({ +export const vitePluginsConfig = ({ mode, - packageType, -}: ConfigEnv & { packageType?: "full" | "embedded" }): UserConfig => { +}: Pick): UserConfig => { const env = loadEnv(mode, process.cwd()); - // Environment variables with the VITE_ prefix are accessible at runtime. - // So, we set this to allow for build/package specific behavior. - // In future we might be able to do what is needed via code splitting at - // build time. - process.env.VITE_PACKAGE = packageType ?? "full"; const plugins: PluginOption[] = [ react(), wasm(), @@ -72,7 +64,7 @@ export default ({ ); } - if (!process.env.STORYBOOK) { + if (!process.env.STORYBOOK && !process.env.VITEST) { plugins.push( createHtmlPlugin({ entry: "src/main.tsx", @@ -86,6 +78,20 @@ export default ({ ); } + return { plugins }; +}; +// https://vitejs.dev/config/ +// Modified type helper from defineConfig to allow for packageType (see defineConfig from vite) +export default ({ + mode, + packageType, +}: ConfigEnv & { packageType?: "full" | "embedded" }): UserConfig => { + // Environment variables with the VITE_ prefix are accessible at runtime. + // So, we set this to allow for build/package specific behavior. + // In future we might be able to do what is needed via code splitting at + // build time. + process.env.VITE_PACKAGE = packageType ?? "full"; + // The crypto WASM module is imported dynamically. Since it's common // for developers to use a linked copy of matrix-js-sdk or Rust // crypto (which could reside anywhere on their file system), Vite @@ -102,6 +108,7 @@ export default ({ console.log("Allowed vite paths:", allow); return { + ...vitePluginsConfig({ mode }), server: { port: 3000, fs: { allow }, @@ -136,7 +143,6 @@ export default ({ }, }, }, - plugins, resolve: { alias: { // matrix-widget-api has its transpiled lib/index.js as its entry point, diff --git a/vitest.config.ts b/vitest.config.ts index 90082f58..40fd4288 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -1,20 +1,54 @@ import { defineConfig, mergeConfig } from "vitest/config"; +import { playwright } from "@vitest/browser-playwright"; +import { vitePluginsConfig } from "./vite.config"; +import { storybookTest } from "@storybook/addon-vitest/vitest-plugin"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; -import viteConfig from "./vite.config"; +const dirname = path.dirname(fileURLToPath(import.meta.url)); export default defineConfig((configEnv) => mergeConfig( - viteConfig(configEnv), + vitePluginsConfig(configEnv), defineConfig({ test: { - environment: "jsdom", - css: { - modules: { - classNameStrategy: "non-scoped", + projects: [ + { + extends: true, + test: { + css: { + modules: { + classNameStrategy: "non-scoped", + }, + }, + setupFiles: ["src/vitest.setup.ts"], + environment: "jsdom", + // an example of file based convention, + // you don't have to follow it + include: ["src/**/*.test.ts", "src/**/*.test.tsx"], + name: "unit", + }, }, - }, - setupFiles: ["src/vitest.setup.ts"], - include: ["src/**/*.test.ts", "src/**/*.test.tsx"], + { + plugins: [ + storybookTest({ + // The location of your Storybook config, main.js|ts + configDir: path.join(dirname, ".storybook"), + }), + ...vitePluginsConfig(configEnv).plugins!, + ], + test: { + name: "storybook", + browser: { + enabled: true, + // Make sure to install Playwright + provider: playwright(), + headless: true, + instances: [{ browser: "chromium" }], + }, + }, + }, + ], coverage: { reporter: ["html", "json"], include: ["src/**/*.{ts,tsx,js,jsx}"], From 53626785b35be902bc86eb3c3f93e3d1b3d7fc90 Mon Sep 17 00:00:00 2001 From: Timo K Date: Mon, 11 May 2026 18:22:58 +0200 Subject: [PATCH 02/79] install playwright for unit tests --- .github/workflows/test.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index d8af6f92..3fca37a1 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -22,6 +22,8 @@ jobs: - name: Install dependencies # ignore-pnpmfile should never be commited. Make CI crash if it happened (`pnpmfileChecksum` is present) run: "pnpm install --frozen-lockfile --ignore-pnpmfile" + - name: Install Playwright Browsers + run: pnpm exec playwright install - name: Vitest run: "pnpm run test:coverage" - name: Upload to codecov From bc2be4dfab8e017013a7b3b51d4ba0d26348d3c6 Mon Sep 17 00:00:00 2001 From: Timo K Date: Mon, 11 May 2026 18:44:16 +0200 Subject: [PATCH 03/79] test in CI --- .github/workflows/test.yaml | 2 +- .storybook/vitest.setup.ts | 17 +++++++++++++++++ vitest.config.ts | 1 + 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 .storybook/vitest.setup.ts diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 3fca37a1..b312d311 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -23,7 +23,7 @@ jobs: # ignore-pnpmfile should never be commited. Make CI crash if it happened (`pnpmfileChecksum` is present) run: "pnpm install --frozen-lockfile --ignore-pnpmfile" - name: Install Playwright Browsers - run: pnpm exec playwright install + run: pnpm exec playwright install --with-deps chromium - name: Vitest run: "pnpm run test:coverage" - name: Upload to codecov diff --git a/.storybook/vitest.setup.ts b/.storybook/vitest.setup.ts new file mode 100644 index 00000000..de24c78c --- /dev/null +++ b/.storybook/vitest.setup.ts @@ -0,0 +1,17 @@ +/* +Copyright 2026 Element Creations Ltd. + +SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial +Please see LICENSE in the repository root for full details. +*/ + +import { beforeAll } from "vitest"; +import { setProjectAnnotations } from "@storybook/react-vite"; +import * as projectAnnotations from "./preview"; + +// Apply the right Storybook configuration when testing stories. +// See: https://storybook.js.org/docs/api/portable-stories/portable-stories-vitest#setprojectannotations +const annotations = setProjectAnnotations([projectAnnotations]); + +// Run Storybook's beforeAll hook (sets up decorators, parameters, etc.) +beforeAll(annotations.beforeAll); diff --git a/vitest.config.ts b/vitest.config.ts index 40fd4288..01ed73ad 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -39,6 +39,7 @@ export default defineConfig((configEnv) => ], test: { name: "storybook", + setupFiles: [".storybook/vitest.setup.ts"], browser: { enabled: true, // Make sure to install Playwright From 88f14ffcde62e154756d72d973ef521a26f1a304 Mon Sep 17 00:00:00 2001 From: Timo K Date: Mon, 11 May 2026 18:56:52 +0200 Subject: [PATCH 04/79] try with playwirght container --- .github/workflows/test.yaml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index b312d311..2713a790 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -2,11 +2,15 @@ name: Test on: pull_request: {} push: - branches: [livekit, full-mesh] + branches: [livekit] jobs: vitest: name: Run unit tests runs-on: ubuntu-latest + container: + # Make sure to grab the latest version of the Playwright image + # https://playwright.dev/docs/docker#pull-the-image + image: mcr.microsoft.com/playwright:v1.59.1-noble steps: - name: Checkout code uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 @@ -22,8 +26,8 @@ jobs: - name: Install dependencies # ignore-pnpmfile should never be commited. Make CI crash if it happened (`pnpmfileChecksum` is present) run: "pnpm install --frozen-lockfile --ignore-pnpmfile" - - name: Install Playwright Browsers - run: pnpm exec playwright install --with-deps chromium + # - name: Install Playwright Browsers + # run: pnpm exec playwright install --with-deps chromium - name: Vitest run: "pnpm run test:coverage" - name: Upload to codecov From aa125d917d9340e60dae8632415acd09048f43da Mon Sep 17 00:00:00 2001 From: Timo K Date: Mon, 11 May 2026 19:01:47 +0200 Subject: [PATCH 05/79] no setup file for storybook --- vitest.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vitest.config.ts b/vitest.config.ts index 01ed73ad..c800cf15 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -39,7 +39,7 @@ export default defineConfig((configEnv) => ], test: { name: "storybook", - setupFiles: [".storybook/vitest.setup.ts"], + // setupFiles: [".storybook/vitest.setup.ts"], browser: { enabled: true, // Make sure to install Playwright From 85762001a49d3ab1014e53081a65efca79e457ec Mon Sep 17 00:00:00 2001 From: Timo K Date: Mon, 11 May 2026 19:08:40 +0200 Subject: [PATCH 06/79] try file parallelism --- vitest.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vitest.config.ts b/vitest.config.ts index c800cf15..20124ad8 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -12,6 +12,7 @@ export default defineConfig((configEnv) => vitePluginsConfig(configEnv), defineConfig({ test: { + fileParallelism: false, projects: [ { extends: true, @@ -39,7 +40,6 @@ export default defineConfig((configEnv) => ], test: { name: "storybook", - // setupFiles: [".storybook/vitest.setup.ts"], browser: { enabled: true, // Make sure to install Playwright From 7ca890ea531138778062c46068b4c926d6112c46 Mon Sep 17 00:00:00 2001 From: Timo K Date: Mon, 11 May 2026 19:08:45 +0200 Subject: [PATCH 07/79] Delete vitest.setup.ts --- .storybook/vitest.setup.ts | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 .storybook/vitest.setup.ts diff --git a/.storybook/vitest.setup.ts b/.storybook/vitest.setup.ts deleted file mode 100644 index de24c78c..00000000 --- a/.storybook/vitest.setup.ts +++ /dev/null @@ -1,17 +0,0 @@ -/* -Copyright 2026 Element Creations Ltd. - -SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial -Please see LICENSE in the repository root for full details. -*/ - -import { beforeAll } from "vitest"; -import { setProjectAnnotations } from "@storybook/react-vite"; -import * as projectAnnotations from "./preview"; - -// Apply the right Storybook configuration when testing stories. -// See: https://storybook.js.org/docs/api/portable-stories/portable-stories-vitest#setprojectannotations -const annotations = setProjectAnnotations([projectAnnotations]); - -// Run Storybook's beforeAll hook (sets up decorators, parameters, etc.) -beforeAll(annotations.beforeAll); From f37128414a0a0e0bd2f3b7cb0fda8f5cb09eea18 Mon Sep 17 00:00:00 2001 From: Timo K Date: Mon, 11 May 2026 19:16:07 +0200 Subject: [PATCH 08/79] try with firefox --- vitest.config.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vitest.config.ts b/vitest.config.ts index 20124ad8..9e8b05cf 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -17,6 +17,7 @@ export default defineConfig((configEnv) => { extends: true, test: { + name: "unit", css: { modules: { classNameStrategy: "non-scoped", @@ -27,7 +28,6 @@ export default defineConfig((configEnv) => // an example of file based convention, // you don't have to follow it include: ["src/**/*.test.ts", "src/**/*.test.tsx"], - name: "unit", }, }, { @@ -45,7 +45,7 @@ export default defineConfig((configEnv) => // Make sure to install Playwright provider: playwright(), headless: true, - instances: [{ browser: "chromium" }], + instances: [{ browser: "firefox" }], }, }, }, From 4f28bac749309aa08888c2cf47a51f34ffe2c06d Mon Sep 17 00:00:00 2001 From: Timo K Date: Mon, 11 May 2026 19:18:10 +0200 Subject: [PATCH 09/79] without playwright container --- .github/workflows/test.yaml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 2713a790..96483af2 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -7,10 +7,7 @@ jobs: vitest: name: Run unit tests runs-on: ubuntu-latest - container: - # Make sure to grab the latest version of the Playwright image - # https://playwright.dev/docs/docker#pull-the-image - image: mcr.microsoft.com/playwright:v1.59.1-noble + steps: - name: Checkout code uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 @@ -26,8 +23,8 @@ jobs: - name: Install dependencies # ignore-pnpmfile should never be commited. Make CI crash if it happened (`pnpmfileChecksum` is present) run: "pnpm install --frozen-lockfile --ignore-pnpmfile" - # - name: Install Playwright Browsers - # run: pnpm exec playwright install --with-deps chromium + - name: Install Playwright Browsers + run: pnpm exec playwright install --with-deps firefox - name: Vitest run: "pnpm run test:coverage" - name: Upload to codecov From 5bdbd80f371b5f8d77dd3233fe8c0d19eca432e2 Mon Sep 17 00:00:00 2001 From: Timo K Date: Mon, 11 May 2026 19:29:07 +0200 Subject: [PATCH 10/79] try storybook only --- .github/workflows/test.yaml | 6 +++--- vitest.config.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 96483af2..bb8ddcb5 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -23,10 +23,10 @@ jobs: - name: Install dependencies # ignore-pnpmfile should never be commited. Make CI crash if it happened (`pnpmfileChecksum` is present) run: "pnpm install --frozen-lockfile --ignore-pnpmfile" - - name: Install Playwright Browsers - run: pnpm exec playwright install --with-deps firefox + - name: Install Playwright Browser + run: pnpm exec playwright install --with-deps chromium - name: Vitest - run: "pnpm run test:coverage" + run: "pnpm run test:storybook" - name: Upload to codecov uses: codecov/codecov-action@75cd11691c0faa626561e295848008c8a7dddffe # v5 env: diff --git a/vitest.config.ts b/vitest.config.ts index 9e8b05cf..22b5e88a 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -45,7 +45,7 @@ export default defineConfig((configEnv) => // Make sure to install Playwright provider: playwright(), headless: true, - instances: [{ browser: "firefox" }], + instances: [{ browser: "chromium" }], }, }, }, From ded6e4c1a06f6c082a5cdbb6803d560a860affe0 Mon Sep 17 00:00:00 2001 From: Timo K Date: Mon, 11 May 2026 19:50:32 +0200 Subject: [PATCH 11/79] fix tests dep optimization issues --- .github/workflows/test.yaml | 2 +- .storybook/main.ts | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index bb8ddcb5..7bdeefc5 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -26,7 +26,7 @@ jobs: - name: Install Playwright Browser run: pnpm exec playwright install --with-deps chromium - name: Vitest - run: "pnpm run test:storybook" + run: "pnpm run test:coverage" - name: Upload to codecov uses: codecov/codecov-action@75cd11691c0faa626561e295848008c8a7dddffe # v5 env: diff --git a/.storybook/main.ts b/.storybook/main.ts index 9a3f0b53..e227ef76 100644 --- a/.storybook/main.ts +++ b/.storybook/main.ts @@ -11,5 +11,26 @@ const config: StorybookConfig = { stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"], addons: ["@storybook/addon-docs", "@storybook/addon-vitest"], framework: "@storybook/react-vite", + // THIS IS IMPORTANT + // vitest runs without Vite's normal dependency optimization, so we need to manually include the polyfills for the stories to work. + // otherwise we will get: new dependencies optimized: ... + // and + // ``` + // [vitest] Vite unexpectedly reloaded a test. This may cause tests to fail, lead to flaky behaviour or duplicated test runs. + // For a stable experience, please add mentioned dependencies to your config's `optimizeDeps.include` field manually. + // ``` + // which breaks the storybook ci on the first and only run. + viteFinal(config) { + config.optimizeDeps = { + ...config.optimizeDeps, + include: [ + ...(config.optimizeDeps?.include ?? []), + "vite-plugin-node-polyfills/shims/buffer", + "vite-plugin-node-polyfills/shims/global", + "vite-plugin-node-polyfills/shims/process", + ], + }; + return config; + }, }; export default config; From 34486e64864e6a5ea01ac54fe1c894758e3cb71b Mon Sep 17 00:00:00 2001 From: Timo K Date: Mon, 11 May 2026 19:56:21 +0200 Subject: [PATCH 12/79] use container to skip playwright install --- .github/workflows/test.yaml | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 7bdeefc5..6bb0f309 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -7,7 +7,10 @@ jobs: vitest: name: Run unit tests runs-on: ubuntu-latest - + container: + # Make sure to grab the latest version of the Playwright image + # https://playwright.dev/docs/docker#pull-the-image + image: mcr.microsoft.com/playwright:v1.59.1-noble steps: - name: Checkout code uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 @@ -23,8 +26,8 @@ jobs: - name: Install dependencies # ignore-pnpmfile should never be commited. Make CI crash if it happened (`pnpmfileChecksum` is present) run: "pnpm install --frozen-lockfile --ignore-pnpmfile" - - name: Install Playwright Browser - run: pnpm exec playwright install --with-deps chromium + # - name: Install Playwright Browser + # run: pnpm exec playwright install --with-deps chromium - name: Vitest run: "pnpm run test:coverage" - name: Upload to codecov @@ -38,6 +41,10 @@ jobs: name: Run end-to-end tests timeout-minutes: 60 runs-on: ubuntu-latest + container: + # Make sure to grab the latest version of the Playwright image + # https://playwright.dev/docs/docker#pull-the-image + image: mcr.microsoft.com/playwright:v1.59.1-noble steps: - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 with: @@ -51,8 +58,8 @@ jobs: - name: Install dependencies # ignore-pnpmfile should never be commited. Make CI crash if it happened (`pnpmfileChecksum` is present) run: pnpm install --frozen-lockfile --ignore-pnpmfile - - name: Install Playwright Browsers - run: pnpm exec playwright install --with-deps + # - name: Install Playwright Browsers + # run: pnpm exec playwright install --with-deps - name: Run backend components run: | docker compose -f playwright-backend-docker-compose.yml -f playwright-backend-docker-compose.override.yml pull From d37c064df39f7780bf3b96bc75394287432ce07e Mon Sep 17 00:00:00 2001 From: Timo K Date: Mon, 11 May 2026 20:01:18 +0200 Subject: [PATCH 13/79] custom container does not work for playwright tests --- .github/workflows/test.yaml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 6bb0f309..2cec64f5 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -26,8 +26,6 @@ jobs: - name: Install dependencies # ignore-pnpmfile should never be commited. Make CI crash if it happened (`pnpmfileChecksum` is present) run: "pnpm install --frozen-lockfile --ignore-pnpmfile" - # - name: Install Playwright Browser - # run: pnpm exec playwright install --with-deps chromium - name: Vitest run: "pnpm run test:coverage" - name: Upload to codecov @@ -41,10 +39,6 @@ jobs: name: Run end-to-end tests timeout-minutes: 60 runs-on: ubuntu-latest - container: - # Make sure to grab the latest version of the Playwright image - # https://playwright.dev/docs/docker#pull-the-image - image: mcr.microsoft.com/playwright:v1.59.1-noble steps: - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 with: @@ -58,8 +52,8 @@ jobs: - name: Install dependencies # ignore-pnpmfile should never be commited. Make CI crash if it happened (`pnpmfileChecksum` is present) run: pnpm install --frozen-lockfile --ignore-pnpmfile - # - name: Install Playwright Browsers - # run: pnpm exec playwright install --with-deps + - name: Install Playwright Browsers + run: pnpm exec playwright install --with-deps - name: Run backend components run: | docker compose -f playwright-backend-docker-compose.yml -f playwright-backend-docker-compose.override.yml pull From 9f6ae4ba55d99a087ae3459ac97839a89709ddd8 Mon Sep 17 00:00:00 2001 From: Timo K Date: Mon, 11 May 2026 17:27:38 +0200 Subject: [PATCH 14/79] small device selection refactor --- src/settings/DeviceSelection.tsx | 73 ++++++++++++++------------------ 1 file changed, 31 insertions(+), 42 deletions(-) diff --git a/src/settings/DeviceSelection.tsx b/src/settings/DeviceSelection.tsx index 197046c3..f189348b 100644 --- a/src/settings/DeviceSelection.tsx +++ b/src/settings/DeviceSelection.tsx @@ -5,14 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial Please see LICENSE in the repository root for full details. */ -import { - type ChangeEvent, - type FC, - type ReactElement, - type ReactNode, - useCallback, - useId, -} from "react"; +import { type ChangeEvent, type FC, useCallback, useId } from "react"; import { Heading, InlineField, @@ -20,8 +13,8 @@ import { RadioControl, Separator, } from "@vector-im/compound-web"; -import { Trans, useTranslation } from "react-i18next"; import { useObservableEagerState } from "observable-hooks"; +import { t } from "i18next"; import { type AudioOutputDeviceLabel, @@ -37,12 +30,39 @@ interface Props { numberedLabel: (number: number) => string; } +export function mediaDeviceLabelToString( + label: DeviceLabel | AudioOutputDeviceLabel, + numberedLabel: (number: number) => string, +): string { + let labelText = ""; + switch (label.type) { + case "name": + labelText = label.name; + break; + case "number": + labelText = numberedLabel(label.number); + break; + case "default": + labelText = + label.name === null + ? t("settings.devices.default") + : t("settings.devices.default") + " (" + label.name + ")"; + break; + case "speaker": + labelText = t("settings.devices.loudspeaker"); + break; + case "earpiece": + labelText = t("settings.devices.handset"); + break; + } + return labelText; +} + export const DeviceSelection: FC = ({ device, title, numberedLabel, }) => { - const { t } = useTranslation(); const groupId = useId(); const available = useObservableEagerState(device.available$); const selectedId = useObservableEagerState(device.selected$)?.id; @@ -70,38 +90,7 @@ export const DeviceSelection: FC = ({
{[...available].map(([id, label]) => { - let labelText: ReactNode; - switch (label.type) { - case "name": - labelText = label.name; - break; - case "number": - labelText = numberedLabel(label.number); - break; - case "default": - labelText = - label.name === null ? ( - t("settings.devices.default") - ) : ( - - Default{" "} - - ({{ name: label.name } as unknown as ReactElement}) - - - ); - break; - case "speaker": - labelText = t("settings.devices.loudspeaker"); - break; - case "earpiece": - labelText = t("settings.devices.handset"); - break; - } - + const labelText = mediaDeviceLabelToString(label, numberedLabel); return ( Date: Mon, 11 May 2026 17:29:41 +0200 Subject: [PATCH 15/79] Introduce ViewModel.ts --- src/state/ViewModel.ts | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/state/ViewModel.ts diff --git a/src/state/ViewModel.ts b/src/state/ViewModel.ts new file mode 100644 index 00000000..12016cd4 --- /dev/null +++ b/src/state/ViewModel.ts @@ -0,0 +1,39 @@ +/* +Copyright 2026 Element Software Ltd. + +SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial +Please see LICENSE in the repository root for full details. +*/ + +import { BehaviorSubject } from "rxjs"; + +import { useBehavior } from "../useBehavior"; +import { type Behavior } from "./Behavior"; + +export type ViewModel = { + [K in keyof Snapshot as `${string & K}$`]: Behavior; +}; + +export function useViewModel(vm: ViewModel): Snapshot { + const snapshot = {} as Snapshot; + for (const key in vm) { + const value$ = (vm as Record>)[key]; + const snapshotKey = key.slice(0, -1) as keyof Snapshot; + // we allow using hooks in a loop here because we know the shape of the vm is static and won't change between renders, so the order of hooks calls will always be the same. + // eslint-disable-next-line react-hooks/rules-of-hooks + snapshot[snapshotKey] = useBehavior(value$) as Snapshot[keyof Snapshot]; + } + return snapshot; +} + +export function createMockedViewModel( + snapshot: Snapshot, +): ViewModel { + const vm = {} as ViewModel; + for (const key in snapshot) { + (vm as Record>)[`${key}$`] = new BehaviorSubject( + snapshot[key], + ); + } + return vm; +} From 7615e146a53adf2191a8fad83c0bf2e4306b54a8 Mon Sep 17 00:00:00 2001 From: Timo K Date: Mon, 11 May 2026 17:36:54 +0200 Subject: [PATCH 16/79] Use ViewModel approach for the CallFooterView + interaction tests (this is just imaginary. There is no view model yet.) --- locales/en/app.json | 1 - src/components/CallFooter.module.css | 4 - src/components/CallFooter.stories.tsx | 143 +++++++++++++++++++++----- src/components/CallFooter.tsx | 130 +++++++++++------------ 4 files changed, 185 insertions(+), 93 deletions(-) diff --git a/locales/en/app.json b/locales/en/app.json index b51c6ed9..1d5eaa19 100644 --- a/locales/en/app.json +++ b/locales/en/app.json @@ -202,7 +202,6 @@ "camera_numbered": "Camera {{n}}", "change_device_button": "Change audio device", "default": "Default", - "default_named": "Default <2>({{name}})", "handset": "Handset", "loudspeaker": "Loudspeaker", "microphone": "Microphone", diff --git a/src/components/CallFooter.module.css b/src/components/CallFooter.module.css index adff99d5..228d7654 100644 --- a/src/components/CallFooter.module.css +++ b/src/components/CallFooter.module.css @@ -26,10 +26,6 @@ Please see LICENSE in the repository root for full details. ); } -.footer.hidden { - display: none; -} - .footer.overlay { /* Note that the footer is still position: sticky in this case so that certain tiles can move up out of the way of the footer when visible. */ diff --git a/src/components/CallFooter.stories.tsx b/src/components/CallFooter.stories.tsx index 7090a338..129c2b3a 100644 --- a/src/components/CallFooter.stories.tsx +++ b/src/components/CallFooter.stories.tsx @@ -5,18 +5,40 @@ SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial Please see LICENSE in the repository root for full details. */ -import { fn } from "storybook/test"; +import { expect, fn, userEvent, within } from "storybook/test"; import { BehaviorSubject } from "rxjs"; -import { type ReactNode } from "react"; +import { type JSX, type ReactNode } from "react"; import { Link } from "@vector-im/compound-web"; import type { Meta, StoryObj } from "@storybook/react-vite"; -import { CallFooter, type FooterProps } from "./CallFooter"; +import { CallFooter, type FooterSnapshot } from "./CallFooter"; import inCallViewStyles from "../room/InCallView.module.css"; +import { createMockedViewModel } from "../state/ViewModel"; import { ReactionsSenderContext } from "../reactions/useReactionsSender"; import { type ReactionOption } from "../reactions"; +import { type GridMode } from "../state/CallViewModel/CallViewModel"; +// consts for tests +const reactionIdentifier = "@user:example.com:DEVICE"; +const reactionData = { + handsRaised$: new BehaviorSubject({}), + reactions$: new BehaviorSubject({}), +}; -function CallFooterWrapper(props: FooterProps): ReactNode { +/** + * A wrapper component that is used for: + * - exposing the snapshot via props so the storybook documents the snapshot properties (basically unpack them form the vm) + * - Add additional react context + * @param chilren used for the "Back to Recents" button in the lobby stories, but can be used for anything really + * @param vmSnapshot the Snapshot of the vm, the wrapper will create a mocked vm from it and pass it to the CallFooter. + * @returns + */ +function CallFooterStoryWrapper({ + children, + ...vmSnapshot +}: FooterSnapshot & { + children?: false | JSX.Element | JSX.Element[] | undefined; +}): ReactNode { + const vm = createMockedViewModel(vmSnapshot); return (
Promise.resolve(), }} > - +
); } const meta = { - component: CallFooterWrapper, -} satisfies Meta; + component: CallFooterStoryWrapper, +} satisfies Meta; export default meta; type Story = StoryObj; -const reactionIdentifier = "@user:example.com:DEVICE"; -const reactionData = { - handsRaised$: new BehaviorSubject({}), - reactions$: new BehaviorSubject({}), -}; - const fnArgType = { control: { type: "select" as const }, options: ["MockedCallback", "undefined"], mapping: { MockedCallback: fn(), undefined: undefined }, }; + export const Default: Story = { args: { - hideLogo: true, + showLogo: false, layoutMode: "grid", audioEnabled: true, videoEnabled: true, @@ -62,12 +79,16 @@ export const Default: Story = { toggleVideo: fn(), toggleScreenSharing: fn(), hangup: fn(), + buttonSize: "lg", }, parameters: { layout: "fullscreen", }, argTypes: { - layoutMode: { control: "radio", options: ["grid", "spotlight"] }, + layoutMode: { + control: "radio", + options: ["grid", "spotlight"] satisfies GridMode[], + }, audioOutputSwitcher: { control: "select", options: ["NoOutputCallback", "speaker", "earpiece"], @@ -110,7 +131,7 @@ export const WithLogo: Story = { ...Default, args: { ...Default.args, - hideLogo: false, + showLogo: true, }, }; @@ -121,6 +142,51 @@ export const AudioVideoEnabled: Story = { audioEnabled: true, videoEnabled: true, }, + play: async ({ args, canvasElement }) => { + const canvas = within(canvasElement); + + const spotlightRadio = canvas.getByRole("radio", { name: "Spotlight" }); + await userEvent.click(spotlightRadio); + await expect(args.setLayoutMode).toHaveBeenCalledWith("spotlight"); + + const micButtonMute = canvas.getByRole("switch", { + name: "Mute microphone", + }); + await userEvent.click(micButtonMute); + await expect(args.toggleAudio).toHaveBeenCalled(); + + const videoMuteButton = canvas.getByRole("switch", { + name: "Stop video", + }); + await userEvent.click(videoMuteButton); + await expect(args.toggleVideo).toHaveBeenCalled(); + const screenShare = canvas.getByRole("switch", { + name: "Share screen", + }); + await userEvent.click(screenShare); + await expect(args.toggleScreenSharing).toHaveBeenCalled(); + const endCall = canvas.getByRole("button", { + name: "End call", + }); + await userEvent.click(endCall); + await expect(args.hangup).toHaveBeenCalled(); + }, +}; + +/** used to test switching to grid mode */ +export const SpotlightMode: Story = { + ...Default, + args: { + ...Default.args, + layoutMode: "spotlight", + }, + play: async ({ args, canvasElement }) => { + const canvas = within(canvasElement); + + const spotlightRadio = canvas.getByRole("radio", { name: "Grid" }); + await userEvent.click(spotlightRadio); + await expect(args.setLayoutMode).toHaveBeenCalledWith("grid"); + }, }; export const WithAudioOutputSpeaker: Story = { @@ -150,7 +216,38 @@ export const Pip: Story = { ...Default, args: { ...Default.args, - asPip: true, + buttonSize: "md", + showSettingsButton: false, + layoutMode: undefined, + }, + play: async ({ args, canvasElement }) => { + const canvas = within(canvasElement); + + await expect( + canvas.queryByRole("radio", { name: "Spotlight" }), + ).not.toBeInTheDocument(); + + const micButtonMute = canvas.getByRole("switch", { + name: "Mute microphone", + }); + await userEvent.click(micButtonMute); + await expect(args.toggleAudio).toHaveBeenCalled(); + + const videoMuteButton = canvas.getByRole("switch", { + name: "Stop video", + }); + await userEvent.click(videoMuteButton); + await expect(args.toggleVideo).toHaveBeenCalled(); + const screenShare = canvas.getByRole("switch", { + name: "Share screen", + }); + await userEvent.click(screenShare); + await expect(args.toggleScreenSharing).toHaveBeenCalled(); + const endCall = canvas.getByRole("button", { + name: "End call", + }); + await userEvent.click(endCall); + await expect(args.hangup).toHaveBeenCalled(); }, }; export const NoControlsWithLogo: Story = { @@ -158,7 +255,7 @@ export const NoControlsWithLogo: Story = { args: { ...Default.args, hideControls: true, - hideLogo: false, + showLogo: true, }, }; @@ -187,7 +284,7 @@ export const MobileLayout: Story = { ...Default, args: { ...Default.args, - hideLogo: true, + showLogo: false, audioOutputSwitcher: { targetOutput: "speaker", switch: fn() }, }, @@ -203,7 +300,7 @@ export const Lobby: Story = { ...Default, args: { ...Default.args, - hideLogo: true, + showLogo: false, openSettings: undefined, setLayoutMode: undefined, toggleScreenSharing: undefined, @@ -217,7 +314,7 @@ export const LobbyMobile: Story = { ...Default, args: { ...Default.args, - hideLogo: true, + showLogo: false, setLayoutMode: undefined, toggleScreenSharing: undefined, @@ -235,7 +332,7 @@ export const LobbyRecentButton: Story = { args: { ...Default.args, children: Back To Recents, - hideLogo: true, + showLogo: false, setLayoutMode: undefined, toggleScreenSharing: undefined, }, @@ -249,7 +346,7 @@ export const LobbyRecentButtonMobile: Story = { args: { ...Default.args, children: Back To Recents, - hideLogo: true, + showLogo: false, setLayoutMode: undefined, toggleScreenSharing: undefined, }, diff --git a/src/components/CallFooter.tsx b/src/components/CallFooter.tsx index afc5bdc9..bbb8f7e2 100644 --- a/src/components/CallFooter.tsx +++ b/src/components/CallFooter.tsx @@ -7,13 +7,12 @@ Please see LICENSE in the repository root for full details. import { type FC, type JSX, type Ref, useMemo } from "react"; import classNames from "classnames"; -import { BehaviorSubject } from "rxjs"; -import { Switch } from "@vector-im/compound-web"; -import { t } from "i18next"; import { SpotlightIcon, GridIcon, } from "@vector-im/compound-design-tokens/assets/web/icons"; +import { Switch } from "@vector-im/compound-web"; +import { t } from "i18next"; import LogoMark from "../icons/LogoMark.svg?react"; import LogoType from "../icons/LogoType.svg?react"; @@ -33,35 +32,36 @@ import { type GridMode } from "../state/CallViewModel/CallViewModel"; import { MediaMuteAndSwitchButton, type MenuOptions, + type ToggleOption, } from "./MediaMuteAndSwitchButton"; +import { type ViewModel, useViewModel } from "../state/ViewModel"; export interface AudioOutputSwitcher { targetOutput: string; switch: () => void; } -export interface FooterProps { - ref?: Ref; - /** Children will only be visible if the component is wider than 5*/ - children?: JSX.Element | JSX.Element[] | false; - +export interface FooterSnapshot { audioEnabled: boolean; /** Also controls if the audioMute button is disabled */ toggleAudio: (() => void) | undefined; + videoEnabled: boolean; /** Also controls if the videoMute button is disabled */ toggleVideo: (() => void) | undefined; /* This is needed for WindowMode = "flat" */ hideControls?: boolean; - /** hide the entire footer*/ - hidden?: boolean; - /** Pip controls buttonSize and hides: settings button, layout switcher and logo */ - asPip?: boolean; /** The footer should be used as an overlay. - * (Over the Call Grid) This saves spaces on small screens.*/ + * (Over the Call Grid) This saves spaces on small screens. */ asOverlay?: boolean; + buttonSize: "md" | "lg"; + showSettingsButton?: boolean; + showLayoutSwitcher?: boolean; + showLogoDebugContainer?: boolean; + showLogo?: boolean; + layoutMode?: GridMode; /** Also controls if the layout button is visible */ setLayoutMode?: (mode: GridMode) => void; @@ -69,7 +69,7 @@ export interface FooterProps { sharingScreen?: boolean; toggleScreenSharing?: () => void; - /** Also controls if the audio button is visible */ + /** Also controls if the audio output button is visible */ audioOutputSwitcher?: AudioOutputSwitcher; /** Also controls if the settings button is visible */ openSettings?: () => void; @@ -79,60 +79,64 @@ export interface FooterProps { reactionIdentifier?: string; reactionData?: ReactionData; - hideLogo?: boolean; // debug stuff debugTileLayout?: boolean; tileStoreGeneration?: number; + /** Providing no options `[]` or `undefined` will imply that we dont have a audio fast switcher */ audioOptions?: MenuOptions[]; + /** Providing no options `[]` or `undefined` will imply that we dont have a audio fast switcher */ videoOptions?: MenuOptions[]; selectedAudio?: string; selectedVideo?: string; - selectAudioDevice?: (deviceId: string) => void; - selectVideoDevice?: (deviceId: string) => void; + selectAudioButtonOption?: (deviceId: string) => void; + selectVideoButtonOption?: (option: string) => void; + videoToggles?: ToggleOption[]; } -export const CallFooter: FC = ({ - ref, - children, - asOverlay, - hidden, - hideControls, - hideLogo, - asPip, - layoutMode, - setLayoutMode, - openSettings, - audioEnabled, - videoEnabled, - toggleAudio, - toggleVideo, - sharingScreen, - toggleScreenSharing, - reactionIdentifier, - reactionData, - audioOutputSwitcher, - hangup, - debugTileLayout, - tileStoreGeneration, +export interface FooterProps { + ref?: Ref; + children?: JSX.Element | JSX.Element[] | false; + vm: ViewModel; +} +export const CallFooter: FC = ({ ref, children, vm }) => { + const { + asOverlay, + hideControls, + layoutMode, + setLayoutMode, + openSettings, + audioEnabled, + videoEnabled, + toggleAudio, + toggleVideo, + sharingScreen, + toggleScreenSharing, + reactionIdentifier, + reactionData, + audioOutputSwitcher, + hangup, + debugTileLayout, + tileStoreGeneration, + videoOptions, + selectedVideo, + audioOptions, + selectedAudio, + selectAudioButtonOption, + selectVideoButtonOption, + videoToggles, + buttonSize, + showSettingsButton, + showLogoDebugContainer, + showLogo, + } = useViewModel(vm); - audioOptions, - videoOptions, - selectedAudio, - selectedVideo, - selectAudioDevice, - selectVideoDevice, -}) => { const buttons: JSX.Element[] = []; - const buttonSize = asPip ? "md" : "lg"; - const showSettingsButton = - openSettings !== undefined && !asPip && !hideControls; - const showLayoutSwitcher = !asPip && !hideControls; - const showLogoDebugContainer = !asPip || (!hideLogo && !debugTileLayout); - const showLogo = !hideLogo && !asPip; + if (showSettingsButton) { - // add the settings button to the center group of buttons, so it will be visible on small screens. - // On larger screens, it will be hidden SettingsIconButton the one with `showForScreenWidth = "wide"` in the `settingsLogoContainer` will be visible. + // Add the settings button to the center group so it's visible on small + // screens. On larger screens the SettingsIconButton with + // showForScreenWidth="wide" in the settingsLogoContainer is used instead. buttons.push( = ({ data-testid="incall_mute" options={audioOptions} selectedOption={selectedAudio} - onSelect={selectAudioDevice} + onSelect={selectAudioButtonOption} />, ); } else { @@ -169,6 +173,7 @@ export const CallFooter: FC = ({ />, ); } + if ((videoOptions?.length ?? 0) > 0) { buttons.push( = ({ onMuteClick={toggleVideo} data-testid="incall_videomute" options={videoOptions} + toggles={videoToggles} selectedOption={selectedVideo} - onSelect={selectVideoDevice} + onSelect={selectVideoButtonOption} />, ); } else { @@ -213,12 +219,7 @@ export const CallFooter: FC = ({ buttons.push( = ({ ref={ref} className={classNames(styles.footer, { [styles.overlay]: asOverlay, - [styles.hidden]: hidden, })} >
@@ -288,7 +288,7 @@ export const CallFooter: FC = ({ {showLogoDebugContainer && logoDebugContainer}
{!hideControls &&
{buttons}
} - {setLayoutMode && layoutMode && showLayoutSwitcher && ( + {setLayoutMode && layoutMode && ( name="layoutMode" aria-label={t("layout_switch_label")} From 936dfb193f0988cfd4e2544a73b8383d625bd799 Mon Sep 17 00:00:00 2001 From: Timo K Date: Mon, 11 May 2026 17:37:06 +0200 Subject: [PATCH 17/79] add the CallFooterViewModel --- src/components/CallFooterViewModel.test.ts | 143 ++++++++++ src/components/CallFooterViewModel.tsx | 302 +++++++++++++++++++++ 2 files changed, 445 insertions(+) create mode 100644 src/components/CallFooterViewModel.test.ts create mode 100644 src/components/CallFooterViewModel.tsx diff --git a/src/components/CallFooterViewModel.test.ts b/src/components/CallFooterViewModel.test.ts new file mode 100644 index 00000000..601a8393 --- /dev/null +++ b/src/components/CallFooterViewModel.test.ts @@ -0,0 +1,143 @@ +/* +Copyright 2026 Element Creations Ltd. + +SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial +Please see LICENSE in the repository root for full details. +*/ + +import { describe, expect, it, vi } from "vitest"; + +import { testScope, mockMuteStates, mockMediaDevices } from "../utils/test"; +import { constant } from "../state/Behavior"; +import type { CallViewModel } from "../state/CallViewModel/CallViewModel"; +import type { Layout } from "../state/layout-types"; +import type { SpotlightTileViewModel } from "../state/TileViewModel"; +import type { DeviceLabel } from "../state/MediaDevices"; +import { createCallFooterViewModel } from "./CallFooterViewModel"; + +const platformMock = vi.hoisted(() => vi.fn(() => "desktop")); +vi.mock("../Platform", () => ({ + get platform(): string { + return platformMock(); + }, +})); + +// Prevent supportsBackgroundProcessors from throwing in jsdom – it is not +// exercised by these tests (only used in `videoToggles`, not `videoOptions`). +vi.mock("@livekit/track-processors", () => ({ + supportsBackgroundProcessors: (): boolean => false, +})); + +/** + * Returns the minimum set of CallViewModel fields required by + * createCallFooterViewModel, with all other properties stubbed to + * simple constant values. + */ +function buildMinimalCallViewModel(layout: Layout): CallViewModel { + return { + layout$: constant(layout), + windowMode$: constant("normal"), + showHeader$: constant(false), + hangup: (): void => {}, + gridMode$: constant("grid"), + setGridMode: (): void => {}, + sharingScreen$: constant(false), + toggleScreenSharing: null, + audioOutputSwitcher$: constant(null), + handsRaised$: constant({}), + reactions$: constant({}), + tileStoreGeneration$: constant(0), + } as unknown as CallViewModel; +} + +/** A regular grid layout (not PiP). */ +const gridLayout: Layout = { + type: "grid", + grid: [], + setVisibleTiles: (): void => {}, +}; + +/** A PiP layout – only the `type` matters for the tests. */ +const pipLayout: Layout = { + type: "pip", + spotlight: {} as SpotlightTileViewModel, +}; + +const twoMicsAndOneCamMediaDevices = mockMediaDevices({ + audioInput: { + available$: constant( + new Map([ + ["mic1", { type: "name", name: "Microphone 1" }], + ["mic2", { type: "name", name: "Microphone 2" }], + ]), + ), + selected$: constant(undefined), + select: vi.fn(), + }, + videoInput: { + available$: constant( + new Map([ + ["cam1", { type: "name", name: "Camera 1" }], + ]), + ), + selected$: constant(undefined), + select: vi.fn(), + }, +}); + +describe("createCallFooterViewModel", () => { + describe("audioOptions and videoOptions", () => { + it("are empty when the layout is PiP on desktop", () => { + platformMock.mockReturnValue("desktop"); + + const vm = createCallFooterViewModel( + testScope(), + buildMinimalCallViewModel(pipLayout), + mockMuteStates(), + twoMicsAndOneCamMediaDevices, + /* openSettings */ undefined, + /* reactionIdentifier */ undefined, + ); + + expect(vm.audioOptions$?.value).toEqual([]); + expect(vm.videoOptions$?.value).toEqual([]); + }); + + it("are empty when the platform is iOS regardless of layout", () => { + platformMock.mockReturnValue("ios"); + + const vm = createCallFooterViewModel( + testScope(), + buildMinimalCallViewModel(gridLayout), + mockMuteStates(), + twoMicsAndOneCamMediaDevices, + /* openSettings */ undefined, + /* reactionIdentifier */ undefined, + ); + + expect(vm.audioOptions$?.value).toEqual([]); + expect(vm.videoOptions$?.value).toEqual([]); + }); + + it("are populated when the platform is desktop and the layout is not PiP", () => { + platformMock.mockReturnValue("desktop"); + + const vm = createCallFooterViewModel( + testScope(), + buildMinimalCallViewModel(gridLayout), + mockMuteStates(), + twoMicsAndOneCamMediaDevices, + /* openSettings */ undefined, + /* reactionIdentifier */ undefined, + ); + + expect(vm.audioOptions$?.value).toEqual([ + { id: "mic1", label: "Microphone 1" }, + { id: "mic2", label: "Microphone 2" }, + ]); + expect(vm.videoOptions$?.value).toEqual([ + { id: "cam1", label: "Camera 1" }, + ]); + }); + }); +}); diff --git a/src/components/CallFooterViewModel.tsx b/src/components/CallFooterViewModel.tsx new file mode 100644 index 00000000..c1ca11fa --- /dev/null +++ b/src/components/CallFooterViewModel.tsx @@ -0,0 +1,302 @@ +/* +Copyright 2026 Element Creations Ltd. + +SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial +Please see LICENSE in the repository root for full details. +*/ + +import { combineLatest, map, switchMap } from "rxjs"; +import { supportsBackgroundProcessors } from "@livekit/track-processors"; + +import { type CallViewModel } from "../state/CallViewModel/CallViewModel"; +import { + type MenuOptions, + type ToggleOption, +} from "./MediaMuteAndSwitchButton"; +import { type MediaDevices } from "../state/MediaDevices"; +import { mediaDeviceLabelToString } from "../settings/DeviceSelection"; +import { + backgroundBlur as backgroundBlurSettings, + debugTileLayout as debugTileLayoutSetting, +} from "../settings/settings"; +import { type Behavior, constant } from "../state/Behavior"; +import type { ObservableScope } from "../state/ObservableScope"; +import { type MuteStates } from "../state/MuteStates"; +import { type ViewModel } from "../state/ViewModel"; +import { getUrlParams, HeaderStyle } from "../UrlParams"; +import { platform } from "../Platform"; +import { type FooterSnapshot } from "./CallFooter"; + +/** + * Shared helper: maps MuteStates into the audio/video enabled + toggle behaviors + * needed by FooterSnapshot. + */ +function buildMuteBehaviors( + scope: ObservableScope, + muteStates: MuteStates, +): Pick< + ViewModel, + "audioEnabled$" | "toggleAudio$" | "videoEnabled$" | "toggleVideo$" +> { + return { + audioEnabled$: muteStates.audio.enabled$, + toggleAudio$: scope.behavior( + muteStates.audio.toggle$.pipe(map((t) => t ?? undefined)), + ), + videoEnabled$: muteStates.video.enabled$, + toggleVideo$: scope.behavior( + muteStates.video.toggle$.pipe(map((t) => t ?? undefined)), + ), + }; +} + +/** + * Shared helper: maps MediaDevices into the audio/video device-list behaviors + * needed by FooterSnapshot (options, selection, callbacks, blur toggle). + */ +function buildDeviceBehaviors( + scope: ObservableScope, + mediaDevices: MediaDevices, + /** return empty arrays for audioOptions and videoOptions*/ + disableSwitcher$: Behavior, +): Pick< + ViewModel, + | "audioOptions$" + | "selectedAudio$" + | "selectAudioButtonOption$" + | "videoOptions$" + | "selectedVideo$" + | "selectVideoButtonOption$" + | "videoToggles$" +> { + return { + audioOptions$: scope.behavior( + disableSwitcher$.pipe( + switchMap((disable) => + disable + ? constant([] as MenuOptions[]) + : mediaDevices.audioInput.available$.pipe( + map((available) => + [...available.entries()].map(([id, label]) => ({ + id, + label: mediaDeviceLabelToString( + label, + (n) => "Audio Device " + n, + ), + })), + ), + ), + ), + ), + ), + selectedAudio$: scope.behavior( + mediaDevices.audioInput.selected$.pipe(map((s) => s?.id)), + ), + selectAudioButtonOption$: constant(mediaDevices.audioInput.select), + videoOptions$: scope.behavior( + disableSwitcher$.pipe( + switchMap((disable) => + disable + ? constant([] as MenuOptions[]) + : mediaDevices.videoInput.available$.pipe( + map((available) => + [...available.entries()].map(([id, label]) => ({ + id, + label: mediaDeviceLabelToString( + label, + (n) => "Camera " + n, + ), + })), + ), + ), + ), + ), + ), + selectedVideo$: scope.behavior( + mediaDevices.videoInput.selected$.pipe(map((s) => s?.id)), + ), + selectVideoButtonOption$: scope.behavior( + backgroundBlurSettings.value$.pipe( + map((current) => { + return (option: string) => { + if (option === "blur") { + backgroundBlurSettings.setValue(!current); + } else { + mediaDevices.videoInput.select(option); + } + }; + }), + ), + ), + videoToggles$: scope.behavior( + disableSwitcher$.pipe( + switchMap((disable) => + disable + ? constant([] as ToggleOption[]) + : backgroundBlurSettings.value$.pipe( + map((blurActive) => + supportsBackgroundProcessors() + ? [ + { + id: "blur", + enabled: blurActive, + label: "Blur Background", + }, + ] + : [], + ), + ), + ), + ), + ), + }; +} + +/** + * Creates the ViewModel for the CallFooter. + * + * @param scope - ObservableScope that bounds the lifetime of derived behaviors. + * @param vm - The root CallViewModel; provides layout, grid mode, reactions, etc. + * @param muteStates - Audio and video mute state + toggles. + * @param mediaDevices - Available and selected input devices. + * @param openSettings - Callback to open the settings modal, or undefined if the + * settings button should be hidden (e.g. when it is already shown in an app bar). + * @param reactionIdentifier - The local user's reaction identifier string, or + * undefined when reactions are not supported (hides the reaction button). + */ +export function createCallFooterViewModel( + scope: ObservableScope, + callModel: CallViewModel, + muteStates: MuteStates, + mediaDevices: MediaDevices, + openSettings: (() => void) | undefined, + reactionIdentifier: string | undefined, +): ViewModel { + const { showControls, header: headerStyle } = getUrlParams(); + + const hideLogo = headerStyle !== HeaderStyle.Standard; + const isPip$ = scope.behavior( + callModel.layout$.pipe(map((l) => l.type === "pip")), + ); + const disableDeviceSwitcher$ = scope.behavior( + isPip$.pipe(map((isPip) => isPip || platform !== "desktop")), + ); + return { + ...buildMuteBehaviors(scope, muteStates), + ...buildDeviceBehaviors(scope, mediaDevices, disableDeviceSwitcher$), + + hideControls$: constant(!showControls), + asOverlay$: scope.behavior( + callModel.windowMode$.pipe(map((mode) => mode === "flat")), + ), + buttonSize$: scope.behavior( + isPip$.pipe(map((pip) => (pip ? "md" : "lg") as "md" | "lg")), + ), + showSettingsButton$: scope.behavior( + combineLatest([isPip$, callModel.showHeader$]).pipe( + map( + ([isPip, showHeader]) => + openSettings !== undefined && + !isPip && + showControls && + !(headerStyle === HeaderStyle.AppBar && showHeader), + ), + ), + ), + showLayoutSwitcher$: scope.behavior( + isPip$.pipe(map((l) => !isPip$ && showControls)), + ), + showLogoDebugContainer$: scope.behavior( + combineLatest([isPip$, debugTileLayoutSetting.value$]).pipe( + map(([isPip, debugTile]) => !isPip || (!hideLogo && !debugTile)), + ), + ), + showLogo$: scope.behavior(isPip$.pipe(map((l) => !hideLogo && !isPip$))), + + layoutMode$: callModel.gridMode$, + setLayoutMode$: constant(callModel.setGridMode), + + sharingScreen$: callModel.sharingScreen$, + toggleScreenSharing$: constant(callModel.toggleScreenSharing ?? undefined), + + audioOutputSwitcher$: scope.behavior( + callModel.audioOutputSwitcher$.pipe( + map((switcher) => switcher ?? undefined), + ), + ), + + openSettings$: scope.behavior( + callModel.showHeader$.pipe( + map((showHeader) => + headerStyle === HeaderStyle.AppBar && showHeader + ? undefined + : openSettings, + ), + ), + ), + hangup$: constant(callModel.hangup), + + reactionIdentifier$: constant(reactionIdentifier), + reactionData$: constant( + reactionIdentifier !== undefined + ? { + handsRaised$: callModel.handsRaised$, + reactions$: callModel.reactions$, + } + : undefined, + ), + + debugTileLayout$: debugTileLayoutSetting.value$, + tileStoreGeneration$: callModel.tileStoreGeneration$, + }; +} + +/** + * Creates a simplified ViewModel for the CallFooter used in the lobby + * (pre-call) screen. Unlike createCallFooterViewModel, this does not require + * a CallViewModel — it only needs mute states, device lists, and callbacks. + * + * @param scope - ObservableScope that bounds the lifetime of derived behaviors. + * @param muteStates - Audio and video mute state + toggles. + * @param mediaDevices - Available and selected input devices. + * @param openSettings - Callback to open the settings modal, or undefined. + * @param hangup - Callback to leave/cancel, or undefined (hides the button). + * @param showLogo - Whether to show the Element Call logo. + */ +export function createLobbyFooterViewModel( + scope: ObservableScope, + muteStates: MuteStates, + mediaDevices: MediaDevices, + openSettings: (() => void) | undefined, + hangup: (() => void) | undefined, + showLogo: boolean, +): ViewModel { + return { + ...buildMuteBehaviors(scope, muteStates), + ...buildDeviceBehaviors(scope, mediaDevices, constant(false)), + hideControls$: constant(false), + asOverlay$: constant(false), + buttonSize$: constant("lg"), + showSettingsButton$: constant(openSettings !== undefined), + showLayoutSwitcher$: constant(false), + showLogoDebugContainer$: constant(showLogo), + showLogo$: constant(showLogo), + + layoutMode$: constant(undefined), + setLayoutMode$: constant(undefined), + + sharingScreen$: constant(undefined), + toggleScreenSharing$: constant(undefined), + + audioOutputSwitcher$: constant(undefined), + + openSettings$: constant(openSettings), + hangup$: constant(hangup), + + reactionIdentifier$: constant(undefined), + reactionData$: constant(undefined), + + debugTileLayout$: constant(false), + tileStoreGeneration$: constant(0), + }; +} From d29b92058109af55a7ab5f94b52163eea1fb8d5c Mon Sep 17 00:00:00 2001 From: Timo K Date: Mon, 11 May 2026 17:53:09 +0200 Subject: [PATCH 18/79] use footer view model in lobby --- src/room/LobbyView.tsx | 44 +++++++++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 13 deletions(-) diff --git a/src/room/LobbyView.tsx b/src/room/LobbyView.tsx index 277ed61c..cec9f6ac 100644 --- a/src/room/LobbyView.tsx +++ b/src/room/LobbyView.tsx @@ -38,6 +38,7 @@ import { useMediaQuery } from "../useMediaQuery"; import { E2eeType } from "../e2ee/e2eeType"; import { Link } from "../button/Link"; import { useMediaDevices } from "../MediaDevicesContext"; +import { ObservableScope } from "../state/ObservableScope"; import { useInitial } from "../useInitial"; import { useTrackProcessor, @@ -46,8 +47,10 @@ import { import { usePageTitle } from "../usePageTitle"; import { getValue } from "../utils/observable"; import { useBehavior } from "../useBehavior"; -import { CallFooter } from "../components/CallFooter"; +import { CallFooter, type FooterSnapshot } from "../components/CallFooter"; import { useCallViewKeyboardShortcuts } from "../useCallViewKeyboardShortcuts"; +import { createLobbyFooterViewModel } from "../components/CallFooterViewModel"; +import { type ViewModel } from "../state/ViewModel"; interface Props { client: MatrixClient; @@ -112,6 +115,7 @@ export const LobbyView: FC = ({ logger.error("Failed to navigate to /", error); }); }, [navigate]); + const hangup = confineToRoom ? undefined : onLeaveClick; const recentsButtonInFooter = useMediaQuery("(max-height: 500px)"); const recentsButton = !confineToRoom && ( @@ -184,6 +188,27 @@ export const LobbyView: FC = ({ useTrackProcessorSync(videoTrack); + const [footerVm, setFooterVm] = useState | null>( + null, + ); + useEffect(() => { + const footerScope = new ObservableScope(); + setFooterVm( + createLobbyFooterViewModel( + footerScope, + muteStates, + devices, + openSettings, + hangup, + // Logo and header are connected: only show the logo in SPA with header. + !hideHeader, + ), + ); + return (): void => { + footerScope.end(); + }; + }, [devices, hangup, hideHeader, muteStates, onLeaveClick, openSettings]); + // TODO: Unify this component with InCallView, so we can get slick joining // animations and don't have to feel bad about reusing its CSS return ( @@ -227,18 +252,11 @@ export const LobbyView: FC = ({ {!recentsButtonInFooter && recentsButton}
- - {recentsButtonInFooter && recentsButton} - + {footerVm !== null && ( + + {recentsButtonInFooter && recentsButton} + + )} {client && ( Date: Mon, 11 May 2026 17:53:24 +0200 Subject: [PATCH 19/79] use footer view model in InCallview --- src/room/InCallView.tsx | 77 +++++++++++++++-------------------------- 1 file changed, 28 insertions(+), 49 deletions(-) diff --git a/src/room/InCallView.tsx b/src/room/InCallView.tsx index 7fc97e27..932bb40d 100644 --- a/src/room/InCallView.tsx +++ b/src/room/InCallView.tsx @@ -43,7 +43,6 @@ import { InviteButton } from "../button/InviteButton"; import { type CallViewModel, createCallViewModel$, - type GridMode, } from "../state/CallViewModel/CallViewModel.ts"; import { Grid, type TileProps } from "../grid/Grid"; import { useInitial } from "../useInitial"; @@ -68,11 +67,7 @@ import { import { ReactionsAudioRenderer } from "./ReactionAudioRenderer"; import { ReactionsOverlay } from "./ReactionsOverlay"; import { CallEventAudioRenderer } from "./CallEventAudioRenderer"; -import { - debugTileLayout as debugTileLayoutSetting, - matrixRTCMode as matrixRTCModeSetting, - useSetting, -} from "../settings/settings"; +import { matrixRTCMode as matrixRTCModeSetting } from "../settings/settings"; import { ReactionsReader } from "../reactions/ReactionsReader"; import { LivekitRoomAudioRenderer } from "../livekit/MatrixAudioRenderer.tsx"; import { muteAllAudio$ } from "../state/MuteAllAudioModel.ts"; @@ -90,8 +85,10 @@ import { useTrackProcessorObservable$ } from "../livekit/TrackProcessorContext.t import { type Layout } from "../state/layout-types.ts"; import { ObservableScope } from "../state/ObservableScope.ts"; import { useLatest } from "../useLatest.ts"; -import { CallFooter } from "../components/CallFooter.tsx"; +import { CallFooter, type FooterSnapshot } from "../components/CallFooter.tsx"; import { SettingsIconButton } from "../button/Button.tsx"; +import { createCallFooterViewModel } from "../components/CallFooterViewModel.tsx"; +import { type ViewModel } from "../state/ViewModel.ts"; const logger = rootLogger.getChild("[InCallView]"); @@ -220,9 +217,7 @@ export const InCallView: FC = ({ muted: muteAllAudio, }); const latestPickupPhaseAudio = useLatest(pickupPhaseAudio); - - const audioEnabled = useBehavior(muteStates.audio.enabled$); - const videoEnabled = useBehavior(muteStates.video.enabled$); + const mediaDevices = useMediaDevices(); const toggleAudio = useBehavior(muteStates.audio.toggle$); const toggleVideo = useBehavior(muteStates.video.toggle$); const setAudioEnabled = useBehavior(muteStates.audio.setEnabled$); @@ -241,14 +236,10 @@ export const InCallView: FC = ({ const reconnecting = useBehavior(vm.reconnecting$); const windowMode = useBehavior(vm.windowMode$); const layout = useBehavior(vm.layout$); - const tileStoreGeneration = useBehavior(vm.tileStoreGeneration$); - const [debugTileLayout] = useSetting(debugTileLayoutSetting); - const gridMode = useBehavior(vm.gridMode$); const showHeader = useBehavior(vm.showHeader$); const showFooter = useBehavior(vm.showFooter$); const earpieceMode = useBehavior(vm.earpieceMode$); const audioOutputSwitcher = useBehavior(vm.audioOutputSwitcher$); - const sharingScreen = useBehavior(vm.sharingScreen$); const fatalCallError = useBehavior(vm.fatalError$); // Stop the rendering and throw for the error boundary @@ -348,11 +339,6 @@ export const InCallView: FC = ({ () => new BehaviorSubject(defaultPipAlignment), ); - const setGridMode = useCallback( - (mode: GridMode) => vm.setGridMode(mode), - [vm], - ); - useAppBarHidden(!showHeader); let header: ReactNode = null; @@ -558,9 +544,28 @@ export const InCallView: FC = ({ const rageshakeRequestModalProps = useRageshakeRequestModal( matrixRoom.roomId, ); + const [footerVm, setFooterVm] = useState | null>( + null, + ); + useEffect(() => { + const footerScope = new ObservableScope(); + setFooterVm( + createCallFooterViewModel( + footerScope, + vm, + muteStates, + mediaDevices, + openSettings, + supportsReactions + ? `${client.getUserId()}:${client.getDeviceId()}` + : undefined, + ), + ); + return (): void => { + footerScope.end(); + }; + }, [client, mediaDevices, muteStates, openSettings, supportsReactions, vm]); - const settingsButtonInAppBar = - headerStyle === HeaderStyle.AppBar && showHeader; useAppBarSecondaryButton( = ({ ); // Only hide the settings button if we have an AppBar header and we are showing the header - const footer = ( -