Page MenuHomePhabricator

🚧 [MEX][SPIKE] Dividing the E2E specs into multiple parallel processes to reduce the execution time
Open, LowPublic

Description

Introduce new approaches for the E2E Cypress tests for the extension Wikibase to boost the performance and reduce the execution time.

This will require to gather the some build data and to calculate the optimized execution time for the parallel processes.

The investigation scope:

  • Dividing the Cypress E2E tests to run into multiple parallel processes to reduce the execution time (might consume more resources).

Deliverables:

  • A POC implementation for the Cypress E2E parallel processes.
  • The build data before and after the implementation (this will need longer observation time for the proper built data gathering).

Related: T415170: 🚧 [MEX] E2E tests refactoring for better performance (Experimental)
Reference: T374001: [Infra] Investigate options for parallelising cypress tests T370033: [Infra][SW] Make selenium E2E tests run in parallel in CI jobs T50217: Speed up MediaWiki PHPUnit build by running integration tests in parallel

Event Timeline

mahmoud.abdelsattar.wmde renamed this task from [MEX][SPIKE] Dividing the E2E specs into multiple parallel processes to reduce the execution time to 🚧 [MEX][SPIKE] Dividing the E2E specs into multiple parallel processes to reduce the execution time.Feb 19 2026, 8:21 AM

Do not do in parallel to: T416574 as it can skew the numbers

Change #1270440 had a related patch set uploaded (by Sadiya.mohammed13; author: Sadiya.mohammed13):

[mediawiki/extensions/Wikibase@master] [MEX][SPIKE] Dividing the E2E specs into multiple parallel processes to reduce the execution time

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

Goal
The goal of this task was to reduce the runtime of the wbui2025 Cypress test suite in CI without changing test logic or configuration.
Initial Situation
All wbui2025 Cypress tests were executed in a single run using:
npm run cypress:run.

This resulted in a runtime of approximately 2 minutes 48 seconds, with all tests running sequentially.
Approach
To improve performance, the test suite was split into smaller groups that can run in parallel.
Different grouping strategies were tested:
Single full run (baseline)
3-way split
2-way split
All tests were executed multiple times to ensure stability.
Single full run (baseline)
Real time: 4 minutes 1 second
Cypress reported runtime: 2 minutes 48 seconds
Baseline total runtime: ~4m 1s
Tested options
Option 1 two-way split (by file count)
Part 1: 1m 30s
Part 2: 1m 0s
Parallel runtime: ~1m 30s
This improved runtime significantly but was imbalanced.
Option 2 two-way split runtime-balanced
Part 1: 1m 11s
Part 2: 1m 24s
Parallel runtime: ~1m 24s
This provided better workload balance and improved overall runtime compared to Option 1.
Option 3 three-way split
Part 1: 38s
Part 2: 41s
Part 3: 1m 11s
Parallel runtime: ~1m 11s
This was the fastest configuration tested, but it introduced additional complexity and imbalance.
Final decision
Although the 3-way split produced the fastest runtime, the 2-way runtime-balanced split was selected for implementation.
Reasoning:
Simpler CI configuration (fewer parallel jobs)
Lower maintenance overhead
Sufficient performance improvement
Reduced the risk of uneven shard distribution over time
In the final solution, I divide the tests into two groups:
Part 1:
editEntityDatatypes
addReference
publishStatementChanges
RTLLanguages
addValueModal
viewItem
Runtime: ~1 minute
Part 2:
addQualifier
editReference
editTimeDatatype
editStringDatatypes
addStatement
editStatement
Runtime: ~1 minute 38 seconds
Result
When executed in parallel, the total runtime is determined by the slower group.
Expected runtime: ~1 minute 38 seconds
Original runtime: ~2 minutes 48 seconds
This results in a reduction of over 1 minute.
Implementation
The change was implemented in package.json by adding two new scripts:
cypress:run:wbui2025:part1
Cypress:run:wbui2025:part2
And updating the selenium test entry point to run both parts in parallel using npm-run-all: npm-run-all -p cypress:run:wbui2025:part1 cypress:run:wbui2025:part2
Investigation summary
This investigation evaluated whether splitting the wbui2025 Cypress test suite into multiple parts can reduce total execution time.
No changes were made to the repository code during the investigation phase. The following remained unchanged:
package.json scripts
CI configuration
Cypress test files
All experiments were performed locally using
npm cypress run --spec to simulate different splitting strategies and measure runtime.
Conclusion
The wbui2025 Cypress suite is now executed in two parallel jobs.
This reduces CI runtime significantly while keeping test behavior unchanged and maintaining a simple configuration. Splitting the Cypress suite significantly improves execution time.
The baseline (unsplit) run is the slowest
Runtime-balanced splitting performs better than equal file splitting
A 2-way split provides a strong balance between performance and simplicity
The implemented solution reduces runtime, keeping the setup maintainable.