mirror of https://github.com/vector-im/riot-web
add ll tests to check if all expected members are in memberlist
also move verify-device use case to timeline to reuse memberlist query for this test.pull/21833/head
parent
5d06c65ce5
commit
239e6a4bce
|
@ -25,7 +25,7 @@ const {receiveMessage} = require('../usecases/timeline');
|
|||
const createRoom = require('../usecases/create-room');
|
||||
const changeRoomSettings = require('../usecases/room-settings');
|
||||
const {getE2EDeviceFromSettings} = require('../usecases/settings');
|
||||
const verifyDeviceForUser = require('../usecases/verify-device');
|
||||
const {verifyDeviceForUser} = require('../usecases/memberlist');
|
||||
|
||||
module.exports = async function e2eEncryptionScenarios(alice, bob) {
|
||||
console.log(" creating an e2e encrypted room and join through invite:");
|
||||
|
|
|
@ -23,14 +23,17 @@ const {
|
|||
scrollToTimelineTop
|
||||
} = require('../usecases/timeline');
|
||||
const createRoom = require('../usecases/create-room');
|
||||
const {getMembersInMemberlist} = require('../usecases/memberlist');
|
||||
const changeRoomSettings = require('../usecases/room-settings');
|
||||
const {enableLazyLoading} = require('../usecases/settings');
|
||||
const assert = require('assert');
|
||||
|
||||
module.exports = async function lazyLoadingScenarios(alice, bob, charlies) {
|
||||
console.log(" creating a room for lazy loading member scenarios:");
|
||||
await enableLazyLoading(alice);
|
||||
await setupRoomWithBobAliceAndCharlies(alice, bob, charlies);
|
||||
await checkPaginatedDisplayNames(alice, charlies);
|
||||
await checkMemberList(alice, charlies);
|
||||
}
|
||||
|
||||
const room = "Lazy Loading Test";
|
||||
|
@ -69,3 +72,16 @@ async function checkPaginatedDisplayNames(alice, charlies) {
|
|||
}, []);
|
||||
await checkTimelineContains(alice, expectedMessages, "Charly #1-10");
|
||||
}
|
||||
|
||||
async function checkMemberList(alice, charlies) {
|
||||
alice.log.step("checks the memberlist contains herself, bob and all charlies");
|
||||
const displayNames = (await getMembersInMemberlist(alice)).map((m) => m.displayName);
|
||||
assert(displayNames.includes("alice"));
|
||||
assert(displayNames.includes("bob"));
|
||||
charlies.sessions.forEach((charly) => {
|
||||
assert(displayNames.includes(charly.displayName()),
|
||||
`${charly.displayName()} should be in the member list, ` +
|
||||
`only have ${displayNames}`);
|
||||
});
|
||||
alice.log.done();
|
||||
}
|
||||
|
|
|
@ -16,16 +16,13 @@ limitations under the License.
|
|||
|
||||
const assert = require('assert');
|
||||
|
||||
module.exports = async function verifyDeviceForUser(session, name, expectedDevice) {
|
||||
module.exports.verifyDeviceForUser = async function(session, name, expectedDevice) {
|
||||
session.log.step(`verifies e2e device for ${name}`);
|
||||
const memberNameElements = await session.queryAll(".mx_MemberList .mx_EntityTile_name");
|
||||
const membersAndNames = await Promise.all(memberNameElements.map(async (el) => {
|
||||
return [el, await session.innerText(el)];
|
||||
}));
|
||||
const matchingMember = membersAndNames.filter(([el, text]) => {
|
||||
return text === name;
|
||||
}).map(([el]) => el)[0];
|
||||
await matchingMember.click();
|
||||
const membersAndNames = await getMembersInMemberlist(session);
|
||||
const matchingLabel = membersAndNames.filter((m) => {
|
||||
return m.displayName === name;
|
||||
}).map((m) => m.label)[0];
|
||||
await matchingLabel.click();
|
||||
const firstVerifyButton = await session.waitAndQuery(".mx_MemberDeviceInfo_verify");
|
||||
await firstVerifyButton.click();
|
||||
const dialogCodeFields = await session.waitAndQueryAll(".mx_QuestionDialog code");
|
||||
|
@ -40,3 +37,12 @@ module.exports = async function verifyDeviceForUser(session, name, expectedDevic
|
|||
await closeMemberInfo.click();
|
||||
session.log.done();
|
||||
}
|
||||
|
||||
async function getMembersInMemberlist(session) {
|
||||
const memberNameElements = await session.waitAndQueryAll(".mx_MemberList .mx_EntityTile_name");
|
||||
return Promise.all(memberNameElements.map(async (el) => {
|
||||
return {label: el, displayName: await session.innerText(el)};
|
||||
}));
|
||||
}
|
||||
|
||||
module.exports.getMembersInMemberlist = getMembersInMemberlist;
|
Loading…
Reference in New Issue