diff --git a/mailpoet/tests/acceptance/Newsletters/EditorCouponCest.php b/mailpoet/tests/acceptance/Newsletters/EditorCouponCest.php new file mode 100644 index 0000000000..d63ed58438 --- /dev/null +++ b/mailpoet/tests/acceptance/Newsletters/EditorCouponCest.php @@ -0,0 +1,46 @@ +withFeatureEnabled(FeaturesController::FEATURE_COUPON_BLOCK); + } + + public function addCoupon(\AcceptanceTester $i) { + $couponInEditor = '[data-automation-id="coupon_block"]'; + $couponSettingsHeading = '[data-automation-id="coupon_settings_heading"]'; + $couponSettingsDone = '[data-automation-id="coupon_done_button"]'; + $footer = '[data-automation-id="footer"]'; + + $i->activateWooCommerce(); + + $i->wantTo('Add coupon block to newsletter'); + $newsletter = (new Newsletter()) + ->loadBodyFrom('newsletterWithText.json') + ->create(); + $i->login(); + $i->amEditingNewsletter($newsletter->getId()); + $i->dragAndDrop('#automation_editor_block_coupon', '#mce_1'); + $i->waitForElementVisible($couponInEditor); + $i->see(Coupon::CODE_PLACEHOLDER); + $i->wantTo('Check coupon overlay'); + $i->moveMouseOver($footer, 3, 2); + $i->moveMouseOver($couponInEditor, 3, 2); + $i->waitForText('The coupon code will be auto-generated when this campaign is activated.'); + $i->wantTo('Open coupon settings panel'); + $i->click($couponInEditor); + $i->waitForElement($couponSettingsHeading); + $i->wantTo('Close coupon settings panel'); + $i->click($couponSettingsDone); + $i->waitForElementNotVisible($couponSettingsHeading); + } +} diff --git a/mailpoet/views/newsletter/templates/blocks/coupon/block.hbs b/mailpoet/views/newsletter/templates/blocks/coupon/block.hbs index b8cb12acd4..3229e4d203 100644 --- a/mailpoet/views/newsletter/templates/blocks/coupon/block.hbs +++ b/mailpoet/views/newsletter/templates/blocks/coupon/block.hbs @@ -1,5 +1,5 @@
-