Fixes in subscriptions. It now passes the tests.
API tests still don't work.
This commit is contained in:
parent
e9165838dc
commit
47b8d80c22
16 changed files with 2649 additions and 975 deletions
|
@ -8,7 +8,7 @@ const only = 'only';
|
|||
const skip = 'skip';
|
||||
|
||||
let tests = [
|
||||
'login',
|
||||
//'login',
|
||||
'subscription'
|
||||
];
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ const fieldHelpers = list => ({
|
|||
|
||||
for (const field of list.customFields) {
|
||||
if (field.key in subscription) {
|
||||
await this.setValue(`[name="${field.column}"]`, subscription[field.key]);
|
||||
await this.setValue(`[name="${field.key}"]`, subscription[field.key]);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -41,7 +41,7 @@ const fieldHelpers = list => ({
|
|||
|
||||
for (const field of list.customFields) {
|
||||
if (field.key in subscription) {
|
||||
expect(await this.getValue(`[name="${field.column}"]`)).to.equal(subscription[field.key]);
|
||||
expect(await this.getValue(`[name="${field.key}"]`)).to.equal(subscription[field.key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -55,16 +55,29 @@ module.exports = list => ({
|
|||
textsToWaitFor: ['Subscribe to list'],
|
||||
elements: {
|
||||
form: `form[action="/subscription/${list.cid}/subscribe"]`,
|
||||
emailInput: '#main-form input[name="email"]',
|
||||
firstNameInput: '#main-form input[name="first-name"]',
|
||||
lastNameInput: '#main-form input[name="last-name"]',
|
||||
emailInput: '#main-form input[name="EMAIL"]',
|
||||
firstNameInput: '#main-form input[name="FIRST_NAME"]',
|
||||
lastNameInput: '#main-form input[name="LAST_NAME"]',
|
||||
submitButton: 'a[href="#submit"]'
|
||||
}
|
||||
}, fieldHelpers(list)),
|
||||
|
||||
webSubscribeAfterPost: web({
|
||||
url: `/subscription/${list.cid}/subscribe`,
|
||||
elementsToWaitFor: ['form'],
|
||||
textsToWaitFor: ['Subscribe to list'],
|
||||
elements: {
|
||||
form: `form[action="/subscription/${list.cid}/subscribe"]`,
|
||||
emailInput: '#main-form input[name="EMAIL"]',
|
||||
firstNameInput: '#main-form input[name="FIRST_NAME"]',
|
||||
lastNameInput: '#main-form input[name="LAST_NAME"]',
|
||||
submitButton: 'a[href="#submit"]'
|
||||
}
|
||||
}, fieldHelpers(list)),
|
||||
|
||||
webSubscribeNonPublic: web({
|
||||
url: `/subscription/${list.cid}`,
|
||||
textsToWaitFor: ['The list does not allow public subscriptions'],
|
||||
textsToWaitFor: ['Permission denied'],
|
||||
}),
|
||||
|
||||
webConfirmSubscriptionNotice: web({
|
||||
|
@ -117,9 +130,9 @@ module.exports = list => ({
|
|||
textsToWaitFor: ['Update Your Preferences'],
|
||||
elements: {
|
||||
form: `form[action="/subscription/${list.cid}/manage"]`,
|
||||
emailInput: '#main-form input[name="email"]',
|
||||
firstNameInput: '#main-form input[name="first-name"]',
|
||||
lastNameInput: '#main-form input[name="last-name"]',
|
||||
emailInput: '#main-form input[name="EMAIL"]',
|
||||
firstNameInput: '#main-form input[name="FIRST_NAME"]',
|
||||
lastNameInput: '#main-form input[name="LAST_NAME"]',
|
||||
submitButton: 'a[href="#submit"]',
|
||||
manageAddressLink: `a[href^="/subscription/${list.cid}/manage-address/"]`
|
||||
},
|
||||
|
@ -134,8 +147,8 @@ module.exports = list => ({
|
|||
textsToWaitFor: ['Update Your Email Address'],
|
||||
elements: {
|
||||
form: `form[action="/subscription/${list.cid}/manage-address"]`,
|
||||
emailInput: '#main-form input[name="email"]',
|
||||
emailNewInput: '#main-form input[name="email-new"]',
|
||||
emailInput: '#main-form input[name="EMAIL"]',
|
||||
emailNewInput: '#main-form input[name="EMAIL_NEW"]',
|
||||
submitButton: 'a[href="#submit"]'
|
||||
}
|
||||
}),
|
||||
|
|
|
@ -15,7 +15,7 @@ function getPage(listConf) {
|
|||
}
|
||||
|
||||
function generateEmail() {
|
||||
return 'keep.' + shortid.generate() + '@mailtrain.org';
|
||||
return 'keep.' + shortid.generate() + '@gmail.com';
|
||||
}
|
||||
|
||||
function generateCustomFieldValue(field) {
|
||||
|
@ -142,8 +142,8 @@ suite('Subscription use-cases', () => {
|
|||
});
|
||||
|
||||
await step('System shows a flash notice that email is invalid.', async () => {
|
||||
await page.webSubscribe.waitForFlash();
|
||||
expect(await page.webSubscribe.getFlash()).to.contain('Invalid email address');
|
||||
await page.webSubscribeAfterPost.waitForFlash();
|
||||
expect(await page.webSubscribeAfterPost.getFlash()).to.contain('Invalid email address');
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue