Skip to content

Commit

Permalink
🏗 Add amp visual-diff support for Mac and Windows (#36885)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielrozenberg committed Nov 10, 2021
1 parent d13bbc1 commit f798dbe
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
18 changes: 16 additions & 2 deletions build-system/tasks/visual-diff/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,22 @@ const {log} = require('./log');
// 4. Open https://omahaproxy.appspot.com in a browser
// 5. Go to "Tools" -> "Version information"
// 6. Paste the full version (add ".0" at the end) in the "Version" field and click "Lookup"
// 7. Copy the value next to "Branch Base Position" and update the line below
const PUPPETEER_CHROMIUM_REVISION = '870763'; // 91.0.4472.0
// 7. Copy the value next to "Branch Base Position"
// 8. Clone the Puppeteer repository: `git clone https://github.com/puppeteer/puppeteer`
// 9. Run `npm ci` in the cloned directory
// 10. `node utils/check_availability.js ${branchBasePosition} ${branchBasePosition + 1000}`
// (e.g., `node utils/check_availability.js 870763 871763)
// 10. Find the first available value for each platform and update the value below:
const PUPPETEER_CHROMIUM_REVISION = // 91.0.4472.x
process.platform === 'linux'
? '870763'
: process.platform === 'darwin' // ('mac' in check_availability.js output)
? '870776'
: process.platform === 'win32' && process.arch === 'x32' // ('win32' in check_availability.js output)
? '870768'
: process.platform === 'win32' && process.arch === 'x64' // ('win64' in check_availability.js output)
? '870781'
: '';

const VIEWPORT_WIDTH = 1400;
const VIEWPORT_HEIGHT = 100000;
Expand Down
6 changes: 6 additions & 0 deletions build-system/tasks/visual-diff/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,12 @@ async function createEmptyBuild(browser) {
* @return {Promise<void>}
*/
async function visualDiff() {
if (!PUPPETEER_CHROMIUM_REVISION) {
throw new Error(
`${cyan('amp visual-diff')} is only available on Linux, Mac, and Windows`
);
}

const handlerProcess = createCtrlcHandler('visual-diff');
await ensureOrBuildAmpRuntimeInTestMode_();
const browserFetcher = await loadBrowserFetcher();
Expand Down

0 comments on commit f798dbe

Please sign in to comment.