fix creating a room
parent
ab5a2452ee
commit
65ca1b33ee
|
@ -18,8 +18,16 @@ const assert = require('assert');
|
||||||
|
|
||||||
module.exports = async function createRoom(session, roomName) {
|
module.exports = async function createRoom(session, roomName) {
|
||||||
session.log.step(`creates room "${roomName}"`);
|
session.log.step(`creates room "${roomName}"`);
|
||||||
//TODO: brittle selector
|
const roomListHeaders = await session.queryAll('.mx_RoomSubList_labelContainer');
|
||||||
const createRoomButton = await session.waitAndQuery('.mx_RoleButton[aria-label="Create new room"]');
|
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();
|
await createRoomButton.click();
|
||||||
|
|
||||||
const roomNameInput = await session.waitAndQuery('.mx_CreateRoomDialog_input');
|
const roomNameInput = await session.waitAndQuery('.mx_CreateRoomDialog_input');
|
||||||
|
|
Loading…
Reference in New Issue