There is a short delay between rendering of a heading and the form fields. It is safer to wait for form itself before manipulating it.
43 lines
1.6 KiB
PHP
43 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace MailPoet\Test\Acceptance;
|
|
|
|
class SaveNewsletterAsDraftCest {
|
|
function saveStandardNewsletterAsDraft(\AcceptanceTester $I) {
|
|
$I->wantTo('Create standard newsletter and save as a draft');
|
|
|
|
$newsletter_title = 'Testing Newsletter ' . \MailPoet\Util\Security::generateRandomString();
|
|
|
|
$I->login();
|
|
$I->amOnMailpoetPage('Emails');
|
|
$I->click('[data-automation-id=\'new_email\']');
|
|
|
|
// step 1 - select notification type
|
|
$I->seeInCurrentUrl('#/new');
|
|
$I->click('[data-automation-id=\'create_standard\']');
|
|
|
|
// step 2 - select template
|
|
$standard_template = '[data-automation-id=\'select_template_0\']';
|
|
$I->waitForElement($standard_template);
|
|
$I->see('Newsletters', ['css' => 'a.current']);
|
|
$I->seeInCurrentUrl('#/template');
|
|
$I->click($standard_template);
|
|
|
|
// step 3 - design newsletter (update subject)
|
|
$title_element = '[data-automation-id=\'newsletter_title\']';
|
|
$I->waitForElement($title_element);
|
|
$I->seeInCurrentUrl('mailpoet-newsletter-editor');
|
|
$I->fillField($title_element, $newsletter_title);
|
|
$I->click('Next');
|
|
// step 4 - Choose list and send
|
|
$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->waitForText('Standard newsletter', 5, '[data-automation-id="listing_item_1"]');
|
|
}
|
|
}
|