Page MenuHomePhabricator

Fresh problem when running Selenium tests
Open, Needs TriagePublic

Description

I have a local MediaWiki set up via MediaWiki-Docker.

I have no problems running MediaWiki Core Selenium tests from the host machine (Ubuntu) targeting the local MediaWiki.

1z@air:~$ lsb_release -a
2No LSB modules are available.
3Distributor ID: Ubuntu
4Description: Ubuntu 22.04 LTS
5Release: 22.04
6Codename: jammy
7
8
9
10z@air:~$ docker --version
11Docker version 20.10.14, build a224086
12
13
14
15z@air:~$ docker-compose --version
16docker-compose version 1.29.2, build 5becea4c
17
18
19
20z@air:~$ node -v
21v14.17.5
22
23
24
25z@air:~$ npm -v
267.21.0
27
28
29
30z@air:~/Documents/gerrit/mediawiki/core$ time npm run selenium-test
31
32> selenium-test
33> wdio ./tests/selenium/wdio.conf.js
34
35
36Execution of 5 workers started at 2022-07-27T09:42:30.504Z
37
38[0-1] RUNNING in chrome - /tests/selenium/specs/recentchanges.js
39[0-0] RUNNING in chrome - /tests/selenium/specs/page.js
40[0-3] RUNNING in chrome - /tests/selenium/specs/watchlist.js
41[0-2] RUNNING in chrome - /tests/selenium/specs/user.js
42[0-1] PASSED in chrome - /tests/selenium/specs/recentchanges.js
43[0-4] RUNNING in chrome - /tests/selenium/wdio-mediawiki/specs/BlankPage.js
44[0-0] PASSED in chrome - /tests/selenium/specs/page.js
45[0-3] PASSED in chrome - /tests/selenium/specs/watchlist.js
46[0-4] PASSED in chrome - /tests/selenium/wdio-mediawiki/specs/BlankPage.js
47[0-2] PASSED in chrome - /tests/selenium/specs/user.js
48
49 "spec" Reporter:
50------------------------------------------------------------------
51[Chrome Headless 103.0.5060.134 linux #0-1] Running: Chrome Headless (v103.0.5060.134) on linux
52[Chrome Headless 103.0.5060.134 linux #0-1] Session ID: 59885b9a-e587-405c-be74-ec13b36e24f8
53[Chrome Headless 103.0.5060.134 linux #0-1]
54[Chrome Headless 103.0.5060.134 linux #0-1] » /tests/selenium/specs/recentchanges.js
55[Chrome Headless 103.0.5060.134 linux #0-1] Special:RecentChanges
56[Chrome Headless 103.0.5060.134 linux #0-1] ? shows page creation
57[Chrome Headless 103.0.5060.134 linux #0-1] - shows page creation
58[Chrome Headless 103.0.5060.134 linux #0-1]
59[Chrome Headless 103.0.5060.134 linux #0-1] 1 skipped (750ms)
60------------------------------------------------------------------
61[Chrome Headless 103.0.5060.134 linux #0-0] Running: Chrome Headless (v103.0.5060.134) on linux
62[Chrome Headless 103.0.5060.134 linux #0-0] Session ID: 8ff67c11-2013-4cd7-b456-c055d7b6ab27
63[Chrome Headless 103.0.5060.134 linux #0-0]
64[Chrome Headless 103.0.5060.134 linux #0-0] » /tests/selenium/specs/page.js
65[Chrome Headless 103.0.5060.134 linux #0-0] Page
66[Chrome Headless 103.0.5060.134 linux #0-0] ? should be previewable
67[Chrome Headless 103.0.5060.134 linux #0-0] - should be previewable
68[Chrome Headless 103.0.5060.134 linux #0-0] ? should be creatable
69[Chrome Headless 103.0.5060.134 linux #0-0] - should be creatable
70[Chrome Headless 103.0.5060.134 linux #0-0] ? should be re-creatable
71[Chrome Headless 103.0.5060.134 linux #0-0] - should be re-creatable
72[Chrome Headless 103.0.5060.134 linux #0-0] ? should be editable @daily
73[Chrome Headless 103.0.5060.134 linux #0-0] - should be editable @daily
74[Chrome Headless 103.0.5060.134 linux #0-0] ? should have history @daily
75[Chrome Headless 103.0.5060.134 linux #0-0] - should have history @daily
76[Chrome Headless 103.0.5060.134 linux #0-0] ? should be deletable
77[Chrome Headless 103.0.5060.134 linux #0-0] - should be deletable
78[Chrome Headless 103.0.5060.134 linux #0-0] ? should be restorable
79[Chrome Headless 103.0.5060.134 linux #0-0] - should be restorable
80[Chrome Headless 103.0.5060.134 linux #0-0] ? should be protectable
81[Chrome Headless 103.0.5060.134 linux #0-0] - should be protectable
82[Chrome Headless 103.0.5060.134 linux #0-0] - should be undoable
83[Chrome Headless 103.0.5060.134 linux #0-0]
84[Chrome Headless 103.0.5060.134 linux #0-0] 9 skipped (1.4s)
85------------------------------------------------------------------
86[Chrome Headless 103.0.5060.134 linux #0-3] Running: Chrome Headless (v103.0.5060.134) on linux
87[Chrome Headless 103.0.5060.134 linux #0-3] Session ID: d53a6df3-8897-4676-a6df-3b95289518ee
88[Chrome Headless 103.0.5060.134 linux #0-3]
89[Chrome Headless 103.0.5060.134 linux #0-3] » /tests/selenium/specs/watchlist.js
90[Chrome Headless 103.0.5060.134 linux #0-3] Special:Watchlist
91[Chrome Headless 103.0.5060.134 linux #0-3] ? should show page with new edit
92[Chrome Headless 103.0.5060.134 linux #0-3] - should show page with new edit
93[Chrome Headless 103.0.5060.134 linux #0-3]
94[Chrome Headless 103.0.5060.134 linux #0-3] 1 skipped (2.3s)
95------------------------------------------------------------------
96[Chrome Headless 103.0.5060.134 linux #0-4] Running: Chrome Headless (v103.0.5060.134) on linux
97[Chrome Headless 103.0.5060.134 linux #0-4] Session ID: b97aa6eb-54b9-448b-bf42-c98b3bf37731
98[Chrome Headless 103.0.5060.134 linux #0-4]
99[Chrome Headless 103.0.5060.134 linux #0-4] » /tests/selenium/wdio-mediawiki/specs/BlankPage.js
100[Chrome Headless 103.0.5060.134 linux #0-4] BlankPage
101[Chrome Headless 103.0.5060.134 linux #0-4] ✓ should have its title @daily
102[Chrome Headless 103.0.5060.134 linux #0-4]
103[Chrome Headless 103.0.5060.134 linux #0-4] 1 passing (459ms)
104------------------------------------------------------------------
105[Chrome Headless 103.0.5060.134 linux #0-2] Running: Chrome Headless (v103.0.5060.134) on linux
106[Chrome Headless 103.0.5060.134 linux #0-2] Session ID: cb213996-4a92-4caf-957f-44a80d750294
107[Chrome Headless 103.0.5060.134 linux #0-2]
108[Chrome Headless 103.0.5060.134 linux #0-2] » /tests/selenium/specs/user.js
109[Chrome Headless 103.0.5060.134 linux #0-2] User
110[Chrome Headless 103.0.5060.134 linux #0-2] ✓ should be able to create account
111[Chrome Headless 103.0.5060.134 linux #0-2] ✓ should be able to log in @daily
112[Chrome Headless 103.0.5060.134 linux #0-2]
113[Chrome Headless 103.0.5060.134 linux #0-2] 2 passing (5.4s)
114
115
116Spec Files: 5 passed, 5 total (100% completed) in 00:00:08
117
118
119real 0m9,860s
120user 0m13,539s
121sys 0m2,696s

When I try running MediaWiki Core Selenium tests from a Fresh container, the tests never finish.

1z@air:~$ lsb_release -a
2No LSB modules are available.
3Distributor ID: Ubuntu
4Description: Ubuntu 22.04 LTS
5Release: 22.04
6Codename: jammy
7
8
9
10z@air:~$ docker --version
11Docker version 20.10.14, build a224086
12
13
14
15z@air:~$ docker-compose --version
16docker-compose version 1.29.2, build 5becea4c
17
18
19
20z@air:~/Documents/gerrit/mediawiki/core$ fresh-node -env -net
21# fresh: 22.05.1
22# image: docker-registry.wikimedia.org/releng/node14-test-browser:0.0.2-s4
23# software: Debian GNU/Linux 11 (bullseye)
24# Node.js v14.17.5 (npm 7.21.0)
25# Chromium 97.0.4692.99
26# Mozilla Firefox 91.5.0esr
27# JSDuck 5.3.4 (Ruby 2.7.4) ruby 2.7.4p191
28# mount: /core ➟ /home/z/Documents/gerrit/mediawiki/core (read-write)
29# /core/.git ➟ /home/z/Documents/gerrit/mediawiki/core/.git (read-only)
30# env: MW_*, MEDIAWIKI_*
31# net: expose host
32
33🌱 Fresh!
34
35
36
37I have no name!@air:/core$ time npm run selenium-test
38
39> selenium-test
40> wdio ./tests/selenium/wdio.conf.js
41
42
43Execution of 5 workers started at 2022-07-27T10:14:04.702Z
44
45[0-3] RUNNING in chrome - /tests/selenium/specs/watchlist.js
46[0-1] RUNNING in chrome - /tests/selenium/specs/recentchanges.js
47[0-0] RUNNING in chrome - /tests/selenium/specs/page.js
48[0-2] RUNNING in chrome - /tests/selenium/specs/user.js

The CPU is at 90% but the tests never finish.

fresh.png (768×1 px, 193 KB)

processes.png (768×1 px, 269 KB)

To make it more fun, it does not happen every time. I've just tried to run three times, the first two times it got stuck, but the tests ran just fine the third time.

Event Timeline

Krinkle subscribed.

I feel this is most likely an issue with Chrome or another package residing in the container (provided by RelEng for WMF CI), and not something with the 10-line bash script ("Fresh") that we maintain which basically just invokes docker-run.

Can you determine whether you're generally able to reach your MW install from Fresh? E.g. try curl. Also, there might be a verbose mode in selenium/wdio that can help you pinpoint where stuff goes wrong. I can help with that but it's mostly outside the scope of Fresh.

Krinkle edited projects, added Performance-Team (Radar); removed Performance-Team.
Krinkle moved this task from Limbo to Watching on the Performance-Team (Radar) board.
zeljkofilipin changed the task status from Open to In Progress.Aug 23 2022, 10:51 AM
zeljkofilipin claimed this task.
zeljkofilipin moved this task from Waiting 🏹 to Deep work 🌊 on the User-zeljkofilipin board.
zeljkofilipin changed the task status from In Progress to Open.Dec 9 2022, 12:46 PM

@Krinkle apologies for the late reply, I almost forgot about this, but I was recently reminded about it because of a very similar CI problem: T332393: Selenium Jenkins jobs fail after updating @wdio npm packages to v8.

Mediawiki is available in the Fresh container: P45897.

While debugging T332393 I've created a patch (866386) that increases wdio logging to maximum (logLevel: 'trace', wdio.conf.js#11).

Unfortunately, it doesn't reveal much, other than wdio seems to open a browser and then gets stuck.

CI (wmf-quibble-selenium-php74-docker): P45898

I can't reproduce that error consistently on my machine. The only way I've noticed on how to reproduce it is to reboot the machine. The first time I try to run the tests, it gets stuck. If I cancel the test run and run it again, it works just fine.

Fresh: P45900

@zeljkofilipin I see in https://github.com/webdriverio/webdriverio/issues/8279 some reports about webdriver working inconsistently in node16 and node18. But the system requirements for webdriver 8 say to use at least Node 16 (https://webdriver.io/docs/gettingstarted/#system-requirements) whereas the CI build you linked above (T313899#8714211) is using Node 14, so perhaps that is related?

I see in https://github.com/webdriverio/webdriverio/issues/8279 some reports about webdriver working inconsistently in node16 and node18.

It's a long bug report, so I might have missed something important, but as far as I can see, the problem there is that FetchError happens.

The problem I have is that tests get stuck at a step before that:

INFO devtools: Connect Puppeteer with browser on port 38943

The tests never report any errors, they just get stuck.

Also, looks like the github problem is connected with node v16 and v18, while for me it happens on v14.

But the system requirements for webdriver 8 say to use at least Node 16 (https://webdriver.io/docs/gettingstarted/#system-requirements) whereas the CI build you linked above (T313899#8714211) is using Node 14, so perhaps that is related?

That might be related, but wdio v8 announcement says:

We've dropped support for Node v12 and v14, latter was moved into a maintenance LTS phase by the Node.js team in October 2021. While it is technically fine to continue using Node.js v14, we don't see a reason why you shouldn't update to Node.js v16 or ideally v18 directly.

So wdio v14 should be ok.