Repository navigation
Start Chrome and Firefox once before the Selenium contract tests - #90
Merged
Merged
Conversation
Chrome's first start on a fresh runner can take longer than the 60 second limit of the first contract test, which failed Ubuntu_PHP_7.4 in full build 43270028176. ci/start-chrome-once.ps1, the same script as 51degrees-java's, starts Chrome and its driver once and prints how long each took. The contract tests now print each test's time.
…ests The shared suite's first Firefox test took 10 to 32 s in each job of full build 43520416596, the same first start cost this script takes out of the tests for Chrome. The script is now start-browsers-once.ps1 and warms both.
jwrosewell
marked this pull request as ready for review
November 14, 2026 20:53
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The first Selenium contract test of a job starts Chrome, and Chrome's first start on a fresh runner can take longer than the test's 60 second limit. In full build 43270028176 the job Ubuntu_PHP_7.4 failed that way, "The HTTP request to the remote WebDriver server for URL http://localhost:42445/session timed out after 60 seconds", in the first test. 51degrees-java#124 found the same wait failing on Intel macOS runners and measured Chrome's first start there.
Firefox has the same cost. In full build 43520416596, which started Chrome once and not Firefox, the first run of
SessionStorageCache_FireFox (True)in each job took 10 to 32 seconds, and the same test took 2 to 4 seconds in the job's second contract run.A test that fails on timing is fixed rather than run again, either with a limit that fits the slowest runner or by finding why it is slow. Here the slow part is not the test. It is each browser starting for the first time on a new machine, so this draft moves those starts out of the tests.
What changed
ci/start-browsers-once.ps1starts the Chrome driver, Chrome, the Firefox driver and Firefox once, waits up to 300 seconds for each, and prints how long each took. A start that runs over is stopped and one that fails is reported, both as warnings, and the tests then run as they would have without it.CHROME_BIN, then the path, then where Chrome installs itself) and with the same arguments.Helpers/BrowserDrivers.csfinds them, beingFIREFOX_BINandGECKOWEBDRIVERfirst, thenfirefoxandgeckodriveron the path. The driver is run with--version. Firefox takes a headless screenshot ofabout:blankwith a profile of its own, which is then deleted. On Windows it is given--wait-for-browser, because Firefox's launcher there can hand the start to a second process and exit at once, and that option makes it wait for the browser, so the time includes the start.start-chrome-once.ps1.ci/run-integration-tests.ps1runs it once before any package's integration tests, so the first starts fall outside the limit of every contract test, cloud and on-premise.--logger "console;verbosity=normal", so each test's time is printed, passed or failed.The call sits in the root script, not in a package's
ci/, because a package directory is published to its mirror as it is. The two package scripts changed sit underdevice-detection/cloud/ci/anddevice-detection/onpremise/ci/, which the release plan of #37 ignores, so this draft releases no package.How it was checked
This draft changes CI scripts only, with no package code. James Rosewell's decision of 12 November for such changes is "rebuild and include, but the change doesn't impact the code so no need to run the full builds", so it needs green quick checks on the head and a review. Full builds ran anyway, to measure each browser's first start on every runner.
Full build 43533876757 ran on the head f6140ff and passed, with 9 of 9
Setting 'PullRequestSha'lines on f6140ff and "Left out 5 macOS entries". Every contract run printed "Passed: 9", and no warning was printed.The first four columns are the first starts this script made, outside every test, and they took up to 26.3 seconds. "First Firefox test" is
SessionStorageCache_FireFox (True)in the job's first contract run, before in build 43520416596 and now in build 43533876757. It is the slowest contract test in every job of the new build, and the slowest is 14 seconds, against its 60 second limit. Its second run in the same job takes 2 to 4 seconds, so a few seconds of each new Firefox session's own start are left in the first test, which a test cannot avoid because each session makes a new profile.The Chrome start of java#124's script has its own red and green runs on 51degrees-java#124, red 43518883531 (a Chrome that exits with code 3 was reported as started) and green 43518903716. Build 43520416596 above is this draft's earlier head 733201e, which warmed only Chrome, and passed with 9 of 9
Setting 'PullRequestSha'lines on 733201e.macOS was left out of this draft's full build under the 9 November decision. The rc head is built with macOS before it merges into main.
The head
f6140ff is b794a13 plus the Firefox commit. b794a13 is 733201e with
rcat 6d95eee merged in, with a merge commit and no conflict. The quick checks on f6140ff are green, Environment variable names 43533875091, Only rc into main 43533875510 and UTM link lint 43533875207.What remains
rchead, which runs with macOS.CHROME_BIN,CHROMEWEBDRIVER,FIREFOX_BINandGECKOWEBDRIVER, which the script reads, to the one list of environment variable names, with the other browser names the shared Selenium suite reads.