From eef863fce55734ce0f2c6bbe33cfa0f230b223f7 Mon Sep 17 00:00:00 2001 From: Robert DeLuca Date: Tue, 14 May 2019 13:57:34 -0500 Subject: [PATCH 1/2] Add failing test snapshot This will fail to snapshot with Percy (but the test suite will pass). We will need to make sure we review any diffs that arise. --- test/integration/agent-integration.test.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/integration/agent-integration.test.ts b/test/integration/agent-integration.test.ts index ea673b26..42919d44 100644 --- a/test/integration/agent-integration.test.ts +++ b/test/integration/agent-integration.test.ts @@ -26,6 +26,7 @@ describe('Integration test', () => { before(async () => { browser = await puppeteer.launch({ headless: true, + ignoreHTTPSErrors: true, args: [ '--disable-gpu', '--no-sandbox', @@ -56,6 +57,13 @@ describe('Integration test', () => { expect(domSnapshot).contains('Example Domain') }) + it('snapshots an invalid HTTPS site', async () => { + // maintained by the chrome team + await page.goto('https://self-signed.badssl.com/') + const domSnapshot = await snapshot(page, 'Invalid HTTPS') + expect(domSnapshot).contains('badssl.com') + }) + it('snapshots a complex website with responsive images', async () => { await page.goto('https://polaris.shopify.com/') const domSnapshot = await snapshot(page, 'Polaris snapshot', {widths: [300, 1200]}) From 73ad87e65c6dfe5fe6e6e9c5d6be370b1771e08b Mon Sep 17 00:00:00 2001 From: Robert DeLuca Date: Tue, 14 May 2019 14:07:54 -0500 Subject: [PATCH 2/2] Ignore HTTPS errors when doing asset discovery on snapshotservice This is so the asset discovery service doesn't fail to capture assets for snapshots that are done on invalid HTTPS sites. Without this the assets would be missing from the snapshots (as seen in the previous commits percy build). --- src/services/asset-discovery-service.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/services/asset-discovery-service.ts b/src/services/asset-discovery-service.ts index fdf08eda..07e260dc 100644 --- a/src/services/asset-discovery-service.ts +++ b/src/services/asset-discovery-service.ts @@ -35,7 +35,11 @@ export default class AssetDiscoveryService extends PercyClientService { async setup() { profile('-> assetDiscoveryService.puppeteer.launch') this.browser = await puppeteer.launch({ - args: ['--no-sandbox'], + args: [ + '--no-sandbox', + '--disable-web-security', + ], + ignoreHTTPSErrors: true, handleSIGINT : false, }) profile('-> assetDiscoveryService.puppeteer.launch')