summaryrefslogtreecommitdiffstats
path: root/remote/test/puppeteer/packages/browsers/test/src/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'remote/test/puppeteer/packages/browsers/test/src/chrome')
-rw-r--r--remote/test/puppeteer/packages/browsers/test/src/chrome/chrome-data.spec.ts17
-rw-r--r--remote/test/puppeteer/packages/browsers/test/src/chrome/install.spec.ts68
2 files changed, 60 insertions, 25 deletions
diff --git a/remote/test/puppeteer/packages/browsers/test/src/chrome/chrome-data.spec.ts b/remote/test/puppeteer/packages/browsers/test/src/chrome/chrome-data.spec.ts
index 510afa8454..4d5bc980b1 100644
--- a/remote/test/puppeteer/packages/browsers/test/src/chrome/chrome-data.spec.ts
+++ b/remote/test/puppeteer/packages/browsers/test/src/chrome/chrome-data.spec.ts
@@ -16,29 +16,30 @@ import {
relativeExecutablePath,
resolveSystemExecutablePath,
resolveBuildId,
+ compareVersions,
} from '../../../lib/cjs/browser-data/chrome.js';
describe('Chrome', () => {
it('should resolve download URLs', () => {
assert.strictEqual(
resolveDownloadUrl(BrowserPlatform.LINUX, '113.0.5672.0'),
- 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/113.0.5672.0/linux64/chrome-linux64.zip'
+ 'https://storage.googleapis.com/chrome-for-testing-public/113.0.5672.0/linux64/chrome-linux64.zip'
);
assert.strictEqual(
resolveDownloadUrl(BrowserPlatform.MAC, '113.0.5672.0'),
- 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/113.0.5672.0/mac-x64/chrome-mac-x64.zip'
+ 'https://storage.googleapis.com/chrome-for-testing-public/113.0.5672.0/mac-x64/chrome-mac-x64.zip'
);
assert.strictEqual(
resolveDownloadUrl(BrowserPlatform.MAC_ARM, '113.0.5672.0'),
- 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/113.0.5672.0/mac-arm64/chrome-mac-arm64.zip'
+ 'https://storage.googleapis.com/chrome-for-testing-public/113.0.5672.0/mac-arm64/chrome-mac-arm64.zip'
);
assert.strictEqual(
resolveDownloadUrl(BrowserPlatform.WIN32, '113.0.5672.0'),
- 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/113.0.5672.0/win32/chrome-win32.zip'
+ 'https://storage.googleapis.com/chrome-for-testing-public/113.0.5672.0/win32/chrome-win32.zip'
);
assert.strictEqual(
resolveDownloadUrl(BrowserPlatform.WIN64, '113.0.5672.0'),
- 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/113.0.5672.0/win64/chrome-win64.zip'
+ 'https://storage.googleapis.com/chrome-for-testing-public/113.0.5672.0/win64/chrome-win64.zip'
);
});
@@ -116,4 +117,10 @@ describe('Chrome', () => {
it('should resolve build prefix', async () => {
assert.strictEqual(await resolveBuildId('115.0.5790'), '115.0.5790.170');
});
+
+ it('should compare versions', async () => {
+ assert.ok(compareVersions('115.0.5790', '115.0.5789') >= 1);
+ assert.ok(compareVersions('115.0.5789', '115.0.5790') <= -1);
+ assert.ok(compareVersions('115.0.5790', '115.0.5790') === 0);
+ });
});
diff --git a/remote/test/puppeteer/packages/browsers/test/src/chrome/install.spec.ts b/remote/test/puppeteer/packages/browsers/test/src/chrome/install.spec.ts
index 8103ff3612..f669d1c57c 100644
--- a/remote/test/puppeteer/packages/browsers/test/src/chrome/install.spec.ts
+++ b/remote/test/puppeteer/packages/browsers/test/src/chrome/install.spec.ts
@@ -17,6 +17,7 @@ import {
Browser,
BrowserPlatform,
Cache,
+ computeExecutablePath,
} from '../../../lib/cjs/main.js';
import {getServerUrl, setupTestServer} from '../utils.js';
import {testChromeBuildId} from '../versions.js';
@@ -63,6 +64,42 @@ describe('Chrome install', () => {
);
});
+ it('can detect missing executables', async function () {
+ this.timeout(60000);
+ const expectedOutputPath = path.join(
+ tmpDir,
+ 'chrome',
+ `${BrowserPlatform.LINUX}-${testChromeBuildId}`
+ );
+ fs.mkdirSync(expectedOutputPath, {recursive: true});
+ assert.strictEqual(fs.existsSync(expectedOutputPath), true);
+ async function installThatThrows(): Promise<Error | undefined> {
+ try {
+ await install({
+ cacheDir: tmpDir,
+ browser: Browser.CHROME,
+ platform: BrowserPlatform.LINUX,
+ buildId: testChromeBuildId,
+ });
+ return undefined;
+ } catch (err) {
+ return err as Error;
+ }
+ }
+ assert.strictEqual(
+ (await installThatThrows())?.message,
+ `The browser folder (${expectedOutputPath}) exists but the executable (${computeExecutablePath(
+ {
+ cacheDir: tmpDir,
+ browser: Browser.CHROME,
+ platform: BrowserPlatform.LINUX,
+ buildId: testChromeBuildId,
+ }
+ )}) is missing`
+ );
+ assert.strictEqual(fs.existsSync(expectedOutputPath), true);
+ });
+
it('should download a buildId that is a zip archive', async function () {
this.timeout(60000);
const expectedOutputPath = path.join(
@@ -100,30 +137,21 @@ describe('Chrome install', () => {
);
});
- it('throws on invalid URL', async function () {
+ it('falls back to the chrome-for-testing dashboard URLs if URL is not available', async function () {
const expectedOutputPath = path.join(
tmpDir,
'chrome',
`${BrowserPlatform.LINUX}-${testChromeBuildId}`
);
assert.strictEqual(fs.existsSync(expectedOutputPath), false);
-
- async function installThatThrows(): Promise<unknown> {
- try {
- await install({
- cacheDir: tmpDir,
- browser: Browser.CHROME,
- platform: BrowserPlatform.LINUX,
- buildId: testChromeBuildId,
- baseUrl: 'https://127.0.0.1',
- });
- return undefined;
- } catch (err) {
- return err;
- }
- }
- assert.ok(await installThatThrows());
- assert.strictEqual(fs.existsSync(expectedOutputPath), false);
+ await install({
+ cacheDir: tmpDir,
+ browser: Browser.CHROME,
+ platform: BrowserPlatform.LINUX,
+ buildId: testChromeBuildId,
+ baseUrl: 'https://127.0.0.1',
+ });
+ assert.strictEqual(fs.existsSync(expectedOutputPath), true);
});
describe('with proxy', () => {
@@ -198,7 +226,7 @@ describe('Chrome install', () => {
true
);
assert.deepStrictEqual(proxiedRequestUrls, [
- getServerUrl() + '/113.0.5672.0/linux64/chrome-linux64.zip',
+ getServerUrl() + `/${testChromeBuildId}/linux64/chrome-linux64.zip`,
]);
assert.deepStrictEqual(proxiedRequestHosts, [
getServerUrl().replace('http://', ''),
@@ -223,7 +251,7 @@ describe('Chrome install', () => {
assert.strictEqual(browser.path, expectedOutputPath);
assert.ok(fs.existsSync(expectedOutputPath));
assert.deepStrictEqual(proxiedRequestUrls, [
- getServerUrl() + '/113.0.5672.0/linux64/chrome-linux64.zip',
+ getServerUrl() + `/${testChromeBuildId}/linux64/chrome-linux64.zip`,
]);
assert.deepStrictEqual(proxiedRequestHosts, [
getServerUrl().replace('http://', ''),