-
Notifications
You must be signed in to change notification settings - Fork 91
Description
Running storycap
with a URL that contains a query parameter fails to load, for example:
npx storycap http://localhost:6006\?theme\=dark
info Wait for connecting storybook server http://localhost:6006?theme=dark.
info Executable Chromium path: <redacted>
error waiting for function failed: timeout 60000ms exceeded
It appears to be due to storycrawler
assuming the URL doesn't contain query string parameters, i.e.:
Where it attempts to visit this.connection.url + '/iframe.html?selectedKind=story-crawler-kind&selectedStory=story-crawler-story'
, which in the above example would resolve to 'http://localhost:6006?theme=dark/iframe.html?selectedKind=story-crawler-kind&selectedStory=story-crawler-story'
Expected outcome
Query parameters are present when storycap
loads each story.
Why?
It's possible to initialise Storybook globals using query string parameters. This is useful for capturing multiple themes without needing to re-build Storybook, for example.
How?
Split this.connection.url
in to hostname
and search
. Use hostname
as the base URL (this.connection.url
) and merge search
(query string params) in to the ones that storycrawler
adds.