Create helper to load mailhog app and wait for angular to load
This commit is contained in:
@@ -66,6 +66,16 @@ class AcceptanceTester extends \Codeception\Actor {
|
|||||||
$I->waitForText($page, 5);
|
$I->waitForText($page, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Navigate to Mailhog page and wait for angular to load
|
||||||
|
*/
|
||||||
|
public function amOnMailboxAppPage() {
|
||||||
|
$I = $this;
|
||||||
|
$I->amOnUrl(self::MAIL_URL);
|
||||||
|
// ensure that angular is loaded by checking angular specific class
|
||||||
|
$I->waitForElement('.messages.ng-scope');
|
||||||
|
}
|
||||||
|
|
||||||
public function clickItemRowActionByItemName($item_name, $link) {
|
public function clickItemRowActionByItemName($item_name, $link) {
|
||||||
$I = $this;
|
$I = $this;
|
||||||
$I->moveMouseOver(['xpath' => '//*[text()="' . $item_name . '"]//ancestor::tr']);
|
$I->moveMouseOver(['xpath' => '//*[text()="' . $item_name . '"]//ancestor::tr']);
|
||||||
@@ -106,7 +116,7 @@ class AcceptanceTester extends \Codeception\Actor {
|
|||||||
$I->cli('widget add mailpoet_form sidebar-1 2 --form=' . $form->id . ' --title="Subscribe to Our Newsletter" --allow-root');
|
$I->cli('widget add mailpoet_form sidebar-1 2 --form=' . $form->id . ' --title="Subscribe to Our Newsletter" --allow-root');
|
||||||
|
|
||||||
// subscribe
|
// subscribe
|
||||||
$I->amOnUrl(\AcceptanceTester::WP_URL);
|
$I->amOnUrl(self::WP_URL);
|
||||||
$I->fillField('[data-automation-id="form_email"]', 'subscriber@example.com');
|
$I->fillField('[data-automation-id="form_email"]', 'subscriber@example.com');
|
||||||
$I->click('[data-automation-id="subscribe-submit-button"]');
|
$I->click('[data-automation-id="subscribe-submit-button"]');
|
||||||
$I->waitForText('Check your inbox or spam folder to confirm your subscription.', 30, '.mailpoet_validate_success');
|
$I->waitForText('Check your inbox or spam folder to confirm your subscription.', 30, '.mailpoet_validate_success');
|
||||||
|
@@ -29,7 +29,7 @@ class EditSignUpConfirmationEmailCest {
|
|||||||
$I->createFormAndSubscribe();
|
$I->createFormAndSubscribe();
|
||||||
|
|
||||||
// check the received email
|
// check the received email
|
||||||
$I->amOnUrl(\AcceptanceTester::MAIL_URL);
|
$I->amOnMailboxAppPage();
|
||||||
$I->waitForText('Confirmation email subject');
|
$I->waitForText('Confirmation email subject');
|
||||||
$I->click(Locator::contains('span.subject', 'Confirmation email subject'));
|
$I->click(Locator::contains('span.subject', 'Confirmation email subject'));
|
||||||
|
|
||||||
|
@@ -10,7 +10,7 @@ class EnableAndDisableSignupConfirmationCest {
|
|||||||
function removeAllEmails(AcceptanceTester $I) {
|
function removeAllEmails(AcceptanceTester $I) {
|
||||||
// Remove all mails, because when there is more mails than paging allows it causes
|
// Remove all mails, because when there is more mails than paging allows it causes
|
||||||
// problems with counting ones, which would be moved to other page after adding more mails
|
// problems with counting ones, which would be moved to other page after adding more mails
|
||||||
$I->amOnUrl(AcceptanceTester::MAIL_URL);
|
$I->amOnMailboxAppPage();
|
||||||
$I->waitForElement(Locator::contains('a', 'Delete all messages'), 10);
|
$I->waitForElement(Locator::contains('a', 'Delete all messages'), 10);
|
||||||
$I->click(Locator::contains('a', 'Delete all messages'));
|
$I->click(Locator::contains('a', 'Delete all messages'));
|
||||||
$I->waitForElement('.modal-footer');
|
$I->waitForElement('.modal-footer');
|
||||||
@@ -52,15 +52,13 @@ class EnableAndDisableSignupConfirmationCest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function countConfirmationEmails(AcceptanceTester $I) {
|
private function countConfirmationEmails(AcceptanceTester $I) {
|
||||||
$I->amOnUrl(AcceptanceTester::MAIL_URL);
|
$I->amOnMailboxAppPage();
|
||||||
$I->waitForElement('.messages.ng-scope'); // ensure that angular is loaded
|
|
||||||
$confirmation_emails = $I->grabMultiple(Locator::contains('span.subject', 'Confirm your subscription'));
|
$confirmation_emails = $I->grabMultiple(Locator::contains('span.subject', 'Confirm your subscription'));
|
||||||
return count($confirmation_emails);
|
return count($confirmation_emails);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function seeConfirmationEmailsCountIs(AcceptanceTester $I, $n) {
|
private function seeConfirmationEmailsCountIs(AcceptanceTester $I, $n) {
|
||||||
$I->amOnUrl(AcceptanceTester::MAIL_URL);
|
$I->amOnMailboxAppPage();
|
||||||
$I->waitForElement('.messages.ng-scope'); // ensure that angular is loaded
|
|
||||||
$I->seeNumberOfElements(Locator::contains('span.subject', 'Confirm your subscription'), $n);
|
$I->seeNumberOfElements(Locator::contains('span.subject', 'Confirm your subscription'), $n);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -46,7 +46,7 @@ class ManageSubscriptionLinkCest {
|
|||||||
function manageSubscriptionLink(\AcceptanceTester $I) {
|
function manageSubscriptionLink(\AcceptanceTester $I) {
|
||||||
$I->wantTo('Verify that "manage subscription" link works and subscriber status can be updated');
|
$I->wantTo('Verify that "manage subscription" link works and subscriber status can be updated');
|
||||||
|
|
||||||
$I->amOnUrl(\AcceptanceTester::MAIL_URL);
|
$I->amOnMailboxAppPage();
|
||||||
$I->click(Locator::contains('span.subject', $this->newsletter_title));
|
$I->click(Locator::contains('span.subject', $this->newsletter_title));
|
||||||
$I->switchToIframe('preview-html');
|
$I->switchToIframe('preview-html');
|
||||||
$I->waitForElementChange(
|
$I->waitForElementChange(
|
||||||
@@ -79,7 +79,7 @@ class ManageSubscriptionLinkCest {
|
|||||||
|
|
||||||
$form_status_element = '[data-automation-id="form_status"]';
|
$form_status_element = '[data-automation-id="form_status"]';
|
||||||
|
|
||||||
$I->amOnUrl(\AcceptanceTester::MAIL_URL);
|
$I->amOnMailboxAppPage();
|
||||||
$I->click(Locator::contains('span.subject', $this->newsletter_title));
|
$I->click(Locator::contains('span.subject', $this->newsletter_title));
|
||||||
$I->switchToIframe('preview-html');
|
$I->switchToIframe('preview-html');
|
||||||
$I->waitForElementChange(
|
$I->waitForElementChange(
|
||||||
|
@@ -62,7 +62,7 @@ class ReceivePostNotificationCest {
|
|||||||
$I->waitForText('Sent to 1 of 1', 90);
|
$I->waitForText('Sent to 1 of 1', 90);
|
||||||
|
|
||||||
// confirm newsletter is received
|
// confirm newsletter is received
|
||||||
$I->amOnUrl(\AcceptanceTester::MAIL_URL);
|
$I->amOnMailboxAppPage();
|
||||||
$I->waitForText($newsletter_subject, 90);
|
$I->waitForText($newsletter_subject, 90);
|
||||||
$I->click(Locator::contains('span.subject', $newsletter_subject));
|
$I->click(Locator::contains('span.subject', $newsletter_subject));
|
||||||
$I->switchToIframe('preview-html');
|
$I->switchToIframe('preview-html');
|
||||||
|
@@ -39,7 +39,7 @@ class ReceiveStandardEmailCest {
|
|||||||
$I->click('Send');
|
$I->click('Send');
|
||||||
$I->waitForElement('.mailpoet_progress_label', 90);
|
$I->waitForElement('.mailpoet_progress_label', 90);
|
||||||
//confirm newsletter is received
|
//confirm newsletter is received
|
||||||
$I->amOnUrl(\AcceptanceTester::MAIL_URL);
|
$I->amOnMailboxAppPage();
|
||||||
$I->waitForText($newsletter_title, 90);
|
$I->waitForText($newsletter_title, 90);
|
||||||
$I->click(Locator::contains('span.subject', $newsletter_title));
|
$I->click(Locator::contains('span.subject', $newsletter_title));
|
||||||
}
|
}
|
||||||
|
@@ -30,7 +30,7 @@ class SubscribeToMultipleListsCest {
|
|||||||
//Add this form to a widget
|
//Add this form to a widget
|
||||||
$I->createFormAndSubscribe($form);
|
$I->createFormAndSubscribe($form);
|
||||||
//Subscribe via that form
|
//Subscribe via that form
|
||||||
$I->amOnUrl(\AcceptanceTester::MAIL_URL);
|
$I->amOnMailboxAppPage();
|
||||||
$I->click(Locator::contains('span.subject', 'Confirm your subscription'));
|
$I->click(Locator::contains('span.subject', 'Confirm your subscription'));
|
||||||
$I->switchToIframe('preview-html');
|
$I->switchToIframe('preview-html');
|
||||||
$I->click('Click here to confirm your subscription');
|
$I->click('Click here to confirm your subscription');
|
||||||
|
@@ -62,7 +62,7 @@ class SubscriptionFormCest {
|
|||||||
* @depends subscriptionFormWidget
|
* @depends subscriptionFormWidget
|
||||||
*/
|
*/
|
||||||
function subscriptionConfirmation(\AcceptanceTester $I) {
|
function subscriptionConfirmation(\AcceptanceTester $I) {
|
||||||
$I->amOnUrl(\AcceptanceTester::MAIL_URL);
|
$I->amOnMailboxAppPage();
|
||||||
$I->click(Locator::contains('span.subject', 'Confirm your subscription'));
|
$I->click(Locator::contains('span.subject', 'Confirm your subscription'));
|
||||||
$I->switchToIframe('preview-html');
|
$I->switchToIframe('preview-html');
|
||||||
$I->click('Click here to confirm your subscription');
|
$I->click('Click here to confirm your subscription');
|
||||||
|
Reference in New Issue
Block a user