diff --git a/tests/EndToEnd/forms/blocks-shortcodes/PageBlockFormBuilderCest.php b/tests/EndToEnd/forms/blocks-shortcodes/PageBlockFormBuilderCest.php index 1319b02a4..38ee77d1a 100644 --- a/tests/EndToEnd/forms/blocks-shortcodes/PageBlockFormBuilderCest.php +++ b/tests/EndToEnd/forms/blocks-shortcodes/PageBlockFormBuilderCest.php @@ -979,8 +979,8 @@ public function testFormBuilderSupportsCoreBlocks(EndToEndTester $I) $I->waitForElementVisible('.interface-interface-skeleton__sidebar[aria-label="Editor settings"]'); // Confirm some core blocks can be added to the Form Builder block. - $I->seeGutenbergBlockAvailable($I, 'Paragraph', 'paragraph'); - $I->seeGutenbergBlockAvailable($I, 'Heading', 'heading'); + $I->seeGutenbergBlockAvailable($I, 'Paragraph', 'paragraph/paragraph'); + $I->seeGutenbergBlockAvailable($I, 'Heading', 'heading/heading'); $I->seeGutenbergBlockAvailable($I, 'List', 'list'); $I->seeGutenbergBlockAvailable($I, 'Image', 'image'); $I->seeGutenbergBlockAvailable($I, 'Spacer', 'spacer'); diff --git a/tests/EndToEnd/restrict-content/post-types/RestrictContentProductThirdPartyThemeOrPageBuilderCest.php b/tests/EndToEnd/restrict-content/post-types/RestrictContentProductThirdPartyThemeOrPageBuilderCest.php index cd9fb57e5..b88c47b9a 100644 --- a/tests/EndToEnd/restrict-content/post-types/RestrictContentProductThirdPartyThemeOrPageBuilderCest.php +++ b/tests/EndToEnd/restrict-content/post-types/RestrictContentProductThirdPartyThemeOrPageBuilderCest.php @@ -76,7 +76,9 @@ public function testRestrictContentByProductWithUncodeThemeAndVisualComposer(End options: [ 'visible_content' => '', 'member_content' => 'Member-only content.', - ] + ], + // Don't check for warnings and notices, as Uncode uses deprecated functions which WordPress 6.9 warn about. + checkNoWarningsAndNotices: false ); // Deactivate Visual Composer Page Builder. @@ -122,7 +124,9 @@ public function testRestrictContentByProductWithUncodeTheme(EndToEndTester $I) options: [ 'visible_content' => '', 'member_content' => 'Member-only content.', - ] + ], + // Don't check for warnings and notices, as Uncode uses deprecated functions which WordPress 6.9 warn about. + checkNoWarningsAndNotices: false ); } diff --git a/tests/Support/Data/dump.sql b/tests/Support/Data/dump.sql index f1aeeb879..e3ec007bf 100644 --- a/tests/Support/Data/dump.sql +++ b/tests/Support/Data/dump.sql @@ -155,7 +155,7 @@ INSERT INTO `wp_options` (`option_id`, `option_name`, `option_value`, `autoload` (43, 'html_type', 'text/html', 'on'), (44, 'use_trackback', '0', 'on'), (45, 'default_role', 'subscriber', 'on'), -(46, 'db_version', '60421', 'on'), +(46, 'db_version', '60717', 'on'), (47, 'uploads_use_yearmonth_folders', '1', 'on'), (48, 'upload_path', '', 'on'), (49, 'blog_public', '1', 'on'), @@ -208,7 +208,7 @@ INSERT INTO `wp_options` (`option_id`, `option_name`, `option_value`, `autoload` (96, 'auto_update_core_minor', 'enabled', 'on'), (97, 'auto_update_core_major', 'enabled', 'on'), (98, 'wp_force_deactivated_plugins', 'a:0:{}', 'on'), -(99, 'initial_db_version', '60421', 'on'), +(99, 'initial_db_version', '60717', 'on'), (100, 'wp_user_roles', 'a:5:{s:13:\"administrator\";a:2:{s:4:\"name\";s:13:\"Administrator\";s:12:\"capabilities\";a:61:{s:13:\"switch_themes\";b:1;s:11:\"edit_themes\";b:1;s:16:\"activate_plugins\";b:1;s:12:\"edit_plugins\";b:1;s:10:\"edit_users\";b:1;s:10:\"edit_files\";b:1;s:14:\"manage_options\";b:1;s:17:\"moderate_comments\";b:1;s:17:\"manage_categories\";b:1;s:12:\"manage_links\";b:1;s:12:\"upload_files\";b:1;s:6:\"import\";b:1;s:15:\"unfiltered_html\";b:1;s:10:\"edit_posts\";b:1;s:17:\"edit_others_posts\";b:1;s:20:\"edit_published_posts\";b:1;s:13:\"publish_posts\";b:1;s:10:\"edit_pages\";b:1;s:4:\"read\";b:1;s:8:\"level_10\";b:1;s:7:\"level_9\";b:1;s:7:\"level_8\";b:1;s:7:\"level_7\";b:1;s:7:\"level_6\";b:1;s:7:\"level_5\";b:1;s:7:\"level_4\";b:1;s:7:\"level_3\";b:1;s:7:\"level_2\";b:1;s:7:\"level_1\";b:1;s:7:\"level_0\";b:1;s:17:\"edit_others_pages\";b:1;s:20:\"edit_published_pages\";b:1;s:13:\"publish_pages\";b:1;s:12:\"delete_pages\";b:1;s:19:\"delete_others_pages\";b:1;s:22:\"delete_published_pages\";b:1;s:12:\"delete_posts\";b:1;s:19:\"delete_others_posts\";b:1;s:22:\"delete_published_posts\";b:1;s:20:\"delete_private_posts\";b:1;s:18:\"edit_private_posts\";b:1;s:18:\"read_private_posts\";b:1;s:20:\"delete_private_pages\";b:1;s:18:\"edit_private_pages\";b:1;s:18:\"read_private_pages\";b:1;s:12:\"delete_users\";b:1;s:12:\"create_users\";b:1;s:17:\"unfiltered_upload\";b:1;s:14:\"edit_dashboard\";b:1;s:14:\"update_plugins\";b:1;s:14:\"delete_plugins\";b:1;s:15:\"install_plugins\";b:1;s:13:\"update_themes\";b:1;s:14:\"install_themes\";b:1;s:11:\"update_core\";b:1;s:10:\"list_users\";b:1;s:12:\"remove_users\";b:1;s:13:\"promote_users\";b:1;s:18:\"edit_theme_options\";b:1;s:13:\"delete_themes\";b:1;s:6:\"export\";b:1;}}s:6:\"editor\";a:2:{s:4:\"name\";s:6:\"Editor\";s:12:\"capabilities\";a:34:{s:17:\"moderate_comments\";b:1;s:17:\"manage_categories\";b:1;s:12:\"manage_links\";b:1;s:12:\"upload_files\";b:1;s:15:\"unfiltered_html\";b:1;s:10:\"edit_posts\";b:1;s:17:\"edit_others_posts\";b:1;s:20:\"edit_published_posts\";b:1;s:13:\"publish_posts\";b:1;s:10:\"edit_pages\";b:1;s:4:\"read\";b:1;s:7:\"level_7\";b:1;s:7:\"level_6\";b:1;s:7:\"level_5\";b:1;s:7:\"level_4\";b:1;s:7:\"level_3\";b:1;s:7:\"level_2\";b:1;s:7:\"level_1\";b:1;s:7:\"level_0\";b:1;s:17:\"edit_others_pages\";b:1;s:20:\"edit_published_pages\";b:1;s:13:\"publish_pages\";b:1;s:12:\"delete_pages\";b:1;s:19:\"delete_others_pages\";b:1;s:22:\"delete_published_pages\";b:1;s:12:\"delete_posts\";b:1;s:19:\"delete_others_posts\";b:1;s:22:\"delete_published_posts\";b:1;s:20:\"delete_private_posts\";b:1;s:18:\"edit_private_posts\";b:1;s:18:\"read_private_posts\";b:1;s:20:\"delete_private_pages\";b:1;s:18:\"edit_private_pages\";b:1;s:18:\"read_private_pages\";b:1;}}s:6:\"author\";a:2:{s:4:\"name\";s:6:\"Author\";s:12:\"capabilities\";a:10:{s:12:\"upload_files\";b:1;s:10:\"edit_posts\";b:1;s:20:\"edit_published_posts\";b:1;s:13:\"publish_posts\";b:1;s:4:\"read\";b:1;s:7:\"level_2\";b:1;s:7:\"level_1\";b:1;s:7:\"level_0\";b:1;s:12:\"delete_posts\";b:1;s:22:\"delete_published_posts\";b:1;}}s:11:\"contributor\";a:2:{s:4:\"name\";s:11:\"Contributor\";s:12:\"capabilities\";a:5:{s:10:\"edit_posts\";b:1;s:4:\"read\";b:1;s:7:\"level_1\";b:1;s:7:\"level_0\";b:1;s:12:\"delete_posts\";b:1;}}s:10:\"subscriber\";a:2:{s:4:\"name\";s:10:\"Subscriber\";s:12:\"capabilities\";a:2:{s:4:\"read\";b:1;s:7:\"level_0\";b:1;}}}', 'on'), (101, 'fresh_site', '1', 'on'), (102, 'user_count', '1', 'off'), diff --git a/tests/Support/Helper/KitRestrictContent.php b/tests/Support/Helper/KitRestrictContent.php index 850342865..dc95c6010 100644 --- a/tests/Support/Helper/KitRestrictContent.php +++ b/tests/Support/Helper/KitRestrictContent.php @@ -193,8 +193,9 @@ public function createRestrictedContentPage($I, $options = false) * @type string $member_content Content that should only be available to authenticated subscribers. * @type array $settings Restrict content settings. If not defined, uses expected defaults. * } + * @param bool $checkNoWarningsAndNotices Whether to check for errors. */ - public function testRestrictedContentByProductOnFrontend($I, $urlOrPageID, $options = false) + public function testRestrictedContentByProductOnFrontend($I, $urlOrPageID, $options = false, $checkNoWarningsAndNotices = true) { // Setup test. $options = $this->setupRestrictContentTest($I, $options, $urlOrPageID); @@ -203,7 +204,7 @@ public function testRestrictedContentByProductOnFrontend($I, $urlOrPageID, $opti $I->seeInSource('waitForElementVisible([ 'xpath' => $xpath ]); + $I->seeElementInDOM([ 'xpath' => $xpath ]); + $I->click([ 'xpath' => $xpath ]); + } else { + $selector = '.block-editor-inserter__panel-content button.editor-block-list-item-' . $blockProgrammaticName; + $I->waitForElementVisible($selector); + $I->seeElementInDOM($selector); + $I->click($selector); + } // Close block inserter. $I->click('button.editor-document-tools__inserter-toggle'); @@ -139,7 +148,7 @@ public function addGutenbergBlock($I, $blockName, $blockProgrammaticName, $block */ public function addGutenbergParagraphBlock($I, $text) { - $I->addGutenbergBlock($I, 'Paragraph', 'paragraph'); + $I->addGutenbergBlock($I, 'Paragraph', 'paragraph/paragraph'); $I->click('.wp-block-post-content'); $I->fillField('.wp-block-post-content p[data-empty="true"]', $text); @@ -268,7 +277,17 @@ public function seeGutenbergBlockAvailable($I, $blockName, $blockProgrammaticNam $I->wait(2); // Confirm the block is available. - $I->waitForElementVisible('.block-editor-inserter__panel-content button.editor-block-list-item-' . $blockProgrammaticName); + // $blockProgrammaticName may contain a slash, which is not valid in a CSS class selector. + // Use XPath to check for a button containing the relevant class. + if (strpos($blockProgrammaticName, '/') !== false) { + // XPath: class attribute contains all required classes including block-programmatic-name. + $classParts = explode('/', $blockProgrammaticName); + $xpath = '//button[contains(@class, "editor-block-list-item-' . $blockProgrammaticName . '") and contains(@class,"block-editor-block-types-list__item") and contains(@class,"components-button")]'; + $I->waitForElementVisible([ 'xpath' => $xpath ]); + } else { + $selector = '.block-editor-inserter__panel-content button.editor-block-list-item-' . $blockProgrammaticName; + $I->waitForElementVisible($selector); + } // Clear the search field. $I->click('button[aria-label="Reset search"]');