Skip to content
Open
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
3 changes: 2 additions & 1 deletion tests/Support/Data/dump.sql
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,8 @@ INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALU
(20, 1, 'edit_page_per_page', '100'),
(21, 1, 'edit_post_per_page', '100'),
(22, 1, 'wp_persisted_preferences', 'a:4:{s:4:"core";a:2:{s:26:"isComplementaryAreaVisible";b:1;s:24:"enableChoosePatternModal";b:0;}s:14:"core/edit-post";a:4:{s:12:"welcomeGuide";b:0;s:23:"metaBoxesMainOpenHeight";i:540;s:20:"welcomeGuideTemplate";b:0;s:19:"metaBoxesMainIsOpen";b:1;}s:9:"_modified";s:24:"2024-07-18T02:45:41.491Z";s:17:"core/edit-widgets";a:2:{s:26:"isComplementaryAreaVisible";b:1;s:12:"welcomeGuide";b:0;}}'),
(23, 1, 'elementor_introduction', 'a:5:{s:7:"exit_to";b:1;s:27:"ai-get-started-announcement";b:1;s:20:"globals_introduction";b:1;s:6:"e-apps";b:1;s:27:"e-editor-one-notice-pointer";b:1;}');
(23, 1, 'elementor_introduction', 'a:5:{s:7:"exit_to";b:1;s:27:"ai-get-started-announcement";b:1;s:20:"globals_introduction";b:1;s:6:"e-apps";b:1;s:27:"e-editor-one-notice-pointer";b:1;}'),
(24, 1, 'dismissed_no_secure_connection_notice', 'true');

DROP TABLE IF EXISTS `wp_users`;
CREATE TABLE `wp_users` (
Expand Down
3 changes: 3 additions & 0 deletions tests/Support/Helper/WPClassicEditor.php
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,9 @@ public function publishAndViewClassicEditorPage($I)
// Publish Page.
$I->publishClassicEditorPage($I);

// Wait for the notice to display.
$I->waitForElementVisible('.notice-success');

// Load the Page on the frontend site.
$I->click('.notice-success a');

Expand Down
20 changes: 15 additions & 5 deletions tests/Support/Helper/WPQuickEdit.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,23 @@ public function openQuickEdit($I, $postType, $postID)
// Navigate to Post Type's WP_List_Table.
$I->amOnAdminPage('edit.php?post_type=' . $postType);

// Hover mouse over Post's table row.
$I->moveMouseOver('tr#post-' . $postID);
// Wait for the WP_List_Table to load.
$I->waitForElementVisible('table.wp-list-table');

// Wait for Quick edit link to be visible.
$I->waitForElementVisible('tr#post-' . $postID . ' button.editinline');
// Wait for the Post's row to exist in the table.
$I->waitForElementVisible('tr#post-' . $postID);

// Click Quick Edit link.
// Display all row actions by adding the `visible` class, as
// moveMouseOver() is flaky.
$I->executeJS(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit problematic as it could hide a regression. What are your thoughts on wrapping this in a retry instead? It looks like Codeception has some built in "retry" logic (at least 4.x does).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The retry logic is still flaky at times, which is why I went for this method. I don't think it'll hide a regression - it just ensures that the row actions are displayed automatically, rather than being displayed on mouse over.

We're not testing the row actions themselves - they're built in to WordPress. This is so we can reliably get WordPress' Quick Edit form to display. What's being tested is that the Quick Edit form's values are saved after changing, which follows this line.

'
document.querySelectorAll(".row-actions").forEach(function(el){
el.classList.add("visible");
});
'
);

// Click Quick Edit link for the Post.
$I->click('tr#post-' . $postID . ' button.editinline');
}
}
Loading