Page MenuHomePhabricator

Slow connection warning in editor appearing in Selenium test: Error in "Wikitext Editor.Closing editor (browser button)" Error: waitUntil condition timed out after 5000ms
Open, Needs TriagePublic

Description

Seen on an unrelated vendor patch

https://gerrit.wikimedia.org/r/c/mediawiki/vendor/+/964591/3
https://integration.wikimedia.org/ci/job/wmf-quibble-selenium-php74-docker/62940/console

14:46:57 [0-1] Error in "Wikitext Editor.Closing editor (browser button)"
14:47:04 Error: waitUntil condition timed out after 5000ms
14:47:04     at async iDoNotSeeAnOverlay (/workspace/src/skins/MinervaNeue/tests/selenium/features/step_definitions/common_steps.js:118:2)
14:47:04     at async Context.<anonymous> (/workspace/src/skins/MinervaNeue/tests/selenium/specs/editor_wikitext_nosave.js:33:3)
14:47:04 [0-1] RETRYING in chrome - /tests/selenium/specs/editor_wikitext_nosave.js
14:47:04 [0-1] RUNNING in chrome - /tests/selenium/specs/editor_wikitext_nosave.js
14:47:05 [0-1] Error in "Wikitext Editor.Closing editor (browser button)"
14:47:20 Error: waitUntil condition timed out after 5000ms
14:47:20     at async iDoNotSeeAnOverlay (/workspace/src/skins/MinervaNeue/tests/selenium/features/step_definitions/common_steps.js:118:2)
14:47:20     at async Context.<anonymous> (/workspace/src/skins/MinervaNeue/tests/selenium/specs/editor_wikitext_nosave.js:33:3)
14:47:20 [0-1] FAILED in chrome - /tests/selenium/specs/editor_wikitext_nosave.js (1 retries)

Event Timeline

This is happening at greater frequency now, adding @zeljkofilipin who will know better

Having this affect a good chunk of test / gate-and-submit runs for changes on the ReportIncident extension.

There's also recent repeated failure in Math repo because of this. It seems no one is interested in fixing it. I think it should be disabled like the other test in the suite T313775 which was disabled with even lower failure rate.

Occurring on https://integration.wikimedia.org/ci/job/quibble-vendor-mysql-php74-selenium-docker/73752/console

From the associated assets it looks like VisualEditor is not loading here (or is loading slowly) and back button is disabled here. Might be worth getting the editing team to investigate this separately. Selenium seems to be doing what it should do here.

Screenshot 2023-10-30 at 9.40.13 AM.png (406×952 px, 90 KB)

IN terms of the test it should be easy to modify it for a short term fix to either:

  1. check for the slow button in addition to the editor (which it's currently waiting on)
  2. Increase the waitUntil condition time.

Change 970454 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/skins/MinervaNeue@master] Account for load basic button

https://gerrit.wikimedia.org/r/970454

Change 970454 merged by jenkins-bot:

[mediawiki/skins/MinervaNeue@master] Account for load basic button

https://gerrit.wikimedia.org/r/970454

Jdlrobson claimed this task.

Hopefully above patch addresses this issue. If not feel free to reopen.

Change 970759 had a related patch set uploaded (by Reedy; author: Jdlrobson):

[mediawiki/skins/MinervaNeue@REL1_41] Account for load basic button

https://gerrit.wikimedia.org/r/970759

Change 970760 had a related patch set uploaded (by Reedy; author: Jdlrobson):

[mediawiki/skins/MinervaNeue@REL1_40] Account for load basic button

https://gerrit.wikimedia.org/r/970760

Jdlrobson renamed this task from Error in "Wikitext Editor.Closing editor (browser button)" Error: waitUntil condition timed out after 5000ms to Slow connection warning in editor appearing in Selenium test: Error in "Wikitext Editor.Closing editor (browser button)" Error: waitUntil condition timed out after 5000ms.Nov 3 2023, 5:18 PM
Jdlrobson reopened this task as Open.
Jdlrobson removed Jdlrobson as the assignee of this task.

According to the video this still has something to do with a slow connection. We can skip this test for the time being but it's a little concerning that our browser tests are hitting this and I'd be curious if the editing team knows why "slow connection" is showing so quickly in this simulation. It suggests some kind of bug is occurring in the loading of the editor.

Screenshot 2023-11-03 at 10.15.06 AM.png (658×1 px, 175 KB)

According to the video this still has something to do with a slow connection. We can skip this test for the time being but it's a little concerning that our browser tests are hitting this and I'd be curious if the editing team knows why "slow connection" is showing so quickly in this simulation. It suggests some kind of bug is occurring in the loading of the editor.

Screenshot 2023-11-03 at 10.15.06 AM.png (658×1 px, 175 KB)

It is not showing quickly, the recording is just weird.

