From 9ee6920ebb71bac6723059c61eaebd66b34e9ee3 Mon Sep 17 00:00:00 2001 From: Pavel Dohnal Date: Tue, 30 Jan 2018 15:03:03 +0000 Subject: [PATCH] Use our login function --- tests/_support/AcceptanceTester.php | 8 ++++---- tests/acceptance/FormsListingCest.php | 2 +- tests/acceptance/ListsListingCest.php | 2 +- tests/acceptance/ManageSubscriptionLinkCest.php | 2 +- tests/acceptance/NewsletterCreationCest.php | 2 +- tests/acceptance/NewslettersListingCest.php | 4 ++-- tests/acceptance/SubscribersListingCest.php | 2 +- tests/acceptance/SubscriptionFormCest.php | 2 +- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/_support/AcceptanceTester.php b/tests/_support/AcceptanceTester.php index f41b2302be..e15366bede 100644 --- a/tests/_support/AcceptanceTester.php +++ b/tests/_support/AcceptanceTester.php @@ -22,12 +22,12 @@ class AcceptanceTester extends \Codeception\Actor { * Define custom actions here */ public function login() { - if($this->loadSessionSnapshot('login')) return; + // if($this->loadSessionSnapshot('login')) return; $this->amOnPage('/wp-login.php'); - $this->fillField('Username', getenv('WP_TEST_USER')); - $this->fillField('Password', getenv('WP_TEST_PASSWORD')); + $this->fillField('Username', 'admin'); + $this->fillField('Password', 'password'); $this->click('Log In'); - $this->saveSessionSnapshot('login'); + // $this->saveSessionSnapshot('login'); } /** diff --git a/tests/acceptance/FormsListingCest.php b/tests/acceptance/FormsListingCest.php index 370d44048f..58af4ad455 100644 --- a/tests/acceptance/FormsListingCest.php +++ b/tests/acceptance/FormsListingCest.php @@ -6,7 +6,7 @@ class FormsListingCest { function formsListing(\AcceptanceTester $I) { $I->wantTo('Open forms listings page'); - $I->loginAsAdmin(); + $I->login(); $I->amOnMailpoetPage('Forms'); $I->waitForText('Test Form', 5, '[data-automation-id="listing_item_1"]'); diff --git a/tests/acceptance/ListsListingCest.php b/tests/acceptance/ListsListingCest.php index e3edad4e09..f94665b365 100644 --- a/tests/acceptance/ListsListingCest.php +++ b/tests/acceptance/ListsListingCest.php @@ -6,7 +6,7 @@ class ListsListingCest { function listsListing(\AcceptanceTester $I) { $I->wantTo('Open lists listings page'); - $I->loginAsAdmin(); + $I->login(); $I->amOnMailpoetPage('Lists'); $I->waitForText('WordPress Users', 5, '[data-automation-id="listing_item_1"]'); diff --git a/tests/acceptance/ManageSubscriptionLinkCest.php b/tests/acceptance/ManageSubscriptionLinkCest.php index 44e33e98d5..0a6d7fe846 100644 --- a/tests/acceptance/ManageSubscriptionLinkCest.php +++ b/tests/acceptance/ManageSubscriptionLinkCest.php @@ -12,7 +12,7 @@ class ManageSubscriptionLinkCest { function sendEmail(\AcceptanceTester $I) { $I->wantTo('Create and send new email to WordPress Users list'); - $I->loginAsAdmin(); + $I->login(); $I->amOnMailpoetPage('Emails'); $I->click('[data-automation-id=\'new_email\']'); diff --git a/tests/acceptance/NewsletterCreationCest.php b/tests/acceptance/NewsletterCreationCest.php index ad774c118c..c9446ff432 100644 --- a/tests/acceptance/NewsletterCreationCest.php +++ b/tests/acceptance/NewsletterCreationCest.php @@ -8,7 +8,7 @@ class NewsletterCreationCest { $newsletter_title = 'Post Notification ' . \MailPoet\Util\Security::generateRandomString(); - $I->loginAsAdmin(); + $I->login(); $I->amOnMailpoetPage('Emails'); $I->click('[data-automation-id=\'new_email\']'); diff --git a/tests/acceptance/NewslettersListingCest.php b/tests/acceptance/NewslettersListingCest.php index 70b1c2f55f..85638a979d 100644 --- a/tests/acceptance/NewslettersListingCest.php +++ b/tests/acceptance/NewslettersListingCest.php @@ -6,7 +6,7 @@ class NewslettersListingCest { function newslettersListing(\AcceptanceTester $I) { $I->wantTo('Open newsletters listings page'); - $I->loginAsAdmin(); + $I->login(); $I->amOnMailpoetPage('Emails'); // Standard newsletters is the default tab @@ -22,7 +22,7 @@ class NewslettersListingCest { function statisticsColumn(\AcceptanceTester $I) { $I->wantTo('Check if statistics column is visible depending on tracking option'); - $I->loginAsAdmin(); + $I->login(); // column is hidden when tracking is not enabled $I->cli('db query "UPDATE mp_mailpoet_settings SET value = null WHERE name = \'tracking\'" --allow-root'); diff --git a/tests/acceptance/SubscribersListingCest.php b/tests/acceptance/SubscribersListingCest.php index 42a7472893..c2fcc867ae 100644 --- a/tests/acceptance/SubscribersListingCest.php +++ b/tests/acceptance/SubscribersListingCest.php @@ -6,7 +6,7 @@ class SubscribersListingCest { function subscribersListing(\AcceptanceTester $I) { $I->wantTo('Open subscribers listings page'); - $I->loginAsAdmin(); + $I->login(); $I->amOnMailpoetPage('Subscribers'); $I->waitForText('wp@example.com', 5, '[data-automation-id="listing_item_1"]'); diff --git a/tests/acceptance/SubscriptionFormCest.php b/tests/acceptance/SubscriptionFormCest.php index 87dee8caff..a90263d49f 100644 --- a/tests/acceptance/SubscriptionFormCest.php +++ b/tests/acceptance/SubscriptionFormCest.php @@ -60,7 +60,7 @@ class SubscriptionFormCest { $I->seeNoJSErrors(); $I->amOnUrl('http://wordpress'); - $I->loginAsAdmin(); + $I->login(); $I->amOnMailpoetPage('Subscribers'); $I->waitForText($this->subscriber_email); $I->see('Subscribed', Locator::contains('tr', $this->subscriber_email));