Skip to content

Fix flaky e2e tests, focus on Webkit and making sure the DOM is ready so events fire properly#2841

Open
mleray wants to merge 2 commits intomainfrom
fix-flaky-e2e
Open

Fix flaky e2e tests, focus on Webkit and making sure the DOM is ready so events fire properly#2841
mleray wants to merge 2 commits intomainfrom
fix-flaky-e2e

Conversation

@mleray
Copy link
Contributor

@mleray mleray commented Dec 19, 2025

Summary

  • simplifies the searchAndInsertBlock function

@mleray mleray marked this pull request as ready for review December 19, 2025 09:15
@mleray mleray added the WIP label Dec 19, 2025
planet-4 added a commit to greenpeace/planet4-test-janus that referenced this pull request Dec 19, 2025
/unhold 29bbcc0b-a4db-47a9-92d0-ca91f968487c
@planet-4
Copy link
Contributor

planet-4 commented Dec 19, 2025

Test instance is ready 🚀

🌑 janus | admin | blocks report | CircleCI | composer-local.json

⌚ 2026.01.27 09:21:23

planet-4 added a commit to greenpeace/planet4-test-janus that referenced this pull request Dec 19, 2025
/unhold 0cb5c1ad-23d7-4a4c-8c20-d42026c22df9
planet-4 added a commit to greenpeace/planet4-test-janus that referenced this pull request Dec 19, 2025
/unhold 5fc084de-2f22-43de-bd29-19f3c9870762
Copy link
Contributor

@Osong-Michael Osong-Michael left a comment

Choose a reason for hiding this comment

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

@mleray should we merge so you can test your other PRs?

@Osong-Michael Osong-Michael changed the title Fix flaky e2e tests Fix flaky e2e tests, focus on Webkit and making sure the DOM is ready so events fire properly Dec 19, 2025
try {
await expect(getCloseButton()).toBeVisible({timeout: 1000});
await getCloseButton().click();
} catch (error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need the catch block?

Copy link
Contributor

Choose a reason for hiding this comment

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

Would be nice to have some kind of way to see why the try block didn't run

* @param {string} text
*/
const addHeadingOrParagraph = async ({page}, blockName, blockTag, number, text) => {
const addHeadingOrParagraph = async ({page}, blockName, blockTag, text) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

With the new changes, this function looks pretty generic to me, and it could be used for other blocks, not only headings or paragraphs.
Maybe it could be renamed, or at least, the new code you inserted could be extracted into another function to make it reusable.

Copy link
Contributor

Choose a reason for hiding this comment

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

We already have a generic function to add blocks to pages, I am not sure but this is also pretty reusable if there is a use case, as for the changes, those are just hacks to ensure there is enough time to allow DOM update and stability before certain actions take place, different browsers render differently hence the reason for flakiness in some of our tests

@mleray mleray requested a review from Osong-Michael January 5, 2026 13:42
@mleray mleray force-pushed the fix-flaky-e2e branch 2 times, most recently from c81a12b to b722a56 Compare January 6, 2026 15:02
planet-4 added a commit to greenpeace/planet4-test-janus that referenced this pull request Jan 6, 2026
/unhold dd55661d-4012-4960-97c5-8e214e439655
planet-4 added a commit to greenpeace/planet4-test-janus that referenced this pull request Jan 6, 2026
/unhold 5aef2ee3-eb61-4a82-ac2f-c20f2f85652d
planet-4 added a commit to greenpeace/planet4-test-janus that referenced this pull request Jan 7, 2026
/unhold 415c7c88-a93c-4fcb-a21a-3effd00be76e
planet-4 added a commit to greenpeace/planet4-test-janus that referenced this pull request Jan 7, 2026
/unhold bd70e5c6-a208-4876-acd1-8168cba516e9
planet-4 added a commit to greenpeace/planet4-test-janus that referenced this pull request Jan 8, 2026
/unhold 28248b38-ac7f-4dfb-be6f-b9d1251c161e
planet-4 added a commit to greenpeace/planet4-test-janus that referenced this pull request Jan 8, 2026
/unhold d9ac55de-d011-4637-9b03-a63ace0553b1
planet-4 added a commit to greenpeace/planet4-test-janus that referenced this pull request Jan 12, 2026
/unhold 69d568d8-6414-435f-bb4a-a42f765726cb
planet-4 added a commit to greenpeace/planet4-test-janus that referenced this pull request Jan 12, 2026
/unhold c5c1323a-9c58-46cb-babe-aab5500b2694
planet-4 added a commit to greenpeace/planet4-test-janus that referenced this pull request Jan 12, 2026
/unhold 9180e14d-5b7d-43d7-8d32-1a9d9fa2cbd1
planet-4 added a commit to greenpeace/planet4-test-janus that referenced this pull request Jan 19, 2026
/unhold d5233c21-e582-4cf8-be87-81607f95a61b
planet-4 added a commit to greenpeace/planet4-test-janus that referenced this pull request Jan 23, 2026
/unhold 4e294aa3-e101-4a34-914e-4179c3f701e5
planet-4 added a commit to greenpeace/planet4-test-janus that referenced this pull request Jan 27, 2026
/unhold c1154afa-10ab-417c-a92a-c84e4f5d2051
mleray and others added 2 commits January 27, 2026 10:13
This commit simplifies the searchAndInsertBlock function
- Added code to ensure DOM is ready in webkit
- Ensure page is not closed before interacting with elements
planet-4 added a commit to greenpeace/planet4-test-janus that referenced this pull request Jan 27, 2026
/unhold c3e258e6-2d03-47cf-9f0f-2b81703596e0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants