1
0
mirror of https://github.com/element-hq/element-web.git synced 2026-10-23 11:09:01 +03:00

13 Commits

Author SHA1 Message Date
Timo
5fae057a60 Element call as a react component (#34935)
* Add an end-to-end Element Call test with a real MatrixRTC backend

Element Web's Playwright coverage of Element Call has only ever used a stand-in:
`sample-files/fake-element-call.html`, a page that does just enough for the widget
plumbing to be exercised. Nothing in the suite has ever carried media.

This adds one real call between two users, through the Element Call the build under
test ships (`@element-hq/element-call-embedded`, copied to `widgets/element-call/`),
against a real MatrixRTC backend:

- `testcontainers/livekit.ts` — a LiveKit SFU advertising loopback so the browser
  reaches it through published ports on macOS as well as Linux.
- `testcontainers/lk-jwt-service.ts` — the authorisation service, validating OpenID
  tokens over Synapse's federation API.
- `testcontainers/matrix-rtc.ts` — starts the two and produces the Synapse
  configuration that announces the transport (MSC4143) and enables the MSCs Element
  Call needs.
- `services.ts` — a `matrixRTC` worker option turning all of that on.

`routeConfigJson` no longer hard-codes the dev server's origin: it resolves
`config.json` against the context's `baseURL`, so a `BASE_URL` other than the default
works, and other origins a test loads keep their own.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* Make Renovate actually see the new testcontainer images

The custom manager's `depName` group is `[^@]+`, which matches newlines and
quotes, so it is only bounded by the next `@` in the file. In `synapse.ts` and
`mas.ts` an `@element-hq/…` import happens to sit above the image literal and
caps it; `livekit.ts` and `lk-jwt-service.ts` import `testcontainers` and `yaml`,
so the match instead starts at that import and swallows everything up to the
image name. Renovate gets a nonsense package name, finds nothing, and the pins
quietly rot.

Exclude quotes and whitespace from both groups. All four digest-pinned files now
extract correctly, synapse and mas unchanged.

Bump lk-jwt-service to 0.7.0 while here.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* Address the bundled Element Call by directory, not by index.html

The full-call spec passed against the webpack dev server and failed in CI, where
the production build is hosted by `serve`.

`ElementCall.generateWidgetUrl` built `./widgets/element-call/index.html#…`.
`serve` has `cleanUrls` on by default, so it 301s that to the extensionless
`/widgets/element-call`. Element Call's `index.html` references its chunks
relatively (`./assets/…`), and against a base with no trailing slash the browser
resolves those to `/widgets/assets/…` — 404. Element Call never boots, so the
lobby never appears and the test times out.

Address the directory instead. It is the same deployment, the trailing slash
sidesteps the redirect, and the hash is overwritten further down either way. This
is not only a test concern: Netlify also strips `.html` by default, and that is
what serves the PR previews and develop.element.io.

Doing it here rather than in the spec keeps the test honest — it exercises the
widget URL Element Web really generates, with no `Developer.elementCallUrl`
override. Setting `cleanUrls` in a `serve.json` was the other candidate and is
not viable: any value other than the default also stops `serve` resolving `/` to
`index.html`, which breaks every other test.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* EC react component Plan

* The implemantation Element Call React Component with mocked EC react
component

* final plan

* tests

* update plan to not do e2e tests in EW but in EC

* Start using the real react component instead of the mock (activation
react EC)

* add playwright e2e tests

* fix transport discovery (pass in via config. Hack the well-known source
for servers not supporting get_transports)

* stylesheet fixes

* Update element-call-react-plan.md

* add docuemnt pip

* Depend on the Element Call component from its git branch

`@element-hq/element-call-component` was a `link:` to a hand-built
`dist/` in a machine-local worktree. It is now a git dependency on the
`component` directory of element-hq/element-call, on the
`valere/component_ec_M1` branch (element-call#4233), whose `prepare`
script builds the component on install; pnpm has to be allowed to run
it (`allowBuilds`). The ref goes back to `main` once that PR has merged.

The branch first needs the commit that adds the component's manifest
and build (`toger5/component-package-manifest` in the EC checkout);
until it is pushed, `path:/component` resolves to no manifest and the
lockfile keeps the old `link:` entry. Both are written up in the plan.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* use the component_ec_m1 dep lock file entries

* fix element call reloading

* pass the right theme to element-call component

* bump element-call-component

* Return a call from the browser PiP window to where it left from

Closing the Document Picture-in-Picture window always dropped the call
into Element Web's floating PiP, even when it had filled the room's call
view a moment earlier and the user was still looking at that room.

The store now remembers whether the call left from the call view, and
on release opens the call view again when it did — unless the call has
ended, the user has moved to another room, or the user opened the call
view themselves (which is what closed the window). A call that was
floating in Element Web's PiP before goes back there, as it did.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* Draw the call header's outline icons a little smaller

The room header's icons are Compound's solid set, but minimise,
maximise and pop-out exist only as outlines: Compound has no filled
counterparts, and nothing else in the set says what they say. At the
solid icons' size their open strokes look heavy-handed next to them.

Scaling the glyphs down slightly inside the buttons lets them sit
comfortably next to their neighbours without changing the buttons'
footprint.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* Hand a persisted tree to the remaining placeholder on unmount

When two PersistedElements for the same key mount in one React commit
(a call returning from the browser PiP window into the call view, while
Element Web's floating PiP briefly shows it as well), whichever rendered
the tree last owns the child's ref. If that one is then the one to
unmount, it hid the tree, and the survivor, never having been handed the
child, could not show it again.

On unmount, if another placeholder is mounted, render the tree once more
with the most recently mounted survivor's wrapper so it takes over the
child and positions it; only hide the tree when nothing is left to show
it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* Adjust to updates done in EC
(simpler public api. More resilient to prop changes)

* package.json back to EC branch valere/component_ec_M1

* fix closing in component mode

* Configure pnpm store location in workflows

Keep the pnpm store out of node_modules to prevent incorrect
bundling of element-call-component when building git dependencies.

* update docs on EC packaging improvements

* fix ci

* Update pnpm-lock and tsconfig

* Move the browser Picture-in-Picture window and call header changes to a follow-up

Keeps this PR to Element Call as a React component. The Document
Picture-in-Picture window (DocumentPipStore, useDocumentPip, the
PersistedElement detach/reattach and placeholder hand-over, the
PipContainer awareness of it), the call header's minimise, maximise and
pop-out buttons with their outline-icon sizing, the browser API typings,
their strings, tests and e2e spec move to toger5/ec-document-pip.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* bump to main branch EC

* fix CI failing due to pnpm store

* remove docs and dev journals

* review

* CI: silence zizmor's github-env finding on the pnpm store action

zizmor flags every $GITHUB_ENV write inside a composite action, because it
cannot see which triggers the action will be used from. The value written
here is a constant built from RUNNER_TEMP with nothing attacker-controlled
in it, so suppress the finding the way the repo does elsewhere.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* Keep the ready promise's rejection from going unobserved

close() rejects the pending ready promise so that a start() still waiting on
the component learns the call went away instead of hanging until the timeout.
Usually nothing is waiting, and the unobserved rejection then surfaced as an
unhandled promise rejection, which crashed the Vitest worker running
Call.test.ts. Mark the promise as handled before rejecting it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* review

* review: double import

* move types to EC repo (just import them here)

* review: refactor ElementCallAppTile to a MVVM shared compoenent

* merge useEffectiveTheme and useTheme hooks

* cnvert the ElementCallMock to MVVM

* use unstable EC branch. DO NOT MERGE UNTI THIS COMMIT IS REVERTED
this branch is used to test CI with the new exports from EC.
We need to first merge:
https://github.com/element-hq/element-call/pull/4269 before we can put
this back to main (revert this commit).

* Move Node and pnpm setup into a single action

The setup-node-pnpm action now includes pnpm/action-setup and
actions/setup-node alongside the store relocation, eliminating
boilerplate across workflows and fixing the setup order in one place.

* fix broken lock file

* test for review change "reject on promise race"

* review: letter spacing

* Import the EC CSS layered

* Use self-repository syntax

* Fix import path

* Fix webpack

* Revert actions syntax as Sonar doesn't seem compatible with it

* Switch to Flex

* Switch to a11y label

* Take client from SdkContext

* Make strings in mock view translatable

* Keep class names in EW

* Move mock view to shared components and add stories

* Exempt voip|element_call_mock|title

* Fix tests

* Clarify doc string

* Add labs.md entry

* Use text element

* Remove redundant test

* Remove redundant test

* Delint

* Format

* Update snapshots

* Bump element-call

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Johannes Marbach <n0-0ne+github@mailbox.org>
2026-09-25 15:12:19 +00:00
Michael Telatynski
8359e4f150 Migrate remainder of Jest tests to Vitest (#35084)
* Migrate final batch of tests from Jest to Vitest

* Update test-utils imports

* Move test-utils

* Remove the remainder of Jest

* Make tsc & knip happy

 Conflicts:
	pnpm-lock.yaml

* Fix bad merge conflict

* Iterate
2026-09-18 11:13:19 +00:00
David Langley
ca589fd7f6 Add multi-digit support for overlay badges and tests (#33637)
* Add multi-digit support for overlay badges and tests

Fix multi-digit notification badge in Windows taskbar overlay

The BadgeOverlayRenderer reused the over-baseImage layout for the
standalone 16x16 overlay, which pushed multi-digit badges off the left
of the canvas (e.g. "10" rendered as just "0"). Keep the pill inside
the canvas bounds in the no-baseImage path and reduce its height for
multi-digit counts so the rounded-rect path actually produces a pill.

Adds a Playwright test that bundles favicon.ts with esbuild, drives
the real BadgeOverlayRenderer in Chromium, and writes the resulting
PNGs to disk plus a scaled-up screenshot snapshot for regression
detection.

Include summary for overlay and favicon

* add esbuild as devDependency

* Update pnpm-lock.yaml

* e2e -> unit test

* Fix regression on vertical alignment of the badge text

* Update pnpm-lock.yaml

* Fix prettier formatting in favicon.ts and image snapshot tests

* Clamp Windows overlay badge at "99+"

Clamp Windows overlay badge at "99+"

The Windows taskbar overlay is only 16x16 px and the platform's own
notification badges clamp at "99+", so do the same here rather than
trying to fit three-digit counts or "1k+" labels into the tiny canvas.
Browser-tab favicons are unaffected and still render larger counts.

* Move badge rendering tests to vitest browser mode

* Rename browser tests to *.test.browser.ts

* Exclude browser tests from jest coverage collection

* Scope browser matcher types to the browser tests

* Tell knip @vitest/browser is used via tsconfig types

---------

Co-authored-by: David Langley <langley.dave@gmail.com>
2026-09-02 07:58:34 +00:00
Michael Telatynski
b6859885a3 Upgrade to TypeScript 7 (#34208)
* Upgrade to TypeScript 7

for massive tsc speed gains

Those on WebStorm will want to upgrade to EAP to reap the benefits of the new TSGo compiler

Some things (module-api & shared-components) which utilise unplugin-dts (and api-extractor) need to hold a copy of ts6 for its conventional lib format and API. TS7 ships with no API until TS7.1.

Other things which use eslint also need ts6 for typescript-eslint.

Some type changes were necessary as TS7 caught some issues.

* Add knip exception

* Fix bad merge
2026-07-14 08:09:03 +00:00
Michael Telatynski
15c85ec50f Switch from eslint to oxlint (#34166)
* Fix type imports

* Fix jsdoc

* Fixup types

* Fix stray awaits on non-thenables

* Fixup imports

* Fix splats

* Fix this-context on callbacks

* Memoise react contexts

* Prefer find/flatMap

* Make oxlint happier about our React keys

* Avoid unsafe default function params

* Fixup jsdoc

* Fixup contexts

* Switch from eslint to oxlint

* Some oxlint-related tweaks

* Iterate

* Partial revert to defer some changes and shrink diff

* Iterate

* Add eslint-plugin-element-call and enable the copyright rule

* Set strictStorePkgContentCheck

* Iterate

* Make sonar happy

* Fix new lints
2026-07-10 09:47:41 +00:00
Michael Telatynski
df4a1f0c85 Migrate batch of tests to vitest (#34108)
* Migrate utils/dm tests to vitest

* Migrate utils/room tests to vitest

* Migrate utils/location tests to vitest

* Fix types

* Satisfy tsc & knip
2026-07-03 08:50:11 +00:00
Will Hunt
be91d19e31 Add URL preview above message composer (#33964)
* Modify LinkPreview to export shared atomics

* Implement MessageComposerUrlPreviewView

* Create UrlPreviewFetcher utility function

* Modify view models

* Implement in composer

* Support running tests in dom-less vitest environment

* Add a playwright test

* hide another one

* fmt

* cleanup

* test rte too

* fixup

* Add back docstring

* cleanup

* off by one

* remove description check

* Cleanup hacks

* Remove another hack

* cleanup

* one more

* fixup window here too

* whoops type

* Rename to be cleaeer

* Trim URLs first

* fix bug
2026-06-30 16:58:03 +00:00
Michael Telatynski
45234b9c94 Migrate more jest tests to vitest (#33898)
* Migrate more jest tests to vitest

* Fix jest config

* Fix jest config

* Make remaining jest tests type-happy
2026-06-19 15:34:18 +00:00
Michael Telatynski
7ad8f58a08 pnpm tidy up (#33744)
* Fix tsconfig paths

* Tidy pnpm patches

* Fix pnpm-link.ts for devEngines specification
2026-06-05 07:42:26 +00:00
renovate[bot]
2d16498fe6 Update dependency typescript to v6 (#32927)
* Update dependency typescript to v6

* Switch to unplugin-vts

Workaround for https://github.com/qmhc/unplugin-dts/issues/467

And tweak tsconfigs

* tweak tsconfig

* Make tsc happy

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
2026-04-22 12:28:54 +00:00
Michael Telatynski
6d21687ca9 Make tsc happier
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2026-03-24 15:03:52 +00:00
Michael Telatynski
b8509d249b Fixup paths
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2026-02-24 21:27:03 +00:00
Michael Telatynski
91a3cb03c1 mv element.io @types __mocks__/ debian docker module_system/ playwright res src test webapp Dockerfile .dockerignore .eslintignore .stylelintrc.cjs babel.config.cjs recorder-worklet-loader.cjs .modernizr.json components.json config.json config.sample.json package.json project.json tsconfig.json tsconfig.module_system.json jest.config.ts playwright.config.ts webpack.config.ts build_config.sample.yaml apps/web/
mkdir apps/web/scripts
mv scripts/{cleanup.sh,ci_package.sh,copy-res.ts,deploy.py,package.sh} apps/web/scripts

And a couple of gitignore tweaks

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2026-02-24 15:43:58 +00:00