E2E Tests: Fix new-post saveable test for RTC auto-save#75733
E2E Tests: Fix new-post saveable test for RTC auto-save#75733jorgefilipecosta wants to merge 6 commits intotrunkfrom
Conversation
With real-time collaboration enabled by default, posts created with initial content via URL parameters are now auto-saved immediately. This causes the save button to show "Saved" instead of "Save draft". Update the test to accept either button state, as both confirm the post is saveable.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
I thought RTC would be disabled by default and would be an opt-in feature. This pretty much changes the "initial edits" behavior, so not sure if adding extra checks to the test is the right solution. If we want something temporary, we could just skip the test and restore later. |
|
Size Change: 0 B Total Size: 6.84 MB ℹ️ View Unchanged
|
Instead of checking for either button state, explicitly detect if real-time collaboration is enabled via window._wpCollaborationEnabled and apply the appropriate assertion for each case.
Create two separate tests that explicitly enable or disable real-time collaboration to test both code paths: - RTC disabled: expects traditional "Save draft" button - RTC enabled: expects "Saved" indicator (post is auto-saved) This ensures both behaviors are tested regardless of the environment's default RTC setting.
Each test now retrieves the original enable_real_time_collaboration setting value before modifying it and restores it at the end. This prevents test pollution and ensures a clean state for subsequent tests. Defaults to false if the setting is not yet defined.
Very good points I think this test should test both cases as the behaviors are different and both need to tested I divided the test in two, one with RTC enabled another with RTC disabled, so both behaviors are tested. |
scruffian
left a comment
There was a problem hiding this comment.
Tests pass locally for me.
That's what concerns me too.. For example in |
|
There are more new RTC-related failures, which weren't happening a couple of hours ago. Usually, similar failures are temporary due to core sync issues. I don't think we should make any changes to our test suite if the problem is coming from upstream. I also agree that we should improve the RTC to enable test suites, but maybe instead of altering current tests, we should create a separate directory/pecs for it. |
Yah in that case I think it is a bug in this case, it seems with RTC it is expected the post is already saved when the check happens. |
The reason they started happening was the very recent change where RTC become enabled by default. |
@jorgefilipecosta, do you know where I can find this discussion? |
I'm not totally inside the reason why it was made a default, but I think making it a default on core, also made it a default on the plugin given how db/settings work. @chriszarate is putting a PR on Gutenberg to make that change explicit. |
RTC will be enabled by default for now during the beta cycle https://core.trac.wordpress.org/ticket/64622#comment:17 |
It will be opt-in after all. However, this failure has a preferred fix in #75751 (see item 2). I recommend closing this one, with huge thanks for jumping in to help! |
|
Thanks, @chriszarate! |
Summary
should be saveable with sufficient initial editsE2E test that was failing due to real-time collaboration (RTC) being enabled by defaultTest plan
Run the E2E test:
All 6 tests should pass.