Merge remote-tracking branch 'upstream/develop' into feature/call-event-tile
This commit is contained in:
commit
949532c297
75 changed files with 1260 additions and 541 deletions
|
@ -16,7 +16,7 @@ limitations under the License.
|
|||
|
||||
import '../skinned-sdk'; // Must be first for skinning to work
|
||||
import React from "react";
|
||||
import Adapter from "enzyme-adapter-react-16";
|
||||
import Adapter from "@wojtekmaj/enzyme-adapter-react-17";
|
||||
import { configure, mount } from "enzyme";
|
||||
|
||||
import {
|
||||
|
|
|
@ -32,7 +32,7 @@ import Matrix from 'matrix-js-sdk';
|
|||
const test_utils = require('../../test-utils');
|
||||
const mockclock = require('../../mock-clock');
|
||||
|
||||
import Adapter from "enzyme-adapter-react-16";
|
||||
import Adapter from "@wojtekmaj/enzyme-adapter-react-17";
|
||||
import { configure, mount } from "enzyme";
|
||||
|
||||
import MatrixClientContext from "../../../src/contexts/MatrixClientContext";
|
||||
|
@ -89,7 +89,7 @@ describe('MessagePanel', function() {
|
|||
DMRoomMap.makeShared();
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
afterEach(function() {
|
||||
clock.uninstall();
|
||||
});
|
||||
|
||||
|
@ -282,7 +282,7 @@ describe('MessagePanel', function() {
|
|||
|
||||
it('should show the events', function() {
|
||||
const res = TestUtils.renderIntoDocument(
|
||||
<WrappedMessagePanel className="cls" events={events} />,
|
||||
<WrappedMessagePanel className="cls" events={events} />,
|
||||
);
|
||||
|
||||
// just check we have the right number of tiles for now
|
||||
|
@ -310,8 +310,8 @@ describe('MessagePanel', function() {
|
|||
|
||||
it('should insert the read-marker in the right place', function() {
|
||||
const res = TestUtils.renderIntoDocument(
|
||||
<WrappedMessagePanel className="cls" events={events} readMarkerEventId={events[4].getId()}
|
||||
readMarkerVisible={true} />,
|
||||
<WrappedMessagePanel className="cls" events={events} readMarkerEventId={events[4].getId()}
|
||||
readMarkerVisible={true} />,
|
||||
);
|
||||
|
||||
const tiles = TestUtils.scryRenderedComponentsWithType(
|
||||
|
@ -328,8 +328,8 @@ describe('MessagePanel', function() {
|
|||
it('should show the read-marker that fall in summarised events after the summary', function() {
|
||||
const melsEvents = mkMelsEvents();
|
||||
const res = TestUtils.renderIntoDocument(
|
||||
<WrappedMessagePanel className="cls" events={melsEvents} readMarkerEventId={melsEvents[4].getId()}
|
||||
readMarkerVisible={true} />,
|
||||
<WrappedMessagePanel className="cls" events={melsEvents} readMarkerEventId={melsEvents[4].getId()}
|
||||
readMarkerVisible={true} />,
|
||||
);
|
||||
|
||||
const summary = TestUtils.findRenderedDOMComponentWithClass(res, 'mx_EventListSummary');
|
||||
|
@ -346,8 +346,8 @@ describe('MessagePanel', function() {
|
|||
it('should hide the read-marker at the end of summarised events', function() {
|
||||
const melsEvents = mkMelsEventsOnly();
|
||||
const res = TestUtils.renderIntoDocument(
|
||||
<WrappedMessagePanel className="cls" events={melsEvents} readMarkerEventId={melsEvents[9].getId()}
|
||||
readMarkerVisible={true} />,
|
||||
<WrappedMessagePanel className="cls" events={melsEvents} readMarkerEventId={melsEvents[9].getId()}
|
||||
readMarkerVisible={true} />,
|
||||
);
|
||||
|
||||
const summary = TestUtils.findRenderedDOMComponentWithClass(res, 'mx_EventListSummary');
|
||||
|
@ -370,9 +370,9 @@ describe('MessagePanel', function() {
|
|||
|
||||
// first render with the RM in one place
|
||||
let mp = ReactDOM.render(
|
||||
<WrappedMessagePanel className="cls" events={events} readMarkerEventId={events[4].getId()}
|
||||
readMarkerVisible={true}
|
||||
/>, parentDiv);
|
||||
<WrappedMessagePanel className="cls" events={events} readMarkerEventId={events[4].getId()}
|
||||
readMarkerVisible={true}
|
||||
/>, parentDiv);
|
||||
|
||||
const tiles = TestUtils.scryRenderedComponentsWithType(
|
||||
mp, sdk.getComponent('rooms.EventTile'));
|
||||
|
@ -386,9 +386,9 @@ describe('MessagePanel', function() {
|
|||
|
||||
// now move the RM
|
||||
mp = ReactDOM.render(
|
||||
<WrappedMessagePanel className="cls" events={events} readMarkerEventId={events[6].getId()}
|
||||
readMarkerVisible={true}
|
||||
/>, parentDiv);
|
||||
<WrappedMessagePanel className="cls" events={events} readMarkerEventId={events[6].getId()}
|
||||
readMarkerVisible={true}
|
||||
/>, parentDiv);
|
||||
|
||||
// now there should be two RM containers
|
||||
const found = TestUtils.scryRenderedDOMComponentsWithClass(mp, 'mx_RoomView_myReadMarker_container');
|
||||
|
@ -463,7 +463,7 @@ describe('MessagePanel', function() {
|
|||
expect(isReadMarkerVisible(rm)).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should render Date separators for the events', function () {
|
||||
it('should render Date separators for the events', function() {
|
||||
const events = mkOneDayEvents();
|
||||
const res = mount(
|
||||
<WrappedMessagePanel
|
||||
|
|
|
@ -18,7 +18,7 @@ import "../../../skinned-sdk";
|
|||
|
||||
import React from "react";
|
||||
import {configure, mount} from "enzyme";
|
||||
import Adapter from "enzyme-adapter-react-16";
|
||||
import Adapter from "@wojtekmaj/enzyme-adapter-react-17";
|
||||
import {act} from "react-dom/test-utils";
|
||||
|
||||
import * as TestUtils from "../../../test-utils";
|
||||
|
|
|
@ -15,7 +15,7 @@ limitations under the License.
|
|||
*/
|
||||
|
||||
import React from "react";
|
||||
import Adapter from "enzyme-adapter-react-16";
|
||||
import Adapter from "@wojtekmaj/enzyme-adapter-react-17";
|
||||
import { configure, mount } from "enzyme";
|
||||
|
||||
import sdk from "../../../skinned-sdk";
|
||||
|
|
|
@ -15,7 +15,7 @@ limitations under the License.
|
|||
*/
|
||||
|
||||
import '../../../skinned-sdk'; // Must be first for skinning to work
|
||||
import Adapter from "enzyme-adapter-react-16";
|
||||
import Adapter from "@wojtekmaj/enzyme-adapter-react-17";
|
||||
import { configure, mount } from "enzyme";
|
||||
import React from "react";
|
||||
import {act} from "react-dom/test-utils";
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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();
|
||||
};
|
||||
|
|
|
@ -122,7 +122,7 @@ function getAllEventTiles(session) {
|
|||
}
|
||||
|
||||
async function getMessageFromEventTile(eventTile) {
|
||||
const senderElement = await eventTile.$(".mx_SenderProfile_name");
|
||||
const senderElement = await eventTile.$(".mx_SenderProfile_displayName");
|
||||
const className = await (await eventTile.getProperty("className")).jsonValue();
|
||||
const classNames = className.split(" ");
|
||||
const bodyElement = await eventTile.$(".mx_EventTile_body");
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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(_name => {
|
||||
window.mxPerformanceMonitor.start(_name);
|
||||
}, name);
|
||||
};
|
||||
|
||||
module.exports.measureStop = function(session, name) {
|
||||
return session.page.evaluate(_name => {
|
||||
window.mxPerformanceMonitor.stop(_name);
|
||||
}, name);
|
||||
};
|
||||
|
|
|
@ -79,7 +79,7 @@ async function runTests() {
|
|||
await new Promise((resolve) => setTimeout(resolve, 5 * 60 * 1000));
|
||||
}
|
||||
|
||||
const performanceEntries = {};
|
||||
let performanceEntries;
|
||||
|
||||
await Promise.all(sessions.map(async (session) => {
|
||||
// Collecting all performance monitoring data before closing the session
|
||||
|
@ -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);
|
||||
|
@ -95,7 +99,11 @@ async function runTests() {
|
|||
}, true);
|
||||
return measurements;
|
||||
});
|
||||
performanceEntries[session.username] = JSON.parse(measurements);
|
||||
|
||||
/**
|
||||
* TODO: temporary only use one user session data
|
||||
*/
|
||||
performanceEntries = JSON.parse(measurements);
|
||||
return session.close();
|
||||
}));
|
||||
fs.writeFileSync(`performance-entries.json`, JSON.stringify(performanceEntries));
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
import * as languageHandler from "../src/languageHandler";
|
||||
import { TextEncoder, TextDecoder } from 'util';
|
||||
|
||||
languageHandler.setLanguage('en');
|
||||
languageHandler.setMissingEntryGenerator(key => key.split("|", 2)[1]);
|
||||
|
||||
require('jest-fetch-mock').enableMocks();
|
||||
|
||||
// polyfilling TextEncoder as it is not available on JSDOM
|
||||
// view https://github.com/facebook/jest/issues/9983
|
||||
global.TextEncoder = TextEncoder;
|
||||
global.TextDecoder = TextDecoder;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue