Pass the session through

This commit is contained in:
Travis Ralston 2020-07-07 16:38:24 -06:00
parent f12d951209
commit 9000888013
2 changed files with 4 additions and 4 deletions

View file

@ -19,7 +19,7 @@ const {findSublist} = require("./create-room");
module.exports = async function acceptInvite(session, name) { module.exports = async function acceptInvite(session, name) {
session.log.step(`accepts "${name}" invite`); session.log.step(`accepts "${name}" invite`);
const inviteSublist = await findSublist("invites"); const inviteSublist = await findSublist(session, "invites");
const invitesHandles = await inviteSublist.$(".mx_RoomTile2_name"); const invitesHandles = await inviteSublist.$(".mx_RoomTile2_name");
const invitesWithText = await Promise.all(invitesHandles.map(async (inviteHandle) => { const invitesWithText = await Promise.all(invitesHandles.map(async (inviteHandle) => {
const text = await session.innerText(inviteHandle); const text = await session.innerText(inviteHandle);

View file

@ -20,7 +20,7 @@ async function openRoomDirectory(session) {
await roomDirectoryButton.click(); await roomDirectoryButton.click();
} }
async function findSublist(name) { async function findSublist(session, name) {
const sublists = await session.queryAll('.mx_RoomSublist2'); const sublists = await session.queryAll('.mx_RoomSublist2');
for (const sublist of sublists) { for (const sublist of sublists) {
const header = await sublist.$('.mx_RoomSublist2_headerText'); const header = await sublist.$('.mx_RoomSublist2_headerText');
@ -35,7 +35,7 @@ async function findSublist(name) {
async function createRoom(session, roomName, encrypted=false) { async function createRoom(session, roomName, encrypted=false) {
session.log.step(`creates room "${roomName}"`); session.log.step(`creates room "${roomName}"`);
const roomsSublist = await findSublist("rooms"); const roomsSublist = await findSublist(session, "rooms");
const addRoomButton = await roomsSublist.$(".mx_RoomSublist2_auxButton"); const addRoomButton = await roomsSublist.$(".mx_RoomSublist2_auxButton");
await addRoomButton.click(); await addRoomButton.click();
@ -57,7 +57,7 @@ async function createRoom(session, roomName, encrypted=false) {
async function createDm(session, invitees) { async function createDm(session, invitees) {
session.log.step(`creates DM with ${JSON.stringify(invitees)}`); session.log.step(`creates DM with ${JSON.stringify(invitees)}`);
const dmsSublist = await findSublist("people"); const dmsSublist = await findSublist(session, "people");
const startChatButton = await dmsSublist.$(".mx_RoomSublist2_auxButton"); const startChatButton = await dmsSublist.$(".mx_RoomSublist2_auxButton");
await startChatButton.click(); await startChatButton.click();