@@ -48,6 +48,7 @@ export async function checkSettingsToggle(session: ElementSession,
4848
4949interface Tabs {
5050 securityTabButton : ElementHandle ;
51+ generalTabButton : ElementHandle ;
5152}
5253
5354async function findTabs ( session : ElementSession ) : Promise < Tabs > {
@@ -64,8 +65,9 @@ async function findTabs(session: ElementSession): Promise<Tabs> {
6465 const tabButtons = await session . queryAll ( ".mx_RoomSettingsDialog .mx_TabbedView_tabLabel" ) ;
6566 const tabLabels = await Promise . all ( tabButtons . map ( t => session . innerText ( t ) ) ) ;
6667 const securityTabButton = tabButtons [ tabLabels . findIndex ( l => l . toLowerCase ( ) . includes ( "security" ) ) ] ;
68+ const generalTabButton = tabButtons [ tabLabels . findIndex ( l => l . toLowerCase ( ) . includes ( "general" ) ) ] ;
6769
68- return { securityTabButton } ;
70+ return { securityTabButton, generalTabButton } ;
6971}
7072
7173interface Settings {
@@ -140,24 +142,7 @@ export async function checkRoomSettings(session: ElementSession, expectedSetting
140142export async function changeRoomSettings ( session , settings ) {
141143 session . log . startGroup ( `changes the room settings` ) ;
142144
143- const { securityTabButton } = await findTabs ( session ) ;
144- const generalSwitches = await session . queryAll ( ".mx_RoomSettingsDialog .mx_ToggleSwitch" ) ;
145- const isDirectory = generalSwitches [ 0 ] ;
146-
147- if ( typeof settings . directory === "boolean" ) {
148- session . log . step ( `sets directory listing to ${ settings . directory } ` ) ;
149- await setSettingsToggle ( session , isDirectory , settings . directory ) ;
150- }
151-
152- if ( settings . alias ) {
153- session . log . step ( `sets alias to ${ settings . alias } ` ) ;
154- const aliasField = await session . query ( ".mx_RoomSettingsDialog .mx_AliasSettings details input[type=text]" ) ;
155- await session . replaceInputText ( aliasField , settings . alias . substring ( 1 , settings . alias . lastIndexOf ( ":" ) ) ) ;
156- const addButton = await session . query ( ".mx_RoomSettingsDialog .mx_AliasSettings details .mx_AccessibleButton" ) ;
157- await addButton . click ( ) ;
158- await session . delay ( 10 ) ; // delay to give time for the validator to run and check the alias
159- session . log . done ( ) ;
160- }
145+ const { securityTabButton, generalTabButton } = await findTabs ( session ) ;
161146
162147 securityTabButton . click ( ) ;
163148 await session . delay ( 500 ) ;
@@ -186,6 +171,27 @@ export async function changeRoomSettings(session, settings) {
186171 } else {
187172 throw new Error ( `unrecognized room visibility setting: ${ settings . visibility } ` ) ;
188173 }
174+ await session . delay ( 100 ) ;
175+ session . log . done ( ) ;
176+ }
177+
178+ generalTabButton . click ( ) ;
179+ await session . delay ( 500 ) ;
180+ const generalSwitches = await session . queryAll ( ".mx_RoomSettingsDialog .mx_ToggleSwitch" ) ;
181+ const isDirectory = generalSwitches [ 0 ] ;
182+
183+ if ( typeof settings . directory === "boolean" ) {
184+ session . log . step ( `sets directory listing to ${ settings . directory } ` ) ;
185+ await setSettingsToggle ( session , isDirectory , settings . directory ) ;
186+ }
187+
188+ if ( settings . alias ) {
189+ session . log . step ( `sets alias to ${ settings . alias } ` ) ;
190+ const aliasField = await session . query ( ".mx_RoomSettingsDialog .mx_AliasSettings details input[type=text]" ) ;
191+ await session . replaceInputText ( aliasField , settings . alias . substring ( 1 , settings . alias . lastIndexOf ( ":" ) ) ) ;
192+ const addButton = await session . query ( ".mx_RoomSettingsDialog .mx_AliasSettings details .mx_AccessibleButton" ) ;
193+ await addButton . click ( ) ;
194+ await session . delay ( 10 ) ; // delay to give time for the validator to run and check the alias
189195 session . log . done ( ) ;
190196 }
191197
0 commit comments