This repository has been archived by the owner on Oct 21, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from matrix-org/bwindels/lltests2
Test all members are in memberlist with LL turned on
- Loading branch information
Showing
23 changed files
with
366 additions
and
194 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
Copyright 2018 New Vector Ltd | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
module.exports = class LogBuffer { | ||
constructor(page, eventName, eventMapper, reduceAsync=false, initialValue = "") { | ||
this.buffer = initialValue; | ||
page.on(eventName, (arg) => { | ||
const result = eventMapper(arg); | ||
if (reduceAsync) { | ||
result.then((r) => this.buffer += r); | ||
} | ||
else { | ||
this.buffer += result; | ||
} | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
Copyright 2018 New Vector Ltd | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
module.exports = class Logger { | ||
constructor(username) { | ||
this.indent = 0; | ||
this.username = username; | ||
this.muted = false; | ||
} | ||
|
||
startGroup(description) { | ||
if (!this.muted) { | ||
const indent = " ".repeat(this.indent * 2); | ||
console.log(`${indent} * ${this.username} ${description}:`); | ||
} | ||
this.indent += 1; | ||
return this; | ||
} | ||
|
||
endGroup() { | ||
this.indent -= 1; | ||
return this; | ||
} | ||
|
||
step(description) { | ||
if (!this.muted) { | ||
const indent = " ".repeat(this.indent * 2); | ||
process.stdout.write(`${indent} * ${this.username} ${description} ... `); | ||
} | ||
return this; | ||
} | ||
|
||
done(status = "done") { | ||
if (!this.muted) { | ||
process.stdout.write(status + "\n"); | ||
} | ||
return this; | ||
} | ||
|
||
mute() { | ||
this.muted = true; | ||
return this; | ||
} | ||
|
||
unmute() { | ||
this.muted = false; | ||
return this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
scenarios contains the high-level playbook for the test suite |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
Copyright 2018 New Vector Ltd | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
|
||
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'); | ||
|
||
module.exports = async function roomDirectoryScenarios(alice, bob) { | ||
console.log(" creating a public room and join through directory:"); | ||
const room = 'test'; | ||
await createRoom(alice, room); | ||
await changeRoomSettings(alice, {directory: true, visibility: "public_no_guests"}); | ||
await join(bob, room); //looks up room in directory | ||
const bobMessage = "hi Alice!"; | ||
await sendMessage(bob, bobMessage); | ||
await receiveMessage(alice, {sender: "bob", body: bobMessage}); | ||
const aliceMessage = "hi Bob, welcome!" | ||
await sendMessage(alice, aliceMessage); | ||
await receiveMessage(bob, {sender: "alice", body: aliceMessage}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
Copyright 2018 New Vector Ltd | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
|
||
const {delay} = require('../util'); | ||
const {acceptDialogMaybe} = require('../usecases/dialog'); | ||
const join = require('../usecases/join'); | ||
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 {getE2EDeviceFromSettings} = require('../usecases/settings'); | ||
const {verifyDeviceForUser} = require('../usecases/memberlist'); | ||
|
||
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 invite(bob, "@alice:localhost"); | ||
await acceptInvite(alice, room); | ||
const bobDevice = await getE2EDeviceFromSettings(bob); | ||
// wait some time for the encryption warning dialog | ||
// to appear after closing the settings | ||
await delay(1000); | ||
await acceptDialogMaybe(bob, "encryption"); | ||
const aliceDevice = await getE2EDeviceFromSettings(alice); | ||
// wait some time for the encryption warning dialog | ||
// to appear after closing the settings | ||
await delay(1000); | ||
await acceptDialogMaybe(alice, "encryption"); | ||
await verifyDeviceForUser(bob, "alice", aliceDevice); | ||
await verifyDeviceForUser(alice, "bob", bobDevice); | ||
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}); | ||
} |
Oops, something went wrong.