From bb359e79e577f2581fb7b70a6b499e145b820bb8 Mon Sep 17 00:00:00 2001 From: nilshah98 Date: Wed, 18 Oct 2023 16:49:17 +0530 Subject: [PATCH 1/2] feat: add fetching env support for storybook v7+ --- src/utils.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/utils.js b/src/utils.js index 01bbc5f6..706cf88a 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 From 807a66d0bc5eede16433e76e25ca5bd4d93ce40a Mon Sep 17 00:00:00 2001 From: nilshah98 Date: Wed, 18 Oct 2023 16:58:13 +0530 Subject: [PATCH 2/2] chore: lint using --fix --- src/utils.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils.js b/src/utils.js index 706cf88a..6bb7b88d 100644 --- a/src/utils.js +++ b/src/utils.js @@ -151,8 +151,8 @@ export function evalStorybookEnvironmentInfo({ waitForXPath }) { .then(el => `storybook/${el.innerText.match(/-?\d*\.?\d+/g).join('')}`) .catch(() => { waitForXPath("//strong[starts-with(text(), 'You are on Storybook ')]", 5000) - .then(el => `storybook/${el.innerText.match(/-?\d*\.?\d+/g).join('')}`) - .catch(() => 'storybook/unknown') + .then(el => `storybook/${el.innerText.match(/-?\d*\.?\d+/g).join('')}`) + .catch(() => 'storybook/unknown'); }); }