diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 201631404..4edfb84c3 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -35,7 +35,7 @@ jobs: # Defines the WordPress and PHP Versions matrix to run tests on. strategy: matrix: - wp-versions: [ 'latest' ] #[ '6.1.1', 'latest' ] + wp-versions: [ '7.0-beta5' ] #[ '6.1.1', 'latest' ] php-versions: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ] #[ '7.3', '7.4', '8.0', '8.1' ] # Steps to install, configure and run tests diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6cf311f85..5797fa509 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -53,7 +53,7 @@ jobs: strategy: fail-fast: false matrix: - wp-versions: [ 'latest' ] #[ '6.1.1', 'latest' ] + wp-versions: [ '7.0-beta5' ] #[ '6.1.1', 'latest' ] php-versions: [ '8.1', '8.2', '8.3', '8.4' ] #[ '7.4', '8.0', '8.1' ] # Folder names within the 'tests' folder to run tests in parallel. diff --git a/tests/EndToEnd/broadcasts/import-export/BroadcastsExportPostCest.php b/tests/EndToEnd/broadcasts/import-export/BroadcastsExportPostCest.php index a276f5f2e..34d4821a3 100644 --- a/tests/EndToEnd/broadcasts/import-export/BroadcastsExportPostCest.php +++ b/tests/EndToEnd/broadcasts/import-export/BroadcastsExportPostCest.php @@ -164,11 +164,11 @@ public function testCreateBroadcastWhenEnabledInPost(EndToEndTester $I) // Click the Publish button. $I->click('.editor-post-publish-button__button'); - // When the pre-publish panel displays, confirm no Create Broadcast option exists. - $I->waitForElementVisible('.editor-post-publish-panel__header-publish-button'); + // Wait for the Create Broadcast option to be visible. + $I->waitForElementVisible('.convertkit-pre-publish-actions.is-opened'); // Enable the Create Broadcast option. - $I->click('.convertkit-pre-publish-actions #inspector-toggle-control-0'); + $I->click('.convertkit-pre-publish-actions.is-opened input#convertkit_action_broadcast_export'); // Publish the Post. $I->clickPublishOnPrePublishChecksForGutenbergPage($I); diff --git a/tests/EndToEnd/integrations/divi-theme/DiviThemeBroadcastsCest.php b/tests/EndToEnd/integrations/divi-theme/DiviThemeBroadcastsCest.php index 9aac59cb8..9aa0aeeac 100644 --- a/tests/EndToEnd/integrations/divi-theme/DiviThemeBroadcastsCest.php +++ b/tests/EndToEnd/integrations/divi-theme/DiviThemeBroadcastsCest.php @@ -122,83 +122,6 @@ public function testBroadcastsModule(EndToEndTester $I) ); } - /** - * Test the Broadcasts module displays the expected message when the Plugin has no credentials. - * - * @since 2.8.0 - * - * @param EndToEndTester $I Tester. - */ - public function testBroadcastsModuleWhenNoCredentials(EndToEndTester $I) - { - // Skip test until modules upgraded to Divi 5. - $I->useTheme('twentytwentytwo'); - $I->deactivateKitPlugin($I); - $I->resetKitPlugin($I); - $I->markTestSkipped('No Credentials notice cannot be displayed until modules upgraded to Divi 5.'); - - // Create a Divi Page in the backend editor. - $I->createDiviPageInBackendEditor( - $I, - title: 'Kit: Page: Broadcasts: Divi 5: No Credentials' - ); - - // Insert the Broadcasts module. - $I->insertDiviRowWithModule( - $I, - name: 'Kit Broadcasts', - programmaticName: 'convertkit_broadcasts' - ); - - // Confirm the on screen message displays. - $I->seeTextInDiviModule( - $I, - title: 'Not connected to Kit', - text: 'Connect your Kit account at Settings > Kit, and then refresh this page to configure broadcasts to display.' - ); - } - - /** - * Test the Broadcasts module displays the expected message when the Kit account - * has no broadcasts. - * - * @since 2.8.0 - * - * @param EndToEndTester $I Tester. - */ - public function testBroadcastsModuleWhenNoBroadcasts(EndToEndTester $I) - { - // Skip test until modules upgraded to Divi 5. - $I->useTheme('twentytwentytwo'); - $I->deactivateKitPlugin($I); - $I->resetKitPlugin($I); - $I->markTestSkipped('No resources notice cannot be displayed until modules upgraded to Divi 5.'); - - // Setup Plugin. - $I->setupKitPluginCredentialsNoData($I); - $I->setupKitPluginResourcesNoData($I); - - // Create a Divi Page in the backend editor. - $I->createDiviPageInBackendEditor( - $I, - title: 'Kit: Page: Broadcasts: Divi 5: No Broadcasts' - ); - - // Insert the Broadcasts module. - $I->insertDiviRowWithModule( - $I, - name: 'Kit Broadcasts', - programmaticName: 'convertkit_broadcasts' - ); - - // Confirm the on screen message displays. - $I->seeTextInDiviModule( - $I, - title: 'No broadcasts exist in Kit', - text: 'Add a broadcast to your Kit account, and then refresh this page to configure broadcasts to display.' - ); - } - /** * 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 diff --git a/tests/EndToEnd/integrations/divi-theme/DiviThemeFormCest.php b/tests/EndToEnd/integrations/divi-theme/DiviThemeFormCest.php index 003d2d08b..5eeb3a1a3 100644 --- a/tests/EndToEnd/integrations/divi-theme/DiviThemeFormCest.php +++ b/tests/EndToEnd/integrations/divi-theme/DiviThemeFormCest.php @@ -64,77 +64,6 @@ public function testFormModule(EndToEndTester $I) $I->deactivateThirdPartyPlugin($I, 'classic-editor'); } - /** - * Test the Form module displays the expected message when the Plugin has no credentials - * - * @since 2.8.0 - * - * @param EndToEndTester $I Tester. - */ - public function testFormModuleWhenNoCredentials(EndToEndTester $I) - { - // Skip test until modules upgraded to Divi 5. - $I->useTheme('twentytwentytwo'); - $I->deactivateKitPlugin($I); - $I->resetKitPlugin($I); - $I->markTestSkipped('No Credentials notice cannot be displayed until modules upgraded to Divi 5.'); - - // Create a Divi Page in the frontend editor. - $I->createDiviPageInFrontendEditor($I, 'Kit: Page: Form: Divi: Frontend: No Credentials', false); - - // Insert the Form module. - $I->insertDiviRowWithModule( - $I, - name: 'Kit Form', - programmaticName: 'convertkit_form' - ); - - // Confirm the on screen message displays. - $I->seeTextInDiviModule( - $I, - title: 'Not connected to Kit', - text: 'Connect your Kit account at Settings > Kit, and then refresh this page to select a form.' - ); - } - - /** - * Test the Form module displays the expected message when the Kit account - * has no forms. - * - * @since 2.8.0 - * - * @param EndToEndTester $I Tester. - */ - public function testFormModuleWhenNoForms(EndToEndTester $I) - { - // Skip test until modules upgraded to Divi 5. - $I->useTheme('twentytwentytwo'); - $I->deactivateKitPlugin($I); - $I->resetKitPlugin($I); - $I->markTestSkipped('No resources notice cannot be displayed until modules upgraded to Divi 5.'); - - // Setup Plugin. - $I->setupKitPluginCredentialsNoData($I); - $I->setupKitPluginResourcesNoData($I); - - // Create a Divi Page in the frontend editor. - $I->createDiviPageInFrontendEditor($I, 'Kit: Page: Form: Divi: Frontend: No Forms'); - - // Insert the Form module. - $I->insertDiviRowWithModule( - $I, - name: 'Kit Form', - programmaticName: 'convertkit_form' - ); - - // Confirm the on screen message displays. - $I->seeTextInDiviModule( - $I, - title: 'No forms exist in Kit', - text: 'Add a form to your Kit account, and then refresh this page to select a form.' - ); - } - /** * Test the Form module works when a valid Legacy Form is selected. * diff --git a/tests/EndToEnd/integrations/divi-theme/DiviThemeFormTriggerCest.php b/tests/EndToEnd/integrations/divi-theme/DiviThemeFormTriggerCest.php index 6c2fe182c..984d5ea02 100644 --- a/tests/EndToEnd/integrations/divi-theme/DiviThemeFormTriggerCest.php +++ b/tests/EndToEnd/integrations/divi-theme/DiviThemeFormTriggerCest.php @@ -64,78 +64,6 @@ public function testFormTriggerModule(EndToEndTester $I) $I->seeNumberOfElementsInDOM('form[data-sv-form="' . $_ENV['CONVERTKIT_API_FORM_FORMAT_MODAL_ID'] . '"]', 1); } - - /** - * Test the Form module displays the expected message when the Plugin has no credentials - * - * @since 2.8.0 - * - * @param EndToEndTester $I Tester. - */ - public function testFormTriggerModuleWhenNoCredentials(EndToEndTester $I) - { - // Skip test until modules upgraded to Divi 5. - $I->useTheme('twentytwentytwo'); - $I->deactivateKitPlugin($I); - $I->resetKitPlugin($I); - $I->markTestSkipped('No Credentials notice cannot be displayed until modules upgraded to Divi 5.'); - - // Create a Divi Page in the frontend editor. - $I->createDiviPageInFrontendEditor($I, 'Kit: Page: Form Trigger: Divi: Frontend: No Credentials', false); - - // Insert the Form module. - $I->insertDiviRowWithModule( - $I, - name: 'Kit Form Trigger', - programmaticName: 'convertkit_formtrigger' - ); - - // Confirm the on screen message displays. - $I->seeTextInDiviModule( - $I, - title: 'Not connected to Kit', - text: 'Connect your Kit account at Settings > Kit, and then refresh this page to select a form.' - ); - } - - /** - * Test the Form module displays the expected message when the Kit account - * has no forms. - * - * @since 2.8.0 - * - * @param EndToEndTester $I Tester. - */ - public function testFormTriggerModuleInFrontendEditorWhenNoForms(EndToEndTester $I) - { - // Skip test until modules upgraded to Divi 5. - $I->useTheme('twentytwentytwo'); - $I->deactivateKitPlugin($I); - $I->resetKitPlugin($I); - $I->markTestSkipped('No resources notice cannot be displayed until modules upgraded to Divi 5.'); - - // Setup Plugin. - $I->setupKitPluginCredentialsNoData($I); - $I->setupKitPluginResourcesNoData($I); - - // Create a Divi Page in the frontend editor. - $I->createDiviPageInFrontendEditor($I, 'Kit: Page: Form Trigger: Divi: Frontend: No Forms'); - - // Insert the Form module. - $I->insertDiviRowWithModule( - $I, - name: 'Kit Form Trigger', - programmaticName: 'convertkit_formtrigger' - ); - - // Confirm the on screen message displays. - $I->seeTextInDiviModule( - $I, - title: 'No modal, sticky bar or slide in forms exist in Kit', - text: 'Add a non-inline form to your Kit account, and then refresh this page to select a form.' - ); - } - /** * Test the Form module works when no Form is selected. * diff --git a/tests/EndToEnd/integrations/divi-theme/DiviThemeProductCest.php b/tests/EndToEnd/integrations/divi-theme/DiviThemeProductCest.php index ec6e61edf..9691bb89f 100644 --- a/tests/EndToEnd/integrations/divi-theme/DiviThemeProductCest.php +++ b/tests/EndToEnd/integrations/divi-theme/DiviThemeProductCest.php @@ -63,77 +63,6 @@ public function testProductModule(EndToEndTester $I) $I->deactivateThirdPartyPlugin($I, 'classic-editor'); } - /** - * Test the Product module displays the expected message when the Plugin has no credentials - * - * @since 2.8.0 - * - * @param EndToEndTester $I Tester. - */ - public function testProductModuleWhenNoCredentials(EndToEndTester $I) - { - // Skip test until modules upgraded to Divi 5. - $I->useTheme('twentytwentytwo'); - $I->deactivateKitPlugin($I); - $I->resetKitPlugin($I); - $I->markTestSkipped('No Credentials notice cannot be displayed until modules upgraded to Divi 5.'); - - // Create a Divi Page in the frontend editor. - $I->createDiviPageInFrontendEditor($I, 'Kit: Page: Product: Divi: Frontend: No Credentials', false); - - // Insert the Product module. - $I->insertDiviRowWithModule( - $I, - name: 'Kit Product', - programmaticName: 'convertkit_product' - ); - - // Confirm the on screen message displays. - $I->seeTextInDiviModule( - $I, - title: 'Not connected to Kit', - text: 'Connect your Kit account at Settings > Kit, and then refresh this page to select a product.' - ); - } - - /** - * Test the Product module displays the expected message when the Kit account - * has no products. - * - * @since 2.8.0 - * - * @param EndToEndTester $I Tester. - */ - public function testProductModuleWhenNoProducts(EndToEndTester $I) - { - // Skip test until modules upgraded to Divi 5. - $I->useTheme('twentytwentytwo'); - $I->deactivateKitPlugin($I); - $I->resetKitPlugin($I); - $I->markTestSkipped('No resources notice cannot be displayed until modules upgraded to Divi 5.'); - - // Setup Plugin. - $I->setupKitPluginCredentialsNoData($I); - $I->setupKitPluginResourcesNoData($I); - - // Create a Divi Page in the frontend editor. - $I->createDiviPageInFrontendEditor($I, 'Kit: Page: Product: Divi: Product: No Products'); - - // Insert the Product module. - $I->insertDiviRowWithModule( - $I, - name: 'Kit Product', - programmaticName: 'convertkit_product' - ); - - // Confirm the on screen message displays. - $I->seeTextInDiviModule( - $I, - title: 'No products exist in Kit', - text: 'Add a product to your Kit account, and then refresh this page to select a product.' - ); - } - /** * Test the Product module works when no Product is selected. * @@ -167,7 +96,6 @@ public function testProductModuleWithNoProductParameter(EndToEndTester $I) $I->dontSeeProductOutput($I); } - /** * 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 diff --git a/tests/Support/Data/dump.sql b/tests/Support/Data/dump.sql index ba1ffe735..142f4cf2a 100644 --- a/tests/Support/Data/dump.sql +++ b/tests/Support/Data/dump.sql @@ -168,7 +168,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', '60717', 'on'), +(46, 'db_version', '61833', 'on'), (47, 'uploads_use_yearmonth_folders', '1', 'on'), (48, 'upload_path', '', 'on'), (49, 'blog_public', '1', 'on'), @@ -221,7 +221,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', '60717', 'on'), +(99, 'initial_db_version', '61833', '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/Divi5Theme.php b/tests/Support/Helper/Divi5Theme.php index 4a3077432..344bcdab9 100644 --- a/tests/Support/Helper/Divi5Theme.php +++ b/tests/Support/Helper/Divi5Theme.php @@ -12,39 +12,35 @@ class Divi5Theme extends \Codeception\Module /** * Helper method to create a Divi Page in the WordPress Administration interface. * - * @since 2.5.7 + * @since 3.2.1 * * @param EndToEndTester $I EndToEnd Tester. * @param string $title Page Title. - * @param bool $configureMetaBox Configure Plugin's Meta Box to set Form = None (set to false if running a test with no credentials). */ - public function createDivi5Page($I, $title, $configureMetaBox = true) + public function createDivi5Page($I, $title) { - // Add a Page using the Gutenberg editor. - // We don't use addGutenbergPage(), as when the Divi Builder is used, the iframed Gutenberg editor is not used, - // and addGutenbergPage() may switch to an iframe based on the value of the WORDPRESS_V3_BLOCK_EDITOR_ENABLED environment variable. - // Navigate to Post Type (e.g. Pages / Posts) > Add New. - $I->amOnAdminPage('post-new.php?post_type=page'); - $I->waitForElementVisible('body.post-new-php'); - - // Define the Title. - $I->fillField('.editor-post-title__input', $title); - - // Configure metabox's Form setting = None, ensuring we only test the Divi block. - if ($configureMetaBox) { - $I->configureMetaboxSettings( - $I, - 'wp-convertkit-meta-box', - [ - 'form' => [ 'select2', 'None' ], - ] - ); - } - - // Publish Page. - $I->publishGutenbergPage($I); - - // Click Divi Builder button. + // Create a Page. + $pageID = $I->havePostInDatabase( + [ + 'post_type' => 'page', + 'post_title' => $title, + 'post_content' => '', + 'meta_input' => [ + // Configure Kit Plugin to not display a default Form. + '_wp_convertkit_post_meta' => [ + 'form' => '0', + 'landing_page' => '', + 'tag' => '', + ], + '_et_pb_use_builder' => 'on', + ], + ] + ); + + // Edit Page. + $I->amOnPage('/wp-admin/post.php?post=' . $pageID . '&action=edit'); + + // Click "Use The Divi Builder" button. $I->click('#et-switch-to-divi'); // Wait for Divi Builder to load. @@ -114,7 +110,8 @@ public function insertDivi5RowWithModule($I, $name, $programmaticName, $fieldNam } /** - * Helper method to save a page created using Divi 5. + * Helper method to save a page created using Divi 5, and view + * it on the frontend site. * * @since 3.2.1 * @@ -127,10 +124,9 @@ public function saveDivi5PageAndViewOnFrontend($I) $I->click('.et-vb-page-bar-dropdown-button.et-vb-page-bar-dropdown-button--fill button.et-vb-page-bar-action-button'); $I->waitForElementNotVisible('.et-vb-page-bar-dropdown-button--saving'); - // Load the Page on the frontend site. - $I->click('div[aria-label="Exit Dropdown"]'); - $I->waitForElementVisible('button[value="view-page"]'); - $I->click('button[value="view-page"]'); + // View page. + $url = $_ENV['WORDPRESS_URL'] . wp_parse_url($I->grabFromCurrentUrl(), PHP_URL_PATH); + $I->amOnUrl($url); // Check that no PHP warnings or notices were output. $I->checkNoWarningsAndNoticesOnScreen($I); diff --git a/tests/Support/Helper/DiviBuilder.php b/tests/Support/Helper/DiviBuilder.php index 5c7ff3402..fe45d6c3e 100644 --- a/tests/Support/Helper/DiviBuilder.php +++ b/tests/Support/Helper/DiviBuilder.php @@ -83,14 +83,10 @@ public function createDiviPageInBackendEditor($I, $title) public function createDiviPageInFrontendEditor($I, $title, $configureMetaBox = true) { // Add a Page using the Gutenberg editor. - // We don't use addGutenbergPage(), as when the Divi Builder is used, the iframed Gutenberg editor is not used, - // and addGutenbergPage() may switch to an iframe based on the value of the WORDPRESS_V3_BLOCK_EDITOR_ENABLED environment variable. - // Navigate to Post Type (e.g. Pages / Posts) > Add New. - $I->amOnAdminPage('post-new.php?post_type=page'); - $I->waitForElementVisible('body.post-new-php'); - - // Define the Title. - $I->fillField('.editor-post-title__input', $title); + $I->addGutenbergPage( + $I, + title: $title + ); // Configure metabox's Form setting = None, ensuring we only test the block in Gutenberg. if ($configureMetaBox) { @@ -106,15 +102,24 @@ public function createDiviPageInFrontendEditor($I, $title, $configureMetaBox = t // Publish Page. $url = $I->publishGutenbergPage($I); - // Click Divi Builder button inside the Gutenberg editor. - $I->click('Use Divi Builder'); + // Load page. + $I->amOnUrl($url); - // Reload page to dismiss modal. - $I->wait(5); - $I->amOnUrl($url . '?et_fb=1&PageSpeed=off'); + // Enable the Divi Builder. + $I->waitForElementVisible('#wp-admin-bar-et-use-visual-builder'); + $I->click('#wp-admin-bar-et-use-visual-builder a'); + + // Dismiss modal if displayed. + // May have been dismissed by other tests in the suite e.g. DiviFormCest. + try { + $I->waitForElementVisible('.et-core-modal-action-dont-restore'); + $I->click('.et-core-modal-action-dont-restore'); + } catch ( \Facebook\WebDriver\Exception\NoSuchElementException $e ) { // phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedCatch + // No modal exists, so nothing to dismiss. + } // Click Build from scratch button. - $I->waitForElementVisible('.et-fb-page-creation-card-build_from_scratch', 30); + $I->waitForElementVisible('.et-fb-page-creation-card-build_from_scratch'); $I->click('Start Building', '.et-fb-page-creation-card-build_from_scratch'); return $url; diff --git a/tests/Support/Helper/KitBroadcasts.php b/tests/Support/Helper/KitBroadcasts.php index 60de6e27f..9b1b3287d 100644 --- a/tests/Support/Helper/KitBroadcasts.php +++ b/tests/Support/Helper/KitBroadcasts.php @@ -54,6 +54,9 @@ public function setupKitPluginBroadcasts($I, $settings = false) // Click the Save Changes button. $I->click('Save Changes'); + // Confirm that the settings were saved. + $I->waitForElementVisible('.notice-success'); + // Check that no PHP warnings or notices were output. $I->checkNoWarningsAndNoticesOnScreen($I); } diff --git a/tests/Support/Helper/KitForms.php b/tests/Support/Helper/KitForms.php index f4525c36c..2a2f20ae4 100644 --- a/tests/Support/Helper/KitForms.php +++ b/tests/Support/Helper/KitForms.php @@ -53,7 +53,7 @@ public function seeFormOutput($I, $formID, $position = false, $element = false, // The block editor automatically adds CSS classes to some elements. switch ( $element ) { case 'p': - $I->seeInSource('<' . $element . '>Item #' . $elementIndex . '' . $element . '>