diff --git a/packages/browsers/src/browser-data/browser-data.ts b/packages/browsers/src/browser-data/browser-data.ts index 5e01067d2df..2d0fdc7922a 100644 --- a/packages/browsers/src/browser-data/browser-data.ts +++ b/packages/browsers/src/browser-data/browser-data.ts @@ -101,12 +101,14 @@ export async function resolveBuildId( case Browser.CHROMEDRIVER: switch (tag as BrowserTag) { case BrowserTag.LATEST: - return await chromedriver.resolveBuildId('latest'); - case BrowserTag.BETA: case BrowserTag.CANARY: + return await chromedriver.resolveBuildId(ChromeReleaseChannel.CANARY); + case BrowserTag.BETA: + return await chromedriver.resolveBuildId(ChromeReleaseChannel.BETA); case BrowserTag.DEV: + return await chromedriver.resolveBuildId(ChromeReleaseChannel.DEV); case BrowserTag.STABLE: - throw new Error(`${tag} is not support for ${browser}`); + return await chromedriver.resolveBuildId(ChromeReleaseChannel.STABLE); } case Browser.CHROMIUM: switch (tag as BrowserTag) { diff --git a/packages/browsers/src/browser-data/chromedriver.ts b/packages/browsers/src/browser-data/chromedriver.ts index 6631e870a36..c5c318ef262 100644 --- a/packages/browsers/src/browser-data/chromedriver.ts +++ b/packages/browsers/src/browser-data/chromedriver.ts @@ -13,29 +13,30 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import path from 'path'; -import {getText} from '../httpUtil.js'; +import {getLastKnownGoodReleaseForChannel} from './chrome.js'; +import {BrowserPlatform, ChromeReleaseChannel} from './types.js'; -import {BrowserPlatform} from './types.js'; - -function archive(platform: BrowserPlatform): string { +function folder(platform: BrowserPlatform): string { switch (platform) { case BrowserPlatform.LINUX: - return 'chromedriver_linux64'; + return 'linux64'; case BrowserPlatform.MAC_ARM: - return 'chromedriver_mac_arm64'; + return 'mac-arm64'; case BrowserPlatform.MAC: - return 'chromedriver_mac64'; + return 'mac-x64'; case BrowserPlatform.WIN32: + return 'win32'; case BrowserPlatform.WIN64: - return 'chromedriver_win32'; + return 'win64'; } } export function resolveDownloadUrl( platform: BrowserPlatform, buildId: string, - baseUrl = 'https://chromedriver.storage.googleapis.com' + baseUrl = 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing' ): string { return `${baseUrl}/${resolveDownloadPath(platform, buildId).join('/')}`; } @@ -44,7 +45,7 @@ export function resolveDownloadPath( platform: BrowserPlatform, buildId: string ): string[] { - return [buildId, `${archive(platform)}.zip`]; + return [buildId, folder(platform), `chromedriver-${folder(platform)}.zip`]; } export function relativeExecutablePath( @@ -54,17 +55,16 @@ export function relativeExecutablePath( switch (platform) { case BrowserPlatform.MAC: case BrowserPlatform.MAC_ARM: + return path.join('chromedriver-' + folder(platform), 'chromedriver'); case BrowserPlatform.LINUX: - return 'chromedriver'; + return path.join('chromedriver-linux64', 'chromedriver'); case BrowserPlatform.WIN32: case BrowserPlatform.WIN64: - return 'chromedriver.exe'; + return path.join('chromedriver-' + folder(platform), 'chromedriver.exe'); } } export async function resolveBuildId( - _channel: 'latest' = 'latest' + channel: ChromeReleaseChannel ): Promise { - return await getText( - new URL(`https://chromedriver.storage.googleapis.com/LATEST_RELEASE`) - ); + return (await getLastKnownGoodReleaseForChannel(channel)).version; } diff --git a/packages/browsers/test/src/chromedriver/chromedriver-data.spec.ts b/packages/browsers/test/src/chromedriver/chromedriver-data.spec.ts index fb4134a6631..e29f1a8182d 100644 --- a/packages/browsers/test/src/chromedriver/chromedriver-data.spec.ts +++ b/packages/browsers/test/src/chromedriver/chromedriver-data.spec.ts @@ -15,6 +15,7 @@ */ import assert from 'assert'; +import path from 'path'; import {BrowserPlatform} from '../../../lib/cjs/browser-data/browser-data.js'; import { @@ -25,47 +26,47 @@ import { describe('ChromeDriver', () => { it('should resolve download URLs', () => { assert.strictEqual( - resolveDownloadUrl(BrowserPlatform.LINUX, '112.0.5615.49'), - 'https://chromedriver.storage.googleapis.com/112.0.5615.49/chromedriver_linux64.zip' + resolveDownloadUrl(BrowserPlatform.LINUX, '115.0.5763.0'), + 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/115.0.5763.0/linux64/chromedriver-linux64.zip' ); assert.strictEqual( - resolveDownloadUrl(BrowserPlatform.MAC, '112.0.5615.49'), - 'https://chromedriver.storage.googleapis.com/112.0.5615.49/chromedriver_mac64.zip' + resolveDownloadUrl(BrowserPlatform.MAC, '115.0.5763.0'), + 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/115.0.5763.0/mac-x64/chromedriver-mac-x64.zip' ); assert.strictEqual( - resolveDownloadUrl(BrowserPlatform.MAC_ARM, '112.0.5615.49'), - 'https://chromedriver.storage.googleapis.com/112.0.5615.49/chromedriver_mac_arm64.zip' + resolveDownloadUrl(BrowserPlatform.MAC_ARM, '115.0.5763.0'), + 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/115.0.5763.0/mac-arm64/chromedriver-mac-arm64.zip' ); assert.strictEqual( - resolveDownloadUrl(BrowserPlatform.WIN32, '112.0.5615.49'), - 'https://chromedriver.storage.googleapis.com/112.0.5615.49/chromedriver_win32.zip' + resolveDownloadUrl(BrowserPlatform.WIN32, '115.0.5763.0'), + 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/115.0.5763.0/win32/chromedriver-win32.zip' ); assert.strictEqual( - resolveDownloadUrl(BrowserPlatform.WIN64, '112.0.5615.49'), - 'https://chromedriver.storage.googleapis.com/112.0.5615.49/chromedriver_win32.zip' + resolveDownloadUrl(BrowserPlatform.WIN64, '115.0.5763.0'), + 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/115.0.5763.0/win64/chromedriver-win64.zip' ); }); it('should resolve executable paths', () => { assert.strictEqual( relativeExecutablePath(BrowserPlatform.LINUX, '12372323'), - 'chromedriver' + path.join('chromedriver-linux64', 'chromedriver') ); assert.strictEqual( relativeExecutablePath(BrowserPlatform.MAC, '12372323'), - 'chromedriver' + path.join('chromedriver-mac-x64/', 'chromedriver') ); assert.strictEqual( relativeExecutablePath(BrowserPlatform.MAC_ARM, '12372323'), - 'chromedriver' + path.join('chromedriver-mac-arm64', 'chromedriver') ); assert.strictEqual( relativeExecutablePath(BrowserPlatform.WIN32, '12372323'), - 'chromedriver.exe' + path.join('chromedriver-win32', 'chromedriver.exe') ); assert.strictEqual( relativeExecutablePath(BrowserPlatform.WIN64, '12372323'), - 'chromedriver.exe' + path.join('chromedriver-win64', 'chromedriver.exe') ); }); }); diff --git a/packages/browsers/test/src/chromedriver/cli.spec.ts b/packages/browsers/test/src/chromedriver/cli.spec.ts index 52c23d22c23..d2d10a04e31 100644 --- a/packages/browsers/test/src/chromedriver/cli.spec.ts +++ b/packages/browsers/test/src/chromedriver/cli.spec.ts @@ -64,6 +64,7 @@ describe('ChromeDriver CLI', function () { tmpDir, 'chromedriver', `linux-${testChromeDriverBuildId}`, + 'chromedriver-linux64', 'chromedriver' ) ) @@ -81,6 +82,7 @@ describe('ChromeDriver CLI', function () { tmpDir, 'chromedriver', `linux-${testChromeDriverBuildId}`, + 'chromedriver-linux64', 'chromedriver' ) ) diff --git a/packages/browsers/test/src/versions.ts b/packages/browsers/test/src/versions.ts index 2707569dda5..388e3479fe9 100644 --- a/packages/browsers/test/src/versions.ts +++ b/packages/browsers/test/src/versions.ts @@ -19,4 +19,4 @@ export const testChromiumBuildId = '1083080'; // TODO: We can add a Cron job to auto-update on change. // Firefox keeps only `latest` version of Nightly builds. export const testFirefoxBuildId = '115.0a1'; -export const testChromeDriverBuildId = '112.0.5615.49'; +export const testChromeDriverBuildId = '115.0.5763.0';