diff --git a/src/performance/entry-names.ts b/src/performance/entry-names.ts index effd9506f6..6cb193b1b1 100644 --- a/src/performance/entry-names.ts +++ b/src/performance/entry-names.ts @@ -37,17 +37,17 @@ export enum PerformanceEntryNames { SWITCH_ROOM = "mx_SwithRoom", JUMP_TO_ROOM = "mx_JumpToRoom", - JOIN_ROOM = "mx_JoinRoom", - CREATE_DM = "mx_CreateDM", + JOIN_ROOM = "mx_JoinRoom", // ✅ + CREATE_DM = "mx_CreateDM", // ✅ PEEK_ROOM = "mx_PeekRoom", /** * User */ - VERIFY_E2EE_USER = "mx_VerifyE2EEUser", - LOGIN = "mx_Login", - REGISTER = "mx_Register", + VERIFY_E2EE_USER = "mx_VerifyE2EEUser", // ✅ + LOGIN = "mx_Login", // ✅ + REGISTER = "mx_Register", // ✅ /** * VoIP diff --git a/test/end-to-end-tests/src/scenarios/e2e-encryption.js b/test/end-to-end-tests/src/scenarios/e2e-encryption.js index 20e8af2947..ed5c598032 100644 --- a/test/end-to-end-tests/src/scenarios/e2e-encryption.js +++ b/test/end-to-end-tests/src/scenarios/e2e-encryption.js @@ -20,9 +20,11 @@ const acceptInvite = require('../usecases/accept-invite'); const {receiveMessage} = require('../usecases/timeline'); const {createDm} = require('../usecases/create-room'); const {checkRoomSettings} = require('../usecases/room-settings'); -const {startSasVerifcation, acceptSasVerification} = require('../usecases/verify'); +const {startSasVerification, acceptSasVerification} = require('../usecases/verify'); const { setupSecureBackup } = require('../usecases/security'); const assert = require('assert'); +const { measureStart, measureStop } = require('../util'); + module.exports = async function e2eEncryptionScenarios(alice, bob) { 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'); // do sas verifcation 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); // 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) const [bobSas, aliceSas] = await Promise.all([bobSasPromise, aliceSasPromise]); assert.deepEqual(bobSas, aliceSas); + await measureStop(bob, "mx_VerifyE2EEUser"); // bob.log.done(`done (match for ${bobSas.join(", ")})`); const aliceMessage = "Guess what I just heard?!"; await sendMessage(alice, aliceMessage); diff --git a/test/end-to-end-tests/src/usecases/create-room.js b/test/end-to-end-tests/src/usecases/create-room.js index 3830e3e0da..36b9ed21ec 100644 --- a/test/end-to-end-tests/src/usecases/create-room.js +++ b/test/end-to-end-tests/src/usecases/create-room.js @@ -15,6 +15,8 @@ See the License for the specific language governing permissions and limitations under the License. */ +const { measureStart, measureStop } = require('../util'); + async function openRoomDirectory(session) { const roomDirectoryButton = await session.query('.mx_LeftPanel_exploreButton'); await roomDirectoryButton.click(); @@ -52,6 +54,8 @@ async function createRoom(session, roomName, encrypted=false) { async function createDm(session, invitees) { session.log.step(`creates DM with ${JSON.stringify(invitees)}`); + await measureStart(session, "mx_CreateDM"); + const dmsSublist = await findSublist(session, "people"); const startChatButton = await dmsSublist.$(".mx_RoomSublist_auxButton"); await startChatButton.click(); @@ -76,6 +80,8 @@ async function createDm(session, invitees) { await session.query('.mx_MessageComposer'); session.log.done(); + + await measureStop(session, "mx_CreateDM"); } module.exports = {openRoomDirectory, findSublist, createRoom, createDm}; diff --git a/test/end-to-end-tests/src/usecases/join.js b/test/end-to-end-tests/src/usecases/join.js index 655c0be686..cf0f67be44 100644 --- a/test/end-to-end-tests/src/usecases/join.js +++ b/test/end-to-end-tests/src/usecases/join.js @@ -16,9 +16,12 @@ limitations under the License. */ const {openRoomDirectory} = require('./create-room'); +const { measureStart, measureStop } = require('../util'); + module.exports = async function join(session, roomName) { session.log.step(`joins room "${roomName}"`); + await measureStart(session, "mx_JoinRoom"); await openRoomDirectory(session); const roomInput = await session.query('.mx_DirectorySearchBox input'); 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'); await joinFirstLink.click(); await session.query('.mx_MessageComposer'); + await measureStop(session, "mx_JoinRoom"); session.log.done(); }; diff --git a/test/end-to-end-tests/src/usecases/verify.js b/test/end-to-end-tests/src/usecases/verify.js index ea5b9961a4..a66c8c1b1c 100644 --- a/test/end-to-end-tests/src/usecases/verify.js +++ b/test/end-to-end-tests/src/usecases/verify.js @@ -74,7 +74,7 @@ async function doSasVerification(session) { return sasCodes; } -module.exports.startSasVerifcation = async function(session, name) { +module.exports.startSasVerification = async function(session, name) { session.log.startGroup("starts verification"); await startVerification(session, name); diff --git a/test/end-to-end-tests/src/util.js b/test/end-to-end-tests/src/util.js index cc7391fa9f..854c1f7ad2 100644 --- a/test/end-to-end-tests/src/util.js +++ b/test/end-to-end-tests/src/util.js @@ -26,3 +26,15 @@ module.exports.range = function(start, amount, step = 1) { module.exports.delay = function(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); + }); +}; diff --git a/test/end-to-end-tests/start.js b/test/end-to-end-tests/start.js index c1588e848e..04df0c51c0 100644 --- a/test/end-to-end-tests/start.js +++ b/test/end-to-end-tests/start.js @@ -88,6 +88,10 @@ async function runTests() { window.mxPerformanceMonitor.addPerformanceDataCallback({ entryNames: [ window.mxPerformanceEntryNames.REGISTER, + window.mxPerformanceEntryNames.LOGIN, + window.mxPerformanceEntryNames.JOIN_ROOM, + window.mxPerformanceEntryNames.CREATE_DM, + window.mxPerformanceEntryNames.VERIFY_E2EE_USER, ], callback: (events) => { measurements = JSON.stringify(events);