Auto-fix lint errors
This commit is contained in:
parent
4c5720a573
commit
ae0a8b8da4
625 changed files with 3170 additions and 3232 deletions
|
@ -27,5 +27,5 @@ module.exports.approveConsent = async function(consentUrl) {
|
|||
const h = doc("input[name=h]").val();
|
||||
const formAction = doc("form").attr("action");
|
||||
const absAction = url.resolve(consentUrl, formAction);
|
||||
await request.post(absAction).form({v, u, h});
|
||||
await request.post(absAction).form({ v, u, h });
|
||||
};
|
||||
|
|
|
@ -15,7 +15,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
const {exec} = require('child_process');
|
||||
const { exec } = require('child_process');
|
||||
const request = require('request-promise-native');
|
||||
const RestSession = require('./session');
|
||||
const RestMultiSession = require('./multi');
|
||||
|
@ -26,7 +26,7 @@ function execAsync(command, options) {
|
|||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
resolve({stdout, stderr});
|
||||
resolve({ stdout, stderr });
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -67,7 +67,7 @@ module.exports = class RestSessionCreator {
|
|||
registerCmd,
|
||||
].join(' && ');
|
||||
|
||||
await execAsync(allCmds, {cwd: this.cwd, encoding: 'utf-8'});
|
||||
await execAsync(allCmds, { cwd: this.cwd, encoding: 'utf-8' });
|
||||
}
|
||||
|
||||
async _authenticate(username, password) {
|
||||
|
@ -80,7 +80,7 @@ module.exports = class RestSessionCreator {
|
|||
"password": password,
|
||||
};
|
||||
const url = `${this.hsUrl}/_matrix/client/r0/login`;
|
||||
const responseBody = await request.post({url, json: true, body: requestBody});
|
||||
const responseBody = await request.post({ url, json: true, body: requestBody });
|
||||
return {
|
||||
accessToken: responseBody.access_token,
|
||||
homeServer: responseBody.home_server,
|
||||
|
|
|
@ -17,7 +17,7 @@ limitations under the License.
|
|||
const request = require('request-promise-native');
|
||||
const Logger = require('../logger');
|
||||
const RestRoom = require('./room');
|
||||
const {approveConsent} = require('./consent');
|
||||
const { approveConsent } = require('./consent');
|
||||
|
||||
module.exports = class RestSession {
|
||||
constructor(credentials) {
|
||||
|
|
|
@ -14,8 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
const {range} = require('./util');
|
||||
const { range } = require('./util');
|
||||
const signup = require('./usecases/signup');
|
||||
const toastScenarios = require('./scenarios/toast');
|
||||
const roomDirectoryScenarios = require('./scenarios/directory');
|
||||
|
|
|
@ -15,23 +15,22 @@ 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');
|
||||
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", alias: "#test"});
|
||||
await changeRoomSettings(alice, { directory: true, visibility: "public_no_guests", alias: "#test" });
|
||||
await join(bob, room); //looks up room in directory
|
||||
const bobMessage = "hi Alice!";
|
||||
await sendMessage(bob, bobMessage);
|
||||
await receiveMessage(alice, {sender: "bob", body: bobMessage});
|
||||
await receiveMessage(alice, { sender: "bob", body: bobMessage });
|
||||
const aliceMessage = "hi Bob, welcome!";
|
||||
await sendMessage(alice, aliceMessage);
|
||||
await receiveMessage(bob, {sender: "alice", body: aliceMessage});
|
||||
await receiveMessage(bob, { sender: "alice", body: aliceMessage });
|
||||
};
|
||||
|
|
|
@ -17,19 +17,18 @@ limitations under the License.
|
|||
|
||||
const sendMessage = require('../usecases/send-message');
|
||||
const acceptInvite = require('../usecases/accept-invite');
|
||||
const {receiveMessage} = require('../usecases/timeline');
|
||||
const {createDm} = require('../usecases/create-room');
|
||||
const {checkRoomSettings} = require('../usecases/room-settings');
|
||||
const {startSasVerification, acceptSasVerification} = require('../usecases/verify');
|
||||
const { receiveMessage } = require('../usecases/timeline');
|
||||
const { createDm } = require('../usecases/create-room');
|
||||
const { checkRoomSettings } = require('../usecases/room-settings');
|
||||
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:");
|
||||
await createDm(bob, ['@alice:localhost']);
|
||||
await checkRoomSettings(bob, {encryption: true}); // for sanity, should be e2e-by-default
|
||||
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}`);
|
||||
|
@ -44,9 +43,9 @@ module.exports = async function e2eEncryptionScenarios(alice, bob) {
|
|||
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});
|
||||
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});
|
||||
await receiveMessage(alice, { sender: "bob", body: bobMessage, encrypted: true });
|
||||
await setupSecureBackup(alice);
|
||||
};
|
||||
|
|
|
@ -15,17 +15,16 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
const {delay} = require('../util');
|
||||
const { delay } = require('../util');
|
||||
const join = require('../usecases/join');
|
||||
const sendMessage = require('../usecases/send-message');
|
||||
const {
|
||||
checkTimelineContains,
|
||||
scrollToTimelineTop,
|
||||
} = require('../usecases/timeline');
|
||||
const {createRoom} = require('../usecases/create-room');
|
||||
const {getMembersInMemberlist} = require('../usecases/memberlist');
|
||||
const {changeRoomSettings} = require('../usecases/room-settings');
|
||||
const { createRoom } = require('../usecases/create-room');
|
||||
const { getMembersInMemberlist } = require('../usecases/memberlist');
|
||||
const { changeRoomSettings } = require('../usecases/room-settings');
|
||||
const assert = require('assert');
|
||||
|
||||
module.exports = async function lazyLoadingScenarios(alice, bob, charlies) {
|
||||
|
@ -52,7 +51,7 @@ const charlyMsg2 = "how's it going??";
|
|||
|
||||
async function setupRoomWithBobAliceAndCharlies(alice, bob, charlies) {
|
||||
await createRoom(bob, room);
|
||||
await changeRoomSettings(bob, {directory: true, visibility: "public_no_guests", alias});
|
||||
await changeRoomSettings(bob, { directory: true, visibility: "public_no_guests", alias });
|
||||
// wait for alias to be set by server after clicking "save"
|
||||
// so the charlies can join it.
|
||||
await bob.delay(500);
|
||||
|
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
const {assertNoToasts, acceptToast, rejectToast} = require("../usecases/toasts");
|
||||
const { assertNoToasts, acceptToast, rejectToast } = require("../usecases/toasts");
|
||||
|
||||
module.exports = async function toastScenarios(alice, bob) {
|
||||
console.log(" checking and clearing toasts:");
|
||||
|
|
|
@ -18,7 +18,7 @@ limitations under the License.
|
|||
const puppeteer = require('puppeteer');
|
||||
const Logger = require('./logger');
|
||||
const LogBuffer = require('./logbuffer');
|
||||
const {delay} = require('./util');
|
||||
const { delay } = require('./util');
|
||||
|
||||
const DEFAULT_TIMEOUT = 20000;
|
||||
|
||||
|
@ -112,7 +112,7 @@ module.exports = class ElementSession {
|
|||
|
||||
async replaceInputText(input, text) {
|
||||
// click 3 times to select all text
|
||||
await input.click({clickCount: 3});
|
||||
await input.click({ clickCount: 3 });
|
||||
// waiting here solves not having selected all the text by the 3x click above,
|
||||
// presumably because of the Field label animation.
|
||||
await this.delay(300);
|
||||
|
@ -123,7 +123,7 @@ module.exports = class ElementSession {
|
|||
}
|
||||
|
||||
query(selector, timeout = DEFAULT_TIMEOUT, hidden = false) {
|
||||
return this.page.waitForSelector(selector, {visible: true, timeout, hidden});
|
||||
return this.page.waitForSelector(selector, { visible: true, timeout, hidden });
|
||||
}
|
||||
|
||||
async queryAll(selector) {
|
||||
|
|
|
@ -15,7 +15,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
const {findSublist} = require("./create-room");
|
||||
const { findSublist } = require("./create-room");
|
||||
|
||||
module.exports = async function acceptInvite(session, name) {
|
||||
session.log.step(`accepts "${name}" invite`);
|
||||
|
@ -23,9 +23,9 @@ module.exports = async function acceptInvite(session, name) {
|
|||
const invitesHandles = await inviteSublist.$$(".mx_RoomTile_name");
|
||||
const invitesWithText = await Promise.all(invitesHandles.map(async (inviteHandle) => {
|
||||
const text = await session.innerText(inviteHandle);
|
||||
return {inviteHandle, text};
|
||||
return { inviteHandle, text };
|
||||
}));
|
||||
const inviteHandle = invitesWithText.find(({inviteHandle, text}) => {
|
||||
const inviteHandle = invitesWithText.find(({ inviteHandle, text }) => {
|
||||
return text.trim() === name;
|
||||
}).inviteHandle;
|
||||
|
||||
|
|
|
@ -84,4 +84,4 @@ async function createDm(session, invitees) {
|
|||
await measureStop(session, "mx_CreateDM");
|
||||
}
|
||||
|
||||
module.exports = {openRoomDirectory, findSublist, createRoom, createDm};
|
||||
module.exports = { openRoomDirectory, findSublist, createRoom, createDm };
|
||||
|
|
|
@ -15,10 +15,9 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
const {openRoomDirectory} = require('./create-room');
|
||||
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");
|
||||
|
|
|
@ -16,7 +16,7 @@ limitations under the License.
|
|||
*/
|
||||
|
||||
const assert = require('assert');
|
||||
const {openRoomSummaryCard} = require("./rightpanel");
|
||||
const { openRoomSummaryCard } = require("./rightpanel");
|
||||
|
||||
async function openMemberInfo(session, name) {
|
||||
const membersAndNames = await getMembersInMemberlist(session);
|
||||
|
@ -49,7 +49,6 @@ module.exports.verifyDeviceForUser = async function(session, name, expectedDevic
|
|||
const sasLabels = await Promise.all(sasLabelElements.map(e => session.innerText(e)));
|
||||
console.log("my sas labels", sasLabels);
|
||||
|
||||
|
||||
const dialogCodeFields = await session.queryAll(".mx_QuestionDialog code");
|
||||
assert.equal(dialogCodeFields.length, 2);
|
||||
const deviceId = await session.innerText(dialogCodeFields[0]);
|
||||
|
@ -71,7 +70,7 @@ async function getMembersInMemberlist(session) {
|
|||
|
||||
const memberNameElements = await session.queryAll(".mx_MemberList .mx_EntityTile_name");
|
||||
return Promise.all(memberNameElements.map(async (el) => {
|
||||
return {label: el, displayName: await session.innerText(el)};
|
||||
return { label: el, displayName: await session.innerText(el) };
|
||||
}));
|
||||
}
|
||||
|
||||
|
|
|
@ -16,8 +16,8 @@ limitations under the License.
|
|||
*/
|
||||
|
||||
const assert = require('assert');
|
||||
const {openRoomSummaryCard} = require("./rightpanel");
|
||||
const {acceptDialog} = require('./dialog');
|
||||
const { openRoomSummaryCard } = require("./rightpanel");
|
||||
const { acceptDialog } = require('./dialog');
|
||||
|
||||
async function setSettingsToggle(session, toggle, enabled) {
|
||||
const className = await session.getElementProperty(toggle, "className");
|
||||
|
@ -57,13 +57,13 @@ async function findTabs(session) {
|
|||
const tabLabels = await Promise.all(tabButtons.map(t => session.innerText(t)));
|
||||
const securityTabButton = tabButtons[tabLabels.findIndex(l => l.toLowerCase().includes("security"))];
|
||||
|
||||
return {securityTabButton};
|
||||
return { securityTabButton };
|
||||
}
|
||||
|
||||
async function checkRoomSettings(session, expectedSettings) {
|
||||
session.log.startGroup(`checks the room settings`);
|
||||
|
||||
const {securityTabButton} = await findTabs(session);
|
||||
const { securityTabButton } = await findTabs(session);
|
||||
const generalSwitches = await session.queryAll(".mx_RoomSettingsDialog .mx_ToggleSwitch");
|
||||
const isDirectory = generalSwitches[0];
|
||||
|
||||
|
@ -129,7 +129,7 @@ async function checkRoomSettings(session, expectedSettings) {
|
|||
async function changeRoomSettings(session, settings) {
|
||||
session.log.startGroup(`changes the room settings`);
|
||||
|
||||
const {securityTabButton} = await findTabs(session);
|
||||
const { securityTabButton } = await findTabs(session);
|
||||
const generalSwitches = await session.queryAll(".mx_RoomSettingsDialog .mx_ToggleSwitch");
|
||||
const isDirectory = generalSwitches[0];
|
||||
|
||||
|
@ -188,4 +188,4 @@ async function changeRoomSettings(session, settings) {
|
|||
session.log.endGroup();
|
||||
}
|
||||
|
||||
module.exports = {checkRoomSettings, changeRoomSettings};
|
||||
module.exports = { checkRoomSettings, changeRoomSettings };
|
||||
|
|
|
@ -51,5 +51,5 @@ module.exports.getE2EDeviceFromSettings = async function(session) {
|
|||
const closeButton = await session.query(".mx_UserSettingsDialog .mx_Dialog_cancelButton");
|
||||
await closeButton.click();
|
||||
session.log.done();
|
||||
return {id, key};
|
||||
return { id, key };
|
||||
};
|
||||
|
|
|
@ -69,7 +69,6 @@ module.exports.receiveMessage = async function(session, expectedMessage) {
|
|||
session.log.done();
|
||||
};
|
||||
|
||||
|
||||
module.exports.checkTimelineContains = async function(session, expectedMessages, sendersDescription) {
|
||||
session.log.step(`checks timeline contains ${expectedMessages.length} ` +
|
||||
`given messages${sendersDescription ? ` from ${sendersDescription}`:""}`);
|
||||
|
|
|
@ -44,4 +44,4 @@ async function rejectToast(session, expectedTitle) {
|
|||
await btn.click();
|
||||
}
|
||||
|
||||
module.exports = {assertNoToasts, assertToast, acceptToast, rejectToast};
|
||||
module.exports = { assertNoToasts, assertToast, acceptToast, rejectToast };
|
||||
|
|
|
@ -16,7 +16,7 @@ limitations under the License.
|
|||
*/
|
||||
|
||||
const assert = require('assert');
|
||||
const {openMemberInfo} = require("./memberlist");
|
||||
const { openMemberInfo } = require("./memberlist");
|
||||
|
||||
async function startVerification(session, name) {
|
||||
session.log.step("opens their opponent's profile and starts verification");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue