Update acceptance scenario to include more checks
[MAILPOET-3155]
This commit is contained in:
@@ -15,18 +15,44 @@ class CreateNewWordPressUserCest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function sendConfirmationEmail(\AcceptanceTester $i) {
|
public function sendConfirmationEmail(\AcceptanceTester $i) {
|
||||||
$i->wantTo('Create a new wordpress user and check if the confirmation email is sent');
|
$i->wantTo('Create a new WP user and check if the confirmation email is sent and if user is subscribed properly');
|
||||||
$this->settings->withConfirmationEmailEnabled();
|
$this->settings->withConfirmationEmailEnabled();
|
||||||
$this->settings->withSubscribeOnRegisterEnabled();
|
$this->settings->withSubscribeOnRegisterEnabled();
|
||||||
|
$wordpressUsers = 'WordPress Users';
|
||||||
|
$secondListName = 'Newsletter mailing list';
|
||||||
|
$emailTitle = 'Confirm your subscription';
|
||||||
|
|
||||||
//create a wp user with wp role subscriber
|
// add additional list in settings
|
||||||
$i->cli(['user', 'create', 'narwhal', 'standardtest@example.com', '--role=subscriber']);
|
$i->login();
|
||||||
$i->checkEmailWasReceived('Confirm your subscription');
|
$i->amOnMailpoetPage('Settings');
|
||||||
$i->click(Locator::contains('span.subject', 'Confirm your subscription'));
|
$i->waitForText('Settings');
|
||||||
|
$i->selectOptionInSelect2($secondListName);
|
||||||
|
$i->click('[data-automation-id="settings-submit-button"]'); //save settings
|
||||||
|
|
||||||
|
// create a wp user via registration
|
||||||
|
$i->logOut();
|
||||||
|
$i->amOnUrl(\AcceptanceTester::WP_URL . '/wp-login.php?action=register');
|
||||||
|
$i->fillField('#user_login', 'newuser');
|
||||||
|
$i->fillField('#user_email', 'newuser@test.com');
|
||||||
|
$i->click('#mailpoet_subscribe_on_register');
|
||||||
|
$i->click('Register');
|
||||||
|
|
||||||
|
// check email was received and confirm subscribing to both lists
|
||||||
|
$i->checkEmailWasReceived($emailTitle);
|
||||||
|
$i->click(Locator::contains('span.subject', $emailTitle));
|
||||||
$i->switchToIframe('#preview-html');
|
$i->switchToIframe('#preview-html');
|
||||||
$i->click('I confirm my subscription!');
|
$i->click('I confirm my subscription!');
|
||||||
$i->switchToNextTab();
|
$i->switchToNextTab();
|
||||||
$i->see('You have subscribed');
|
$i->see('You have subscribed to:' * $wordpressUsers * ', ' * $secondListName);
|
||||||
$i->seeNoJSErrors();
|
$i->seeNoJSErrors();
|
||||||
|
|
||||||
|
// check if user is assigned to second list
|
||||||
|
$i->amOnUrl(\AcceptanceTester::WP_URL . '/wp-admin');
|
||||||
|
$i->login();
|
||||||
|
$i->amOnMailpoetPage('Subscribers');
|
||||||
|
$i->waitForText('Subscribers');
|
||||||
|
$i->clickItemRowActionByItemName('newuser@test.com', 'Edit');
|
||||||
|
$i->waitForText('Subscribed');
|
||||||
|
$i->seeSelectedInSelect2($secondListName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user