pass rest session creator to scenario
This commit is contained in:
parent
98aafd6abb
commit
afc678fea0
2 changed files with 13 additions and 2 deletions
|
@ -28,7 +28,7 @@ const acceptServerNoticesInviteAndConsent = require('./tests/server-notices-cons
|
||||||
const getE2EDeviceFromSettings = require('./tests/e2e-device');
|
const getE2EDeviceFromSettings = require('./tests/e2e-device');
|
||||||
const verifyDeviceForUser = require("./tests/verify-device");
|
const verifyDeviceForUser = require("./tests/verify-device");
|
||||||
|
|
||||||
module.exports = async function scenario(createSession) {
|
module.exports = async function scenario(createSession, createRestSession) {
|
||||||
async function createUser(username) {
|
async function createUser(username) {
|
||||||
const session = await createSession(username);
|
const session = await createSession(username);
|
||||||
await signup(session, session.username, 'testtest');
|
await signup(session, session.username, 'testtest');
|
||||||
|
|
13
start.js
13
start.js
|
@ -17,6 +17,7 @@ limitations under the License.
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const RiotSession = require('./src/session');
|
const RiotSession = require('./src/session');
|
||||||
const scenario = require('./src/scenario');
|
const scenario = require('./src/scenario');
|
||||||
|
const RestSessionFactory = require('./src/rest/factory');
|
||||||
|
|
||||||
const program = require('commander');
|
const program = require('commander');
|
||||||
program
|
program
|
||||||
|
@ -40,6 +41,16 @@ async function runTests() {
|
||||||
options.executablePath = path;
|
options.executablePath = path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const restFactory = new RestSessionFactory(
|
||||||
|
'synapse/installations/consent',
|
||||||
|
'http://localhost:5005',
|
||||||
|
__dirname
|
||||||
|
);
|
||||||
|
|
||||||
|
function createRestSession(username, password) {
|
||||||
|
return restFactory.createSession(username, password);
|
||||||
|
}
|
||||||
|
|
||||||
async function createSession(username) {
|
async function createSession(username) {
|
||||||
const session = await RiotSession.create(username, options, program.riotUrl);
|
const session = await RiotSession.create(username, options, program.riotUrl);
|
||||||
sessions.push(session);
|
sessions.push(session);
|
||||||
|
@ -48,7 +59,7 @@ async function runTests() {
|
||||||
|
|
||||||
let failure = false;
|
let failure = false;
|
||||||
try {
|
try {
|
||||||
await scenario(createSession);
|
await scenario(createSession, createRestSession);
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
failure = true;
|
failure = true;
|
||||||
console.log('failure: ', err);
|
console.log('failure: ', err);
|
||||||
|
|
Loading…
Reference in a new issue