You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-11 20:22:36 +03:00
fix verification, replace device id/key with SAS verification.
This commit is contained in:
@@ -16,27 +16,29 @@ limitations under the License.
|
||||
|
||||
const assert = require('assert');
|
||||
|
||||
async function assertDialog(session, expectedTitle) {
|
||||
const titleElement = await session.waitAndQuery(".mx_Dialog .mx_Dialog_title");
|
||||
const dialogHeader = await session.innerText(titleElement);
|
||||
assert(dialogHeader, expectedTitle);
|
||||
}
|
||||
|
||||
async function acceptDialog(session, expectedContent) {
|
||||
const foundDialog = await acceptDialogMaybe(session, expectedContent);
|
||||
async function acceptDialog(session, expectedTitle) {
|
||||
const foundDialog = await acceptDialogMaybe(session, expectedTitle);
|
||||
if (!foundDialog) {
|
||||
throw new Error("could not find a dialog");
|
||||
}
|
||||
}
|
||||
|
||||
async function acceptDialogMaybe(session, expectedContent) {
|
||||
let dialog = null;
|
||||
async function acceptDialogMaybe(session, expectedTitle) {
|
||||
let primaryButton = null;
|
||||
try {
|
||||
dialog = await session.waitAndQuery(".mx_QuestionDialog");
|
||||
primaryButton = await session.waitAndQuery(".mx_Dialog [role=dialog] .mx_Dialog_primary");
|
||||
} catch(err) {
|
||||
return false;
|
||||
}
|
||||
if (expectedContent) {
|
||||
const contentElement = await dialog.$(".mx_Dialog_content");
|
||||
const content = await (await contentElement.getProperty("innerText")).jsonValue();
|
||||
assert.ok(content.indexOf(expectedContent) !== -1);
|
||||
if (expectedTitle) {
|
||||
await assertDialog(session, expectedTitle);
|
||||
}
|
||||
const primaryButton = await dialog.$(".mx_Dialog_primary");
|
||||
await primaryButton.click();
|
||||
return true;
|
||||
}
|
||||
@@ -44,4 +46,5 @@ async function acceptDialogMaybe(session, expectedContent) {
|
||||
module.exports = {
|
||||
acceptDialog,
|
||||
acceptDialogMaybe,
|
||||
assertDialog,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user