Files
piratepoet/tests/acceptance/EditExistingPostNotificationEmailCest.php
Jan Jakeš b39dac75d6 Autofix number of newlines between methods
[MAILPOET-2715]
2020-02-19 19:12:53 +00:00

47 lines
1.8 KiB
PHP

<?php
namespace MailPoet\Test\Acceptance;
use MailPoet\Test\DataFactories\Newsletter;
class EditExistingPostNotificationEmailCest {
public function editSubjectAndSchedule(\AcceptanceTester $i) {
$i->wantTo('Edit existing post notification email');
$newsletterTitle = 'Edit Test Post Notification';
$newsletterEditedTitle = 'Edit Test Post Notification Edited';
// step 1 - Prepare post notification data
$form = new Newsletter();
$newsletter = $form->withSubject($newsletterTitle)
->withPostNotificationsType()
->create();
$segmentName = $i->createListWithSubscriber();
// step 2 - Open list of post notifications
$i->login();
$i->amOnMailpoetPage('Emails');
$i->click('Post Notifications', '[data-automation-id="newsletters_listing_tabs"]');
// step 3 - Open editation of post notifcation newsletter
$listingAutomationSelector = '[data-automation-id="listing_item_' . $newsletter->id . '"]';
$i->waitForText('Edit Test Post Notification', 10, $listingAutomationSelector);
$i->clickItemRowActionByItemName($newsletterTitle, 'Edit');
// step 4 - Edit subject
$titleElement = '[data-automation-id="newsletter_title"]';
$i->waitForElement($titleElement);
$i->fillField($titleElement, $newsletterEditedTitle);
// step 5 - Change schedule, list and activate
$i->click('Next');
$i->waitForElement('input.select2-search__field');
$i->selectOption('[data-automation-id="newsletter_interval_type"]', 'Weekly on...');
$i->selectOptionInSelect2($segmentName);
$newsletterListingElement = '[data-automation-id="listing_item_' . basename($i->getCurrentUrl()) . '"]';
$i->click('Activate');
$i->waitForElement($newsletterListingElement);
$i->see($newsletterEditedTitle, $newsletterListingElement);
}
}