From 08dd759e70e7496fd20d5ab0e99ea2c1e59cacf0 Mon Sep 17 00:00:00 2001 From: Michelle Shull Date: Sun, 9 Sep 2018 17:57:31 -0400 Subject: [PATCH 1/3] Save Notification as Draft [MQ-32] --- .../SaveNotificationAsDraftCest.php | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 tests/acceptance/SaveNotificationAsDraftCest.php diff --git a/tests/acceptance/SaveNotificationAsDraftCest.php b/tests/acceptance/SaveNotificationAsDraftCest.php new file mode 100644 index 0000000000..033d4ddd41 --- /dev/null +++ b/tests/acceptance/SaveNotificationAsDraftCest.php @@ -0,0 +1,38 @@ +wantTo('Save post notification email as draft'); + $newsletter_title = 'Draft Test Post Notification'; + $newsletterFactory = new Newsletter(); + $newsletter = $newsletterFactory->withSubject($newsletter_title) + ->withType('notification') + ->withPostNoticationOptions() + ->create(); + + // step 2 - Go to editor + $I->login(); + $I->amEditingNewsletter($newsletter->id); + $I->click('Next'); + + //Save Notification As Draft + $send_form_element = '[data-automation-id="newsletter_send_form"]'; + $I->waitForElement($send_form_element); + $I->seeInCurrentUrl('mailpoet-newsletters#/send/'); + $search_field_element = 'input.select2-search__field'; + $I->fillField($search_field_element, 'WordPress Users'); + $I->pressKey($search_field_element, \WebDriverKeys::ENTER); + $I->click('Save as draft and close'); + $I->wait(10); + $I->seeInCurrentUrl('/wp-admin/admin.php?page=mailpoet-newsletters#/notification'); + $I->waitForText('Draft Test Post Notification'); + } +} \ No newline at end of file From 659ea14f4bf5f2deb12e643a14c9c5ee7329a900 Mon Sep 17 00:00:00 2001 From: Michelle Shull <34072553+michelleshull@users.noreply.github.com> Date: Mon, 10 Sep 2018 13:38:04 -0400 Subject: [PATCH 2/3] Update SaveNotificationAsDraftCest.php --- tests/acceptance/SaveNotificationAsDraftCest.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/acceptance/SaveNotificationAsDraftCest.php b/tests/acceptance/SaveNotificationAsDraftCest.php index 033d4ddd41..d82d625679 100644 --- a/tests/acceptance/SaveNotificationAsDraftCest.php +++ b/tests/acceptance/SaveNotificationAsDraftCest.php @@ -8,7 +8,6 @@ require_once __DIR__ . '/../DataFactories/Newsletter.php'; class SavePostNotificationEmailAsDraftCest { function saveNotificationAsDraft(\AcceptanceTester $I) { - // step 1 - Prepare post notification data $I->wantTo('Save post notification email as draft'); $newsletter_title = 'Draft Test Post Notification'; @@ -17,12 +16,10 @@ class SavePostNotificationEmailAsDraftCest { ->withType('notification') ->withPostNoticationOptions() ->create(); - // step 2 - Go to editor $I->login(); $I->amEditingNewsletter($newsletter->id); $I->click('Next'); - //Save Notification As Draft $send_form_element = '[data-automation-id="newsletter_send_form"]'; $I->waitForElement($send_form_element); @@ -35,4 +32,4 @@ class SavePostNotificationEmailAsDraftCest { $I->seeInCurrentUrl('/wp-admin/admin.php?page=mailpoet-newsletters#/notification'); $I->waitForText('Draft Test Post Notification'); } -} \ No newline at end of file +} From cc43a8503fca05f38b8f9de1b6b02ac177848cb1 Mon Sep 17 00:00:00 2001 From: Michelle Shull Date: Mon, 17 Sep 2018 09:00:18 -0400 Subject: [PATCH 3/3] Made requested changes [MQ-32] --- tests/acceptance/SaveNotificationAsDraftCest.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/tests/acceptance/SaveNotificationAsDraftCest.php b/tests/acceptance/SaveNotificationAsDraftCest.php index 033d4ddd41..fd2798d9d1 100644 --- a/tests/acceptance/SaveNotificationAsDraftCest.php +++ b/tests/acceptance/SaveNotificationAsDraftCest.php @@ -6,9 +6,8 @@ use MailPoet\Test\DataFactories\Newsletter; require_once __DIR__ . '/../DataFactories/Newsletter.php'; -class SavePostNotificationEmailAsDraftCest { +class SaveNotificationAsDraftCest  { function saveNotificationAsDraft(\AcceptanceTester $I) { - // step 1 - Prepare post notification data $I->wantTo('Save post notification email as draft'); $newsletter_title = 'Draft Test Post Notification'; @@ -17,12 +16,10 @@ class SavePostNotificationEmailAsDraftCest { ->withType('notification') ->withPostNoticationOptions() ->create(); - // step 2 - Go to editor $I->login(); $I->amEditingNewsletter($newsletter->id); $I->click('Next'); - //Save Notification As Draft $send_form_element = '[data-automation-id="newsletter_send_form"]'; $I->waitForElement($send_form_element); @@ -31,7 +28,7 @@ class SavePostNotificationEmailAsDraftCest { $I->fillField($search_field_element, 'WordPress Users'); $I->pressKey($search_field_element, \WebDriverKeys::ENTER); $I->click('Save as draft and close'); - $I->wait(10); + $I->waitForElement('[data-automation-id="newsletters_listing_tabs"]', 10); $I->seeInCurrentUrl('/wp-admin/admin.php?page=mailpoet-newsletters#/notification'); $I->waitForText('Draft Test Post Notification'); }