@@ -22,9 +22,6 @@ public function _before(EndToEndTester $I)
2222 {
2323 // Activate Kit Plugin.
2424 $ I ->activateKitPlugin ($ I );
25-
26- // Setup Plugin.
27- $ I ->setupKitPlugin ($ I );
2825 }
2926
3027 /**
@@ -36,8 +33,20 @@ public function _before(EndToEndTester $I)
3633 */
3734 public function testEnableAndDisableMCPServerSetting (EndToEndTester $ I )
3835 {
36+ // Simulate a Kit account that is on a paid plan.
37+ $ I ->setupKitPlugin ($ I );
38+ $ I ->haveOptionInDatabase (
39+ 'convertkit_account ' ,
40+ [
41+ 'account ' => [
42+ 'plan_type ' => 'creator_pro ' ,
43+ ],
44+ ]
45+ );
46+
3947 // Check that the MCP server is not registered.
40- $ I ->doesNotHaveRoute ($ I , '/kit-mcp ' );
48+ $ I ->doesNotHaveRoute ($ I , '/kit/mcp ' );
49+ $ I ->doesNotHaveRoute ($ I , '/kit/mcp/v1 ' );
4150
4251 // Go to the Plugin's MCP Screen.
4352 $ I ->loadKitSettingsMCPScreen ($ I );
@@ -88,6 +97,17 @@ public function testEnableAndDisableMCPServerSetting(EndToEndTester $I)
8897 */
8998 public function testGenerateAndRevokeApplicationPassword (EndToEndTester $ I )
9099 {
100+ // Simulate a Kit account that is on a paid plan.
101+ $ I ->setupKitPlugin ($ I );
102+ $ I ->haveOptionInDatabase (
103+ 'convertkit_account ' ,
104+ [
105+ 'account ' => [
106+ 'plan_type ' => 'creator_pro ' ,
107+ ],
108+ ]
109+ );
110+
91111 // Go to the Plugin's MCP Screen.
92112 $ I ->loadKitSettingsMCPScreen ($ I );
93113
@@ -158,6 +178,86 @@ public function testGenerateAndRevokeApplicationPassword(EndToEndTester $I)
158178 $ I ->waitForElementNotVisible ('#convertkit-settings-mcp-revoke-application-password ' );
159179 }
160180
181+ /**
182+ * Tests that a free-plan Kit account sees the upgrade CTA on the MCP tab
183+ * instead of the enable / connect UI, and that the MCP REST route is not
184+ * registered even when the enabled setting is on.
185+ *
186+ * @since 3.4.0
187+ *
188+ * @param EndToEndTester $I Tester.
189+ */
190+ public function testFreePlanShowsUpgradeCTA (EndToEndTester $ I )
191+ {
192+ // Simulate a Kit account that is on the free plan.
193+ $ I ->setupKitPluginFakeAPIKey ($ I );
194+ $ I ->setupKitPluginResources ($ I );
195+ $ I ->haveOptionInDatabase (
196+ 'convertkit_account ' ,
197+ [
198+ 'account ' => [
199+ 'plan_type ' => 'free ' ,
200+ ],
201+ ]
202+ );
203+
204+ // Enable MCP server.
205+ $ I ->haveOptionInDatabase (
206+ '_wp_convertkit_settings_mcp ' ,
207+ [
208+ 'enabled ' => 'on ' ,
209+ ]
210+ );
211+
212+ // Load the MCP settings tab.
213+ $ I ->loadKitSettingsMCPScreen ($ I );
214+
215+ // Assert that the upgrade CTA is shown.
216+ $ I ->see ('The Kit WordPress MCP is available on paid Kit plans. Upgrade your Kit account to connect AI clients to your WordPress site. ' );
217+ $ I ->seeLink ('Upgrade Kit Account ' );
218+
219+ // Assert no option to enable/disable the MCP server are shown.
220+ $ I ->dontSeeElement ('#enabled ' );
221+ $ I ->dontSee ('Create Application Password ' );
222+
223+ // Assert that the MCP server is not registered.
224+ $ I ->doesNotHaveRoute ($ I , '/kit/mcp ' );
225+ $ I ->doesNotHaveRoute ($ I , '/kit/mcp/v1 ' );
226+ }
227+
228+ /**
229+ * Tests that a paid-plan Kit account sees the enable UI on the MCP tab
230+ * (i.e. the upgrade CTA is not shown).
231+ *
232+ * @since 3.4.0
233+ *
234+ * @param EndToEndTester $I Tester.
235+ */
236+ public function testPaidPlanShowsEnableUI (EndToEndTester $ I )
237+ {
238+ // Simulate a Kit account that is on a paid plan.
239+ $ I ->setupKitPlugin ($ I );
240+ $ I ->setupKitPluginResources ($ I );
241+ $ I ->haveOptionInDatabase (
242+ 'convertkit_account ' ,
243+ [
244+ 'account ' => [
245+ 'plan_type ' => 'creator_pro ' ,
246+ ],
247+ ]
248+ );
249+
250+ // Load the MCP settings tab.
251+ $ I ->loadKitSettingsMCPScreen ($ I );
252+
253+ // The upgrade CTA should not be shown.
254+ $ I ->dontSee ('The Kit WordPress MCP is available on paid Kit plans. Upgrade your Kit account to connect AI clients to your WordPress site. ' );
255+ $ I ->dontSeeLink ('Upgrade Kit Account ' );
256+
257+ // The Enable checkbox should be visible.
258+ $ I ->seeElement ('#enabled ' );
259+ }
260+
161261 /**
162262 * Deactivate and reset Plugin(s) after each test, if the test passes.
163263 * We don't use _after, as this would provide a screenshot of the Plugin
0 commit comments