fix creating a room
							parent
							
								
									ab5a2452ee
								
							
						
					
					
						commit
						65ca1b33ee
					
				|  | @ -18,8 +18,16 @@ const assert = require('assert'); | |||
| 
 | ||||
| module.exports = async function createRoom(session, roomName) { | ||||
|     session.log.step(`creates room "${roomName}"`); | ||||
|     //TODO: brittle selector
 | ||||
|     const createRoomButton = await session.waitAndQuery('.mx_RoleButton[aria-label="Create new room"]'); | ||||
|     const roomListHeaders = await session.queryAll('.mx_RoomSubList_labelContainer'); | ||||
|     const roomListHeaderLabels = await Promise.all(roomListHeaders.map(h => session.innerText(h))); | ||||
|     const roomsIndex = roomListHeaderLabels.findIndex(l => l.toLowerCase().includes("rooms")); | ||||
|     if (roomsIndex === -1) { | ||||
|         throw new Error("could not find room list section that contains rooms in header"); | ||||
|     } | ||||
|     const roomsHeader = roomListHeaders[roomsIndex]; | ||||
|     const addRoomButton = await roomsHeader.$(".mx_RoomSubList_addRoom"); | ||||
|     await addRoomButton.click(); | ||||
|     const createRoomButton = await session.waitAndQuery('.mx_RoomDirectory_createRoom'); | ||||
|     await createRoomButton.click(); | ||||
| 
 | ||||
|     const roomNameInput = await session.waitAndQuery('.mx_CreateRoomDialog_input'); | ||||
|  | @ -30,4 +38,4 @@ module.exports = async function createRoom(session, roomName) { | |||
| 
 | ||||
|     await session.waitAndQuery('.mx_MessageComposer'); | ||||
|     session.log.done(); | ||||
| } | ||||
| } | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 Bruno Windels
						Bruno Windels