From acc5825f20eb4589dddf5c5b3d0699240f0cbd4d Mon Sep 17 00:00:00 2001 From: Yash Ladha Date: Sun, 3 Nov 2019 21:13:34 +0530 Subject: [PATCH 1/2] style(page): Refactored code to remove redundancy There were multiple if block in the logic that can be ironed out into a single statement, which is much more robust and readable. --- lib/Page.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/Page.js b/lib/Page.js index 2c5d4796dd8cc..57059cd8c53e8 100644 --- a/lib/Page.js +++ b/lib/Page.js @@ -892,10 +892,8 @@ class Page extends EventEmitter { screenshotType = options.type; } else if (options.path) { const mimeType = mime.getType(options.path); - if (mimeType === 'image/png') - screenshotType = 'png'; - else if (mimeType === 'image/jpeg') - screenshotType = 'jpeg'; + const mimeMatch = mimeType.match(/^image\/(png|jpeg)$/); + screenshotType = Array.isArray(mimeMatch) ? mimeMatch[1] || null : null; assert(screenshotType, 'Unsupported screenshot mime type: ' + mimeType); } From 4f84c245b118af882ae5fbcba35311aa2c01cefa Mon Sep 17 00:00:00 2001 From: Yash Ladha Date: Mon, 4 Nov 2019 12:08:01 +0530 Subject: [PATCH 2/2] test(accessibility): Picked the changes from #5116 for Flaky tests This patch includes the changes from #5116 --- test/accessibility.spec.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/accessibility.spec.js b/test/accessibility.spec.js index a284d493caf73..b60fc691fa266 100644 --- a/test/accessibility.spec.js +++ b/test/accessibility.spec.js @@ -42,6 +42,7 @@ module.exports.addTests = function({testRunner, expect, FFOX}) { `); + await page.focus('[placeholder="Empty input"]'); const golden = FFOX ? { role: 'document', name: 'Accessibility Test', @@ -81,6 +82,7 @@ module.exports.addTests = function({testRunner, expect, FFOX}) { }); it('should report uninteresting nodes', async function({page}) { await page.setContent(``); + await page.focus('textarea'); const golden = FFOX ? { role: 'entry', name: '',