mirror of https://github.com/vector-im/riot-web
fix joining a room through the room directory
parent
a27b92a49a
commit
fe6a273ba9
|
@ -18,7 +18,7 @@ limitations under the License.
|
||||||
const join = require('../usecases/join');
|
const join = require('../usecases/join');
|
||||||
const sendMessage = require('../usecases/send-message');
|
const sendMessage = require('../usecases/send-message');
|
||||||
const {receiveMessage} = require('../usecases/timeline');
|
const {receiveMessage} = require('../usecases/timeline');
|
||||||
const createRoom = require('../usecases/create-room');
|
const {createRoom} = require('../usecases/create-room');
|
||||||
const changeRoomSettings = require('../usecases/room-settings');
|
const changeRoomSettings = require('../usecases/room-settings');
|
||||||
|
|
||||||
module.exports = async function roomDirectoryScenarios(alice, bob) {
|
module.exports = async function roomDirectoryScenarios(alice, bob) {
|
||||||
|
|
|
@ -16,8 +16,7 @@ limitations under the License.
|
||||||
|
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
|
|
||||||
module.exports = async function createRoom(session, roomName) {
|
async function openRoomDirectory(session) {
|
||||||
session.log.step(`creates room "${roomName}"`);
|
|
||||||
const roomListHeaders = await session.queryAll('.mx_RoomSubList_labelContainer');
|
const roomListHeaders = await session.queryAll('.mx_RoomSubList_labelContainer');
|
||||||
const roomListHeaderLabels = await Promise.all(roomListHeaders.map(h => session.innerText(h)));
|
const roomListHeaderLabels = await Promise.all(roomListHeaders.map(h => session.innerText(h)));
|
||||||
const roomsIndex = roomListHeaderLabels.findIndex(l => l.toLowerCase().includes("rooms"));
|
const roomsIndex = roomListHeaderLabels.findIndex(l => l.toLowerCase().includes("rooms"));
|
||||||
|
@ -27,6 +26,11 @@ module.exports = async function createRoom(session, roomName) {
|
||||||
const roomsHeader = roomListHeaders[roomsIndex];
|
const roomsHeader = roomListHeaders[roomsIndex];
|
||||||
const addRoomButton = await roomsHeader.$(".mx_RoomSubList_addRoom");
|
const addRoomButton = await roomsHeader.$(".mx_RoomSubList_addRoom");
|
||||||
await addRoomButton.click();
|
await addRoomButton.click();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function createRoom(session, roomName) {
|
||||||
|
session.log.step(`creates room "${roomName}"`);
|
||||||
|
await openRoomDirectory(session);
|
||||||
const createRoomButton = await session.waitAndQuery('.mx_RoomDirectory_createRoom');
|
const createRoomButton = await session.waitAndQuery('.mx_RoomDirectory_createRoom');
|
||||||
await createRoomButton.click();
|
await createRoomButton.click();
|
||||||
|
|
||||||
|
@ -39,3 +43,5 @@ module.exports = async function createRoom(session, roomName) {
|
||||||
await session.waitAndQuery('.mx_MessageComposer');
|
await session.waitAndQuery('.mx_MessageComposer');
|
||||||
session.log.done();
|
session.log.done();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module.exports = {openRoomDirectory, createRoom};
|
||||||
|
|
|
@ -15,14 +15,12 @@ limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
|
const {openRoomDirectory} = require('./create-room');
|
||||||
|
|
||||||
module.exports = async function join(session, roomName) {
|
module.exports = async function join(session, roomName) {
|
||||||
session.log.step(`joins room "${roomName}"`);
|
session.log.step(`joins room "${roomName}"`);
|
||||||
//TODO: brittle selector
|
await openRoomDirectory(session);
|
||||||
const directoryButton = await session.waitAndQuery('.mx_RoleButton[aria-label="Room directory"]');
|
const roomInput = await session.waitAndQuery('.mx_DirectorySearchBox input');
|
||||||
await directoryButton.click();
|
|
||||||
|
|
||||||
const roomInput = await session.waitAndQuery('.mx_DirectorySearchBox_input');
|
|
||||||
await session.replaceInputText(roomInput, roomName);
|
await session.replaceInputText(roomInput, roomName);
|
||||||
|
|
||||||
const firstRoomLabel = await session.waitAndQuery('.mx_RoomDirectory_table .mx_RoomDirectory_name:first-child', 1000);
|
const firstRoomLabel = await session.waitAndQuery('.mx_RoomDirectory_table .mx_RoomDirectory_name:first-child', 1000);
|
||||||
|
@ -33,4 +31,4 @@ module.exports = async function join(session, roomName) {
|
||||||
|
|
||||||
await session.waitAndQuery('.mx_MessageComposer');
|
await session.waitAndQuery('.mx_MessageComposer');
|
||||||
session.log.done();
|
session.log.done();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue