mirror of
https://github.com/element-hq/element-web
synced 2024-11-24 02:05:45 +03:00
fix creating a room
This commit is contained in:
parent
ab5a2452ee
commit
65ca1b33ee
1 changed files with 11 additions and 3 deletions
|
@ -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 a new issue