Skip to content

Test the signaling state machine on iOS and the web - #321

Merged
SloMR merged 33 commits into
mainfrom
test/signaling-state-tests
Oct 25, 2026
Merged

SloMR merged 33 commits into
mainfrom
test/signaling-state-tests

Conversation

@SloMR

@SloMR SloMR commented Oct 25, 2026

Copy link
Copy Markdown
Owner

Summary

This adds unit tests for the signaling state machine on both clients: the same six checks on iOS and the web, each covering a failure we have hit before. To make that possible, signaling now gets its WebSocket, TURN, WebRTC and timer dependencies from outside, and the web moves from Karma to Vitest. The apps behave as before, except that the web now drops a peer's queued frames when it gives up on that peer, as iOS already does. The signaling logic itself is otherwise unchanged.

What changed

  • SignalingService on iOS takes its WebSocket, TURN source, WebRTC calls and clock through init (SignalTransport, IceServerSource, WebRTCEngine, any Clock<Duration>), and the app passes the real ones
  • iOS channel and ICE state handling moves out of the delegate methods into handleChannelState(_:onChannel:) and handleIceState(_:onConnection:)
  • The iOS app stays offline while it hosts the unit tests (AppBuildInfo.isRunningTests)
  • iOS unit tests use Swift Testing and swift-clocks, and CI runs them on an iPhone simulator
  • The web runs its unit tests on Vitest with jsdom instead of Karma in Chrome, and its builders move to @angular/build
  • The web signaling service creates peer connections through PeerConnectionFactory
  • Both clients name the server's WebSocket prefixes in a WebSocketPrefix enum instead of raw strings
  • Six signaling tests on each client: a failed build doesn't leave a peer connecting, giving up drops queued frames, queued frames go out before newer ones, a teardown and a new attempt leave one connection, a retry after a close starts a new connection, and a new attempt cancels the old retry
  • The web drops a peer's queued frames when it gives up on that peer

SloMR added 30 commits October 25, 2026 21:06
- Angular's Vitest migration needs the `@angular/build` builders, so build, serve and extract-i18n move there too
@SloMR SloMR self-assigned this Oct 25, 2026
@SloMR SloMR added documentation Improvements or additions to documentation dependencies Pull requests that update a dependency file ios Any iOS related things web Any Web related things ci Changes for the Pipeline CI labels Oct 25, 2026
@SloMR SloMR added this to PastePoint Oct 25, 2026
@SloMR
SloMR merged commit eeafb60 into main Oct 25, 2026
37 checks passed
@SloMR
SloMR deleted the test/signaling-state-tests branch October 25, 2026 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Changes for the Pipeline CI dependencies Pull requests that update a dependency file documentation Improvements or additions to documentation ios Any iOS related things web Any Web related things

Projects

Status: done

Development

Successfully merging this pull request may close these issues.

1 participant