Create helper to load mailhog app and wait for angular to load

This commit is contained in:
Ján Mikláš
2018-12-17 17:25:36 +01:00
parent eea62cd4f7
commit 38aaed77d8
8 changed files with 21 additions and 13 deletions

View File

@ -66,6 +66,16 @@ class AcceptanceTester extends \Codeception\Actor {
$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) {
$I = $this;
$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');
// subscribe
$I->amOnUrl(\AcceptanceTester::WP_URL);
$I->amOnUrl(self::WP_URL);
$I->fillField('[data-automation-id="form_email"]', 'subscriber@example.com');
$I->click('[data-automation-id="subscribe-submit-button"]');
$I->waitForText('Check your inbox or spam folder to confirm your subscription.', 30, '.mailpoet_validate_success');

View File

@ -29,7 +29,7 @@ class EditSignUpConfirmationEmailCest {
$I->createFormAndSubscribe();
// check the received email
$I->amOnUrl(\AcceptanceTester::MAIL_URL);
$I->amOnMailboxAppPage();
$I->waitForText('Confirmation email subject');
$I->click(Locator::contains('span.subject', 'Confirmation email subject'));

View File

@ -10,7 +10,7 @@ class EnableAndDisableSignupConfirmationCest {
function removeAllEmails(AcceptanceTester $I) {
// 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
$I->amOnUrl(AcceptanceTester::MAIL_URL);
$I->amOnMailboxAppPage();
$I->waitForElement(Locator::contains('a', 'Delete all messages'), 10);
$I->click(Locator::contains('a', 'Delete all messages'));
$I->waitForElement('.modal-footer');
@ -52,15 +52,13 @@ class EnableAndDisableSignupConfirmationCest {
}
private function countConfirmationEmails(AcceptanceTester $I) {
$I->amOnUrl(AcceptanceTester::MAIL_URL);
$I->waitForElement('.messages.ng-scope'); // ensure that angular is loaded
$I->amOnMailboxAppPage();
$confirmation_emails = $I->grabMultiple(Locator::contains('span.subject', 'Confirm your subscription'));
return count($confirmation_emails);
}
private function seeConfirmationEmailsCountIs(AcceptanceTester $I, $n) {
$I->amOnUrl(AcceptanceTester::MAIL_URL);
$I->waitForElement('.messages.ng-scope'); // ensure that angular is loaded
$I->amOnMailboxAppPage();
$I->seeNumberOfElements(Locator::contains('span.subject', 'Confirm your subscription'), $n);
}
}

View File

@ -46,7 +46,7 @@ class ManageSubscriptionLinkCest {
function manageSubscriptionLink(\AcceptanceTester $I) {
$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->switchToIframe('preview-html');
$I->waitForElementChange(
@ -79,7 +79,7 @@ class ManageSubscriptionLinkCest {
$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->switchToIframe('preview-html');
$I->waitForElementChange(

View File

@ -62,7 +62,7 @@ class ReceivePostNotificationCest {
$I->waitForText('Sent to 1 of 1', 90);
// confirm newsletter is received
$I->amOnUrl(\AcceptanceTester::MAIL_URL);
$I->amOnMailboxAppPage();
$I->waitForText($newsletter_subject, 90);
$I->click(Locator::contains('span.subject', $newsletter_subject));
$I->switchToIframe('preview-html');

View File

@ -39,7 +39,7 @@ class ReceiveStandardEmailCest {
$I->click('Send');
$I->waitForElement('.mailpoet_progress_label', 90);
//confirm newsletter is received
$I->amOnUrl(\AcceptanceTester::MAIL_URL);
$I->amOnMailboxAppPage();
$I->waitForText($newsletter_title, 90);
$I->click(Locator::contains('span.subject', $newsletter_title));
}

View File

@ -30,7 +30,7 @@ class SubscribeToMultipleListsCest {
//Add this form to a widget
$I->createFormAndSubscribe($form);
//Subscribe via that form
$I->amOnUrl(\AcceptanceTester::MAIL_URL);
$I->amOnMailboxAppPage();
$I->click(Locator::contains('span.subject', 'Confirm your subscription'));
$I->switchToIframe('preview-html');
$I->click('Click here to confirm your subscription');

View File

@ -62,7 +62,7 @@ class SubscriptionFormCest {
* @depends subscriptionFormWidget
*/
function subscriptionConfirmation(\AcceptanceTester $I) {
$I->amOnUrl(\AcceptanceTester::MAIL_URL);
$I->amOnMailboxAppPage();
$I->click(Locator::contains('span.subject', 'Confirm your subscription'));
$I->switchToIframe('preview-html');
$I->click('Click here to confirm your subscription');