Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
f6e5535
Member Content: Courses: Improve SQL query for 6.9 compat.
n7studios Nov 13, 2025
7c82265
Tests: Improve Reliability
n7studios Nov 17, 2025
58ae5eb
Improve bulk edit
n7studios Nov 17, 2025
65af43b
Wait for Plugins page to load after Plugin activation
n7studios Nov 17, 2025
a146847
Plugin activation: reload page to avoid stale reference
n7studios Nov 17, 2025
6b96a0c
Login: Improve login reliability
n7studios Nov 17, 2025
d9d5ba2
API: Use microtime() on emails to avoid race condition where two test…
n7studios Nov 17, 2025
f1ce730
Category Forms: Improve detection of success notice
n7studios Nov 17, 2025
068d377
Review Request: Improve detection of links
n7studios Nov 17, 2025
ffa218d
Emails: Use better method for microtime generation
n7studios Nov 17, 2025
54c53e5
Tests: Member Content Filters: Check filter option selected after sub…
n7studios Nov 17, 2025
c51a0fe
Configure chromedriver to be less flaky
n7studios Nov 18, 2025
03a8228
Improve Uncode tests
n7studios Nov 18, 2025
831b68d
Form Builder Tests: Improve reliability
n7studios Nov 18, 2025
100c868
GitHub Actions: Run integration tests in own matrix
n7studios Nov 18, 2025
47d4f0f
Merge branch 'main' into restrict-content-prev-next-link-compat-6-9
n7studios Nov 18, 2025
725a2af
Merge branch 'main' into tests-improve-reliability
n7studios Nov 18, 2025
5f93181
Isolate review request test
n7studios Nov 18, 2025
3660cfa
Reinstate all tests
n7studios Nov 18, 2025
5c6c288
Switch back to main frame after viewing an iframe
n7studios Nov 18, 2025
37e2cc9
Merge branch 'tests-improve-reliability' into restrict-content-prev-n…
n7studios Nov 18, 2025
28a0a01
Merge pull request #957 from Kit/restrict-content-prev-next-link-comp…
n7studios Nov 19, 2025
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
12 changes: 3 additions & 9 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ jobs:
'EndToEnd/products',
'EndToEnd/restrict-content/general',
'EndToEnd/restrict-content/post-types',
'EndToEnd/tags'
'EndToEnd/tags',
'Integration'
]

# Steps to install, configure and run tests
Expand Down Expand Up @@ -313,14 +314,7 @@ jobs:
working-directory: ${{ env.PLUGIN_DIR }}
run: php vendor/bin/codecept build

# Run Codeception Integration Tests on the PHP 8.3 instance before the EndToEnd/tags End to End tests.
# We run these once to avoid hitting API rate limits.
- name: Run tests/wpunit
if: ${{ matrix.php-versions == '8.3' && matrix.test-groups == 'EndToEnd/tags' }}
working-directory: ${{ env.PLUGIN_DIR }}
run: php vendor/bin/codecept run tests/Integration --fail-fast

