mirror of
https://github.com/element-hq/element-web
synced 2024-11-27 03:36:07 +03:00
Benchmark multiple common user scenario
This commit is contained in:
parent
bef20dde48
commit
19cae42161
7 changed files with 38 additions and 8 deletions
|
@ -37,17 +37,17 @@ export enum PerformanceEntryNames {
|
||||||
|
|
||||||
SWITCH_ROOM = "mx_SwithRoom",
|
SWITCH_ROOM = "mx_SwithRoom",
|
||||||
JUMP_TO_ROOM = "mx_JumpToRoom",
|
JUMP_TO_ROOM = "mx_JumpToRoom",
|
||||||
JOIN_ROOM = "mx_JoinRoom",
|
JOIN_ROOM = "mx_JoinRoom", // ✅
|
||||||
CREATE_DM = "mx_CreateDM",
|
CREATE_DM = "mx_CreateDM", // ✅
|
||||||
PEEK_ROOM = "mx_PeekRoom",
|
PEEK_ROOM = "mx_PeekRoom",
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User
|
* User
|
||||||
*/
|
*/
|
||||||
|
|
||||||
VERIFY_E2EE_USER = "mx_VerifyE2EEUser",
|
VERIFY_E2EE_USER = "mx_VerifyE2EEUser", // ✅
|
||||||
LOGIN = "mx_Login",
|
LOGIN = "mx_Login", // ✅
|
||||||
REGISTER = "mx_Register",
|
REGISTER = "mx_Register", // ✅
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VoIP
|
* VoIP
|
||||||
|
|
|
@ -20,9 +20,11 @@ const acceptInvite = require('../usecases/accept-invite');
|
||||||
const {receiveMessage} = require('../usecases/timeline');
|
const {receiveMessage} = require('../usecases/timeline');
|
||||||
const {createDm} = require('../usecases/create-room');
|
const {createDm} = require('../usecases/create-room');
|
||||||
const {checkRoomSettings} = require('../usecases/room-settings');
|
const {checkRoomSettings} = require('../usecases/room-settings');
|
||||||
const {startSasVerifcation, acceptSasVerification} = require('../usecases/verify');
|
const {startSasVerification, acceptSasVerification} = require('../usecases/verify');
|
||||||
const { setupSecureBackup } = require('../usecases/security');
|
const { setupSecureBackup } = require('../usecases/security');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
|
const { measureStart, measureStop } = require('../util');
|
||||||
|
|
||||||
|
|
||||||
module.exports = async function e2eEncryptionScenarios(alice, bob) {
|
module.exports = async function e2eEncryptionScenarios(alice, bob) {
|
||||||
console.log(" creating an e2e encrypted DM and join through invite:");
|
console.log(" creating an e2e encrypted DM and join through invite:");
|
||||||
|
@ -31,12 +33,14 @@ module.exports = async function e2eEncryptionScenarios(alice, bob) {
|
||||||
await acceptInvite(alice, 'bob');
|
await acceptInvite(alice, 'bob');
|
||||||
// do sas verifcation
|
// do sas verifcation
|
||||||
bob.log.step(`starts SAS verification with ${alice.username}`);
|
bob.log.step(`starts SAS verification with ${alice.username}`);
|
||||||
const bobSasPromise = startSasVerifcation(bob, alice.username);
|
await measureStart(bob, "mx_VerifyE2EEUser");
|
||||||
|
const bobSasPromise = startSasVerification(bob, alice.username);
|
||||||
const aliceSasPromise = acceptSasVerification(alice, bob.username);
|
const aliceSasPromise = acceptSasVerification(alice, bob.username);
|
||||||
// wait in parallel, so they don't deadlock on each other
|
// wait in parallel, so they don't deadlock on each other
|
||||||
// the logs get a bit messy here, but that's fine enough for debugging (hopefully)
|
// the logs get a bit messy here, but that's fine enough for debugging (hopefully)
|
||||||
const [bobSas, aliceSas] = await Promise.all([bobSasPromise, aliceSasPromise]);
|
const [bobSas, aliceSas] = await Promise.all([bobSasPromise, aliceSasPromise]);
|
||||||
assert.deepEqual(bobSas, aliceSas);
|
assert.deepEqual(bobSas, aliceSas);
|
||||||
|
await measureStop(bob, "mx_VerifyE2EEUser"); //
|
||||||
bob.log.done(`done (match for ${bobSas.join(", ")})`);
|
bob.log.done(`done (match for ${bobSas.join(", ")})`);
|
||||||
const aliceMessage = "Guess what I just heard?!";
|
const aliceMessage = "Guess what I just heard?!";
|
||||||
await sendMessage(alice, aliceMessage);
|
await sendMessage(alice, aliceMessage);
|
||||||
|
|
|
@ -15,6 +15,8 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
const { measureStart, measureStop } = require('../util');
|
||||||
|
|
||||||
async function openRoomDirectory(session) {
|
async function openRoomDirectory(session) {
|
||||||
const roomDirectoryButton = await session.query('.mx_LeftPanel_exploreButton');
|
const roomDirectoryButton = await session.query('.mx_LeftPanel_exploreButton');
|
||||||
await roomDirectoryButton.click();
|
await roomDirectoryButton.click();
|
||||||
|
@ -52,6 +54,8 @@ 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)}`);
|
||||||
|
|
||||||
|
await measureStart(session, "mx_CreateDM");
|
||||||
|
|
||||||
const dmsSublist = await findSublist(session, "people");
|
const dmsSublist = await findSublist(session, "people");
|
||||||
const startChatButton = await dmsSublist.$(".mx_RoomSublist_auxButton");
|
const startChatButton = await dmsSublist.$(".mx_RoomSublist_auxButton");
|
||||||
await startChatButton.click();
|
await startChatButton.click();
|
||||||
|
@ -76,6 +80,8 @@ async function createDm(session, invitees) {
|
||||||
|
|
||||||
await session.query('.mx_MessageComposer');
|
await session.query('.mx_MessageComposer');
|
||||||
session.log.done();
|
session.log.done();
|
||||||
|
|
||||||
|
await measureStop(session, "mx_CreateDM");
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {openRoomDirectory, findSublist, createRoom, createDm};
|
module.exports = {openRoomDirectory, findSublist, createRoom, createDm};
|
||||||
|
|
|
@ -16,9 +16,12 @@ limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const {openRoomDirectory} = require('./create-room');
|
const {openRoomDirectory} = require('./create-room');
|
||||||
|
const { measureStart, measureStop } = require('../util');
|
||||||
|
|
||||||
|
|
||||||
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}"`);
|
||||||
|
await measureStart(session, "mx_JoinRoom");
|
||||||
await openRoomDirectory(session);
|
await openRoomDirectory(session);
|
||||||
const roomInput = await session.query('.mx_DirectorySearchBox input');
|
const roomInput = await session.query('.mx_DirectorySearchBox input');
|
||||||
await session.replaceInputText(roomInput, roomName);
|
await session.replaceInputText(roomInput, roomName);
|
||||||
|
@ -26,5 +29,6 @@ module.exports = async function join(session, roomName) {
|
||||||
const joinFirstLink = await session.query('.mx_RoomDirectory_table .mx_RoomDirectory_join .mx_AccessibleButton');
|
const joinFirstLink = await session.query('.mx_RoomDirectory_table .mx_RoomDirectory_join .mx_AccessibleButton');
|
||||||
await joinFirstLink.click();
|
await joinFirstLink.click();
|
||||||
await session.query('.mx_MessageComposer');
|
await session.query('.mx_MessageComposer');
|
||||||
|
await measureStop(session, "mx_JoinRoom");
|
||||||
session.log.done();
|
session.log.done();
|
||||||
};
|
};
|
||||||
|
|
|
@ -74,7 +74,7 @@ async function doSasVerification(session) {
|
||||||
return sasCodes;
|
return sasCodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports.startSasVerifcation = async function(session, name) {
|
module.exports.startSasVerification = async function(session, name) {
|
||||||
session.log.startGroup("starts verification");
|
session.log.startGroup("starts verification");
|
||||||
await startVerification(session, name);
|
await startVerification(session, name);
|
||||||
|
|
||||||
|
|
|
@ -26,3 +26,15 @@ module.exports.range = function(start, amount, step = 1) {
|
||||||
module.exports.delay = function(ms) {
|
module.exports.delay = function(ms) {
|
||||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
module.exports.measureStart = function(session, name) {
|
||||||
|
return session.page.evaluate(() => {
|
||||||
|
window.mxPerformanceMonitor.start(name);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports.measureStop = function(session, name) {
|
||||||
|
return session.page.evaluate(() => {
|
||||||
|
window.mxPerformanceMonitor.stop(name);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
|
@ -88,6 +88,10 @@ async function runTests() {
|
||||||
window.mxPerformanceMonitor.addPerformanceDataCallback({
|
window.mxPerformanceMonitor.addPerformanceDataCallback({
|
||||||
entryNames: [
|
entryNames: [
|
||||||
window.mxPerformanceEntryNames.REGISTER,
|
window.mxPerformanceEntryNames.REGISTER,
|
||||||
|
window.mxPerformanceEntryNames.LOGIN,
|
||||||
|
window.mxPerformanceEntryNames.JOIN_ROOM,
|
||||||
|
window.mxPerformanceEntryNames.CREATE_DM,
|
||||||
|
window.mxPerformanceEntryNames.VERIFY_E2EE_USER,
|
||||||
],
|
],
|
||||||
callback: (events) => {
|
callback: (events) => {
|
||||||
measurements = JSON.stringify(events);
|
measurements = JSON.stringify(events);
|
||||||
|
|
Loading…
Reference in a new issue