Page MenuHomePhabricator

[Infra][SW] Make selenium E2E tests run in parallel in CI jobs
Open, Needs TriagePublic

Description

The selenium (quibble-selenium) CI jobs currently take more than 13 minutes to run:

Analysis for change mediawiki/extensions/Wikibase - wmf-quibble-selenium-php74 (17927):
	wmf-quibble-selenium-php74 (17927): 811
		Setup: 15
		Versions: 1
		Ensure dir: '/workspace/log': 0
		Zuul clone : 124
		Submodule update: /workspace/src: 8
		Install composer dev-requires for vendor.git: 9
		Start backends: <MySQL (no socket)>: 3
		Run Post-dependency install: 0
		Install MediaWiki: 4
		npm install in /workspace/src: 5
		Start backends: <ExternalWebserver http://127.0.0.1:9413 /workspace/src> <Xvfb :94> <ChromeWebDriver :94>: 0
		Browser tests: mediawiki/extensions/Wikibase: 0
		Selenium extensions/Wikibase: 205
		Selenium extensions/AbuseFilter: 37
		Selenium extensions/CheckUser: 26
		Selenium extensions/Cite: 80
		Selenium extensions/Echo: 17
		Selenium extensions/FileImporter: 17
		Selenium extensions/GrowthExperiments: 78
		Selenium extensions/Math: 13
		Selenium extensions/PageTriage: 38
		Selenium extensions/ProofreadPage: 37
		Selenium extensions/VisualEditor: 40
		Selenium skins/MinervaNeue: 23
		PostBuildScript: 31

In particular, the Wikibase browser tests take 205 seconds of the total runtime. Investigate ways to reduce the total time spent for this job, by parallelising the execution of the selenium test suites.

Event Timeline

Change #1055185 had a related patch set uploaded (by Arthur taylor; author: Arthur taylor):

[integration/quibble@master] Run Browser tests in parallel if QUIBBLE_SELENIUM_PARALLEL is set

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

Change #1055186 had a related patch set uploaded (by Arthur taylor; author: Arthur taylor):

[mediawiki/extensions/Wikibase@master] Use fresh user for Repo Selenium tests

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

The browser tests are run with webdriver.io which already has support for parallelism. We did enabled it for most projects, but there are a few for which the tests end up in race condition. The tracking / epic task is T226869

I also don't think we can run in parallel the already parallelized tests, that is going to drain resource and expose even more race conditions? For Wikibase you can enable parallelization by setting maxInstances:

wdio.conf.js
exports.config = { ...config,
    maxInstances:4 ,
...
}

Thanks for the feedback @hashar . I guess that raises some additional questions / todos for us:

  • Check which extensions are using wdio and have parallelisation enabled
  • List which extensions are wdio vs cypress
  • Explain benefits / drawbacks of parallelisation at the Quibble level vs. inside the extensions themselves
  • Research if it's possible to parallelise cypress executions locally
ItamarWMDE renamed this task from [REPO][CLIENT][SW] Make selenium E2E tests run in parallel in CI jobs to [Infra][SW] Make selenium E2E tests run in parallel in CI jobs.Sep 26 2024, 12:59 PM

Change #1055185 abandoned by Hashar:

[integration/quibble@master] Run Browser tests in parallel if QUIBBLE_SELENIUM_PARALLEL is set

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

This task might be a duplicate of T226869: Run browser tests in parallel

T227869 was to ask Webdriver.io to run tests in parallel for a single invocation/repo using wdio instances concept. This T370033 task would be to run multiple npm ci/webdriver.io instances in parallel (each running parallel tests themselves), which is a slightly different parallelism :)

Combination of the tables from T373999 and T374000

Extension Framework Parallel?
AbuseFilterSelenium / wdio4 processes
AchievementBadgesSelenium / wdio4 processes
AdvancedSearchSelenium / wdio4 processes
CampaignEventsSelenium / wdionot parallel
CheckUserSelenium / wdio4 processes
CirrusSearchN/Aup to 8 processes
CiteCypressN/A
CodeMirrorSelenium / wdio4 processes
CommunityConfigurationCypressN/A
CommunityRequestsSelenium / wdio4 processes
EchoSelenium / wdio4 processes
ElectronPdfServiceSelenium / wdionot parallel
EntitySchemaCypressN/A
FacetedCategorySelenium / wdionot parallel
FileImporterSelenium / wdionot parallel
GrowthExperimentsCypress and Selenium / wdio4 processes for selenium, cypress not parallel
GuidedTourCypressN/A
IPInfoSelenium / wdio4 processes
MathSelenium / wdionot parallel
MinervaNeueSelenium / wdio4 processes
NewsletterSelenium / wdionot parallel
PageTriageSelenium / wdio4 processes
PopupsSelenium / wdio4 processes
ProofreadPageSelenium / wdionot parallel
RelatedArticlesSelenium / wdionot parallel
ReportIncidentSelenium / wdio4 processes
RevisionSliderSelenium / wdio4 processes
SanctionsSelenium / wdio4 processes
TemplateWizardSelenium / wdionot parallel
TwoColConflictSelenium / wdio4 processes
VisualEditorSelenium / wdio4 processes
WikibaseSelenium / wdionot parallel
WikibaseLexemeCypressN/A
WikiLambdaSelenium / wdionot parallel

Following the investigation in T374003:

  • There is a strong preference at WMDE for a sharding approach, with a split in preference between test-suite and extension level sharding
  • There is a suggestion of testing the test-suit level sharding as it appears to be a simpler option and would provide insight into how this change would impact the infrastructure
  • Move tests for specific extensions to their own CI jobs (T287582) is also considered a good quick win; however, it also reduces the number of tests being run for extensions generally

We will park this investigation for now and assist as much as possible with T287582