@@ -139,6 +139,9 @@ describe("Spotlight", () => {
139139 const room2Name = "Lounge" ;
140140 let room2Id : string ;
141141
142+ const room3Name = "Public" ;
143+ let room3Id : string ;
144+
142145 beforeEach ( ( ) => {
143146 cy . startSynapse ( "default" ) . then ( data => {
144147 synapse = data ;
@@ -163,6 +166,19 @@ describe("Spotlight", () => {
163166 room2Id = _room2Id ;
164167 bot2 . invite ( room2Id , bot1 . getUserId ( ) ) ;
165168 } ) ;
169+ bot2 . createRoom ( {
170+ name : room3Name ,
171+ visibility : Visibility . Public , initial_state : [ {
172+ type : "m.room.history_visibility" ,
173+ state_key : "" ,
174+ content : {
175+ history_visibility : "world_readable" ,
176+ } ,
177+ } ] ,
178+ } ) . then ( ( { room_id : _room3Id } ) => {
179+ room3Id = _room3Id ;
180+ bot2 . invite ( room3Id , bot1 . getUserId ( ) ) ;
181+ } ) ;
166182 } ) ,
167183 ) . then ( ( ) =>
168184 cy . get ( '.mx_RoomSublist_skeletonUI' ) . should ( 'not.exist' ) ,
@@ -212,6 +228,7 @@ describe("Spotlight", () => {
212228 cy . spotlightSearch ( ) . clear ( ) . type ( room1Name ) ;
213229 cy . spotlightResults ( ) . should ( "have.length" , 1 ) ;
214230 cy . spotlightResults ( ) . eq ( 0 ) . should ( "contain" , room1Name ) ;
231+ cy . spotlightResults ( ) . eq ( 0 ) . should ( "contain" , "View" ) ;
215232 cy . spotlightResults ( ) . eq ( 0 ) . click ( ) ;
216233 cy . url ( ) . should ( "contain" , room1Id ) ;
217234 } ) . then ( ( ) => {
@@ -225,6 +242,7 @@ describe("Spotlight", () => {
225242 cy . spotlightSearch ( ) . clear ( ) . type ( room2Name ) ;
226243 cy . spotlightResults ( ) . should ( "have.length" , 1 ) ;
227244 cy . spotlightResults ( ) . eq ( 0 ) . should ( "contain" , room2Name ) ;
245+ cy . spotlightResults ( ) . eq ( 0 ) . should ( "contain" , "Join" ) ;
228246 cy . spotlightResults ( ) . eq ( 0 ) . click ( ) ;
229247 cy . url ( ) . should ( "contain" , room2Id ) ;
230248 } ) . then ( ( ) => {
@@ -233,6 +251,21 @@ describe("Spotlight", () => {
233251 } ) ;
234252 } ) ;
235253
254+ it ( "should find unknown public world readable rooms" , ( ) => {
255+ cy . openSpotlightDialog ( ) . within ( ( ) => {
256+ cy . spotlightFilter ( Filter . PublicRooms ) ;
257+ cy . spotlightSearch ( ) . clear ( ) . type ( room3Name ) ;
258+ cy . spotlightResults ( ) . should ( "have.length" , 1 ) ;
259+ cy . spotlightResults ( ) . eq ( 0 ) . should ( "contain" , room3Name ) ;
260+ cy . spotlightResults ( ) . eq ( 0 ) . should ( "contain" , "View" ) ;
261+ cy . spotlightResults ( ) . eq ( 0 ) . click ( ) ;
262+ cy . url ( ) . should ( "contain" , room3Id ) ;
263+ } ) . then ( ( ) => {
264+ cy . get ( ".mx_RoomPreviewBar_actions .mx_AccessibleButton" ) . click ( ) ;
265+ cy . roomHeaderName ( ) . should ( "contain" , room3Name ) ;
266+ } ) ;
267+ } ) ;
268+
236269 // TODO: We currently can’t test finding rooms on other homeservers/other protocols
237270 // We obviously don’t have federation or bridges in cypress tests
238271 /*
0 commit comments