瀏覽代碼

Puppeteer E2E test: Download latest stable-channel Chromium (#25395)

* Puppeteer: Download latest dev-channel Chromium

* Workaround

* `dev` -> `stable`

* Log browser info
Levi Pesin 2 年之前
父節點
當前提交
311f46493b
共有 1 個文件被更改,包括 21 次插入8 次删除
  1. 21 8
      test/e2e/puppeteer.js

+ 21 - 8
test/e2e/puppeteer.js

@@ -46,13 +46,16 @@ const exceptionList = [
 
 /* CONFIG VARIABLES END */
 
-const LAST_REVISION_URLS = {
-	linux: 'https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64/LAST_CHANGE',
-	mac: 'https://storage.googleapis.com/chromium-browser-snapshots/Mac/LAST_CHANGE',
-	mac_arm: 'https://storage.googleapis.com/chromium-browser-snapshots/Mac_Arm/LAST_CHANGE',
-	win32: 'https://storage.googleapis.com/chromium-browser-snapshots/Win/LAST_CHANGE',
-	win64: 'https://storage.googleapis.com/chromium-browser-snapshots/Win_x64/LAST_CHANGE'
+const PLATFORMS = {
+	linux: 'linux',
+	mac: 'mac',
+	mac_arm: 'mac_am64',
+	win32: 'win',
+	win64: 'win64'
 };
+const OMAHA_PROXY = 'https://omahaproxy.appspot.com/all.json';
+
+const chromiumChannel = 'stable'; // stable -> beta -> dev -> canary (Mac and Windows) -> canary_asan (Windows)
 
 const port = 1234;
 const pixelThreshold = 0.1; // threshold error in one pixel
@@ -204,8 +207,17 @@ async function downloadLatestChromium() {
 
 	const browserFetcher = new BrowserFetcher( { path: 'test/e2e/chromium' } );
 
-	const lastRevisionURL = LAST_REVISION_URLS[ browserFetcher.platform() ];
-	const revision = await ( await fetch( lastRevisionURL ) ).text();
+	const os = PLATFORMS[ browserFetcher.platform() ];
+
+	const revisions = await ( await fetch( OMAHA_PROXY ) ).json();
+	const omahaRevisionInfo = revisions.find( revs => revs.os === os ).versions.find( version => version.channel === chromiumChannel );
+
+	let revision = omahaRevisionInfo.branch_base_position;
+	while ( ! ( await browserFetcher.canDownload( revision ) ) ) {
+
+		revision = String( revision - 1 );
+
+	}
 
 	let revisionInfo = browserFetcher.revisionInfo( revision );
 	if ( revisionInfo.local === true ) {
@@ -219,6 +231,7 @@ async function downloadLatestChromium() {
 		console.log( 'Downloaded.' );
 
 	}
+	console.log( `Using Chromium ${ omahaRevisionInfo.current_version } (revision ${ revision }, ${ revisionInfo.url }), ${ chromiumChannel } channel on ${ os }` );
 	return revisionInfo;
 
 }