Some fixes for e2e tests
This commit is contained in:
parent
6c35046ab2
commit
f106cd2850
5 changed files with 28 additions and 13 deletions
3
test/e2e/bin/.gitignore
vendored
Normal file
3
test/e2e/bin/.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
*
|
||||||
|
!.gitignore
|
||||||
|
!README.md
|
|
@ -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');
|
log.error('e2e', 'This script only runs if the testserver is enabled. Check config/test.toml');
|
||||||
process.exit(1);
|
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);
|
||||||
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const Page = require('./page');
|
const Page = require('./page');
|
||||||
let flash;
|
|
||||||
|
|
||||||
class Flash extends Page {
|
class Flash extends Page {
|
||||||
getText() {
|
getText() {
|
||||||
|
@ -17,7 +16,7 @@ class Flash extends Page {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = driver => flash || new Flash(driver, {
|
module.exports = driver => new Flash(driver, {
|
||||||
elementToWaitFor: 'alert',
|
elementToWaitFor: 'alert',
|
||||||
elements: {
|
elements: {
|
||||||
alert: 'div.alert:not(.js-warning)'
|
alert: 'div.alert:not(.js-warning)'
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const Page = require('./page');
|
const Page = require('./page');
|
||||||
let home;
|
|
||||||
|
|
||||||
module.exports = driver => home || new Page(driver, {
|
module.exports = driver => new Page(driver, {
|
||||||
url: '/',
|
url: '/',
|
||||||
elementToWaitFor: 'body',
|
elementToWaitFor: 'body',
|
||||||
elements: {
|
elements: {
|
||||||
|
|
|
@ -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) => ({
|
module.exports = (driver, list) => ({
|
||||||
|
|
||||||
webSubscribe: new Web(driver, {
|
webSubscribe: new WebSubscribe(driver, list),
|
||||||
url: `/subscription/${list.cid}`,
|
|
||||||
elementToWaitFor: 'form',
|
|
||||||
elements: {
|
|
||||||
form: `form[action="/subscription/${list.cid}/subscribe"]`,
|
|
||||||
emailInput: '#main-form input[name="email"]',
|
|
||||||
submitButton: 'a[href="#submit"]'
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
|
|
||||||
webConfirmSubscriptionNotice: new Web(driver, {
|
webConfirmSubscriptionNotice: new Web(driver, {
|
||||||
url: `/subscription/${list.cid}/confirm-notice`,
|
url: `/subscription/${list.cid}/confirm-notice`,
|
||||||
|
|
Loading…
Reference in a new issue