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
76 changes: 50 additions & 26 deletions tests/EndToEnd/landing-pages/PageLandingPageCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,25 @@ public function _before(EndToEndTester $I)
public function testAddNewPageUsingNoLandingPage(EndToEndTester $I)
{
// Add a Page using the Gutenberg editor.
$I->addGutenbergPage($I, 'page', 'Kit: Page: Landing Page: None');
$I->addGutenbergPage(
$I,
title: 'Kit: Page: Landing Page: None'
);

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

// Configure metabox's Landing Page setting = None.
$I->configureMetaboxSettings(
$I,
'wp-convertkit-meta-box',
[
metabox: 'wp-convertkit-meta-box',
configuration: [
'landing_page' => [ 'select2', 'None' ],
]
);
Expand All @@ -78,13 +81,16 @@ public function testAddNewPageUsingNoLandingPage(EndToEndTester $I)
public function testAddNewPageUsingDefinedLandingPage(EndToEndTester $I)
{
// Add a Page using the Gutenberg editor.
$I->addGutenbergPage($I, 'page', 'Kit: Page: Landing Page: ' . $_ENV['CONVERTKIT_API_LANDING_PAGE_NAME']);
$I->addGutenbergPage(
$I,
title: 'Kit: Page: Landing Page: ' . $_ENV['CONVERTKIT_API_LANDING_PAGE_NAME']
);

// Configure metabox's Landing Page setting to value specified in the .env file.
$I->configureMetaboxSettings(
$I,
'wp-convertkit-meta-box',
[
metabox: 'wp-convertkit-meta-box',
configuration: [
'landing_page' => [ 'select2', $_ENV['CONVERTKIT_API_LANDING_PAGE_NAME'] ],
]
);
Expand Down Expand Up @@ -125,13 +131,16 @@ public function testLandingPageSiteIcon(EndToEndTester $I)
$I->haveOptionInDatabase('site_icon', $imageID);

// Add a Page using the Gutenberg editor.
$I->addGutenbergPage($I, 'page', 'Kit: Page: Landing Page: Site Icon: ' . $_ENV['CONVERTKIT_API_LANDING_PAGE_NAME']);
$I->addGutenbergPage(
$I,
title: 'Kit: Page: Landing Page: Site Icon: ' . $_ENV['CONVERTKIT_API_LANDING_PAGE_NAME']
);

// Configure metabox's Landing Page setting to value specified in the .env file.
$I->configureMetaboxSettings(
$I,
'wp-convertkit-meta-box',
[
metabox: 'wp-convertkit-meta-box',
configuration: [
'landing_page' => [ 'select2', $_ENV['CONVERTKIT_API_LANDING_PAGE_NAME'] ],
]
);
Expand Down Expand Up @@ -167,13 +176,16 @@ public function testLandingPageSiteIcon(EndToEndTester $I)
public function testLandingPageCharacterEncoding(EndToEndTester $I)
{
// Add a Page using the Gutenberg editor.
$I->addGutenbergPage($I, 'page', 'Kit: Page: Landing Page: ' . $_ENV['CONVERTKIT_API_LANDING_PAGE_CHARACTER_ENCODING_NAME']);
$I->addGutenbergPage(
$I,
title: 'Kit: Page: Landing Page: ' . $_ENV['CONVERTKIT_API_LANDING_PAGE_CHARACTER_ENCODING_NAME']
);

// Configure metabox's Landing Page setting to value specified in the .env file.
$I->configureMetaboxSettings(
$I,
'wp-convertkit-meta-box',
[
metabox: 'wp-convertkit-meta-box',
configuration: [
'landing_page' => [ 'select2', $_ENV['CONVERTKIT_API_LANDING_PAGE_CHARACTER_ENCODING_NAME'] ],
]
);
Expand Down Expand Up @@ -202,13 +214,16 @@ public function testLandingPageCharacterEncoding(EndToEndTester $I)
public function testAddNewPageUsingDefinedLegacyLandingPage(EndToEndTester $I)
{
// Add a Page using the Gutenberg editor.
$I->addGutenbergPage($I, 'page', 'Kit: Page: Landing Page: ' . $_ENV['CONVERTKIT_API_LEGACY_LANDING_PAGE_NAME']);
$I->addGutenbergPage(
$I,
title: 'Kit: Page: Landing Page: ' . $_ENV['CONVERTKIT_API_LEGACY_LANDING_PAGE_NAME']
);

// Configure metabox's Landing Page setting to value specified in the .env file.
$I->configureMetaboxSettings(
$I,
'wp-convertkit-meta-box',
[
metabox: 'wp-convertkit-meta-box',
configuration: [
'landing_page' => [ 'select2', $_ENV['CONVERTKIT_API_LEGACY_LANDING_PAGE_NAME'] ],
]
);
Expand Down Expand Up @@ -242,13 +257,16 @@ public function testLegacyLandingPageSiteIcon(EndToEndTester $I)
$I->haveOptionInDatabase('site_icon', $imageID);

// Add a Page using the Gutenberg editor.
$I->addGutenbergPage($I, 'page', 'Kit: Page: Legacy Landing Page: Site Icon: ' . $_ENV['CONVERTKIT_API_LEGACY_LANDING_PAGE_NAME']);
$I->addGutenbergPage(
$I,
title: 'Kit: Page: Legacy Landing Page: Site Icon: ' . $_ENV['CONVERTKIT_API_LEGACY_LANDING_PAGE_NAME']
);

// Configure metabox's Landing Page setting to value specified in the .env file.
$I->configureMetaboxSettings(
$I,
'wp-convertkit-meta-box',
[
metabox: 'wp-convertkit-meta-box',
configuration: [
'landing_page' => [ 'select2', $_ENV['CONVERTKIT_API_LEGACY_LANDING_PAGE_NAME'] ],
]
);
Expand Down Expand Up @@ -347,13 +365,16 @@ public function testAddNewPageUsingDefinedLandingPageWithPerfmattersPlugin(EndTo
);

// Add a Page using the Gutenberg editor.
$I->addGutenbergPage($I, 'page', 'Kit: Page: Landing Page: Perfmatters: ' . $_ENV['CONVERTKIT_API_LANDING_PAGE_NAME']);
$I->addGutenbergPage(
$I,
title: 'Kit: Page: Landing Page: Perfmatters: ' . $_ENV['CONVERTKIT_API_LANDING_PAGE_NAME']
);

// Configure metabox's Landing Page setting to value specified in the .env file.
$I->configureMetaboxSettings(
$I,
'wp-convertkit-meta-box',
[
metabox: 'wp-convertkit-meta-box',
configuration: [
'landing_page' => [ 'select2', $_ENV['CONVERTKIT_API_LANDING_PAGE_NAME'] ],
]
);
Expand Down Expand Up @@ -402,13 +423,16 @@ public function testAddNewPageUsingDefinedLandingPageWithWPRocket(EndToEndTester
$I->enableWPRocketLazyLoad($I);

// Add a Page using the Gutenberg editor.
$I->addGutenbergPage($I, 'page', 'Kit: Page: Landing Page: WP Rocket: ' . $_ENV['CONVERTKIT_API_LANDING_PAGE_NAME']);
$I->addGutenbergPage(
$I,
title: 'Kit: Page: Landing Page: WP Rocket: ' . $_ENV['CONVERTKIT_API_LANDING_PAGE_NAME']
);

// Configure metabox's Landing Page setting to value specified in the .env file.
$I->configureMetaboxSettings(
$I,
'wp-convertkit-meta-box',
[
metabox: 'wp-convertkit-meta-box',
configuration: [
'landing_page' => [ 'select2', $_ENV['CONVERTKIT_API_LANDING_PAGE_NAME'] ],
]
);
Expand Down
12 changes: 10 additions & 2 deletions tests/EndToEnd/landing-pages/PageLandingPageSetupWizardCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,11 @@ public function testAddNewMemberLandingPage(EndToEndTester $I)
$this->_setupAndLoadAddNewLandingPageScreen($I);

// Select a landing page and enter a slug.
$I->fillSelect2Field($I, '#select2-landing_page-container', $_ENV['CONVERTKIT_API_LANDING_PAGE_NAME']);
$I->fillSelect2Field(
$I,
container: '#select2-landing_page-container',
value: $_ENV['CONVERTKIT_API_LANDING_PAGE_NAME']
);
$I->fillField('post_name', 'landing-page-setup-wizard');

// Click create button.
Expand Down Expand Up @@ -226,7 +230,11 @@ public function testAddNewMemberLegacyLandingPage(EndToEndTester $I)
$this->_setupAndLoadAddNewLandingPageScreen($I);

// Select a landing page and enter a slug.
$I->fillSelect2Field($I, '#select2-landing_page-container', $_ENV['CONVERTKIT_API_LEGACY_LANDING_PAGE_NAME']);
$I->fillSelect2Field(
$I,
container: '#select2-landing_page-container',
value: $_ENV['CONVERTKIT_API_LEGACY_LANDING_PAGE_NAME']
);
$I->fillField('post_name', 'landing-page-setup-wizard');

// Click create button.
Expand Down
10 changes: 7 additions & 3 deletions tests/EndToEnd/landing-pages/PostLandingPageCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ public function _before(EndToEndTester $I)
public function testAddNewPostDoesNotDisplayLandingPageOption(EndToEndTester $I)
{
// Add a Post using the Gutenberg editor.
$I->addGutenbergPage($I, 'post', 'Kit: Post: Landing Page');
$I->addGutenbergPage(
$I,
postType: 'post',
title: 'Kit: Post: Landing Page'
);

// Check that the metabox is displayed.
$I->seeElementInDOM('#wp-convertkit-meta-box');
Expand All @@ -51,8 +55,8 @@ public function testAddNewPostDoesNotDisplayLandingPageOption(EndToEndTester $I)
// Configure metabox's Form setting = Default.
$I->configureMetaboxSettings(
$I,
'wp-convertkit-meta-box',
[
metabox: 'wp-convertkit-meta-box',
configuration: [
'form' => [ 'select2', 'Default' ],
]
);
Expand Down
60 changes: 36 additions & 24 deletions tests/EndToEnd/products/PageBlockFormatterProductLinkCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,16 @@ public function testProductLinkFormatter(EndToEndTester $I)
$I->setupKitPluginResources($I);

// Add a Page using the Gutenberg editor.
$I->addGutenbergPage($I, 'page', 'Kit: Page: Product Link Formatter');
$I->addGutenbergPage(
$I,
title: 'Kit: Page: Product Link Formatter'
);

// Configure metabox's Form setting = None, ensuring we only test the block in Gutenberg.
$I->configureMetaboxSettings(
$I,
'wp-convertkit-meta-box',
[
metabox: 'wp-convertkit-meta-box',
configuration: [
'form' => [ 'select2', 'None' ],
]
);
Expand All @@ -57,9 +60,9 @@ public function testProductLinkFormatter(EndToEndTester $I)
// Apply formatter to link the selected text.
$I->applyGutenbergFormatter(
$I,
'Kit Product Trigger',
'convertkit-product-link',
[
formatterName: 'Kit Product Trigger',
formatterProgrammaticName: 'convertkit-product-link',
formatterConfiguration:[
// Product.
'data-id' => [ 'select', $_ENV['CONVERTKIT_API_PRODUCT_NAME'] ],
]
Expand Down Expand Up @@ -87,13 +90,16 @@ public function testProductLinkFormatterToggleProductSelection(EndToEndTester $I
$I->setupKitPluginResources($I);

// Add a Page using the Gutenberg editor.
$I->addGutenbergPage($I, 'page', 'Kit: Page: Product Link Formatter: Product Toggle');
$I->addGutenbergPage(
$I,
title: 'Kit: Page: Product Link Formatter: Product Toggle'
);

// Configure metabox's Form setting = None, ensuring we only test the block in Gutenberg.
$I->configureMetaboxSettings(
$I,
'wp-convertkit-meta-box',
[
metabox: 'wp-convertkit-meta-box',
configuration: [
'form' => [ 'select2', 'None' ],
]
);
Expand All @@ -107,9 +113,9 @@ public function testProductLinkFormatterToggleProductSelection(EndToEndTester $I
// Apply formatter to link the selected text.
$I->applyGutenbergFormatter(
$I,
'Kit Product Trigger',
'convertkit-product-link',
[
formatterName: 'Kit Product Trigger',
formatterProgrammaticName: 'convertkit-product-link',
formatterConfiguration:[
// Product.
'data-id' => [ 'select', $_ENV['CONVERTKIT_API_PRODUCT_NAME'] ],
]
Expand All @@ -118,10 +124,10 @@ public function testProductLinkFormatterToggleProductSelection(EndToEndTester $I
// Apply the formatter again, this time selecting the 'None' option.
$I->applyGutenbergFormatter(
$I,
'Kit Product Trigger',
'convertkit-product-link',
[
// Form.
formatterName: 'Kit Product Trigger',
formatterProgrammaticName: 'convertkit-product-link',
formatterConfiguration:[
// Product.
'data-id' => [ 'select', 'None' ],
]
);
Expand All @@ -147,13 +153,16 @@ public function testProductLinkFormatterWithNoProduct(EndToEndTester $I)
$I->setupKitPluginResources($I);

// Add a Page using the Gutenberg editor.
$I->addGutenbergPage($I, 'page', 'Kit: Page: Product Link Formatter: No Product');
$I->addGutenbergPage(
$I,
title: 'Kit: Page: Product Link Formatter: No Product'
);

// Configure metabox's Form setting = None, ensuring we only test the block in Gutenberg.
$I->configureMetaboxSettings(
$I,
'wp-convertkit-meta-box',
[
metabox: 'wp-convertkit-meta-box',
configuration: [
'form' => [ 'select2', 'None' ],
]
);
Expand All @@ -167,10 +176,10 @@ public function testProductLinkFormatterWithNoProduct(EndToEndTester $I)
// Apply formatter to link the selected text.
$I->applyGutenbergFormatter(
$I,
'Kit Product Trigger',
'convertkit-product-link',
[
// Form.
formatterName: 'Kit Product Trigger',
formatterProgrammaticName: 'convertkit-product-link',
formatterConfiguration:[
// Product.
'data-id' => [ 'select', 'None' ],
]
);
Expand All @@ -192,7 +201,10 @@ public function testProductLinkFormatterWithNoProduct(EndToEndTester $I)
public function testProductLinkFormatterNotRegisteredWhenNoProductsExist(EndToEndTester $I)
{
// Add a Page using the Gutenberg editor.
$I->addGutenbergPage($I, 'page', 'Kit: Page: Product Link Formatter: No Products Exist');
$I->addGutenbergPage(
$I,
title: 'Kit: Page: Product Link Formatter: No Products Exist'
);

// Add paragraph to Page.
$I->addGutenbergParagraphBlock($I, 'Subscribe');
Expand Down
Loading