From 5a5762cd594f30dd01feb60fc9c0de2d755b1f17 Mon Sep 17 00:00:00 2001 From: Neel Shah Date: Wed, 18 Oct 2023 21:33:50 +0530 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20add=20fetching=20env=20support=20fo?= =?UTF-8?q?r=20storybook=20v7+=20(#827)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: add fetching env support for storybook v7+ * chore: lint using --fix --- src/utils.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/utils.js b/src/utils.js index 15a475c1..15d94682 100644 --- a/src/utils.js +++ b/src/utils.js @@ -149,7 +149,11 @@ export async function* withPage(percy, url, callback, retry) { export function evalStorybookEnvironmentInfo({ waitForXPath }) { return waitForXPath("//header[starts-with(text(), 'Storybook ')]", 5000) .then(el => `storybook/${el.innerText.match(/-?\d*\.?\d+/g).join('')}`) - .catch(() => 'storybook/unknown'); + .catch(() => { + waitForXPath("//strong[starts-with(text(), 'You are on Storybook ')]", 5000) + .then(el => `storybook/${el.innerText.match(/-?\d*\.?\d+/g).join('')}`) + .catch(() => 'storybook/unknown'); + }); } // Evaluate and return serialized Storybook stories to snapshot