Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/fix-flaky-tests' into fix-perfor…
Browse files Browse the repository at this point in the history
…mance
  • Loading branch information
n7studios committed Nov 26, 2024
2 parents a88902a + 8bec7f7 commit c651ff3
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 8 deletions.
2 changes: 1 addition & 1 deletion tests/_support/Helper/Acceptance/MemberMouse.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ public function memberMouseCancelMemberBundle($I, $emailAddress, $bundleName)
{
// Cancel the user's bundle.
$I->amOnAdminPage('admin.php?page=manage_members');
$I->click($emailAddress);
$I->click('a[title="' . $emailAddress . '"]');
$I->click('Access Rights');
$I->click('a[title="Cancel ' . $bundleName . '"]');

Expand Down
21 changes: 14 additions & 7 deletions tests/_support/Helper/Acceptance/ThirdPartyPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,21 @@ public function activateThirdPartyPlugin($I, $name)
public function deactivateThirdPartyPlugin($I, $name)
{
// Login as the Administrator.
$I->loginAsAdmin();
$I->amOnPage('wp-login.php');
$I->waitForElement('#user_login', 10);
$I->fillField('#user_login', $_ENV['TEST_SITE_ADMIN_USERNAME']);
$I->waitForElement('#user_pass', 10);
$I->fillField('#user_pass', $_ENV['TEST_SITE_ADMIN_PASSWORD']);

// Wait and complete the password field again, because sometimes it doesn't
// get filled the first time.
$I->wait(1);
$I->fillField('#user_pass', $_ENV['TEST_SITE_ADMIN_PASSWORD']);

$I->click('#wp-submit');

// Wait for the MemberMouse dashboard to load.
switch ( $name ) {
case 'membermouse-platform':
$I->waitForElementVisible('#mm-view-container');
break;
}
// Wait for admin interface to load.
$I->waitForElementVisible('body.wp-admin');

// Go to the Plugins screen in the WordPress Administration interface.
$I->amOnPluginsPage();
Expand Down
1 change: 1 addition & 0 deletions tests/acceptance/bundle/BundleTagCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ public function testMemberNotTaggedWhenBundleCancelled(AcceptanceTester $I)
*/
public function _passed(AcceptanceTester $I)
{
$I->deactivateThirdPartyPlugin($I, 'membermouse-platform');
$I->deactivateConvertKitPlugin($I);
$I->resetConvertKitPlugin($I);
}
Expand Down
1 change: 1 addition & 0 deletions tests/acceptance/general/SettingsCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ public function testSaveBundleTagAssignment(AcceptanceTester $I)
*/
public function _passed(AcceptanceTester $I)
{
$I->deactivateThirdPartyPlugin($I, 'membermouse-platform');
$I->deactivateConvertKitPlugin($I);
$I->resetConvertKitPlugin($I);
}
Expand Down
1 change: 1 addition & 0 deletions tests/acceptance/member-update/MemberSubscribeCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public function testMemberNameAndEmailUpdatedWhenChangedInMemberMouse(Acceptance
*/
public function _passed(AcceptanceTester $I)
{
$I->deactivateThirdPartyPlugin($I, 'membermouse-platform');
$I->deactivateConvertKitPlugin($I);
$I->resetConvertKitPlugin($I);
}
Expand Down
1 change: 1 addition & 0 deletions tests/acceptance/member/MemberTagCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,7 @@ public function testMemberNotTaggedWhenDeleted(AcceptanceTester $I)
*/
public function _passed(AcceptanceTester $I)
{
$I->deactivateThirdPartyPlugin($I, 'membermouse-platform');
$I->deactivateConvertKitPlugin($I);
$I->resetConvertKitPlugin($I);
}
Expand Down
4 changes: 4 additions & 0 deletions tests/acceptance/product/ProductTagCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ public function testMemberNotTaggedWhenProductPurchased(AcceptanceTester $I)

// Check subscriber does not exist.
$subscriberID = $I->apiCheckSubscriberDoesNotExist($I, $emailAddress);

// Logout.
$I->memberMouseLogOut($I);
}

/**
Expand All @@ -106,6 +109,7 @@ public function testMemberNotTaggedWhenProductPurchased(AcceptanceTester $I)
*/
public function _passed(AcceptanceTester $I)
{
$I->deactivateThirdPartyPlugin($I, 'membermouse-platform');
$I->deactivateConvertKitPlugin($I);
$I->resetConvertKitPlugin($I);
}
Expand Down

0 comments on commit c651ff3

Please sign in to comment.