Use our login function

This commit is contained in:
Pavel Dohnal
2018-01-30 15:03:03 +00:00
parent a8f33d9a7e
commit 9ee6920ebb
8 changed files with 12 additions and 12 deletions

View File

@@ -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');
}
/**

View File

@@ -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"]');

View File

@@ -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"]');

View File

@@ -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\']');

View File

@@ -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\']');

View File

@@ -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');

View File

@@ -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"]');

View File

@@ -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));