Fix end-to-end tests for end-to-end encryption verification
Fixes https://github.com/vector-im/riot-web/issues/13226 This isn't the fastest route, but it is a predictable route for the happy path we probably want to test. For example, Alice will already be staring at the DM and could easily accept the verification there, but we probably want to make sure that the toast is present and does the right thing. Similarly, neither of them need to verify that there's green shields everywhere, they should be implied, however an explicit check follows a real user's gaze.
This commit is contained in:
parent
885bb112ae
commit
e72008d7f1
9 changed files with 244 additions and 71 deletions
|
@ -20,7 +20,7 @@ const join = require('../usecases/join');
|
|||
const sendMessage = require('../usecases/send-message');
|
||||
const {receiveMessage} = require('../usecases/timeline');
|
||||
const {createRoom} = require('../usecases/create-room');
|
||||
const changeRoomSettings = require('../usecases/room-settings');
|
||||
const {changeRoomSettings} = require('../usecases/room-settings');
|
||||
|
||||
module.exports = async function roomDirectoryScenarios(alice, bob) {
|
||||
console.log(" creating a public room and join through directory:");
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Copyright 2018 New Vector Ltd
|
||||
Copyright 2019 The Matrix.org Foundation C.I.C.
|
||||
Copyright 2019, 2020 The Matrix.org Foundation C.I.C.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
@ -15,42 +15,33 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
// TODO: Update test for cross signing
|
||||
// https://github.com/vector-im/riot-web/issues/13226
|
||||
const sendMessage = require('../usecases/send-message');
|
||||
const acceptInvite = require('../usecases/accept-invite');
|
||||
const invite = require('../usecases/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 assert = require('assert');
|
||||
|
||||
module.exports = async function() {
|
||||
console.log(" this is supposed to be an e2e test, but it's broken");
|
||||
module.exports = async function e2eEncryptionScenarios(alice, bob) {
|
||||
console.log(" creating an e2e encrypted DM and join through invite:");
|
||||
await createDm(bob, ['@alice:localhost']);
|
||||
await checkRoomSettings(bob, {encryption: true}); // for sanity, should be e2e-by-default
|
||||
await acceptInvite(alice, 'bob');
|
||||
// do sas verifcation
|
||||
bob.log.step(`starts SAS verification with ${alice.username}`);
|
||||
const bobSasPromise = startSasVerifcation(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);
|
||||
bob.log.done(`done (match for ${bobSas.join(", ")})`);
|
||||
const aliceMessage = "Guess what I just heard?!";
|
||||
await sendMessage(alice, aliceMessage);
|
||||
await receiveMessage(bob, {sender: "alice", body: aliceMessage, encrypted: true});
|
||||
const bobMessage = "You've got to tell me!";
|
||||
await sendMessage(bob, bobMessage);
|
||||
await receiveMessage(alice, {sender: "bob", body: bobMessage, encrypted: true});
|
||||
};
|
||||
|
||||
// const sendMessage = require('../usecases/send-message');
|
||||
// const acceptInvite = require('../usecases/accept-invite');
|
||||
// const invite = require('../usecases/invite');
|
||||
// const {receiveMessage} = require('../usecases/timeline');
|
||||
// const {createRoom} = require('../usecases/create-room');
|
||||
// const changeRoomSettings = require('../usecases/room-settings');
|
||||
// const {startSasVerifcation, acceptSasVerification} = require('../usecases/verify');
|
||||
// const assert = require('assert');
|
||||
//
|
||||
// module.exports = async function e2eEncryptionScenarios(alice, bob) {
|
||||
// console.log(" creating an e2e encrypted room and join through invite:");
|
||||
// const room = "secrets";
|
||||
// await createRoom(bob, room);
|
||||
// await changeRoomSettings(bob, {encryption: true});
|
||||
// // await cancelKeyBackup(bob);
|
||||
// await invite(bob, "@alice:localhost");
|
||||
// await acceptInvite(alice, room);
|
||||
// // do sas verifcation
|
||||
// bob.log.step(`starts SAS verification with ${alice.username}`);
|
||||
// const bobSasPromise = startSasVerifcation(bob, alice.username);
|
||||
// const aliceSasPromise = acceptSasVerification(alice, bob.username);
|
||||
// // wait in parallel, so they don't deadlock on each other
|
||||
// const [bobSas, aliceSas] = await Promise.all([bobSasPromise, aliceSasPromise]);
|
||||
// assert.deepEqual(bobSas, aliceSas);
|
||||
// bob.log.done(`done (match for ${bobSas.join(", ")})`);
|
||||
// const aliceMessage = "Guess what I just heard?!";
|
||||
// await sendMessage(alice, aliceMessage);
|
||||
// await receiveMessage(bob, {sender: "alice", body: aliceMessage, encrypted: true});
|
||||
// const bobMessage = "You've got to tell me!";
|
||||
// await sendMessage(bob, bobMessage);
|
||||
// await receiveMessage(alice, {sender: "bob", body: bobMessage, encrypted: true});
|
||||
// };
|
||||
|
|
|
@ -25,7 +25,7 @@ const {
|
|||
} = require('../usecases/timeline');
|
||||
const {createRoom} = require('../usecases/create-room');
|
||||
const {getMembersInMemberlist} = require('../usecases/memberlist');
|
||||
const changeRoomSettings = require('../usecases/room-settings');
|
||||
const {changeRoomSettings} = require('../usecases/room-settings');
|
||||
const assert = require('assert');
|
||||
|
||||
module.exports = async function lazyLoadingScenarios(alice, bob, charlies) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue