@@ -21,8 +21,11 @@ test.afterEach(async ({ page }) => {
2121 expect ( runtimeErrors . get ( page ) ?? [ ] , 'authenticated shell emitted runtime errors' ) . toEqual ( [ ] )
2222} )
2323
24- async function installAuthenticatedMatrixMock ( page : Page ) : Promise < void > {
25- await page . addInitScript ( ( ) => {
24+ async function installAuthenticatedMatrixMock (
25+ page : Page ,
26+ currentDeepLinks : string [ ] | null = null ,
27+ ) : Promise < void > {
28+ await page . addInitScript ( ( deepLinks ) => {
2629 const calls : IpcCall [ ] = [ ]
2730 const callbacks = new Map < number , ( ...args : unknown [ ] ) => void > ( )
2831 let nextCallbackId = 1
@@ -287,6 +290,8 @@ async function installAuthenticatedMatrixMock(page: Page): Promise<void> {
287290 case 'matrix_clear_composer_draft' :
288291 case 'plugin:event|unlisten' :
289292 return null
293+ case 'plugin:deep-link|get_current' :
294+ return deepLinks
290295 case 'matrix_wait_for_room_update' :
291296 // The real command long-polls the SDK room-update stream. Keeping
292297 // this promise pending models that boundary without a CPU-heavy loop.
@@ -343,11 +348,14 @@ async function installAuthenticatedMatrixMock(page: Page): Promise<void> {
343348 } ) . __TAURI_EVENT_PLUGIN_INTERNALS__ = {
344349 unregisterListener : ( ) => { } ,
345350 }
346- } )
351+ } , currentDeepLinks )
347352}
348353
349- async function openAuthenticatedShell ( page : Page ) : Promise < void > {
350- await installAuthenticatedMatrixMock ( page )
354+ async function openAuthenticatedShell (
355+ page : Page ,
356+ currentDeepLinks : string [ ] | null = null ,
357+ ) : Promise < void > {
358+ await installAuthenticatedMatrixMock ( page , currentDeepLinks )
351359 await page . goto ( '/' )
352360 await expect (
353361 page . getByRole ( 'navigation' , { name : 'Communities and direct messages' } ) ,
@@ -387,6 +395,17 @@ test.describe('authenticated desktop shell', () => {
387395 await expect ( page . getByText ( 'Anonymous' , { exact : true } ) ) . toHaveCount ( 0 )
388396 } )
389397
398+ test ( 'routes a cold-start Mesh invitation into the prefilled join flow' , async ( { page } ) => {
399+ const invite =
400+ 'mesh://join?v=3&kind=matrix&room=!invited:mesh.test&via=mesh.test&service=https%3A%2F%2Fmatrix.mesh.test'
401+ await openAuthenticatedShell ( page , [ invite ] )
402+
403+ const dialog = page . getByRole ( 'dialog' , { name : 'Join a community' } )
404+ await expect ( dialog ) . toBeVisible ( )
405+ await expect ( dialog . getByLabel ( 'Invite code or link' ) ) . toHaveValue ( invite )
406+ await expect ( dialog . getByRole ( 'button' , { name : 'Join Community' } ) ) . toBeEnabled ( )
407+ } )
408+
390409 test ( '@a11y has no automated WCAG A/AA violations in the shell and settings' , async ( { page } ) => {
391410 await openAuthenticatedShell ( page )
392411 await expectNoWcagViolations ( page , 'Authenticated desktop shell' )
0 commit comments