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: 0 additions & 60 deletions tests/EndToEnd/forms/general/CategoryFormCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,6 @@ public function testAddCategoryWithValidFormSetting(EndToEndTester $I)
value: $_ENV['CONVERTKIT_API_FORM_NAME']
);

// Check the order of the Form resources are alphabetical, with the Default option prepending the Forms.
$I->checkSelectFormOptionOrder(
$I,
selectElement: '#wp-convertkit-form',
prependOptions: [
'Default',
'None',
]
);

// Save.
$I->click('input#submit');

Expand Down Expand Up @@ -117,16 +107,6 @@ public function testAddCategoryWithNoneFormSetting(EndToEndTester $I)
value: 'None'
);

// Check the order of the Form resources are alphabetical, with the Default option prepending the Forms.
$I->checkSelectFormOptionOrder(
$I,
selectElement: '#wp-convertkit-form',
prependOptions: [
'Default',
'None',
]
);

// Save.
$I->click('input#submit');

Expand Down Expand Up @@ -192,16 +172,6 @@ public function testEditCategoryWithValidFormSetting(EndToEndTester $I)
// Confirm that settings have label[for] attributes.
$I->seeInSource('<label for="wp-convertkit-form">');

// Check the order of the Form resources are alphabetical, with the Default option prepending the Forms.
$I->checkSelectFormOptionOrder(
$I,
selectElement: '#wp-convertkit-form',
prependOptions: [
'Default',
'None',
]
);