TimeScreenshotNotes
0.633 seconds
cap_selenium_00_00_00.633_01.jpg (1×1 px, 105 KB)
You can see that it started one of the 'Wikitext Editor' tests (it's on a page titled like 'NewPage <date>').
1.468 seconds
cap_selenium_00_00_01.468_02.jpg (1×1 px, 39 KB)
For some reason, another browser window opens!
3.803 seconds
cap_selenium_00_00_03.803_03.jpg (1×1 px, 110 KB)
You can see that the new window is running one of the 'Manage Watchlist' tests (it's on a page titled like 'I am on the "Selenium mobile unwatched test <date>').
4.671 seconds
cap_selenium_00_00_04.671_04.jpg (1×1 px, 80 KB)
The other test finishes, and we see the browser window running our test again, which has displayed the slow connection message in the meantime. This is expected, as this message should appear after 3 seconds.

Is it normal that it's running multiple browser tests at once? That doesn't seem like it would be very reliable.

Occurring on https://integration.wikimedia.org/ci/job/quibble-vendor-mysql-php74-selenium-docker/73752/console

From the associated assets it looks like VisualEditor is not loading here (or is loading slowly) and back button is disabled here. Might be worth getting the editing team to investigate this separately. Selenium seems to be doing what it should do here.

Screenshot 2023-10-30 at 9.40.13 AM.png (406×952 px, 90 KB)

IN terms of the test it should be easy to modify it for a short term fix to either:

  1. check for the slow button in addition to the editor (which it's currently waiting on)
  2. Increase the waitUntil condition time.

I disagree with the analysis here. The editor is not loading slowly; rather, the editor loading is cancelled (by pressing the browser back button), but the "splash screen" remains open. This seems like the bug causing this problem, and the patch would not have fixed it.

You can match up this video closely to the test steps: https://gerrit.wikimedia.org/g/mediawiki/skins/MinervaNeue/+/6af218d9ee47676e319d6737008273f34c2681a4/tests/selenium/specs/editor_wikitext_nosave.js#13

TimeScreenshotTest stepNotes
0.667 seconds
cap_selenium2_00_00_00.667_01.jpg (1×1 px, 103 KB)
iAmOnAPageThatDoesNotExist(); iClickTheEditButton();
0.800 seconds
cap_selenium2_00_00_00.800_02.jpg (1×1 px, 104 KB)
Note the ?action=edit in the browser address bar – we navigated to another page. Maybe the editor should load without navigating to another page? That would speed up the test, at least
1.234 seconds
cap_selenium2_00_00_01.234_03.jpg (1×1 px, 105 KB)
URL has been reformatted and presumably the ?action=edit replaced by #/editor/0 – we can't see that because the page title is too long, but we probably reached this line: https://gerrit.wikimedia.org/g/mediawiki/extensions/MobileFrontend/+/50e08f5c68208402711a6ef99b637a526696fad3/src/mobile.init/editor.js#456
1.701 seconds
cap_selenium2_00_00_01.701_04.jpg (1×1 px, 65 KB)
iSeeTheWikitextEditorOverlay(); iClickTheBrowserBackButton();
2.002 seconds
cap_selenium2_00_00_02.002_05.jpg (1×1 px, 94 KB)
iDoNotSeeAnOverlay();We have navigated back (as evindenced by the browser "forward" button being active), and the overlay background has disappeared, but not the rest of it – thus this step never passes and we wait until timeout

I would recommend using shorter page titles in the tests, so that it's easier to see what happens.

I would also recommend moving the test code from MinervaNeue to MobileFrontend, since that's where the editor is implemented. Keeping them in separate repos makes this difficult to maintain.

tl;dr: The recordings show that browser back button does not reliably close the editor loading screen if the editor hasn't loaded yet. That may be a bug worth investigating. If it's not practical to investigate, we should instead change the iSeeTheWikitextEditorOverlay(); step to wait for the editor to load fully, not only for the loading screen – the browser back button handling may be more reliable in this case.

Thanks for looking at this @matmarex. If there is nothing wrong here with the editor workflow, to be honest I would just suggest removing the test altogether as it doesn't seem useful in current form. If we want to retain a test to check back button behaviour, then the language overlay is a better bet, since that's a synchronous overlay and doesn't require a server roundtrip.

Regarding the multiple test running at same time - that may be an optimization made previously by RelEng that's worth re-evaluating. I think in general use of Selenium at WMF should be reassessed given these tests seem to cause more inconvenience then being helpful. I've heard good things about Cypress for example.

Change 977779 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/skins/MinervaNeue@master] Disable another flakey test

https://gerrit.wikimedia.org/r/977779

Change 977779 merged by jenkins-bot:

[mediawiki/skins/MinervaNeue@master] Disable another flakey test

https://gerrit.wikimedia.org/r/977779

Change 970759 merged by jenkins-bot:

[mediawiki/skins/MinervaNeue@REL1_41] Account for load basic button

https://gerrit.wikimedia.org/r/970759

Change 970760 merged by jenkins-bot:

[mediawiki/skins/MinervaNeue@REL1_40] Account for load basic button

https://gerrit.wikimedia.org/r/970760