# Run Codeception End to End Tests
# Run Codeception Tests.
- name: Run tests/${{ matrix.test-groups }}
working-directory: ${{ env.PLUGIN_DIR }}
run: php vendor/bin/codecept run tests/${{ matrix.test-groups }} --fail-fast
Expand Down
4 changes: 2 additions & 2 deletions includes/class-convertkit-output-restrict-content.php
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ public function maybe_change_previous_post_where_clause( $where, $in_same_term,
$new_where = 'p.post_parent = ' . $post->post_parent . ' AND p.menu_order < ' . $post->menu_order;

// Replace existing where statement with new statement.
$where = 'WHERE ' . $new_where . ' ' . substr( $where, strpos( $where, 'AND' ) );
$where = 'WHERE ' . $new_where . ' ' . substr( $where, strpos( $where, 'AND p.post_type = \'' . $post->post_type . '\' ' ) );

// Return.
return $where;
Expand Down Expand Up @@ -551,7 +551,7 @@ public function maybe_change_next_post_where_clause( $where, $in_same_term, $exc
$new_where = 'p.post_parent = ' . $post->post_parent . ' AND p.menu_order > ' . $post->menu_order;

// Replace existing where statement with new statement.
$where = 'WHERE ' . $new_where . ' ' . substr( $where, strpos( $where, 'AND' ) );
$where = 'WHERE ' . $new_where . ' ' . substr( $where, strpos( $where, 'AND p.post_type = \'' . $post->post_type . '\' ' ) );

// Return.
return $where;
Expand Down
2 changes: 2 additions & 0 deletions tests/EndToEnd.suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ modules:
capabilities:
"goog:chromeOptions":
args:
- "--headless"
- "--disable-gpu"
- "--disable-dev-shm-usage"
- "--disable-software-rasterizer"
- "--proxy-server='direct://'"
- "--proxy-bypass-list=*"
- "--no-sandbox"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public function testFormBuilderBlockWithDefaultConfiguration(EndToEndTester $I)
$I->click('div.wp-block-convertkit-form-builder button[type="submit"]');

// Confirm that the message and form is displayed.
$I->waitForElementVisible('body.page');
$I->waitForElementVisible('.convertkit-form-builder-subscribed-message');
$I->see('Thanks for subscribing!');
$I->seeElementInDOM('input[name="convertkit[first_name]"]');
$I->seeElementInDOM('input[name="convertkit[email]"]');
Expand Down Expand Up @@ -265,12 +265,11 @@ public function testFormBuilderBlockWithTextCustomization(EndToEndTester $I)
$I->fillField('input[name="convertkit[first_name]"]', 'First');
$I->fillField('input[name="convertkit[email]"]', $emailAddress);
$I->click('div.wp-block-convertkit-form-builder button[type="submit"]');
$I->waitForElementVisible('body.page');

// Check that the form no longer displays and the message displays.
$I->dontSeeElementInDOM('input[name="convertkit[first_name]"]');
$I->dontSeeElementInDOM('input[name="convertkit[email]"]');
$I->see('Welcome to the newsletter!');
$I->waitForText('Welcome to the newsletter!', 10, '.convertkit-form-builder.wp-block-convertkit-form-builder');

// Confirm that the email address was added to Kit.
$I->apiCheckSubscriberExists(
Expand Down Expand Up @@ -367,10 +366,9 @@ public function testFormBuilderBlockWithFormEnabled(EndToEndTester $I)
$I->fillField('input[name="convertkit[first_name]"]', 'First');
$I->fillField('input[name="convertkit[email]"]', $emailAddress);
$I->click('div.wp-block-convertkit-form-builder button[type="submit"]');
$I->waitForElementVisible('body.page');

// Confirm that the email address was added to Kit.
$I->waitForElementVisible('body.page');
$I->waitForElementVisible('.convertkit-form-builder-subscribed-message');
$I->wait(3);
$subscriber = $I->apiCheckSubscriberExists(
$I,
Expand Down Expand Up @@ -474,10 +472,9 @@ public function testFormBuilderBlockWithTaggingEnabled(EndToEndTester $I)
$I->fillField('input[name="convertkit[first_name]"]', 'First');
$I->fillField('input[name="convertkit[email]"]', $emailAddress);
$I->click('div.wp-block-convertkit-form-builder button[type="submit"]');
$I->waitForElementVisible('body.page');

// Confirm that the email address was added to Kit.
$I->waitForElementVisible('body.page');
$I->waitForElementVisible('.convertkit-form-builder-subscribed-message');
$I->wait(3);
$subscriber = $I->apiCheckSubscriberExists(
$I,
Expand Down Expand Up @@ -580,10 +577,9 @@ public function testFormBuilderBlockWithSequenceEnabled(EndToEndTester $I)
$I->fillField('input[name="convertkit[first_name]"]', 'First');
$I->fillField('input[name="convertkit[email]"]', $emailAddress);
$I->click('div.wp-block-convertkit-form-builder button[type="submit"]');
$I->waitForElementVisible('body.page');

// Confirm that the email address was added to Kit.
$I->waitForElementVisible('body.page');
$I->waitForElementVisible('.convertkit-form-builder-subscribed-message');
$I->wait(3);
$subscriber = $I->apiCheckSubscriberExists(
$I,
Expand Down Expand Up @@ -718,7 +714,7 @@ public function testFormBuilderBlockWithCustomField(EndToEndTester $I)
$I->click('div.wp-block-convertkit-form-builder button[type="submit"]');

// Confirm that the email address was added to Kit.
$I->waitForElementVisible('body.page');
$I->waitForElementVisible('.convertkit-form-builder-subscribed-message');
$I->wait(3);
$subscriber = $I->apiCheckSubscriberExists(
$I,
Expand Down Expand Up @@ -1051,7 +1047,7 @@ public function testFormBuilderWithRecaptchaEnabled(EndToEndTester $I)
$I->click('div.wp-block-convertkit-form-builder button[type="submit"]');

// Confirm that the email address was added to Kit.
$I->waitForElementVisible('body.page');
$I->waitForElementVisible('.convertkit-form-builder-subscribed-message');
$I->wait(3);
$I->apiCheckSubscriberExists(
$I,
Expand Down Expand Up @@ -1118,7 +1114,6 @@ public function testFormBuilderWithRecaptchaEnabledAndHighMinimumScore(EndToEndT
$I->click('div.wp-block-convertkit-form-builder button[type="submit"]');

// Confirm that the email address was not added to Kit, as reCAPTCHA score failed.
$I->waitForElementVisible('body.page');
$I->wait(3);
$I->apiCheckSubscriberDoesNotExist($I, $emailAddress);
}
Expand Down Expand Up @@ -1192,7 +1187,7 @@ public function testFormBuilderWithStoreEntriesEnabled(EndToEndTester $I)
$I->click('div.wp-block-convertkit-form-builder button[type="submit"]');

// Confirm that the email address was added to Kit.
$I->waitForElementVisible('body.page');
$I->waitForElementVisible('.convertkit-form-builder-subscribed-message');
$I->wait(3);
$subscriber = $I->apiCheckSubscriberExists(
$I,
Expand Down
20 changes: 4 additions & 16 deletions tests/EndToEnd/forms/general/CategoryFormCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,8 @@ public function testEditCategoryWithValidFormSetting(EndToEndTester $I)
// Click Update.
$I->click('Update');

// Wait for the page to load.
$I->waitForElementVisible('#wpfooter');

// Check that the update succeeded.
$I->seeElementInDOM('div.notice-success');
$I->waitForElementVisible('.notice-success');

// Check that no PHP warnings or notices were output.
$I->checkNoWarningsAndNoticesOnScreen($I);
Expand Down Expand Up @@ -287,11 +284,8 @@ public function testEditCategoryWithNoneFormSetting(EndToEndTester $I)
// Click Update.
$I->click('Update');

// Wait for the page to load.
$I->waitForElementVisible('#wpfooter');

// Check that the update succeeded.
$I->seeElementInDOM('div.notice-success');
$I->waitForElementVisible('.notice-success');

// Check that no PHP warnings or notices were output.
$I->checkNoWarningsAndNoticesOnScreen($I);
Expand Down Expand Up @@ -487,11 +481,8 @@ public function testEditCategoryWithFormPositionBefore(EndToEndTester $I)
// Click Update.
$I->click('Update');

// Wait for the page to load.
$I->waitForElementVisible('#wpfooter');

// Check that the update succeeded.
$I->seeElementInDOM('div.notice-success');
$I->waitForElementVisible('.notice-success');

// Check that no PHP warnings or notices were output.
$I->checkNoWarningsAndNoticesOnScreen($I);
Expand Down Expand Up @@ -572,11 +563,8 @@ public function testEditCategoryWithFormPositionAfter(EndToEndTester $I)
// Click Update.
$I->click('Update');

// Wait for the page to load.
$I->waitForElementVisible('#wpfooter');

// Check that the update succeeded.
$I->seeElementInDOM('div.notice-success');
$I->waitForElementVisible('.notice-success');

// Check that no PHP warnings or notices were output.
$I->checkNoWarningsAndNoticesOnScreen($I);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function testPluginActivationAndDeactivationWithOtherPlugins(EndToEndTest
$I->checkNoWarningsAndNoticesOnScreen($I);

// Deactivate Plugins.
$I->deactivateKitPlugin($I);
$I->deactivateThirdPartyPlugin($I, 'convertkit-for-woocommerce');
$I->deactivateKitPlugin($I);
}
}
12 changes: 9 additions & 3 deletions tests/EndToEnd/general/other/ReviewRequestCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,17 @@ public function testReviewRequestNotificationDisplayed(EndToEndTester $I)
$I->amOnAdminPage('index.php');

// Confirm the review displays.
$I->seeElementInDOM('div.review-convertkit');
$I->waitForElementVisible('div.review-convertkit');

// Confirm links are correct.
$I->seeInSource('<a href="https://wordpress.org/support/plugin/convertkit/reviews/?filter=5#new-post" class="button button-primary" rel="noopener" target="_blank">');
$I->seeInSource('<a href="https://kit.com/support" class="button" rel="noopener" target="_blank">');
$I->assertEquals(
$I->grabAttributeFrom('div.review-convertkit a.button-primary', 'href'),
'https://wordpress.org/support/plugin/convertkit/reviews/?filter=5#new-post'
);
$I->assertEquals(
$I->grabAttributeFrom('div.review-convertkit a.button:not(.button-primary)', 'href'),
'https://kit.com/support'
);
}

/**
Expand Down
3 changes: 3 additions & 0 deletions tests/EndToEnd/integrations/other/ContactForm7FormCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,9 @@ function($I) {
$I->waitForElementVisible('.formkit-modal');
$I->switchToIFrame('.formkit-modal iframe');
$I->waitForElementVisible('main[data-component="Page"]');

// Switch back to main window.
$I->switchToIFrame();
}

/**
Expand Down
3 changes: 3 additions & 0 deletions tests/EndToEnd/integrations/other/ForminatorCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,9 @@ function($I) {
$I->waitForElementVisible('.formkit-modal');
$I->switchToIFrame('.formkit-modal iframe');
$I->waitForElementVisible('main[data-component="Page"]');

// Switch back to main window.
$I->switchToIFrame();
}

/**
Expand Down
9 changes: 9 additions & 0 deletions tests/EndToEnd/products/PageBlockProductCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,9 @@ public function testProductBlockWithValidDiscountCodeParameter(EndToEndTester $I
$I->switchToIFrame('iframe[data-active]');
$I->waitForElementVisible('.formkit-main');
$I->see('$0.00');

// Switch back to main window.
$I->switchToIFrame();
}

/**
Expand Down Expand Up @@ -312,6 +315,9 @@ public function testProductBlockWithInvalidDiscountCodeParameter(EndToEndTester
$I->switchToIFrame('iframe[data-active]');
$I->waitForElementVisible('.formkit-main');
$I->see('The coupon is not valid.');

// Switch back to main window.
$I->switchToIFrame();
}

/**
Expand Down Expand Up @@ -369,6 +375,9 @@ public function testProductBlockWithCheckoutParameterEnabled(EndToEndTester $I)
$I->switchToIFrame('iframe[data-active]');
$I->waitForElementVisible('.formkit-main');
$I->see('Order Summary');

// Switch back to main window.
$I->switchToIFrame();
}

/**
Expand Down
9 changes: 9 additions & 0 deletions tests/EndToEnd/products/PageShortcodeProductCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,9 @@ public function testProductShortcodeInVisualEditorWithValidDiscountCodeParameter
$I->switchToIFrame('iframe[data-active]');
$I->waitForElementVisible('.formkit-main');
$I->see('$0.00');

// Switch back to main window.
$I->switchToIFrame();
}

/**
Expand Down Expand Up @@ -308,6 +311,9 @@ public function testProductShortcodeInVisualEditorWithInvalidDiscountCodeParamet
$I->switchToIFrame('iframe[data-active]');
$I->waitForElementVisible('.formkit-main');
$I->see('The coupon is not valid.');

// Switch back to main window.
$I->switchToIFrame();
}

/**
Expand Down Expand Up @@ -355,6 +361,9 @@ public function testProductShortcodeWithCheckoutParameterEnabled(EndToEndTester
$I->switchToIFrame('iframe[data-active]');
$I->waitForElementVisible('.formkit-main');
$I->see('Order Summary');

// Switch back to main window.
$I->switchToIFrame();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,12 @@ public function testFilterByProduct(EndToEndTester $I)
$I->selectOption('#wp-convertkit-restrict-content-filter', $_ENV['CONVERTKIT_API_PRODUCT_NAME']);
$I->click('Filter');

// Wait for the WP_List_Table of Pages to load.
$I->waitForElementVisible('tbody#the-list');

// Check that no PHP warnings or notices were output.
$I->checkNoWarningsAndNoticesOnScreen($I);

// Check the filter dropdown is set to the selected value.
$I->seeOptionIsSelected('#wp-convertkit-restrict-content-filter', $_ENV['CONVERTKIT_API_PRODUCT_NAME']);

// Confirm that the Page is still listed, and has the 'Kit Member Content' label.
$I->see('Kit: Page: Restricted Content: Product: Filter Test');
$I->see('Kit Member Content');
Expand Down Expand Up @@ -153,12 +153,12 @@ public function testFilterByTag(EndToEndTester $I)
$I->selectOption('#wp-convertkit-restrict-content-filter', $_ENV['CONVERTKIT_API_TAG_NAME']);
$I->click('Filter');

// Wait for the WP_List_Table of Pages to load.
$I->waitForElementVisible('tbody#the-list');

// Check that no PHP warnings or notices were output.
$I->checkNoWarningsAndNoticesOnScreen($I);

// Check the filter dropdown is set to the selected value.
$I->seeOptionIsSelected('#wp-convertkit-restrict-content-filter', $_ENV['CONVERTKIT_API_TAG_NAME']);

// Confirm that the Page is still listed, and has the 'Kit Member Content' label.
$I->see('Kit: Page: Restricted Content: Tag: Filter Test');
$I->see('Kit Member Content');
Expand Down Expand Up @@ -203,12 +203,12 @@ public function testFilterByForm(EndToEndTester $I)
$I->selectOption('#wp-convertkit-restrict-content-filter', $_ENV['CONVERTKIT_API_FORM_NAME']);
$I->click('Filter');

// Wait for the WP_List_Table of Pages to load.
$I->waitForElementVisible('tbody#the-list');

// Check that no PHP warnings or notices were output.
$I->checkNoWarningsAndNoticesOnScreen($I);

// Check the filter dropdown is set to the selected value.
$I->seeOptionIsSelected('#wp-convertkit-restrict-content-filter', $_ENV['CONVERTKIT_API_FORM_NAME']);

// Confirm that the Page is still listed, and has the 'Kit Member Content' label.
$I->see('Kit: Page: Restricted Content: Form: Filter Test');
$I->see('Kit Member Content');
Expand Down Expand Up @@ -285,12 +285,12 @@ public function testFilterByAllMemberOnlyContent(EndToEndTester $I)
$I->selectOption('#wp-convertkit-restrict-content-filter', 'All member-only content');
$I->click('Filter');

// Wait for the WP_List_Table of Pages to load.
$I->waitForElementVisible('tbody#the-list');

// Check that no PHP warnings or notices were output.
$I->checkNoWarningsAndNoticesOnScreen($I);

// Check the filter dropdown is set to the selected value.
$I->seeOptionIsSelected('#wp-convertkit-restrict-content-filter', 'All member-only content');

// Confirm that the Restrict Content Pages are listed.
$I->see('Kit: Page: Restricted Content: Form: Filter Test');
$I->see('Kit: Page: Restricted Content: Tag: Filter Test');
Expand Down Expand Up @@ -371,9 +371,6 @@ public function testNoFilteringWhenAllContentSelected(EndToEndTester $I)
// Click the Filter button with no changes made.
$I->click('Filter');

// Wait for the WP_List_Table of Pages to load.
$I->waitForElementVisible('tbody#the-list');

// Check that no PHP warnings or notices were output.
$I->checkNoWarningsAndNoticesOnScreen($I);

Expand Down
Loading