Some fixes for e2e tests

This commit is contained in:
witzig 2017-05-10 12:44:48 +02:00
parent 6c35046ab2
commit f106cd2850
5 changed files with 28 additions and 13 deletions

3
test/e2e/bin/.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
*
!.gitignore
!README.md

View file

@ -14,3 +14,8 @@ if (config.app.testserver.enabled !== true) {
log.error('e2e', 'This script only runs if the testserver is enabled. Check config/test.toml');
process.exit(1);
}
if (config.app.www.port !== 3000) {
log.error('e2e', 'This script requires Mailtrain to be running on port 3000. Check config/test.toml');
process.exit(1);
}

View file

@ -1,7 +1,6 @@
'use strict';
const Page = require('./page');
let flash;
class Flash extends Page {
getText() {
@ -17,7 +16,7 @@ class Flash extends Page {
}
}
module.exports = driver => flash || new Flash(driver, {
module.exports = driver => new Flash(driver, {
elementToWaitFor: 'alert',
elements: {
alert: 'div.alert:not(.js-warning)'

View file

@ -1,9 +1,8 @@
'use strict';
const Page = require('./page');
let home;
module.exports = driver => home || new Page(driver, {
module.exports = driver => new Page(driver, {
url: '/',
elementToWaitFor: 'body',
elements: {

View file

@ -18,17 +18,26 @@ class Mail extends Page {
}
}
class WebSubscribe extends Web {
constructor(driver, list) {
super(driver, {
url: `/subscription/${list.cid}`,
elementToWaitFor: 'form',
elements: {
form: `form[action="/subscription/${list.cid}/subscribe"]`,
emailInput: '#main-form input[name="email"]',
submitButton: 'a[href="#submit"]'
}
});
}
foo() {
// ...
}
}
module.exports = (driver, list) => ({
webSubscribe: new Web(driver, {
url: `/subscription/${list.cid}`,
elementToWaitFor: 'form',
elements: {
form: `form[action="/subscription/${list.cid}/subscribe"]`,
emailInput: '#main-form input[name="email"]',
submitButton: 'a[href="#submit"]'
}
}),
webSubscribe: new WebSubscribe(driver, list),
webConfirmSubscriptionNotice: new Web(driver, {
url: `/subscription/${list.cid}/confirm-notice`,