Fix acceptance tests
[MAILPOET-2677]
This commit is contained in:
committed by
Veljko V
parent
3194d93a07
commit
d1968dfe50
@ -5,6 +5,7 @@ import { onChange, t } from 'common/functions';
|
|||||||
type Props = {
|
type Props = {
|
||||||
id?: string
|
id?: string
|
||||||
value: string
|
value: string
|
||||||
|
automationId?: string
|
||||||
linkAutomationId?: string
|
linkAutomationId?: string
|
||||||
setValue: (x: string) => any
|
setValue: (x: string) => any
|
||||||
preview: 'manage' | 'unsubscribe' | 'confirm'
|
preview: 'manage' | 'unsubscribe' | 'confirm'
|
||||||
@ -17,7 +18,12 @@ export default (props: Props) => {
|
|||||||
: pages[0];
|
: pages[0];
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<select id={props.id} value={props.value} onChange={onChange(props.setValue)}>
|
<select
|
||||||
|
id={props.id}
|
||||||
|
data-automation-id={props.automationId}
|
||||||
|
value={props.value}
|
||||||
|
onChange={onChange(props.setValue)}
|
||||||
|
>
|
||||||
{pages.map((page) => (
|
{pages.map((page) => (
|
||||||
<option key={page.id} value={page.id}>
|
<option key={page.id} value={page.id}>
|
||||||
{`${page.title}`}
|
{`${page.title}`}
|
||||||
|
@ -24,7 +24,15 @@ export default () => {
|
|||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<button type="button" className="button button-primary" disabled={isSaving || hasError} onClick={onClick}>{MailPoet.I18n.t('saveSettings')}</button>
|
<button
|
||||||
|
type="button"
|
||||||
|
data-automation-id="settings-submit-button"
|
||||||
|
className="button button-primary"
|
||||||
|
disabled={isSaving || hasError}
|
||||||
|
onClick={onClick}
|
||||||
|
>
|
||||||
|
{MailPoet.I18n.t('saveSettings')}
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -29,14 +29,14 @@ export default function DefaultSender() {
|
|||||||
type="text"
|
type="text"
|
||||||
id="sender-name"
|
id="sender-name"
|
||||||
placeholder={t`yourName`}
|
placeholder={t`yourName`}
|
||||||
data-automation-id="settings-page-from-name-field"
|
data-automation-id="from-name-field"
|
||||||
value={senderName}
|
value={senderName}
|
||||||
onChange={onChange(setSenderName)}
|
onChange={onChange(setSenderName)}
|
||||||
/>
|
/>
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="from@mydomain.com"
|
placeholder="from@mydomain.com"
|
||||||
data-automation-id="settings-page-from-email-field"
|
data-automation-id="from-email-field"
|
||||||
value={senderEmail}
|
value={senderEmail}
|
||||||
onChange={onChange(setSenderEmail)}
|
onChange={onChange(setSenderEmail)}
|
||||||
/>
|
/>
|
||||||
@ -56,14 +56,14 @@ export default function DefaultSender() {
|
|||||||
type="text"
|
type="text"
|
||||||
id="reply_to-name"
|
id="reply_to-name"
|
||||||
placeholder={t`yourName`}
|
placeholder={t`yourName`}
|
||||||
data-automation-id="settings-page-from-name-field"
|
data-automation-id="reply_to-name-field"
|
||||||
value={replyToName}
|
value={replyToName}
|
||||||
onChange={onChange(setReplyToName)}
|
onChange={onChange(setReplyToName)}
|
||||||
/>
|
/>
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="reply_to@mydomain.com"
|
placeholder="reply_to@mydomain.com"
|
||||||
data-automation-id="settings-page-from-email-field"
|
data-automation-id="reply_to-email-field"
|
||||||
value={replyToEmail}
|
value={replyToEmail}
|
||||||
onChange={onChange(setReplyToEmail)}
|
onChange={onChange(setReplyToEmail)}
|
||||||
/>
|
/>
|
||||||
|
@ -19,14 +19,15 @@ export default function ManageSubscription() {
|
|||||||
{t`manageSubDescription2`}
|
{t`manageSubDescription2`}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
htmlFor="subscription-pages-manage"
|
htmlFor="subscription-manage-page"
|
||||||
/>
|
/>
|
||||||
<Inputs>
|
<Inputs>
|
||||||
<PagesSelect
|
<PagesSelect
|
||||||
value={page}
|
value={page}
|
||||||
preview="manage"
|
preview="manage"
|
||||||
setValue={setPage}
|
setValue={setPage}
|
||||||
id="subscription-pages-manage"
|
id="subscription-manage-page"
|
||||||
|
automationId="subscription-manage-page-selection"
|
||||||
linkAutomationId="preview_manage_subscription_page_link"
|
linkAutomationId="preview_manage_subscription_page_link"
|
||||||
/>
|
/>
|
||||||
<br />
|
<br />
|
||||||
|
@ -24,6 +24,7 @@ export default function SubscribeOn({ title, description, event }: Props) {
|
|||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
id={`subscribe-${event}-enabled`}
|
id={`subscribe-${event}-enabled`}
|
||||||
|
data-automation-id={`subscribe-${event}-checkbox`}
|
||||||
checked={enabled === '1'}
|
checked={enabled === '1'}
|
||||||
onChange={onToggle(setEnabled)}
|
onChange={onToggle(setEnabled)}
|
||||||
/>
|
/>
|
||||||
@ -39,7 +40,9 @@ export default function SubscribeOn({ title, description, event }: Props) {
|
|||||||
<br />
|
<br />
|
||||||
<label htmlFor={`subscribe-${event}-segments`}>{t`usersWillBeSubscribedTo`}</label>
|
<label htmlFor={`subscribe-${event}-segments`}>{t`usersWillBeSubscribedTo`}</label>
|
||||||
<br />
|
<br />
|
||||||
<SegmentsSelect id={`subscribe-${event}-segments`} placeholder={t`chooseList`} value={segments} setValue={setSegments} />
|
<div data-automation-id={`subscribe-${event}-segments-selection`}>
|
||||||
|
<SegmentsSelect id={`subscribe-${event}-segments`} placeholder={t`chooseList`} value={segments} setValue={setSegments} />
|
||||||
|
</div>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</Inputs>
|
</Inputs>
|
||||||
|
@ -407,8 +407,8 @@ class Menu {
|
|||||||
|
|
||||||
// New Settings page
|
// New Settings page
|
||||||
$this->wp->addSubmenuPage(
|
$this->wp->addSubmenuPage(
|
||||||
true,
|
self::MAIN_PAGE_SLUG,
|
||||||
$this->setPageTitle('New Settings'),
|
$this->setPageTitle(__('Settings', 'mailpoet')),
|
||||||
'',
|
'',
|
||||||
AccessControl::PERMISSION_MANAGE_SETTINGS,
|
AccessControl::PERMISSION_MANAGE_SETTINGS,
|
||||||
'mailpoet-new-settings',
|
'mailpoet-new-settings',
|
||||||
|
@ -27,7 +27,7 @@ class AuthorizedEmailAddressesValidationCest {
|
|||||||
$i->cantSee($errorMessagePrefix);
|
$i->cantSee($errorMessagePrefix);
|
||||||
|
|
||||||
// default sender is invalid
|
// default sender is invalid
|
||||||
$i->fillField('[data-automation-id="settings-page-from-email-field"]', $unauthorizedSendingEmail);
|
$i->fillField('[data-automation-id="from-email-field"]', $unauthorizedSendingEmail);
|
||||||
$i->click('[data-automation-id="settings-submit-button"]');
|
$i->click('[data-automation-id="settings-submit-button"]');
|
||||||
$i->waitForText('Settings saved');
|
$i->waitForText('Settings saved');
|
||||||
$i->reloadPage();
|
$i->reloadPage();
|
||||||
@ -35,7 +35,7 @@ class AuthorizedEmailAddressesValidationCest {
|
|||||||
$i->canSee($unauthorizedSendingEmail, $errorNoticeElement);
|
$i->canSee($unauthorizedSendingEmail, $errorNoticeElement);
|
||||||
|
|
||||||
// Error message disappears after email is replaced with authorized email
|
// Error message disappears after email is replaced with authorized email
|
||||||
$i->fillField('[data-automation-id="settings-page-from-email-field"]', \AcceptanceTester::AUTHORIZED_SENDING_EMAIL);
|
$i->fillField('[data-automation-id="from-email-field"]', \AcceptanceTester::AUTHORIZED_SENDING_EMAIL);
|
||||||
$i->click('[data-automation-id="settings-submit-button"]');
|
$i->click('[data-automation-id="settings-submit-button"]');
|
||||||
$i->waitForText('Settings saved');
|
$i->waitForText('Settings saved');
|
||||||
$i->reloadPage();
|
$i->reloadPage();
|
||||||
|
@ -23,7 +23,8 @@ class MailpoetMenuCest {
|
|||||||
$i->seeInCurrentUrl('?page=mailpoet-segments');
|
$i->seeInCurrentUrl('?page=mailpoet-segments');
|
||||||
|
|
||||||
$i->click('Settings');
|
$i->click('Settings');
|
||||||
$i->seeInCurrentUrl('?page=mailpoet-settings');
|
// this is temporary while implementing the new settings
|
||||||
|
$i->seeInCurrentUrl('?page=mailpoet-new-settings');
|
||||||
|
|
||||||
$i->click('Help');
|
$i->click('Help');
|
||||||
$i->seeInCurrentUrl('?page=mailpoet-help');
|
$i->seeInCurrentUrl('?page=mailpoet-help');
|
||||||
|
@ -12,8 +12,8 @@ class SettingsFreeEmailAsFromAddressTriggersAlertCest {
|
|||||||
$settings->withSendingMethodMailPoet();
|
$settings->withSendingMethodMailPoet();
|
||||||
$i->login();
|
$i->login();
|
||||||
$i->amOnMailPoetPage('Settings');
|
$i->amOnMailPoetPage('Settings');
|
||||||
$fromEmailField = '[data-automation-id="settings-page-from-email-field"]';
|
$fromEmailField = '[data-automation-id="from-email-field"]';
|
||||||
$fromNameField = '[data-automation-id="settings-page-from-name-field"]';
|
$fromNameField = '[data-automation-id="from-name-field"]';
|
||||||
$i->fillField($fromNameField, 'AlertUser');
|
$i->fillField($fromNameField, 'AlertUser');
|
||||||
$i->fillField($fromEmailField, 'alertuser@yahoo.com');
|
$i->fillField($fromEmailField, 'alertuser@yahoo.com');
|
||||||
$i->dontSeeElement('.sender_email_address_warning');
|
$i->dontSeeElement('.sender_email_address_warning');
|
||||||
@ -29,8 +29,8 @@ class SettingsFreeEmailAsFromAddressTriggersAlertCest {
|
|||||||
$settings->withSendingMethod(Mailer::METHOD_PHPMAIL);
|
$settings->withSendingMethod(Mailer::METHOD_PHPMAIL);
|
||||||
$i->login();
|
$i->login();
|
||||||
$i->amOnMailPoetPage('Settings');
|
$i->amOnMailPoetPage('Settings');
|
||||||
$fromEmailField = '[data-automation-id="settings-page-from-email-field"]';
|
$fromEmailField = '[data-automation-id="from-email-field"]';
|
||||||
$fromNameField = '[data-automation-id="settings-page-from-name-field"]';
|
$fromNameField = '[data-automation-id="from-name-field"]';
|
||||||
$i->fillField($fromNameField, 'AlertUser');
|
$i->fillField($fromNameField, 'AlertUser');
|
||||||
$i->fillField($fromEmailField, 'alertuser@yahoo.com');
|
$i->fillField($fromEmailField, 'alertuser@yahoo.com');
|
||||||
$i->waitForElement('.sender_email_address_warning');
|
$i->waitForElement('.sender_email_address_warning');
|
||||||
|
@ -35,10 +35,10 @@ class SettingsPageBasicsCest {
|
|||||||
$i->wantTo('Confirm default sender information can be edited');
|
$i->wantTo('Confirm default sender information can be edited');
|
||||||
$i->login();
|
$i->login();
|
||||||
$i->amOnMailPoetPage('Settings');
|
$i->amOnMailPoetPage('Settings');
|
||||||
$i->fillField(['name' => 'sender[name]'], 'Sender');
|
$i->fillField('[data-automation-id="from-name-field"]', 'Sender');
|
||||||
$i->fillField(['name' => 'sender[address]'], 'sender@fake.fake');
|
$i->fillField('[data-automation-id="from-email-field"]', 'sender@fake.fake');
|
||||||
$i->fillField(['name' => 'reply_to[name]'], 'Reply Name');
|
$i->fillField('[data-automation-id="reply_to-name-field"]', 'Reply Name');
|
||||||
$i->fillField(['name' => 'reply_to[address]'], 'reply@fake.fake');
|
$i->fillField('[data-automation-id="reply_to-email-field"]', 'reply@fake.fake');
|
||||||
//save settings
|
//save settings
|
||||||
$i->click('[data-automation-id="settings-submit-button"]');
|
$i->click('[data-automation-id="settings-submit-button"]');
|
||||||
$i->waitForText('Settings saved');
|
$i->waitForText('Settings saved');
|
||||||
@ -49,7 +49,7 @@ class SettingsPageBasicsCest {
|
|||||||
$postTitle = 'Hello world!';
|
$postTitle = 'Hello world!';
|
||||||
$i->login();
|
$i->login();
|
||||||
$i->amOnMailPoetPage('Settings');
|
$i->amOnMailPoetPage('Settings');
|
||||||
$i->checkOption('#settings[subscribe_on_comment]');
|
$i->checkOption('[data-automation-id="subscribe-on_comment-checkbox"]');
|
||||||
$i->selectOptionInSelect2('My First List');
|
$i->selectOptionInSelect2('My First List');
|
||||||
//save settings
|
//save settings
|
||||||
$i->click('[data-automation-id="settings-submit-button"]');
|
$i->click('[data-automation-id="settings-submit-button"]');
|
||||||
@ -60,7 +60,7 @@ class SettingsPageBasicsCest {
|
|||||||
$i->waitForElement(['css' => '.comment-form-mailpoet']);
|
$i->waitForElement(['css' => '.comment-form-mailpoet']);
|
||||||
//clear checkbox to hide Select2 from next test
|
//clear checkbox to hide Select2 from next test
|
||||||
$i->amOnMailPoetPage('Settings');
|
$i->amOnMailPoetPage('Settings');
|
||||||
$i->uncheckOption('#settings[subscribe_on_comment]');
|
$i->uncheckOption('[data-automation-id="subscribe-on_comment-checkbox"]');
|
||||||
//save settings
|
//save settings
|
||||||
$i->click('[data-automation-id="settings-submit-button"]');
|
$i->click('[data-automation-id="settings-submit-button"]');
|
||||||
//check to make sure comment subscription form is gone
|
//check to make sure comment subscription form is gone
|
||||||
@ -74,24 +74,25 @@ class SettingsPageBasicsCest {
|
|||||||
$settings = new Settings();
|
$settings = new Settings();
|
||||||
$settings->withSendingMethod(Mailer::METHOD_SMTP);
|
$settings->withSendingMethod(Mailer::METHOD_SMTP);
|
||||||
$settings->withTodayInstallationDate();
|
$settings->withTodayInstallationDate();
|
||||||
|
$nameField = '[data-automation-id="from-name-field"]';
|
||||||
|
$emailField = '[data-automation-id="from-email-field"]';
|
||||||
$i->wantTo('Confirm default sender information can be edited');
|
$i->wantTo('Confirm default sender information can be edited');
|
||||||
$i->login();
|
$i->login();
|
||||||
$i->amOnMailPoetPage('Settings');
|
$i->amOnMailPoetPage('Settings');
|
||||||
$i->fillField(['name' => 'sender[name]'], 'Sender');
|
$i->fillField($nameField, 'Sender');
|
||||||
$i->fillField(['name' => 'sender[address]'], 'sender@email.com');
|
$i->fillField($emailField, 'sender@email.com');
|
||||||
$i->seeElement('[data-acceptance-id="freemail-sender-warning-old-installation"]');
|
$i->seeElement('[data-acceptance-id="freemail-sender-warning-old-installation"]');
|
||||||
$i->see('contact@' . \AcceptanceTester::WP_DOMAIN);
|
$i->see('contact@' . \AcceptanceTester::WP_DOMAIN);
|
||||||
$i->fillField(['name' => 'sender[address]'], 'sender@fake.fake');
|
$i->fillField($emailField, 'sender@fake.fake');
|
||||||
$i->dontseeElement('[data-acceptance-id="freemail-sender-warning-old-installation"]');
|
$i->dontseeElement('[data-acceptance-id="freemail-sender-warning-old-installation"]');
|
||||||
|
|
||||||
$settings = new Settings();
|
$settings = new Settings();
|
||||||
$settings->withSendingMethodMailPoet();
|
$settings->withSendingMethodMailPoet();
|
||||||
$i->reloadPage();
|
$i->reloadPage();
|
||||||
|
|
||||||
$i->fillField(['name' => 'sender[address]'], 'sender2@email.com');
|
$i->fillField($emailField, 'sender2@email.com');
|
||||||
$i->dontSeeElement('[data-acceptance-id="freemail-sender-warning-new-installation"]');
|
$i->dontSeeElement('[data-acceptance-id="freemail-sender-warning-new-installation"]');
|
||||||
$i->fillField(['name' => 'sender[address]'], 'sender@fake.fake');
|
$i->fillField($emailField, 'sender@fake.fake');
|
||||||
$i->dontSeeElement('[data-acceptance-id="freemail-sender-warning-new-installation"]');
|
$i->dontSeeElement('[data-acceptance-id="freemail-sender-warning-new-installation"]');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,8 +18,8 @@ class SettingsSubscriptionPageCest {
|
|||||||
$i->login();
|
$i->login();
|
||||||
$i->amOnMailPoetPage('Settings');
|
$i->amOnMailPoetPage('Settings');
|
||||||
$i->cli(['post', 'create', '--post_type=page', "--post_title=$pageTitle", "--post_content=$pageContent"]);
|
$i->cli(['post', 'create', '--post_type=page', "--post_title=$pageTitle", "--post_content=$pageContent"]);
|
||||||
$i->click(['css' => '#subscription_manage_page.mailpoet_page_selection']);
|
$i->click(['css' => '[data-automation-id="subscription-manage-page-selection"]']);
|
||||||
$i->checkOption('select#subscription_manage_page', $pageTitle);
|
$i->checkOption('[data-automation-id="subscription-manage-page-selection"]', $pageTitle);
|
||||||
$i->click('[data-automation-id="preview_manage_subscription_page_link"]');
|
$i->click('[data-automation-id="preview_manage_subscription_page_link"]');
|
||||||
$i->waitForText('Manage your subscription');
|
$i->waitForText('Manage your subscription');
|
||||||
|
|
||||||
|
@ -16,8 +16,8 @@ class SubscribeOnRegistrationPageCest {
|
|||||||
$i->login();
|
$i->login();
|
||||||
//Go to settings
|
//Go to settings
|
||||||
$i->amOnMailPoetPage('Settings');
|
$i->amOnMailPoetPage('Settings');
|
||||||
$i->checkOption('#settings[subscribe_on_register]');
|
$i->checkOption('[data-automation-id="subscribe-on_register-checkbox"]');
|
||||||
$i->selectOptionInSelect2($regseg, '#mailpoet_subscribe_in_form input.select2-search__field');
|
$i->selectOptionInSelect2($regseg, '[data-automation-id="subscribe-on_register-segments-selection"] input.select2-search__field');
|
||||||
//save settings
|
//save settings
|
||||||
$i->click('[data-automation-id="settings-submit-button"]');
|
$i->click('[data-automation-id="settings-submit-button"]');
|
||||||
$i->logOut();
|
$i->logOut();
|
||||||
@ -50,7 +50,7 @@ class SubscribeOnRegistrationPageCest {
|
|||||||
$i->login();
|
$i->login();
|
||||||
//Go to settings
|
//Go to settings
|
||||||
$i->amOnMailPoetPage('Settings');
|
$i->amOnMailPoetPage('Settings');
|
||||||
$i->checkOption('#settings[subscribe_on_register]');
|
$i->checkOption('[data-automation-id="subscribe-on_register-checkbox"]');
|
||||||
//save settings
|
//save settings
|
||||||
$i->click('[data-automation-id="settings-submit-button"]');
|
$i->click('[data-automation-id="settings-submit-button"]');
|
||||||
$i->logOut();
|
$i->logOut();
|
||||||
|
Reference in New Issue
Block a user