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