Skip to content

Commit 9cd554b

Browse files
(@wdio/utils): respect browserVersion when setting up Chrome or Firefox (#11248)
1 parent b74f21b commit 9cd554b

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

packages/wdio-utils/src/driver/utils.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,14 @@ export async function setupPuppeteerBrowser(cacheDir: string, caps: Capabilities
107107
if (typeof browserOptions.binary === 'string') {
108108
return {
109109
executablePath: browserOptions.binary,
110-
browserVersion: browserName === Browser.CHROME
111-
? getBuildIdByChromePath(browserOptions.binary)
112-
: await getBuildIdByFirefoxPath(browserOptions.binary)
110+
browserVersion: (
111+
caps.browserVersion ||
112+
(
113+
browserName === Browser.CHROME
114+
? getBuildIdByChromePath(browserOptions.binary)
115+
: await getBuildIdByFirefoxPath(browserOptions.binary)
116+
)
117+
)
113118
}
114119
}
115120

packages/wdio-utils/tests/driver/utils.test.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,13 @@ describe('driver utils', () => {
122122
browserVersion: '116.0.5845.110',
123123
executablePath: '/my/chrome'
124124
})
125+
await expect(setupPuppeteerBrowser('/foo/bar', {
126+
browserVersion: '1.2.3',
127+
'goog:chromeOptions': { binary: '/my/chrome' }
128+
})).resolves.toEqual({
129+
browserVersion: '1.2.3',
130+
executablePath: '/my/chrome'
131+
})
125132
})
126133

127134
it('should install chrome stable if browser is not found', async () => {

0 commit comments

Comments
 (0)