diff --git a/assets/js/src/common/sender_email_address_warning.jsx b/assets/js/src/common/sender_email_address_warning.jsx index 26dbfef608..f5c1f9e36c 100644 --- a/assets/js/src/common/sender_email_address_warning.jsx +++ b/assets/js/src/common/sender_email_address_warning.jsx @@ -9,7 +9,10 @@ const suggestedEmailAddress = `contact@${userHostDomain}`; const NewInstallationWithMSSWarning = ({ emailAddress }) => ( -

+

{ReactStringReplace( MailPoet.I18n.t('senderEmailAddressNewInstallWarning1'), '%originalSender', @@ -55,7 +58,12 @@ NewInstallationWithMSSWarning.propTypes = { const OldInstallationWarning = ({ emailAddress }) => ( -

{MailPoet.I18n.t('senderEmailAddressWarning1')}

+

+ {MailPoet.I18n.t('senderEmailAddressWarning1')} +

{ReactStringReplace( MailPoet.I18n.t('senderEmailAddressWarning2'), diff --git a/tests/DataFactories/Settings.php b/tests/DataFactories/Settings.php index bf81d23a84..439cebf997 100644 --- a/tests/DataFactories/Settings.php +++ b/tests/DataFactories/Settings.php @@ -50,6 +50,10 @@ class Settings { return $this; } + function withTodayInstallationDate() { + $this->settings->set('installed_at', date("Y-m-d H:i:s")); + } + function withSkippedTutorials() { $this->settings->set('show_intro', 0); $this->settings->set('display_nps_poll', 0); diff --git a/tests/_support/AcceptanceTester.php b/tests/_support/AcceptanceTester.php index 1645805f2e..649a4b2c8f 100644 --- a/tests/_support/AcceptanceTester.php +++ b/tests/_support/AcceptanceTester.php @@ -35,7 +35,8 @@ class AcceptanceTester extends \Codeception\Actor { waitForText as _waitForText; } - const WP_URL = 'http://test.local'; + const WP_DOMAIN = 'test.local'; + const WP_URL = 'http://' . self::WP_DOMAIN; const MAIL_URL = 'http://mailhog:8025'; /** diff --git a/tests/acceptance/SettingsPageBasicsCest.php b/tests/acceptance/SettingsPageBasicsCest.php index 789e67e179..6aa9fde6eb 100644 --- a/tests/acceptance/SettingsPageBasicsCest.php +++ b/tests/acceptance/SettingsPageBasicsCest.php @@ -1,8 +1,14 @@ wantTo('Confirm all settings pages load correctly'); $I->login(); @@ -27,6 +33,7 @@ class SettingsPageBasicsCest { $I->waitForText('Activation Key'); $I->seeNoJSErrors(); } + function editDefaultSenderInformation(\AcceptanceTester $I) { $I->wantTo('Confirm default sender information can be edited'); $I->login(); @@ -39,6 +46,7 @@ class SettingsPageBasicsCest { $I->click('[data-automation-id="settings-submit-button"]'); $I->waitForText('Settings saved'); } + function allowSubscribeInComments(\AcceptanceTester $I) { $I->wantTo('Allow users to subscribe to lists in site comments'); $post_title = 'Hello world!'; @@ -62,6 +70,36 @@ class SettingsPageBasicsCest { $I->amOnPage('/'); $I->waitForText($post_title); $I->click($post_title); - $I->dontSee("Yes, add me to your mailing list"); + $I->dontSee("Yes, add me to your mailing list"); + } + + function checkSenderFreemailWarning(\AcceptanceTester $I) { + $settings = new Settings(); + $settings->withSendingMethod(Mailer::METHOD_SMTP); + $settings->withTodayInstallationDate(); + + $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->seeElement('[data-acceptance-id="freemail-sender-warning-old-installation"]'); + $I->see('contact@' . \AcceptanceTester::WP_DOMAIN); + $I->fillField(['name' => 'sender[address]'], '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->seeElement('[data-acceptance-id="freemail-sender-warning-new-installation"]'); + $I->fillField(['name' => 'sender[address]'], 'sender@fake.fake'); + $I->dontSeeElement('[data-acceptance-id="freemail-sender-warning-new-installation"]'); + } + + function _after() { + $settings = new Settings(); + $settings->withSendingMethod(Mailer::METHOD_SMTP); } }