mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-29 22:10:57 +08:00
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.
This commit is contained in:
parent
5d06c65ce5
commit
239e6a4bce
@ -25,7 +25,7 @@ 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');
|
||||||
const {getE2EDeviceFromSettings} = require('../usecases/settings');
|
const {getE2EDeviceFromSettings} = require('../usecases/settings');
|
||||||
const verifyDeviceForUser = require('../usecases/verify-device');
|
const {verifyDeviceForUser} = require('../usecases/memberlist');
|
||||||
|
|
||||||
module.exports = async function e2eEncryptionScenarios(alice, bob) {
|
module.exports = async function e2eEncryptionScenarios(alice, bob) {
|
||||||
console.log(" creating an e2e encrypted room and join through invite:");
|
console.log(" creating an e2e encrypted room and join through invite:");
|
||||||
|
@ -23,14 +23,17 @@ const {
|
|||||||
scrollToTimelineTop
|
scrollToTimelineTop
|
||||||
} = require('../usecases/timeline');
|
} = require('../usecases/timeline');
|
||||||
const createRoom = require('../usecases/create-room');
|
const createRoom = require('../usecases/create-room');
|
||||||
|
const {getMembersInMemberlist} = require('../usecases/memberlist');
|
||||||
const changeRoomSettings = require('../usecases/room-settings');
|
const changeRoomSettings = require('../usecases/room-settings');
|
||||||
const {enableLazyLoading} = require('../usecases/settings');
|
const {enableLazyLoading} = require('../usecases/settings');
|
||||||
|
const assert = require('assert');
|
||||||
|
|
||||||
module.exports = async function lazyLoadingScenarios(alice, bob, charlies) {
|
module.exports = async function lazyLoadingScenarios(alice, bob, charlies) {
|
||||||
console.log(" creating a room for lazy loading member scenarios:");
|
console.log(" creating a room for lazy loading member scenarios:");
|
||||||
await enableLazyLoading(alice);
|
await enableLazyLoading(alice);
|
||||||
await setupRoomWithBobAliceAndCharlies(alice, bob, charlies);
|
await setupRoomWithBobAliceAndCharlies(alice, bob, charlies);
|
||||||
await checkPaginatedDisplayNames(alice, charlies);
|
await checkPaginatedDisplayNames(alice, charlies);
|
||||||
|
await checkMemberList(alice, charlies);
|
||||||
}
|
}
|
||||||
|
|
||||||
const room = "Lazy Loading Test";
|
const room = "Lazy Loading Test";
|
||||||
@ -69,3 +72,16 @@ async function checkPaginatedDisplayNames(alice, charlies) {
|
|||||||
}, []);
|
}, []);
|
||||||
await checkTimelineContains(alice, expectedMessages, "Charly #1-10");
|
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');
|
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}`);
|
session.log.step(`verifies e2e device for ${name}`);
|
||||||
const memberNameElements = await session.queryAll(".mx_MemberList .mx_EntityTile_name");
|
const membersAndNames = await getMembersInMemberlist(session);
|
||||||
const membersAndNames = await Promise.all(memberNameElements.map(async (el) => {
|
const matchingLabel = membersAndNames.filter((m) => {
|
||||||
return [el, await session.innerText(el)];
|
return m.displayName === name;
|
||||||
}));
|
}).map((m) => m.label)[0];
|
||||||
const matchingMember = membersAndNames.filter(([el, text]) => {
|
await matchingLabel.click();
|
||||||
return text === name;
|
|
||||||
}).map(([el]) => el)[0];
|
|
||||||
await matchingMember.click();
|
|
||||||
const firstVerifyButton = await session.waitAndQuery(".mx_MemberDeviceInfo_verify");
|
const firstVerifyButton = await session.waitAndQuery(".mx_MemberDeviceInfo_verify");
|
||||||
await firstVerifyButton.click();
|
await firstVerifyButton.click();
|
||||||
const dialogCodeFields = await session.waitAndQueryAll(".mx_QuestionDialog code");
|
const dialogCodeFields = await session.waitAndQueryAll(".mx_QuestionDialog code");
|
||||||
@ -40,3 +37,12 @@ module.exports = async function verifyDeviceForUser(session, name, expectedDevic
|
|||||||
await closeMemberInfo.click();
|
await closeMemberInfo.click();
|
||||||
session.log.done();
|
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
Block a user