Merge branch 'master' of github.com:Mailtrain-org/mailtrain

Conflicts:
	test/e2e/index.js
	test/e2e/lib/mail.js
	test/e2e/lib/mocha-e2e.js
	test/e2e/lib/page.js
	test/e2e/lib/worker-counter.js
	test/e2e/page-objects/subscription.js
This commit is contained in:
Tomas Bures 2017-05-28 19:23:43 +02:00
commit 731226dfeb
20 changed files with 580 additions and 105 deletions

View file

@ -16,7 +16,7 @@ let _ = require('../translate')._;
let util = require('util'); let util = require('util');
let tableHelpers = require('../table-helpers'); let tableHelpers = require('../table-helpers');
let allowedKeys = ['description', 'from', 'address', 'reply_to', 'subject', 'editor_name', 'editor_data', 'template', 'source_url', 'list', 'segment', 'html', 'text', 'tracking_disabled']; let allowedKeys = ['description', 'from', 'address', 'reply_to', 'subject', 'editor_name', 'editor_data', 'template', 'source_url', 'list', 'segment', 'html', 'text', 'click_tracking_disabled', 'open_tracking_disabled'];
module.exports.list = (start, limit, callback) => { module.exports.list = (start, limit, callback) => {
tableHelpers.list('campaigns', ['*'], 'scheduled', null, start, limit, callback); tableHelpers.list('campaigns', ['*'], 'scheduled', null, start, limit, callback);
@ -370,7 +370,8 @@ module.exports.create = (campaign, opts, callback) => {
campaign = tools.convertKeys(campaign); campaign = tools.convertKeys(campaign);
let name = (campaign.name || '').toString().trim(); let name = (campaign.name || '').toString().trim();
campaign.trackingDisabled = campaign.trackingDisabled ? 1 : 0; campaign.openTrackingDisabled = campaign.openTrackingDisabled ? 1 : 0;
campaign.clickTrackingDisabled = campaign.clickTrackingDisabled ? 1 : 0;
opts = opts || {}; opts = opts || {};
@ -592,7 +593,8 @@ module.exports.update = (id, updates, callback) => {
let campaign = tools.convertKeys(updates); let campaign = tools.convertKeys(updates);
let name = (campaign.name || '').toString().trim(); let name = (campaign.name || '').toString().trim();
campaign.trackingDisabled = campaign.trackingDisabled ? 1 : 0; campaign.openTrackingDisabled = campaign.openTrackingDisabled ? 1 : 0;
campaign.clickTrackingDisabled = campaign.clickTrackingDisabled ? 1 : 0;
if (!name) { if (!name) {
return callback(new Error(_('Campaign Name must be set'))); return callback(new Error(_('Campaign Name must be set')));
@ -827,7 +829,7 @@ module.exports.reset = (id, callback) => {
return callback(err); return callback(err);
} }
connection.query('UPDATE campaigns SET `status`=1, `status_change`=NULL, `delivered`=0, `opened`=0, `clicks`=0, `bounced`=0, `complained`=0, `unsubscribed`=0 WHERE id=? LIMIT 1', [id], err => { connection.query('UPDATE campaigns SET `status`=1, `status_change`=NULL, `delivered`=0, `opened`=0, `clicks`=0, `bounced`=0, `complained`=0, `unsubscribed`=0, `blacklisted`=0 WHERE id=? LIMIT 1', [id], err => {
if (err) { if (err) {
connection.release(); connection.release();
return callback(err); return callback(err);

View file

@ -42,7 +42,7 @@ module.exports.countClick = (remoteIp, useragent, campaignCid, listCid, subscrip
return callback(err); return callback(err);
} }
if (!data || data.campaign.trackingDisabled) { if (!data || data.campaign.clickTrackingDisabled) {
return callback(null, false); return callback(null, false);
} }
@ -158,7 +158,7 @@ module.exports.countOpen = (remoteIp, useragent, campaignCid, listCid, subscript
return callback(err); return callback(err);
} }
if (!data || data.campaign.trackingDisabled) { if (!data || data.campaign.openTrackingDisabled) {
return callback(null, false); return callback(null, false);
} }
@ -268,56 +268,64 @@ module.exports.add = (url, campaignId, callback) => {
}; };
module.exports.updateLinks = (campaign, list, subscription, serviceUrl, message, callback) => { module.exports.updateLinks = (campaign, list, subscription, serviceUrl, message, callback) => {
if (campaign.trackingDisabled || !message || !message.trim()) { if ((campaign.openTrackingDisabled && campaign.clickTrackingDisabled) || !message || !message.trim()) {
// tracking is disabled, do not modify the message // tracking is disabled, do not modify the message
return setImmediate(() => callback(null, message)); return setImmediate(() => callback(null, message));
} }
let re = /(<a[^>]* href\s*=[\s"']*)(http[^"'>\s]+)/gi;
let urls = new Set();
(message || '').replace(re, (match, prefix, url) => {
urls.add(url);
});
let map = new Map();
let vals = urls.values();
// insert tracking image // insert tracking image
let inserted = false; if (!campaign.openTrackingDisabled) {
let imgUrl = urllib.resolve(serviceUrl, util.format('/links/%s/%s/%s', campaign.cid, list.cid, encodeURIComponent(subscription.cid))); let inserted = false;
let img = '<img src="' + imgUrl + '" width="1" height="1" alt="mt">'; let imgUrl = urllib.resolve(serviceUrl, util.format('/links/%s/%s/%s', campaign.cid, list.cid, encodeURIComponent(subscription.cid)));
message = message.replace(/<\/body\b/i, match => { let img = '<img src="' + imgUrl + '" width="1" height="1" alt="mt">';
inserted = true; message = message.replace(/<\/body\b/i, match => {
return img + match; inserted = true;
}); return img + match;
if (!inserted) { });
message = message + img; if (!inserted) {
message = message + img;
}
if (campaign.clickTrackingDisabled) {
return callback(null, message);
}
} }
let replaceUrls = () => { if (!campaign.clickTrackingDisabled) {
callback(null, let re = /(<a[^>]* href\s*=[\s"']*)(http[^"'>\s]+)/gi;
message.replace(re, (match, prefix, url) => let urls = new Set();
prefix + (map.has(url) ? urllib.resolve(serviceUrl, util.format('/links/%s/%s/%s/%s', campaign.cid, list.cid, encodeURIComponent(subscription.cid), encodeURIComponent(map.get(url)))) : url))); (message || '').replace(re, (match, prefix, url) => {
}; urls.add(url);
let storeNext = () => {
let urlItem = vals.next();
if (urlItem.done) {
return replaceUrls();
}
module.exports.add(he.decode(urlItem.value, {
isAttributeValue: true
}), campaign.id, (err, linkId, cid) => {
if (err) {
log.error('Link', err);
return storeNext();
}
map.set(urlItem.value, cid);
return storeNext();
}); });
};
storeNext(); let map = new Map();
let vals = urls.values();
let replaceUrls = () => {
callback(null,
message.replace(re, (match, prefix, url) =>
prefix + (map.has(url) ? urllib.resolve(serviceUrl, util.format('/links/%s/%s/%s/%s', campaign.cid, list.cid, encodeURIComponent(subscription.cid), encodeURIComponent(map.get(url)))) : url)));
};
let storeNext = () => {
let urlItem = vals.next();
if (urlItem.done) {
return replaceUrls();
}
module.exports.add(he.decode(urlItem.value, {
isAttributeValue: true
}), campaign.id, (err, linkId, cid) => {
if (err) {
log.error('Link', err);
return storeNext();
}
map.set(urlItem.value, cid);
return storeNext();
});
};
storeNext();
}
}; };
function getSubscriptionData(campaignCid, listCid, subscriptionCid, callback) { function getSubscriptionData(campaignCid, listCid, subscriptionCid, callback) {

View file

@ -1,3 +1,3 @@
{ {
"schemaVersion": 28 "schemaVersion": 29
} }

View file

@ -69,7 +69,6 @@ CREATE TABLE `campaigns` (
`html_prepared` longtext, `html_prepared` longtext,
`text` longtext, `text` longtext,
`status` tinyint(4) unsigned NOT NULL DEFAULT '1', `status` tinyint(4) unsigned NOT NULL DEFAULT '1',
`tracking_disabled` tinyint(4) unsigned NOT NULL DEFAULT '0',
`scheduled` timestamp NULL DEFAULT NULL, `scheduled` timestamp NULL DEFAULT NULL,
`status_change` timestamp NULL DEFAULT NULL, `status_change` timestamp NULL DEFAULT NULL,
`delivered` int(11) unsigned NOT NULL DEFAULT '0', `delivered` int(11) unsigned NOT NULL DEFAULT '0',
@ -80,6 +79,8 @@ CREATE TABLE `campaigns` (
`bounced` int(1) unsigned NOT NULL DEFAULT '0', `bounced` int(1) unsigned NOT NULL DEFAULT '0',
`complained` int(1) unsigned NOT NULL DEFAULT '0', `complained` int(1) unsigned NOT NULL DEFAULT '0',
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`open_tracking_disabled` tinyint(4) unsigned NOT NULL DEFAULT '0',
`click_tracking_disabled` tinyint(4) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `cid` (`cid`), UNIQUE KEY `cid` (`cid`),
KEY `name` (`name`(191)), KEY `name` (`name`(191)),
@ -93,8 +94,8 @@ CREATE TABLE `confirmations` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT, `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`cid` varchar(255) CHARACTER SET ascii NOT NULL, `cid` varchar(255) CHARACTER SET ascii NOT NULL,
`list` int(11) unsigned NOT NULL, `list` int(11) unsigned NOT NULL,
`email` varchar(255) NOT NULL, `action` varchar(100) NOT NULL,
`opt_in_ip` varchar(100) DEFAULT NULL, `ip` varchar(100) DEFAULT NULL,
`data` text NOT NULL, `data` text NOT NULL,
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
@ -193,11 +194,17 @@ CREATE TABLE `lists` (
`subscribers` int(11) unsigned DEFAULT '0', `subscribers` int(11) unsigned DEFAULT '0',
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`public_subscribe` tinyint(1) unsigned NOT NULL DEFAULT '1', `public_subscribe` tinyint(1) unsigned NOT NULL DEFAULT '1',
`unsubscription_mode` int(11) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `cid` (`cid`), UNIQUE KEY `cid` (`cid`),
KEY `name` (`name`(191)) KEY `name` (`name`(191))
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4; ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4;
INSERT INTO `lists` (`id`, `cid`, `default_form`, `name`, `description`, `subscribers`, `created`, `public_subscribe`) VALUES (1,'Hkj1vCoJb',NULL,'01 Testlist - Public Subscribe','',0,NOW(),1); INSERT INTO `lists` (`id`, `cid`, `default_form`, `name`, `description`, `subscribers`, `created`, `public_subscribe`, `unsubscription_mode`) VALUES (1,'Hkj1vCoJb',0,'#1 (one-step, no form)','',0,NOW(),1,0);
INSERT INTO `lists` (`id`, `cid`, `default_form`, `name`, `description`, `subscribers`, `created`, `public_subscribe`, `unsubscription_mode`) VALUES (2,'SktV4HDZ-',NULL,'#2 (one-step, with form)','',0,NOW(),1,1);
INSERT INTO `lists` (`id`, `cid`, `default_form`, `name`, `description`, `subscribers`, `created`, `public_subscribe`, `unsubscription_mode`) VALUES (3,'BkdvNBw-W',NULL,'#3 (two-step, no form)','',0,NOW(),1,2);
INSERT INTO `lists` (`id`, `cid`, `default_form`, `name`, `description`, `subscribers`, `created`, `public_subscribe`, `unsubscription_mode`) VALUES (4,'rJMKVrDZ-',NULL,'#4 (two-step, with form)','',0,NOW(),1,3);
INSERT INTO `lists` (`id`, `cid`, `default_form`, `name`, `description`, `subscribers`, `created`, `public_subscribe`, `unsubscription_mode`) VALUES (5,'SJgoNSw-W',NULL,'#5 (manual unsubscribe)','',0,NOW(),1,4);
INSERT INTO `lists` (`id`, `cid`, `default_form`, `name`, `description`, `subscribers`, `created`, `public_subscribe`, `unsubscription_mode`) VALUES (6,'HyveEPvWW',NULL,'#6 (non-public)','',0,NOW(),0,0);
CREATE TABLE `queued` ( CREATE TABLE `queued` (
`campaign` int(11) unsigned NOT NULL, `campaign` int(11) unsigned NOT NULL,
`list` int(11) unsigned NOT NULL, `list` int(11) unsigned NOT NULL,
@ -269,7 +276,7 @@ CREATE TABLE `settings` (
`value` text NOT NULL, `value` text NOT NULL,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `key` (`key`) UNIQUE KEY `key` (`key`)
) ENGINE=InnoDB AUTO_INCREMENT=112 DEFAULT CHARSET=utf8mb4; ) ENGINE=InnoDB AUTO_INCREMENT=114 DEFAULT CHARSET=utf8mb4;
INSERT INTO `settings` (`id`, `key`, `value`) VALUES (1,'smtp_hostname','localhost'); INSERT INTO `settings` (`id`, `key`, `value`) VALUES (1,'smtp_hostname','localhost');
INSERT INTO `settings` (`id`, `key`, `value`) VALUES (2,'smtp_port','5587'); INSERT INTO `settings` (`id`, `key`, `value`) VALUES (2,'smtp_port','5587');
INSERT INTO `settings` (`id`, `key`, `value`) VALUES (3,'smtp_encryption','NONE'); INSERT INTO `settings` (`id`, `key`, `value`) VALUES (3,'smtp_encryption','NONE');
@ -286,7 +293,7 @@ INSERT INTO `settings` (`id`, `key`, `value`) VALUES (13,'default_from','My Awes
INSERT INTO `settings` (`id`, `key`, `value`) VALUES (14,'default_address','admin@example.com'); INSERT INTO `settings` (`id`, `key`, `value`) VALUES (14,'default_address','admin@example.com');
INSERT INTO `settings` (`id`, `key`, `value`) VALUES (15,'default_subject','Test message'); INSERT INTO `settings` (`id`, `key`, `value`) VALUES (15,'default_subject','Test message');
INSERT INTO `settings` (`id`, `key`, `value`) VALUES (16,'default_homepage','https://mailtrain.org'); INSERT INTO `settings` (`id`, `key`, `value`) VALUES (16,'default_homepage','https://mailtrain.org');
INSERT INTO `settings` (`id`, `key`, `value`) VALUES (17,'db_schema_version','27'); INSERT INTO `settings` (`id`, `key`, `value`) VALUES (17,'db_schema_version','29');
INSERT INTO `settings` (`id`, `key`, `value`) VALUES (46,'ua_code',''); INSERT INTO `settings` (`id`, `key`, `value`) VALUES (46,'ua_code','');
INSERT INTO `settings` (`id`, `key`, `value`) VALUES (47,'shoutout',''); INSERT INTO `settings` (`id`, `key`, `value`) VALUES (47,'shoutout','');
INSERT INTO `settings` (`id`, `key`, `value`) VALUES (54,'mail_transport','smtp'); INSERT INTO `settings` (`id`, `key`, `value`) VALUES (54,'mail_transport','smtp');
@ -361,6 +368,146 @@ CREATE TABLE `subscription__1` (
KEY `latest_click` (`latest_click`), KEY `latest_click` (`latest_click`),
KEY `created` (`created`) KEY `created` (`created`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE `subscription__2` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`cid` varchar(255) CHARACTER SET ascii NOT NULL,
`email` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '',
`opt_in_ip` varchar(100) DEFAULT NULL,
`opt_in_country` varchar(2) DEFAULT NULL,
`tz` varchar(100) CHARACTER SET ascii DEFAULT NULL,
`imported` int(11) unsigned DEFAULT NULL,
`status` tinyint(4) unsigned NOT NULL DEFAULT '1',
`is_test` tinyint(4) unsigned NOT NULL DEFAULT '0',
`status_change` timestamp NULL DEFAULT NULL,
`latest_open` timestamp NULL DEFAULT NULL,
`latest_click` timestamp NULL DEFAULT NULL,
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`first_name` varchar(255) DEFAULT NULL,
`last_name` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`),
UNIQUE KEY `cid` (`cid`),
KEY `status` (`status`),
KEY `first_name` (`first_name`(191)),
KEY `last_name` (`last_name`(191)),
KEY `subscriber_tz` (`tz`),
KEY `is_test` (`is_test`),
KEY `latest_open` (`latest_open`),
KEY `latest_click` (`latest_click`),
KEY `created` (`created`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE `subscription__3` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`cid` varchar(255) CHARACTER SET ascii NOT NULL,
`email` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '',
`opt_in_ip` varchar(100) DEFAULT NULL,
`opt_in_country` varchar(2) DEFAULT NULL,
`tz` varchar(100) CHARACTER SET ascii DEFAULT NULL,
`imported` int(11) unsigned DEFAULT NULL,
`status` tinyint(4) unsigned NOT NULL DEFAULT '1',
`is_test` tinyint(4) unsigned NOT NULL DEFAULT '0',
`status_change` timestamp NULL DEFAULT NULL,
`latest_open` timestamp NULL DEFAULT NULL,
`latest_click` timestamp NULL DEFAULT NULL,
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`first_name` varchar(255) DEFAULT NULL,
`last_name` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`),
UNIQUE KEY `cid` (`cid`),
KEY `status` (`status`),
KEY `first_name` (`first_name`(191)),
KEY `last_name` (`last_name`(191)),
KEY `subscriber_tz` (`tz`),
KEY `is_test` (`is_test`),
KEY `latest_open` (`latest_open`),
KEY `latest_click` (`latest_click`),
KEY `created` (`created`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE `subscription__4` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`cid` varchar(255) CHARACTER SET ascii NOT NULL,
`email` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '',
`opt_in_ip` varchar(100) DEFAULT NULL,
`opt_in_country` varchar(2) DEFAULT NULL,
`tz` varchar(100) CHARACTER SET ascii DEFAULT NULL,
`imported` int(11) unsigned DEFAULT NULL,
`status` tinyint(4) unsigned NOT NULL DEFAULT '1',
`is_test` tinyint(4) unsigned NOT NULL DEFAULT '0',
`status_change` timestamp NULL DEFAULT NULL,
`latest_open` timestamp NULL DEFAULT NULL,
`latest_click` timestamp NULL DEFAULT NULL,
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`first_name` varchar(255) DEFAULT NULL,
`last_name` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`),
UNIQUE KEY `cid` (`cid`),
KEY `status` (`status`),
KEY `first_name` (`first_name`(191)),
KEY `last_name` (`last_name`(191)),
KEY `subscriber_tz` (`tz`),
KEY `is_test` (`is_test`),
KEY `latest_open` (`latest_open`),
KEY `latest_click` (`latest_click`),
KEY `created` (`created`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE `subscription__5` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`cid` varchar(255) CHARACTER SET ascii NOT NULL,
`email` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '',
`opt_in_ip` varchar(100) DEFAULT NULL,
`opt_in_country` varchar(2) DEFAULT NULL,
`tz` varchar(100) CHARACTER SET ascii DEFAULT NULL,
`imported` int(11) unsigned DEFAULT NULL,
`status` tinyint(4) unsigned NOT NULL DEFAULT '1',
`is_test` tinyint(4) unsigned NOT NULL DEFAULT '0',
`status_change` timestamp NULL DEFAULT NULL,
`latest_open` timestamp NULL DEFAULT NULL,
`latest_click` timestamp NULL DEFAULT NULL,
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`first_name` varchar(255) DEFAULT NULL,
`last_name` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`),
UNIQUE KEY `cid` (`cid`),
KEY `status` (`status`),
KEY `first_name` (`first_name`(191)),
KEY `last_name` (`last_name`(191)),
KEY `subscriber_tz` (`tz`),
KEY `is_test` (`is_test`),
KEY `latest_open` (`latest_open`),
KEY `latest_click` (`latest_click`),
KEY `created` (`created`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE `subscription__6` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`cid` varchar(255) CHARACTER SET ascii NOT NULL,
`email` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '',
`opt_in_ip` varchar(100) DEFAULT NULL,
`opt_in_country` varchar(2) DEFAULT NULL,
`tz` varchar(100) CHARACTER SET ascii DEFAULT NULL,
`imported` int(11) unsigned DEFAULT NULL,
`status` tinyint(4) unsigned NOT NULL DEFAULT '1',
`is_test` tinyint(4) unsigned NOT NULL DEFAULT '0',
`status_change` timestamp NULL DEFAULT NULL,
`latest_open` timestamp NULL DEFAULT NULL,
`latest_click` timestamp NULL DEFAULT NULL,
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`first_name` varchar(255) DEFAULT NULL,
`last_name` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`),
UNIQUE KEY `cid` (`cid`),
KEY `status` (`status`),
KEY `first_name` (`first_name`(191)),
KEY `last_name` (`last_name`(191)),
KEY `subscriber_tz` (`tz`),
KEY `is_test` (`is_test`),
KEY `latest_open` (`latest_open`),
KEY `latest_click` (`latest_click`),
KEY `created` (`created`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE `templates` ( CREATE TABLE `templates` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT, `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL DEFAULT '', `name` varchar(255) NOT NULL DEFAULT '',
@ -422,14 +569,14 @@ INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('africa/blantyre',120);
INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('africa/brazzaville',60); INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('africa/brazzaville',60);
INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('africa/bujumbura',120); INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('africa/bujumbura',120);
INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('africa/cairo',120); INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('africa/cairo',120);
INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('africa/casablanca',60); INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('africa/casablanca',0);
INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('africa/ceuta',120); INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('africa/ceuta',120);
INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('africa/conakry',0); INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('africa/conakry',0);
INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('africa/dakar',0); INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('africa/dakar',0);
INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('africa/dar_es_salaam',180); INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('africa/dar_es_salaam',180);
INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('africa/djibouti',180); INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('africa/djibouti',180);
INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('africa/douala',60); INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('africa/douala',60);
INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('africa/el_aaiun',60); INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('africa/el_aaiun',0);
INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('africa/freetown',0); INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('africa/freetown',0);
INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('africa/gaborone',120); INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('africa/gaborone',120);
INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('africa/harare',120); INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('africa/harare',120);
@ -603,7 +750,7 @@ INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('america/rio_branco',-300);
INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('america/rosario',-180); INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('america/rosario',-180);
INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('america/santarem',-180); INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('america/santarem',-180);
INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('america/santa_isabel',-420); INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('america/santa_isabel',-420);
INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('america/santiago',-180); INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('america/santiago',-240);
INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('america/santo_domingo',-240); INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('america/santo_domingo',-240);
INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('america/sao_paulo',-180); INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('america/sao_paulo',-180);
INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('america/scoresbysund',0); INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('america/scoresbysund',0);
@ -788,8 +935,8 @@ INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('canada/pacific',-420);
INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('canada/saskatchewan',-360); INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('canada/saskatchewan',-360);
INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('canada/yukon',-420); INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('canada/yukon',-420);
INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('cet',120); INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('cet',120);
INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('chile/continental',-180); INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('chile/continental',-240);
INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('chile/easterisland',-300); INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('chile/easterisland',-360);
INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('cst6cdt',-300); INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('cst6cdt',-300);
INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('cuba',-240); INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('cuba',-240);
INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('eet',180); INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('eet',180);
@ -936,7 +1083,7 @@ INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('pacific/auckland',720);
INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('pacific/bougainville',660); INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('pacific/bougainville',660);
INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('pacific/chatham',765); INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('pacific/chatham',765);
INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('pacific/chuuk',600); INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('pacific/chuuk',600);
INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('pacific/easter',-300); INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('pacific/easter',-360);
INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('pacific/efate',660); INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('pacific/efate',660);
INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('pacific/enderbury',780); INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('pacific/enderbury',780);
INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('pacific/fakaofo',780); INSERT INTO `tzoffset` (`tz`, `offset`) VALUES ('pacific/fakaofo',780);

View file

@ -0,0 +1,13 @@
# Header section
# Define incrementing schema version number
SET @schema_version = '29';
# Rename column tracking_disabled
ALTER TABLE `campaigns` ADD COLUMN `open_tracking_disabled` tinyint(4) unsigned DEFAULT 0 NOT NULL, ADD COLUMN `click_tracking_disabled` tinyint(4) unsigned DEFAULT 0 NOT NULL;
UPDATE `campaigns` SET `open_tracking_disabled` = `tracking_disabled`, `click_tracking_disabled` = `tracking_disabled`;
ALTER TABLE `campaigns` DROP COLUMN `tracking_disabled`;
# Footer section
LOCK TABLES `settings` WRITE;
INSERT INTO `settings` (`key`, `value`) VALUES('db_schema_version', @schema_version) ON DUPLICATE KEY UPDATE `value`=@schema_version;
UNLOCK TABLES;

View file

@ -2,8 +2,9 @@
"parser": "babel-eslint", "parser": "babel-eslint",
"rules": { "rules": {
"strict": 0, "strict": 0,
"no-invalid-this": 0, "no-console": 0,
"no-unused-expressions": 0 "comma-dangle": 0,
"arrow-body-style": 0
}, },
"env": { "env": {
"mocha": true "mocha": true

View file

@ -1,11 +1,9 @@
'use strict'; 'use strict';
require('./lib/exit-unless-test'); require('./lib/exit-unless-test');
const { mocha } = require('./lib/mocha-e2e'); const mocha = require('./lib/mocha-e2e').mocha;
const path = require('path'); const path = require('path');
global.USE_SHARED_DRIVER = true;
const only = 'only'; const only = 'only';
const skip = 'skip'; const skip = 'skip';

View file

@ -13,15 +13,46 @@ module.exports = {
} }
}, },
lists: { lists: {
one: { l1: {
id: 1, id: 1,
cid: 'Hkj1vCoJb', cid: 'Hkj1vCoJb',
publicSubscribe: 1, publicSubscribe: 1,
unsubscriptionMode: 0 unsubscriptionMode: 0, // (one-step, no form)
},
l2: {
id: 2,
cid: 'SktV4HDZ-',
publicSubscribe: 1,
unsubscriptionMode: 1, // (one-step, with form)
},
l3: {
id: 3,
cid: 'BkdvNBw-W',
publicSubscribe: 1,
unsubscriptionMode: 2, // (two-step, no form)
},
l4: {
id: 4,
cid: 'rJMKVrDZ-',
publicSubscribe: 1,
unsubscriptionMode: 3, // (two-step, with form)
},
l5: {
id: 5,
cid: 'SJgoNSw-W',
publicSubscribe: 1,
unsubscriptionMode: 4, // (manual unsubscribe)
},
l6: {
id: 6,
cid: 'HyveEPvWW',
publicSubscribe: 0,
unsubscriptionMode: 0, // (one-step, no form)
} }
}, },
settings: { settings: {
'service-url' : 'http://localhost:' + config.www.port + '/', 'service-url': 'http://localhost:' + config.www.port + '/',
'admin-email': 'admin@example.com',
'default-homepage': 'https://mailtrain.org', 'default-homepage': 'https://mailtrain.org',
'smtp-hostname': config.testserver.host, 'smtp-hostname': config.testserver.host,
'smtp-port': config.testserver.port, 'smtp-port': config.testserver.port,

View file

@ -13,10 +13,8 @@ const driver = new webdriver.Builder()
.forBrowser(config.app.seleniumwebdriver.browser || 'phantomjs') .forBrowser(config.app.seleniumwebdriver.browser || 'phantomjs')
.build(); .build();
const failHandlerRunning = new WorkerCounter(); const failHandlerRunning = new WorkerCounter();
function UseCaseReporter(runner) { function UseCaseReporter(runner) {
Mocha.reporters.Base.call(this, runner); Mocha.reporters.Base.call(this, runner);

View file

@ -32,9 +32,13 @@ module.exports = (...extras) => Object.assign({
return params; return params;
}, },
async waitUntilVisible() { async waitUntilVisible(selector) {
await driver.wait(until.elementLocated(By.css('body')), waitTimeout); await driver.wait(until.elementLocated(By.css('body')), waitTimeout);
if (selector) {
await driver.wait(until.elementLocated(By.css(selector)), waitTimeout);
}
for (const elem of (this.elementsToWaitFor || [])) { for (const elem of (this.elementsToWaitFor || [])) {
const sel = this.elements[elem]; const sel = this.elements[elem];
if (!sel) { if (!sel) {
@ -54,13 +58,13 @@ module.exports = (...extras) => Object.assign({
await driver.executeScript('document.mailTrainRefreshAcknowledged = true;'); await driver.executeScript('document.mailTrainRefreshAcknowledged = true;');
}, },
async waitUntilVisibleAfterRefresh() { async waitUntilVisibleAfterRefresh(selector) {
await driver.wait(new webdriver.Condition('for refresh', async driver => { await driver.wait(new webdriver.Condition('for refresh', async driver => {
const val = await driver.executeScript('return document.mailTrainRefreshAcknowledged;'); const val = await driver.executeScript('return document.mailTrainRefreshAcknowledged;');
return !val; return !val;
}), waitTimeout); }), waitTimeout);
await this.waitUntilVisible(); await this.waitUntilVisible(selector);
}, },
async click(key) { async click(key) {

View file

@ -19,6 +19,11 @@ module.exports = list => ({
} }
}), }),
webSubscribeNonPublic: web({
url: `/subscription/${list.cid}`,
textsToWaitFor: ['The list does not allow public subscriptions'],
}),
webConfirmSubscriptionNotice: web({ webConfirmSubscriptionNotice: web({
url: `/subscription/${list.cid}/confirm-subscription-notice`, url: `/subscription/${list.cid}/confirm-subscription-notice`,
textsToWaitFor: ['We need to confirm your email address'] textsToWaitFor: ['We need to confirm your email address']
@ -116,6 +121,36 @@ module.exports = list => ({
elements: { elements: {
resubscribeLink: `a[href^="${config.settings['service-url']}subscription/${list.cid}"]` resubscribeLink: `a[href^="${config.settings['service-url']}subscription/${list.cid}"]`
} }
}) }),
});
webUnsubscribe: web({
elementsToWaitFor: ['submitButton'],
textsToWaitFor: ['Unsubscribe'],
elements: {
submitButton: 'a[href="#submit"]'
}
}),
webConfirmUnsubscriptionNotice: web({
url: `/subscription/${list.cid}/confirm-unsubscription-notice`,
textsToWaitFor: ['We need to confirm your email address']
}),
mailConfirmUnsubscription: mail({
elementsToWaitFor: ['confirmLink'],
textsToWaitFor: ['Please Confirm Unsubscription'],
elements: {
confirmLink: `a[href^="${config.settings['service-url']}subscription/confirm/unsubscribe/"]`
}
}),
webManualUnsubscribeNotice: web({
url: `/subscription/${list.cid}/manual-unsubscribe-notice`,
elementsToWaitFor: ['contactLink'],
textsToWaitFor: ['Online Unsubscription Is Not Possible', config.settings['admin-email']],
elements: {
contactLink: `a[href^="mailto:${config.settings['admin-email']}"]`
}
}),
});

View file

@ -9,7 +9,7 @@ const expect = require('chai').expect;
const page = require('../page-objects/user'); const page = require('../page-objects/user');
const home = require('../page-objects/home'); const home = require('../page-objects/home');
suite('Login use-cases', function() { suite('Login use-cases', () => {
before(() => driver.manage().deleteAllCookies()); before(() => driver.manage().deleteAllCookies());
test('User can access home page', async () => { test('User can access home page', async () => {

View file

@ -6,14 +6,19 @@ const config = require('../lib/config');
const { useCase, step, precondition, driver } = require('../lib/mocha-e2e'); const { useCase, step, precondition, driver } = require('../lib/mocha-e2e');
const shortid = require('shortid'); const shortid = require('shortid');
const expect = require('chai').expect; const expect = require('chai').expect;
const createPage = require('../page-objects/subscription');
const page = require('../page-objects/subscription')(config.lists.one); function getPage(listConf) {
return createPage(listConf);
}
function generateEmail() { function generateEmail() {
return 'keep.' + shortid.generate() + '@mailtrain.org'; return 'keep.' + shortid.generate() + '@mailtrain.org';
} }
async function subscribe(subscription) { async function subscribe(listConf, subscription) {
const page = getPage(listConf);
await step('User navigates to list subscription page.', async () => { await step('User navigates to list subscription page.', async () => {
await page.webSubscribe.navigate(); await page.webSubscribe.navigate();
}); });
@ -62,23 +67,25 @@ async function subscribe(subscription) {
return subscription; return subscription;
} }
async function subscriptionExistsPrecondition(subscription) { async function subscriptionExistsPrecondition(listConf, subscription) {
await precondition('Subscription exists', 'Subscription to a public list (main scenario)', async () => { await precondition('Subscription exists', 'Subscription to a public list (main scenario)', async () => {
await subscribe(subscription); await subscribe(listConf, subscription);
}); });
return subscription; return subscription;
} }
suite('Subscription use-cases', function() { suite('Subscription use-cases', () => {
before(() => driver.manage().deleteAllCookies()); before(() => driver.manage().deleteAllCookies());
useCase('Subscription to a public list (main scenario)', async () => { useCase('Subscription to a public list (main scenario)', async () => {
await subscribe({ await subscribe(config.lists.l1, {
email: generateEmail() email: generateEmail()
}); });
}); });
useCase('Subscription to a public list (invalid email)', async () => { useCase('Subscription to a public list (invalid email)', async () => {
const page = getPage(config.lists.l1);
await step('User navigates to list subscribe page', async () => { await step('User navigates to list subscribe page', async () => {
await page.webSubscribe.navigate(); await page.webSubscribe.navigate();
}); });
@ -95,7 +102,9 @@ suite('Subscription use-cases', function() {
}); });
useCase('Subscription to a public list (email already registered)', async () => { useCase('Subscription to a public list (email already registered)', async () => {
const subscription = await subscriptionExistsPrecondition({ const page = getPage(config.lists.l1);
const subscription = await subscriptionExistsPrecondition(config.lists.l1, {
email: generateEmail() email: generateEmail()
}); });
@ -118,10 +127,18 @@ suite('Subscription use-cases', function() {
}); });
useCase('Subscription to a non-public list'); useCase('Subscription to a non-public list', async () => {
const page = getPage(config.lists.l6);
await step('User navigates to list subscription page and sees message that this list does not allow public subscriptions.', async () => {
await page.webSubscribeNonPublic.navigate();
});
});
useCase('Change profile info', async () => { useCase('Change profile info', async () => {
const subscription = await subscriptionExistsPrecondition({ const page = getPage(config.lists.l1);
const subscription = await subscriptionExistsPrecondition(config.lists.l1, {
email: generateEmail(), email: generateEmail(),
firstName: 'John', firstName: 'John',
lastName: 'Doe' lastName: 'Doe'
@ -163,7 +180,9 @@ suite('Subscription use-cases', function() {
}); });
useCase('Change email', async () => { useCase('Change email', async () => {
const subscription = await subscriptionExistsPrecondition({ const page = getPage(config.lists.l1);
const subscription = await subscriptionExistsPrecondition(config.lists.l1, {
email: generateEmail(), email: generateEmail(),
firstName: 'John', firstName: 'John',
lastName: 'Doe' lastName: 'Doe'
@ -221,7 +240,9 @@ suite('Subscription use-cases', function() {
}); });
useCase('Unsubscription from list #1 (one-step, no form).', async () => { useCase('Unsubscription from list #1 (one-step, no form).', async () => {
const subscription = await subscriptionExistsPrecondition({ const page = getPage(config.lists.l1);
const subscription = await subscriptionExistsPrecondition(config.lists.l1, {
email: generateEmail() email: generateEmail()
}); });
@ -238,13 +259,181 @@ suite('Subscription use-cases', function() {
}); });
}); });
useCase('Unsubscription from list #2 (one-step, with form).'); useCase('Unsubscription from list #2 (one-step, with form).', async () => {
const page = getPage(config.lists.l2);
useCase('Unsubscription from list #3 (two-step, no form).'); const subscription = await subscriptionExistsPrecondition(config.lists.l2, {
email: generateEmail()
});
useCase('Unsubscription from list #4 (two-step, with form).'); await step('User clicks the unsubscribe button.', async () => {
await page.mailSubscriptionConfirmed.click('unsubscribeLink');
});
useCase('Unsubscription from list #5 (manual unsubscribe).'); await step('Systems shows a form to unsubscribe.', async () => {
await page.webUnsubscribe.waitUntilVisibleAfterRefresh();
});
await step('User confirms unsubscribe and clicks the unsubscribe button.', async () => {
await page.webUnsubscribe.submit();
});
await step('System shows a notice that confirms unsubscription.', async () => {
await page.webUnsubscribedNotice.waitUntilVisibleAfterRefresh();
});
await step('System sends an email that confirms unsubscription.', async () => {
await page.mailUnsubscriptionConfirmed.fetchMail(subscription.email);
});
});
useCase('Unsubscription from list #3 (two-step, no form).', async () => {
const page = getPage(config.lists.l3);
const subscription = await subscriptionExistsPrecondition(config.lists.l3, {
email: generateEmail()
});
await step('User clicks the unsubscribe button.', async () => {
await page.mailSubscriptionConfirmed.click('unsubscribeLink');
});
await step('System shows a notice that further instructions are in the email.', async () => {
await page.webConfirmUnsubscriptionNotice.waitUntilVisibleAfterRefresh();
});
await step('System sends an email with a link to confirm unsubscription.', async () => {
await page.mailConfirmUnsubscription.fetchMail(subscription.email);
});
await step('User clicks the confirm unsubscribe button in the email.', async () => {
await page.mailConfirmUnsubscription.click('confirmLink');
});
await step('System shows a notice that confirms unsubscription.', async () => {
await page.webUnsubscribedNotice.waitUntilVisibleAfterRefresh();
});
await step('System sends an email that confirms unsubscription.', async () => {
await page.mailUnsubscriptionConfirmed.fetchMail(subscription.email);
});
});
useCase('Unsubscription from list #4 (two-step, with form).', async () => {
const page = getPage(config.lists.l4);
const subscription = await subscriptionExistsPrecondition(config.lists.l4, {
email: generateEmail()
});
await step('User clicks the unsubscribe button.', async () => {
await page.mailSubscriptionConfirmed.click('unsubscribeLink');
});
await step('Systems shows a form to unsubscribe.', async () => {
await page.webUnsubscribe.waitUntilVisibleAfterRefresh();
});
await step('User confirms unsubscribe and clicks the unsubscribe button.', async () => {
await page.webUnsubscribe.submit();
});
await step('System shows a notice that further instructions are in the email.', async () => {
await page.webConfirmUnsubscriptionNotice.waitUntilVisibleAfterRefresh();
});
await step('System sends an email with a link to confirm unsubscription.', async () => {
await page.mailConfirmUnsubscription.fetchMail(subscription.email);
});
await step('User clicks the confirm unsubscribe button in the email.', async () => {
await page.mailConfirmUnsubscription.click('confirmLink');
});
await step('System shows a notice that confirms unsubscription.', async () => {
await page.webUnsubscribedNotice.waitUntilVisibleAfterRefresh();
});
await step('System sends an email that confirms unsubscription.', async () => {
await page.mailUnsubscriptionConfirmed.fetchMail(subscription.email);
});
});
useCase('Unsubscription from list #5 (manual unsubscribe).', async () => {
const page = getPage(config.lists.l5);
await subscriptionExistsPrecondition(config.lists.l5, {
email: generateEmail()
});
await step('User clicks the unsubscribe button.', async () => {
await page.mailSubscriptionConfirmed.click('unsubscribeLink');
});
await step('Systems shows a notice that online unsubscription is not possible.', async () => {
await page.webManualUnsubscribeNotice.waitUntilVisibleAfterRefresh();
});
});
useCase('Resubscription.', async () => {
const page = getPage(config.lists.l1);
const subscription = await subscriptionExistsPrecondition(config.lists.l1, {
email: generateEmail(),
firstName: 'John',
lastName: 'Doe'
});
await step('User clicks the unsubscribe button.', async () => {
await page.mailSubscriptionConfirmed.click('unsubscribeLink');
});
await step('System shows a notice that confirms unsubscription.', async () => {
await page.webUnsubscribedNotice.waitUntilVisibleAfterRefresh();
});
await step('System sends an email that confirms unsubscription.', async () => {
await page.mailUnsubscriptionConfirmed.fetchMail(subscription.email);
});
await step('User clicks the resubscribe button.', async () => {
await page.mailUnsubscriptionConfirmed.click('resubscribeLink');
});
await step('Systems shows the subscription form. The form contains data entered during initial subscription.', async () => {
await page.webSubscribe.waitUntilVisibleAfterRefresh();
expect(await page.webSubscribe.getValue('emailInput')).to.equal(subscription.email);
expect(await page.webSubscribe.getValue('firstNameInput')).to.equal(subscription.firstName);
expect(await page.webSubscribe.getValue('lastNameInput')).to.equal(subscription.lastName);
});
await step('User submits the subscription form.', async () => {
await page.webSubscribe.submit();
});
await step('System shows a notice that further instructions are in the email.', async () => {
await page.webConfirmSubscriptionNotice.waitUntilVisibleAfterRefresh();
});
await step('System sends an email with a link to confirm the subscription.', async () => {
await page.mailConfirmSubscription.fetchMail(subscription.email);
});
await step('User clicks confirm subscription in the email', async () => {
await page.mailConfirmSubscription.click('confirmLink');
});
await step('System shows a notice that subscription has been confirmed.', async () => {
await page.webSubscribedNotice.waitUntilVisibleAfterRefresh();
});
await step('System sends an email with subscription confirmation. The manage and unsubscribe links are identical with the initial subscription.', async () => {
await page.mailSubscriptionConfirmed.fetchMail(subscription.email);
const unsubscribeLink = await page.mailSubscriptionConfirmed.getHref('unsubscribeLink');
const manageLink = await page.mailSubscriptionConfirmed.getHref('manageLink');
expect(subscription.unsubscribeLink).to.equal(unsubscribeLink);
expect(subscription.manageLink).to.equal(manageLink);
});
});
useCase('Resubscription.'); // This one is supposed to check that values pre-filled in resubscription (i.e. the re-subscribe link in unsubscription confirmation) are the same as the ones used before.
}); });

View file

@ -84,7 +84,15 @@
<div class="col-sm-offset-2"> <div class="col-sm-offset-2">
<div class="checkbox"> <div class="checkbox">
<label> <label>
<input type="checkbox" name="tracking-disabled" value="1" {{#if trackingDisabled}} checked {{/if}}> {{#translate}}Disable clicked/opened tracking{{/translate}} <input type="checkbox" name="open-tracking-disabled" value="1" {{#if openTrackingDisabled}} checked {{/if}}> {{#translate}}Disable opened tracking{{/translate}}
</label>
</div>
</div>
<div class="col-sm-offset-2">
<div class="checkbox">
<label>
<input type="checkbox" name="click-tracking-disabled" value="1" {{#if clickTrackingDisabled}} checked {{/if}}> {{#translate}}Disable clicked tracking{{/translate}}
</label> </label>
</div> </div>
</div> </div>

View file

@ -104,7 +104,15 @@
<div class="col-sm-offset-2"> <div class="col-sm-offset-2">
<div class="checkbox"> <div class="checkbox">
<label> <label>
<input type="checkbox" name="tracking-disabled" value="1" {{#if trackingDisabled}} checked {{/if}}> {{#translate}}Disable clicked/opened tracking{{/translate}} <input type="checkbox" name="open-tracking-disabled" value="1" {{#if openTrackingDisabled}} checked {{/if}}> {{#translate}}Disable opened tracking{{/translate}}
</label>
</div>
</div>
<div class="col-sm-offset-2">
<div class="checkbox">
<label>
<input type="checkbox" name="click-tracking-disabled" value="1" {{#if clickTrackingDisabled}} checked {{/if}}> {{#translate}}Disable clicked tracking{{/translate}}
</label> </label>
</div> </div>
</div> </div>

View file

@ -110,7 +110,15 @@
<div class="col-sm-offset-2"> <div class="col-sm-offset-2">
<div class="checkbox"> <div class="checkbox">
<label> <label>
<input type="checkbox" name="tracking-disabled" value="1" {{#if trackingDisabled}} checked {{/if}}> {{#translate}}Disable clicked/opened tracking{{/translate}} <input type="checkbox" name="open-tracking-disabled" value="1" {{#if openTrackingDisabled}} checked {{/if}}> {{#translate}}Disable opened tracking{{/translate}}
</label>
</div>
</div>
<div class="col-sm-offset-2">
<div class="checkbox">
<label>
<input type="checkbox" name="click-tracking-disabled" value="1" {{#if clickTrackingDisabled}} checked {{/if}}> {{#translate}}Disable clicked tracking{{/translate}}
</label> </label>
</div> </div>
</div> </div>

View file

@ -111,7 +111,15 @@
<div class="col-sm-offset-2"> <div class="col-sm-offset-2">
<div class="checkbox"> <div class="checkbox">
<label> <label>
<input type="checkbox" name="tracking-disabled" value="1" {{#if trackingDisabled}} checked {{/if}}> {{#translate}}Disable clicked/opened tracking{{/translate}} <input type="checkbox" name="open-tracking-disabled" value="1" {{#if openTrackingDisabled}} checked {{/if}}> {{#translate}}Disable opened tracking{{/translate}}
</label>
</div>
</div>
<div class="col-sm-offset-2">
<div class="checkbox">
<label>
<input type="checkbox" name="click-tracking-disabled" value="1" {{#if clickTrackingDisabled}} checked {{/if}}> {{#translate}}Disable clicked tracking{{/translate}}
</label> </label>
</div> </div>
</div> </div>

View file

@ -103,7 +103,15 @@
<div class="col-sm-offset-2"> <div class="col-sm-offset-2">
<div class="checkbox"> <div class="checkbox">
<label> <label>
<input type="checkbox" name="tracking-disabled" value="1" {{#if trackingDisabled}} checked {{/if}}> {{#translate}}Disable clicked/opened tracking{{/translate}} <input type="checkbox" name="open-tracking-disabled" value="1" {{#if openTrackingDisabled}} checked {{/if}}> {{#translate}}Disable opened tracking{{/translate}}
</label>
</div>
</div>
<div class="col-sm-offset-2">
<div class="checkbox">
<label>
<input type="checkbox" name="click-tracking-disabled" value="1" {{#if clickTrackingDisabled}} checked {{/if}}> {{#translate}}Disable clicked tracking{{/translate}}
</label> </label>
</div> </div>
</div> </div>

View file

@ -121,7 +121,15 @@
<div class="col-sm-offset-2"> <div class="col-sm-offset-2">
<div class="checkbox"> <div class="checkbox">
<label> <label>
<input type="checkbox" name="tracking-disabled" value="1" {{#if trackingDisabled}} checked {{/if}}> {{#translate}}Disable clicked/opened tracking{{/translate}} <input type="checkbox" name="open-tracking-disabled" value="1" {{#if openTrackingDisabled}} checked {{/if}}> {{#translate}}Disable opened tracking{{/translate}}
</label>
</div>
</div>
<div class="col-sm-offset-2">
<div class="checkbox">
<label>
<input type="checkbox" name="click-tracking-disabled" value="1" {{#if clickTrackingDisabled}} checked {{/if}}> {{#translate}}Disable clicked tracking{{/translate}}
</label> </label>
</div> </div>
</div> </div>

View file

@ -164,7 +164,7 @@
</div> </div>
</dd> </dd>
{{#unless trackingDisabled}} {{#unless openTrackingDisabled}}
<dt>{{#translate}}Opened{{/translate}} <a href="/campaigns/opened/{{id}}" title="{{#translate}}List subscribers who opened this message{{/translate}}"><span class="glyphicon glyphicon-zoom-in" aria-hidden="true"></span></a></dt> <dt>{{#translate}}Opened{{/translate}} <a href="/campaigns/opened/{{id}}" title="{{#translate}}List subscribers who opened this message{{/translate}}"><span class="glyphicon glyphicon-zoom-in" aria-hidden="true"></span></a></dt>
<dd> <dd>
@ -174,7 +174,8 @@
</div> </div>
</div> </div>
</dd> </dd>
{{/unless}}
{{#unless clickTrackingDisabled}}
<dt>{{#translate}}Clicked{{/translate}} <a href="/campaigns/clicked/{{id}}/all" title="{{#translate}}List subscribers who clicked on a link{{/translate}}"> <span class="glyphicon glyphicon-zoom-in" aria-hidden="true"></span></a></dt> <dt>{{#translate}}Clicked{{/translate}} <a href="/campaigns/clicked/{{id}}/all" title="{{#translate}}List subscribers who clicked on a link{{/translate}}"> <span class="glyphicon glyphicon-zoom-in" aria-hidden="true"></span></a></dt>
<dd> <dd>
<div class="progress"> <div class="progress">