From d3054986132502e50612b15be827e920bcf6b67c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lys=C3=BD?= Date: Fri, 27 Jan 2023 09:22:45 +0100 Subject: [PATCH] Add coupon block acceptance test [MAILPOET-4984] --- .../Newsletters/EditorCouponCest.php | 46 +++++++++++++++++++ .../templates/blocks/coupon/block.hbs | 2 +- .../templates/blocks/coupon/settings.hbs | 4 +- 3 files changed, 49 insertions(+), 3 deletions(-) create mode 100644 mailpoet/tests/acceptance/Newsletters/EditorCouponCest.php 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 @@
-
+
{{ model.code }}
<%= __('The coupon code will be auto-generated when this campaign is activated. All subscribers of this campaign will receive the same coupon code.') %>
diff --git a/mailpoet/views/newsletter/templates/blocks/coupon/settings.hbs b/mailpoet/views/newsletter/templates/blocks/coupon/settings.hbs index afb15e7333..0fa5666841 100644 --- a/mailpoet/views/newsletter/templates/blocks/coupon/settings.hbs +++ b/mailpoet/views/newsletter/templates/blocks/coupon/settings.hbs @@ -1,4 +1,4 @@ -

<%= __('Coupon') %>

+

<%= __('Coupon') %>