@@ -17,6 +17,7 @@ limitations under the License.
1717/// <reference types="cypress" />
1818
1919import type { MatrixClient } from "matrix-js-sdk/src/client" ;
20+ import type { Preset } from "matrix-js-sdk/src/@types/partials" ;
2021import type { ICreateRoomOpts } from "matrix-js-sdk/src/@types/requests" ;
2122import { HomeserverInstance } from "../../plugins/utils/homeserver" ;
2223import Chainable = Cypress . Chainable ;
@@ -32,7 +33,7 @@ function openSpaceContextMenu(spaceName: string): Chainable<JQuery> {
3233 return cy . get ( ".mx_SpacePanel_contextMenu" ) ;
3334}
3435
35- function spaceCreateOptions ( spaceName : string ) : ICreateRoomOpts {
36+ function spaceCreateOptions ( spaceName : string , roomIds : string [ ] = [ ] ) : ICreateRoomOpts {
3637 return {
3738 creation_content : {
3839 type : "m.space" ,
@@ -44,6 +45,7 @@ function spaceCreateOptions(spaceName: string): ICreateRoomOpts {
4445 name : spaceName ,
4546 } ,
4647 } ,
48+ ...roomIds . map ( spaceChildInitialState ) ,
4749 ] ,
4850 } ;
4951}
@@ -283,4 +285,29 @@ describe("Spaces", () => {
283285 cy . checkA11y ( undefined , axeOptions ) ;
284286 cy . get ( ".mx_SpacePanel" ) . percySnapshotElement ( "Space panel expanded" , { widths : [ 258 ] } ) ;
285287 } ) ;
288+
289+ it ( "should not soft crash when joining a room from space hierarchy which has a link in its topic" , ( ) => {
290+ cy . getBot ( homeserver , { displayName : "BotBob" } ) . then ( { timeout : 10000 } , async ( bot ) => {
291+ const { room_id : roomId } = await bot . createRoom ( {
292+ preset : "public_chat" as Preset ,
293+ name : "Test Room" ,
294+ topic : "This is a topic https://github.com/matrix-org/matrix-react-sdk/pull/10060 with a link" ,
295+ } ) ;
296+ const { room_id : spaceId } = await bot . createRoom ( spaceCreateOptions ( "Test Space" , [ roomId ] ) ) ;
297+ await bot . invite ( spaceId , user . userId ) ;
298+ } ) ;
299+
300+ cy . getSpacePanelButton ( "Test Space" ) . should ( "exist" ) ;
301+ cy . wait ( 500 ) ; // without this we can end up clicking too quickly and it ends up having no effect
302+ cy . viewSpaceByName ( "Test Space" ) ;
303+ cy . contains ( ".mx_AccessibleButton" , "Accept" ) . click ( ) ;
304+
305+ cy . contains ( ".mx_SpaceHierarchy_roomTile.mx_AccessibleButton" , "Test Room" ) . within ( ( ) => {
306+ cy . contains ( "Join" ) . should ( "exist" ) . realHover ( ) . click ( ) ;
307+ cy . contains ( "View" , { timeout : 5000 } ) . should ( "exist" ) . click ( ) ;
308+ } ) ;
309+
310+ // Assert we get shown the new room intro, and thus not the soft crash screen
311+ cy . get ( ".mx_NewRoomIntro" ) . should ( "exist" ) ;
312+ } ) ;
286313} ) ;
0 commit comments