Revert ES6ification of end-to-end tests and add instructions for Windows
Because the tests are run directly by node, we have to use the CommonJS module syntax. We could run the thing through babel, but then we just have another babel. Windows instructions are from experience and may not be optimized.
This commit is contained in:
parent
9f04f94c65
commit
e66f2a6c3f
24 changed files with 103 additions and 52 deletions
|
@ -19,7 +19,7 @@ const request = require('request-promise-native');
|
|||
const cheerio = require('cheerio');
|
||||
const url = require("url");
|
||||
|
||||
export async function approveConsent(consentUrl) {
|
||||
module.exports.approveConsent = async function(consentUrl) {
|
||||
const body = await request.get(consentUrl);
|
||||
const doc = cheerio.load(body);
|
||||
const v = doc("input[name=v]").val();
|
||||
|
@ -28,4 +28,4 @@ export async function approveConsent(consentUrl) {
|
|||
const formAction = doc("form").attr("action");
|
||||
const absAction = url.resolve(consentUrl, formAction);
|
||||
await request.post(absAction).form({v, u, h});
|
||||
}
|
||||
};
|
||||
|
|
|
@ -32,7 +32,7 @@ function execAsync(command, options) {
|
|||
});
|
||||
}
|
||||
|
||||
export default class RestSessionCreator {
|
||||
module.exports = class RestSessionCreator {
|
||||
constructor(synapseSubdir, hsUrl, cwd) {
|
||||
this.synapseSubdir = synapseSubdir;
|
||||
this.hsUrl = hsUrl;
|
||||
|
@ -72,12 +72,12 @@ export default class RestSessionCreator {
|
|||
|
||||
async _authenticate(username, password) {
|
||||
const requestBody = {
|
||||
"type": "m.login.password",
|
||||
"identifier": {
|
||||
"type": "m.id.user",
|
||||
"user": username,
|
||||
},
|
||||
"password": password,
|
||||
"type": "m.login.password",
|
||||
"identifier": {
|
||||
"type": "m.id.user",
|
||||
"user": username,
|
||||
},
|
||||
"password": password,
|
||||
};
|
||||
const url = `${this.hsUrl}/_matrix/client/r0/login`;
|
||||
const responseBody = await request.post({url, json: true, body: requestBody});
|
||||
|
|
|
@ -17,7 +17,7 @@ limitations under the License.
|
|||
|
||||
const Logger = require('../logger');
|
||||
|
||||
export default class RestMultiSession {
|
||||
module.exports = class RestMultiSession {
|
||||
constructor(sessions, groupName) {
|
||||
this.log = new Logger(groupName);
|
||||
this.sessions = sessions;
|
||||
|
|
|
@ -18,7 +18,7 @@ limitations under the License.
|
|||
const uuidv4 = require('uuid/v4');
|
||||
|
||||
/* no pun intented */
|
||||
export default class RestRoom {
|
||||
module.exports = class RestRoom {
|
||||
constructor(session, roomId, log) {
|
||||
this.session = session;
|
||||
this._roomId = roomId;
|
||||
|
|
|
@ -19,7 +19,7 @@ const Logger = require('../logger');
|
|||
const RestRoom = require('./room');
|
||||
const {approveConsent} = require('./consent');
|
||||
|
||||
export default class RestSession {
|
||||
module.exports = class RestSession {
|
||||
constructor(credentials) {
|
||||
this.log = new Logger(credentials.userId);
|
||||
this._credentials = credentials;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue