Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 55 additions & 5 deletions tests/EndToEnd/integrations/other/ContactForm7FormCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,64 @@ public function testSettingsContactForm7WhenNoCredentials(EndToEndTester $I)
}

/**
* Test that saving a Contact Form 7 to Kit Form Mapping works.
* Test the Contact Form 7 Form integration works and that the subscriber's state is active
* when a single optin Form is specified.
*
* @since 1.9.6
* @since 3.3.2
*
* @param EndToEndTester $I Tester.
*/
public function testSettingsContactForm7ToKitSingleOptinFormMapping(EndToEndTester $I)
{
// Setup Contact form 7 Form and configuration for this test.
$pageID = $this->_contactForm7SetupForm(
$I,
$_ENV['CONVERTKIT_API_FORM_SINGLE_OPTIN_NAME']
);

// Define email address for this test.
$emailAddress = $I->generateEmailAddress();

// Complete and submit Contact Form 7 Form.
$this->_contactForm7CompleteAndSubmitForm(
$I,
pageID: $pageID,
emailAddress: $emailAddress
);

// Wait for the API to update.
$I->wait(2);

// Confirm that the email address was added to Kit.
$subscriber = $I->apiCheckSubscriberExists($I, $emailAddress);

// Confirm that the subscriber is active, as a form was used.
// This honors a Form's single optin setting.
$I->assertEquals('active', $subscriber['state']);

// Check that the subscriber has the expected form and referrer value set.
$I->apiCheckSubscriberHasForm(
$I,
subscriberID: $subscriber['id'],
formID: $_ENV['CONVERTKIT_API_FORM_SINGLE_OPTIN_ID'],
referrer: $_ENV['WORDPRESS_URL'] . $I->grabFromCurrentUrl()
);
}

/**
* Test the Contact Form 7 Form integration works and that the subscriber's state is inactive
* when a double optin Form is specified.
*
* @since 3.3.2
*
* @param EndToEndTester $I Tester.
*/
public function testSettingsContactForm7ToKitFormMapping(EndToEndTester $I)
public function testSettingsContactForm7ToKitDoubleOptinFormMapping(EndToEndTester $I)
{
// Setup Contact form 7 Form and configuration for this test.
$pageID = $this->_contactForm7SetupForm(
$I,
$_ENV['CONVERTKIT_API_THIRD_PARTY_INTEGRATIONS_FORM_NAME']
$_ENV['CONVERTKIT_API_FORM_DOUBLE_OPTIN_NAME']
);

// Define email address for this test.
Expand All @@ -72,11 +118,15 @@ public function testSettingsContactForm7ToKitFormMapping(EndToEndTester $I)
// Confirm that the email address was added to Kit.
$subscriber = $I->apiCheckSubscriberExists($I, $emailAddress);

// Confirm that the subscriber is inactive, as a form was used.
// This honors a Form's double optin setting.
$I->assertEquals('inactive', $subscriber['state']);

// Check that the subscriber has the expected form and referrer value set.
$I->apiCheckSubscriberHasForm(
$I,
subscriberID: $subscriber['id'],
formID: $_ENV['CONVERTKIT_API_THIRD_PARTY_INTEGRATIONS_FORM_ID'],
formID: $_ENV['CONVERTKIT_API_FORM_DOUBLE_OPTIN_ID'],
referrer: $_ENV['WORDPRESS_URL'] . $I->grabFromCurrentUrl()
);
}
Expand Down
126 changes: 116 additions & 10 deletions tests/EndToEnd/integrations/other/ForminatorCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,19 @@ public function testSettingsForminatorWhenNoCredentials(EndToEndTester $I)
}

/**
* Test that saving a Forminator Form to Kit Form Mapping works.
* Test the Forminator Form integration works and that the subscriber's state is active
* when a single optin Form is specified.
*
* @since 2.3.0
* @since 3.3.2
*
* @param EndToEndTester $I Tester.
*/
public function testSettingsForminatorFormToKitFormMapping(EndToEndTester $I)
public function testSettingsForminatorFormToKitSingleOptinFormMapping(EndToEndTester $I)
{
// Setup Forminator Form and configuration for this test.
$pageID = $this->_forminatorSetupForm(
$I,
$_ENV['CONVERTKIT_API_THIRD_PARTY_INTEGRATIONS_FORM_NAME']
$_ENV['CONVERTKIT_API_FORM_SINGLE_OPTIN_NAME']
);

// Define email address for this test.
Expand All @@ -72,11 +73,60 @@ public function testSettingsForminatorFormToKitFormMapping(EndToEndTester $I)
// Confirm that the email address was added to Kit.
$subscriber = $I->apiCheckSubscriberExists($I, $emailAddress);

// Confirm that the subscriber is active, as a form was used.
// This honors a Form's single optin setting.
$I->assertEquals('active', $subscriber['state']);

// Check that the subscriber has the expected form and referrer value set.
$I->apiCheckSubscriberHasForm(
$I,
subscriberID: $subscriber['id'],
formID: $_ENV['CONVERTKIT_API_THIRD_PARTY_INTEGRATIONS_FORM_ID'],
formID: $_ENV['CONVERTKIT_API_FORM_SINGLE_OPTIN_ID'],
referrer: $_ENV['WORDPRESS_URL'] . $I->grabFromCurrentUrl()
);
}

/**
* Test the Forminator Form integration works and that the subscriber's state is inactive
* when a double optin Form is specified.
*
* @since 3.3.2
*
* @param EndToEndTester $I Tester.
*/
public function testSettingsForminatorFormToKitDoubleOptinFormMapping(EndToEndTester $I)
{
// Setup Forminator Form and configuration for this test.
$pageID = $this->_forminatorSetupForm(
$I,
$_ENV['CONVERTKIT_API_FORM_DOUBLE_OPTIN_NAME']
);

// Define email address for this test.
$emailAddress = $I->generateEmailAddress();

// Complete and submit Forminator Form.
$this->_forminatorCompleteAndSubmitForm(
$I,
pageID: $pageID,
emailAddress: $emailAddress
);

// Wait for the API to update.
$I->wait(2);

// Confirm that the email address was added to Kit.
$subscriber = $I->apiCheckSubscriberExists($I, $emailAddress);

// Confirm that the subscriber is inactive, as a form was used.
// This honors a Form's double optin setting.
$I->assertEquals('inactive', $subscriber['state']);

// Check that the subscriber has the expected form and referrer value set.
$I->apiCheckSubscriberHasForm(
$I,
subscriberID: $subscriber['id'],
formID: $_ENV['CONVERTKIT_API_FORM_DOUBLE_OPTIN_ID'],
referrer: $_ENV['WORDPRESS_URL'] . $I->grabFromCurrentUrl()
);
}
Expand Down Expand Up @@ -246,18 +296,19 @@ public function testSettingsForminatorFormSubscribeOption(EndToEndTester $I)
}

/**
* Test that saving a Forminator Quiz to Kit Form Mapping works.
* Test the Forminator Quiz integration works and that the subscriber's state is active
* when a single optin Form is specified.
*
* @since 2.4.3
* @since 3.3.2
*
* @param EndToEndTester $I Tester.
*/
public function testSettingsForminatorQuizToKitFormMapping(EndToEndTester $I)
public function testSettingsForminatorQuizToKitSingleOptinFormMapping(EndToEndTester $I)
{
// Setup Forminator Quiz and configuration for this test.
$pageID = $this->_forminatorSetupQuiz(
$I,
$_ENV['CONVERTKIT_API_THIRD_PARTY_INTEGRATIONS_FORM_NAME']
$_ENV['CONVERTKIT_API_FORM_SINGLE_OPTIN_NAME']
);

// Define email address for this test.
Expand All @@ -274,7 +325,62 @@ public function testSettingsForminatorQuizToKitFormMapping(EndToEndTester $I)
$I->wait(2);

// Confirm that the email address was added to Kit.
$I->apiCheckSubscriberExists($I, $emailAddress);
$subscriber = $I->apiCheckSubscriberExists($I, $emailAddress);

// Confirm that the subscriber is active, as a form was used.
// This honors a Form's double optin setting.
$I->assertEquals('active', $subscriber['state']);

// Check that the subscriber has the expected form value set.
$I->apiCheckSubscriberHasForm(
$I,
subscriberID: $subscriber['id'],
formID: $_ENV['CONVERTKIT_API_FORM_SINGLE_OPTIN_ID']
);
}