// Change Form to value specified in the .env file.
$I->fillSelect2Field(
$I,
Expand Down Expand Up @@ -264,16 +234,6 @@ public function testEditCategoryWithNoneFormSetting(EndToEndTester $I)
// Confirm that settings have label[for] attributes.
$I->seeInSource('<label for="wp-convertkit-form">');

// Check the order of the Form resources are alphabetical, with the Default option prepending the Forms.
$I->checkSelectFormOptionOrder(
$I,
selectElement: '#wp-convertkit-form',
prependOptions: [
'Default',
'None',
]
);

// Change Form to None.
$I->fillSelect2Field(
$I,
Expand Down Expand Up @@ -460,16 +420,6 @@ public function testEditCategoryWithFormPositionBefore(EndToEndTester $I)
// Confirm that settings have label[for] attributes.
$I->seeInSource('<label for="wp-convertkit-form">');

// Check the order of the Form resources are alphabetical, with the Default option prepending the Forms.
$I->checkSelectFormOptionOrder(
$I,
selectElement: '#wp-convertkit-form',
prependOptions: [
'Default',
'None',
]
);

// Change Form to value specified in the .env file.
$I->fillSelect2Field(
$I,
Expand Down Expand Up @@ -542,16 +492,6 @@ public function testEditCategoryWithFormPositionAfter(EndToEndTester $I)
// Confirm that settings have label[for] attributes.
$I->seeInSource('<label for="wp-convertkit-form">');

// Check the order of the Form resources are alphabetical, with the Default option prepending the Forms.
$I->checkSelectFormOptionOrder(
$I,
selectElement: '#wp-convertkit-form',
prependOptions: [
'Default',
'None',
]
);

// Change Form to value specified in the .env file.
$I->fillSelect2Field(
$I,
Expand Down
10 changes: 0 additions & 10 deletions tests/EndToEnd/forms/post-types/CPTFormCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,16 +138,6 @@ public function testAddNewCPTUsingDefaultFormWithNoDefaultFormSpecifiedInPlugin(
title: 'Kit: CPT: Form: Default: None'
);

// Check the order of the Form resources are alphabetical, with the Default and None options prepending the Forms.
$I->checkSelectFormOptionOrder(
$I,
'#wp-convertkit-form',
[
'Default',
'None',
]
);

// Publish and view the CPT on the frontend site.
$I->publishAndViewGutenbergPage($I);

Expand Down
10 changes: 0 additions & 10 deletions tests/EndToEnd/forms/post-types/PageFormCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,6 @@ public function testAddNewPageUsingDefaultFormWithNoDefaultFormSpecifiedInPlugin
title: 'Kit: Page: Form: Default: None'
);

// Check the order of the Form resources are alphabetical, with the Default and None options prepending the Forms.
$I->checkSelectFormOptionOrder(
$I,
selectElement: '#wp-convertkit-form',
prependOptions: [
'Default',
'None',
]
);

// Publish and view the Page on the frontend site.
$I->publishAndViewGutenbergPage($I);

Expand Down
10 changes: 0 additions & 10 deletions tests/EndToEnd/forms/post-types/PostFormCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,6 @@ public function testAddNewPostUsingDefaultFormWithNoDefaultFormSpecifiedInPlugin
title: 'Kit: Post: Form: Default: None'
);

// Check the order of the Form resources are alphabetical, with the Default and None options prepending the Forms.
$I->checkSelectFormOptionOrder(
$I,
selectElement: '#wp-convertkit-form',
prependOptions: [
'Default',
'None',
]
);

// Publish and view the Post on the frontend site.
$I->publishAndViewGutenbergPage($I);

Expand Down
210 changes: 210 additions & 0 deletions tests/EndToEnd/general/other/SelectOptionOrderCest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
<?php

namespace Tests\EndToEnd;

use Tests\Support\EndToEndTester;

/**
* Tests for the order of resources in select elements.
*
* @since 3.3.0
*/
class SelectOptionOrderCest
{
/**
* Run common actions before running the test functions in this class.
*
* @since 3.3.0
*
* @param EndToEndTester $I Tester.
*/
public function _before(EndToEndTester $I)
{
// Activate and Setup Kit plugin.
$I->activateKitPlugin($I);
$I->activateThirdPartyPlugin($I, 'classic-editor');
$I->setupKitPlugin($I);
$I->setupKitPluginResources($I);

// Create Custom Post Types using the Custom Post Type UI Plugin.
$I->registerCustomPostTypes($I);
}

/**
* Test that the order of the Form resources are alphabetical, with the Default and None options prepending the Forms,
* when adding a new Category.
*
* @since 3.3.0
*
* @param EndToEndTester $I Tester.
*/
public function testFormSelectOrderOnAddCategory(EndToEndTester $I)
{
// Navigate to Posts > Categories.
$I->amOnAdminPage('edit-tags.php?taxonomy=category');

// Check the order of the Form resources are alphabetical, with the Default option prepending the Forms.
$I->checkSelectFormOptionOrder(
$I,
selectElement: '#wp-convertkit-form',
prependOptions: [
'Default',
'None',
]
);
}

/**
* Test that the order of the Form resources are alphabetical, with the Default and None options prepending the Forms,
* when editing a Category.
*
* @since 3.3.0
*
* @param EndToEndTester $I Tester.
*/
public function testFormSelectOrderOnEditCategory(EndToEndTester $I)
{
// Create Category.
$termID = $I->haveTermInDatabase( 'Kit: Edit Category', 'category' );
$termID = $termID[0];

// Edit the Term.
$I->amOnAdminPage('term.php?taxonomy=category&tag_ID=' . $termID);

// Check the order of the Form resources are alphabetical, with the Default option prepending the Forms.
$I->checkSelectFormOptionOrder(
$I,
selectElement: '#wp-convertkit-form',
prependOptions: [
'Default',
'None',
]
);
}

/**
* Test that the order of the Form resources are alphabetical, with the Default and None options prepending the Forms,
* when Pages, Posts and Custom Post Types (CPTs) are added.
*
* @since 3.3.0
*
* @param EndToEndTester $I Tester.
*/
public function testFormSelectOrderOnPostTypes(EndToEndTester $I)
{
// Navigate to Pages > Add New.
$I->amOnAdminPage('post-new.php?post_type=page');

// Check the order of the Form resources are alphabetical, with the Default and None options prepending the Forms.
$I->checkSelectFormOptionOrder(
$I,
selectElement: '#wp-convertkit-form',
prependOptions: [
'Default',
'None',
]
);

// Check the order of the Landing Page resources are alphabetical, with the None option prepending the Landing Pages.
$I->checkSelectLandingPageOptionOrder(
$I,
selectElement: '#wp-convertkit-landing_page',
prependOptions: [
'None',
]
);

// Check the order of the Tag resources are alphabetical, with the None option prepending the Tags.
$I->checkSelectTagOptionOrder(
$I,
selectElement: '#wp-convertkit-tag',
prependOptions: [
'None',
]
);

// Navigate to Posts > Add New.
$I->amOnAdminPage('post-new.php?post_type=post');

// Check the order of the Form resources are alphabetical, with the Default and None options prepending the Forms.
$I->checkSelectFormOptionOrder(
$I,
selectElement: '#wp-convertkit-form',
prependOptions: [
'Default',
'None',
]
);

// Check the order of the Tag resources are alphabetical, with the None option prepending the Tags.
$I->checkSelectTagOptionOrder(
$I,
selectElement: '#wp-convertkit-tag',
prependOptions: [
'None',
]
);

// Navigate to Custom Post Type > Add New.
$I->amOnAdminPage('post-new.php?post_type=article');

// Check the order of the Form resources are alphabetical, with the Default and None options prepending the Forms.
$I->checkSelectFormOptionOrder(
$I,
selectElement: '#wp-convertkit-form',
prependOptions: [
'Default',
'None',
]
);

// Check the order of the Tag resources are alphabetical, with the None option prepending the Tags.
$I->checkSelectTagOptionOrder(
$I,
selectElement: '#wp-convertkit-tag',
prependOptions: [
'None',
]
);
}

/**
* Test that the order of the Form resources are alphabetical, with the None option prepending the Forms,
* when the Plugin Settings General screen is viewed.
*
* @since 3.3.0
*
* @param EndToEndTester $I Tester.
*/
public function testFormSelectOrderOnPluginSettingsGeneralScreen(EndToEndTester $I)
{
// Go to the Plugin's Settings Screen.
$I->loadKitSettingsGeneralScreen($I);

// Check the order of the Form resources are alphabetical, with 'None' as the first choice.
$I->checkSelectFormOptionOrder(
$I,
selectElement: '#_wp_convertkit_settings_page_form',
prependOptions: [
'None',
]
);
}

/**
* Deactivate and reset Plugin(s) after each test, if the test passes.
* We don't use _after, as this would provide a screenshot of the Plugin
* deactivation and not the true test error.
*
* @since 3.3.0
*
* @param EndToEndTester $I Tester.
*/
public function _passed(EndToEndTester $I)
{
$I->unregisterCustomPostTypes($I);
$I->deactivateThirdPartyPlugin($I, 'classic-editor');
$I->deactivateKitPlugin($I);
$I->resetKitPlugin($I);
}
}
9 changes: 0 additions & 9 deletions tests/EndToEnd/general/other/UpgradePathsCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,6 @@ public function testGetAccessTokenByAPIKeyAndSecret(EndToEndTester $I)
// Confirm the Plugin authorized by checking for a Disconnect button.
$I->see('Kit WordPress');
$I->see('Disconnect');

// Check the order of the Form resources are alphabetical, with 'None' as the first choice.
$I->checkSelectFormOptionOrder(
$I,
'#_wp_convertkit_settings_page_form',
[
'None',
]
);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,6 @@ public function testValidCredentials(EndToEndTester $I)
$I->see('Disconnect');
$I->seeElementInDOM('input#submit');

// Check the order of the Form resources are alphabetical, with 'None' as the first choice.
$I->checkSelectFormOptionOrder(
$I,
'#_wp_convertkit_settings_page_form',
[
'None',
]
);

// Save Changes to confirm credentials are not lost.
$I->click('Save Changes');

Expand Down
Loading
Loading