Run full activation of user account on multisite

[MAILPOET-4785]
This commit is contained in:
David Remer
2022-11-08 16:07:30 +02:00
committed by Jan Jakeš
parent 9ab6ebbe0d
commit a520e4bd93

View File

@@ -49,10 +49,12 @@ class UserRegistrationTriggerCest
$this->workflowStorage = $this->container->get(WorkflowStorage::class);
$this->workflowRunStorage = $this->container->get(WorkflowRunStorage::class);
$this->workflowRunLogStorage = $this->container->get(WorkflowRunLogStorage::class);
//In a multisite, for the plugin to be active on wp-activate.php, it needs to be activated network wide.
getenv('MULTISITE') && $i->cli(['plugin','activate','mailpoet','--network']);
}
public function workflowTriggeredByRegistrationWithoutConfirmationNeeded(\AcceptanceTester $i, $scenario) {
$scenario->skip('Temporally skip this test as it is failing when testing with WP multisite');
public function workflowTriggeredByRegistrationWithoutConfirmationNeeded(\AcceptanceTester $i) {
$i->wantTo("Activate a trigger by registering.");
$this->settingsFactory
->withSubscribeOnRegisterEnabled()
@@ -76,8 +78,8 @@ class UserRegistrationTriggerCest
$i->see('Entered 1'); //The visible text is 1 Entered, but in the DOM it's the other way around.
}
public function workflowTriggeredByRegistrationWitConfirmationNeeded(\AcceptanceTester $i, $scenario) {
$scenario->skip('Temporally skip this test as it is failing when testing with WP multisite');
public function workflowTriggeredByRegistrationWitConfirmationNeeded(\AcceptanceTester $i) {
$i->wantTo("Activate a trigger by registering.");
$this->settingsFactory
->withSubscribeOnRegisterEnabled()
@@ -105,6 +107,8 @@ class UserRegistrationTriggerCest
$i->click(Locator::contains('span.subject', 'Confirm your subscription'));
$i->switchToIframe('#preview-html');
$i->click('Click here to confirm your subscription.');
$i->switchToNextTab();
$i->waitForText('You have subscribed to MP Dev');
$i->amonUrl('http://test.local');
$i->amOnMailpoetPage('automation');
@@ -123,12 +127,22 @@ class UserRegistrationTriggerCest
}
$i->click('input[type=submit]');
// Waiting text in Try is for normal WP site, Catch is for multi-site as they differ in UI
try {
$i->waitForText('Registration complete.', 10);
} catch (\Exception $e) {
$i->waitForText($username . ' is your new username', 10);
$registrationComplete = (!getenv('MULTISITE')) ? 'Registration complete' : $username . ' is your new username';
$i->waitForText($registrationComplete);
if (getenv('MULTISITE')) {
$i->amOnMailboxAppPage();
$i->waitForText('Activate');
$i->click(Locator::contains('span.subject', 'Activate'));
$i->waitForText('To activate your user, please click the following link:');
$i->click(Locator::contains('a', 'wp-activate.php'));
$i->switchToNextTab();
$i->waitForText('Your account is now active!');
}
$i->amOnUrl('http://test.local');
}
private function createWorkflow(): Workflow {