/**
* Test the Forminator Quiz integration works and that the subscriber's state is inactive
* when a double optin Form is specified.
*
* @since 3.3.2
*
* @param EndToEndTester $I Tester.
*/
public function testSettingsForminatorQuizToKitDoubleOptinFormMapping(EndToEndTester $I)
{
// Setup Forminator Quiz and configuration for this test.
$pageID = $this->_forminatorSetupQuiz(
$I,
$_ENV['CONVERTKIT_API_FORM_DOUBLE_OPTIN_NAME']
);

// Define email address for this test.
$emailAddress = $I->generateEmailAddress();

// Complete and submit Forminator Quiz.
$this->_forminatorCompleteAndSubmitQuiz(
$I,
pageID: $pageID,
emailAddress: $emailAddress
);

// Wait for the API to update.
$I->wait(2);

// Confirm that the email address was added to Kit.
$subscriber = $I->apiCheckSubscriberExists($I, $emailAddress);

// Confirm that the subscriber is inactive, as a form was used.
// This honors a Form's double optin setting.
$I->assertEquals('inactive', $subscriber['state']);

// Check that the subscriber has the expected form value set.
$I->apiCheckSubscriberHasForm(
$I,
subscriberID: $subscriber['id'],
formID: $_ENV['CONVERTKIT_API_FORM_DOUBLE_OPTIN_ID']
);
}

/**
Expand Down
63 changes: 57 additions & 6 deletions tests/EndToEnd/integrations/wlm/WishListMemberCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ public function _before(EndToEndTester $I)
}

/**
* Test that WishList Member Level to Kit Form Mapping works,
* and the email address is added to Kit when assigned the WishList Member Level
* Test the WishList Member Level to Kit Double Optin works, and that the subscriber's state is active
* when a single optin Form is specified.
*
* @since 1.9.6
* @since 3.3.2
*
* @param EndToEndTester $I Tester.
*/
public function testWLMToKitFormMappingOnLevelAdded(EndToEndTester $I)
public function testWLMToKitSingleOptinFormMappingOnLevelAdded(EndToEndTester $I)
{
// Get WishList Member Level ID defined.
$wlmLevelID = $this->_getWishListMemberLevelID($I);
Expand All @@ -47,13 +47,64 @@ public function testWLMToKitFormMappingOnLevelAdded(EndToEndTester $I)
$userID = $this->_createUser($I, $emailAddress);

// Configure mapping.
$this->_configureMapping($I, $wlmLevelID, 'add', $_ENV['CONVERTKIT_API_THIRD_PARTY_INTEGRATIONS_FORM_NAME']);
$this->_configureMapping($I, $wlmLevelID, 'add', $_ENV['CONVERTKIT_API_FORM_SINGLE_OPTIN_NAME']);

// Assign level to user.
$this->_assignLevelToUser($I, $wlmLevelID, $userID);

// Confirm that the email address was added to Kit.
$I->apiCheckSubscriberExists($I, $emailAddress);
$subscriber = $I->apiCheckSubscriberExists($I, $emailAddress);

// Confirm that the subscriber is active, as a form was used.
// This honors a Form's single optin setting.
$I->assertEquals('active', $subscriber['state']);

// Check that the subscriber has the expected form value set.
$I->apiCheckSubscriberHasForm(
$I,
subscriberID: $subscriber['id'],
formID: $_ENV['CONVERTKIT_API_FORM_SINGLE_OPTIN_ID']
);
}

/**
* Test the WishList Member Level to Kit Double Optin works, and that the subscriber's state is inactive
* when a double optin Form is specified.
*
* @since 3.3.2
*
* @param EndToEndTester $I Tester.
*/
public function testWLMToKitDoubleOptinFormMappingOnLevelAdded(EndToEndTester $I)
{
// Get WishList Member Level ID defined.
$wlmLevelID = $this->_getWishListMemberLevelID($I);

// Define email address for this test.
$emailAddress = $I->generateEmailAddress();

// Create a test WordPress User.
$userID = $this->_createUser($I, $emailAddress);

// Configure mapping.
$this->_configureMapping($I, $wlmLevelID, 'add', $_ENV['CONVERTKIT_API_FORM_DOUBLE_OPTIN_NAME']);

// Assign level to user.
$this->_assignLevelToUser($I, $wlmLevelID, $userID);

// Confirm that the email address was added to Kit.
$subscriber = $I->apiCheckSubscriberExists($I, $emailAddress);

// Confirm that the subscriber is inactive, as a form was used.
// This honors a Form's double optin setting.
$I->assertEquals('inactive', $subscriber['state']);

// Check that the subscriber has the expected form value set.
$I->apiCheckSubscriberHasForm(
$I,
subscriberID: $subscriber['id'],
formID: $_ENV['CONVERTKIT_API_FORM_DOUBLE_OPTIN_ID']
);
}

/**
Expand Down
Loading