Skip to content

Commit

Permalink
Fix failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
n7studios committed Nov 27, 2024
1 parent 9a3bc38 commit 144a00e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 25 deletions.
6 changes: 3 additions & 3 deletions tests/acceptance/bundle/BundleTagCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,16 +203,16 @@ public function testMemberTagRemovedWhenBundleCancelled(AcceptanceTester $I)
$I->memberMouseAssignBundleToMember($I, $emailAddress, 'Bundle');

// Check subscriber exists.
$subscriberID = $I->apiCheckSubscriberExists($I, $emailAddress);
$subscriber = $I->apiCheckSubscriberExists($I, $emailAddress);

// Check that the subscriber has been assigned to the tag.
$I->apiCheckSubscriberHasTag($I, $subscriberID, $_ENV['CONVERTKIT_API_TAG_ID']);
$I->apiCheckSubscriberHasTag($I, $subscriber['id'], $_ENV['CONVERTKIT_API_TAG_ID']);

// Cancel the user's bundle.
$I->memberMouseCancelMemberBundle($I, $emailAddress, 'Bundle');

// Check that the subscriber is no longer assigned to the tag.
$I->apiCheckSubscriberHasNoTags($I, $subscriberID);
$I->apiCheckSubscriberHasNoTags($I, $subscriber['id']);
}

/**
Expand Down
32 changes: 10 additions & 22 deletions tests/acceptance/member/MemberTagCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,28 +172,22 @@ public function testMemberTagRemovedWhenMembershipLevelCancelled(AcceptanceTeste
$I->memberMouseCreateMember($I, $emailAddress);

// Check subscriber exists.
$subscriberID = $I->apiCheckSubscriberExists($I, $emailAddress);
$subscriber = $I->apiCheckSubscriberExists($I, $emailAddress);

// Check that the subscriber has been assigned to the tag.
$I->apiCheckSubscriberHasTag($I, $subscriberID, $_ENV['CONVERTKIT_API_TAG_ID']);
$I->apiCheckSubscriberHasTag($I, $subscriber['id'], $_ENV['CONVERTKIT_API_TAG_ID']);

// Cancel the user's membership level.
$I->amOnAdminPage('admin.php?page=manage_members');
$I->click($emailAddress);
$I->click('Access Rights');
$I->click('Cancel Membership');

// Accept popups
// We have to wait as there's no specific event MemberMouse fires to tell
// us it completed changing the membership level.
$I->wait(5);
$I->acceptPopup();
$I->wait(5);
$I->acceptPopup();
$I->wait(5);
// Accept popups.
$I->memberMouseAcceptPopups($I, 2);

// Check that the subscriber is no longer assigned to the tag.
$I->apiCheckSubscriberHasNoTags($I, $subscriberID);
$I->apiCheckSubscriberHasNoTags($I, $subscriber['id']);
}

/**
Expand Down Expand Up @@ -269,27 +263,21 @@ public function testMemberTagRemovedWhenDeleted(AcceptanceTester $I)
$I->memberMouseCreateMember($I, $emailAddress);

// Check subscriber exists.
$subscriberID = $I->apiCheckSubscriberExists($I, $emailAddress);
$subscriber = $I->apiCheckSubscriberExists($I, $emailAddress);

// Check that the subscriber has been assigned to the tag.
$I->apiCheckSubscriberHasTag($I, $subscriberID, $_ENV['CONVERTKIT_API_TAG_ID']);
$I->apiCheckSubscriberHasTag($I, $subscriber['id'], $_ENV['CONVERTKIT_API_TAG_ID']);

// Cancel the user's membership level.
$I->amOnAdminPage('admin.php?page=manage_members');
$I->click($emailAddress);
$I->click('Delete Member');

// Accept popups
// We have to wait as there's no specific event MemberMouse fires to tell
// us it completed changing the membership level.
$I->wait(5);
$I->acceptPopup();
$I->wait(5);
$I->acceptPopup();
$I->wait(5);
// Accept popups.
$I->memberMouseAcceptPopups($I, 2);

// Check that the subscriber is no longer assigned to the tag.
$I->apiCheckSubscriberHasNoTags($I, $subscriberID);
$I->apiCheckSubscriberHasNoTags($I, $subscriber['id']);
}

/**
Expand Down

0 comments on commit 144a00e

Please sign in to comment.