From 755c36a7e4f5e06702f13b6ec39e81c619168339 Mon Sep 17 00:00:00 2001 From: Bartek Szopka Date: Wed, 4 Mar 2020 14:57:46 +0100 Subject: [PATCH] WIP: Legacy Percy paths (for testing) --- snapshots.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/snapshots.js b/snapshots.js index bae4e363e3..20f6565102 100644 --- a/snapshots.js +++ b/snapshots.js @@ -21,7 +21,14 @@ PercyScript.run(async (page, percySnapshot) => { await page.waitFor('body'); // create percy snapshot with path as a name - const path = new URL(url).pathname.replace(/\/?$/, '/'); + let path = new URL(url).pathname.replace(/\/?$/, '/'); + + if (path.indexOf('/docs/') === -1) { + path = '/site' + path; + } else { + path = path.replace('/docs', ''); + } + await percySnapshot(path, {widths: [375, 1280]}); } });