diff --git a/test/e2e/bin/.gitignore b/test/e2e/bin/.gitignore new file mode 100644 index 00000000..7c9d611b --- /dev/null +++ b/test/e2e/bin/.gitignore @@ -0,0 +1,3 @@ +* +!.gitignore +!README.md diff --git a/test/e2e/helpers/exit-unless-test.js b/test/e2e/helpers/exit-unless-test.js index e53b2eed..63c02761 100644 --- a/test/e2e/helpers/exit-unless-test.js +++ b/test/e2e/helpers/exit-unless-test.js @@ -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); +} diff --git a/test/e2e/page-objects/flash.js b/test/e2e/page-objects/flash.js index 2fd7d8da..e90d15f4 100644 --- a/test/e2e/page-objects/flash.js +++ b/test/e2e/page-objects/flash.js @@ -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)' diff --git a/test/e2e/page-objects/home.js b/test/e2e/page-objects/home.js index 72ad84a7..01b5c18b 100644 --- a/test/e2e/page-objects/home.js +++ b/test/e2e/page-objects/home.js @@ -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: { diff --git a/test/e2e/page-objects/subscription.js b/test/e2e/page-objects/subscription.js index 858dfdf7..0ff189be 100644 --- a/test/e2e/page-objects/subscription.js +++ b/test/e2e/page-objects/subscription.js @@ -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`,