Skip to content

Run Scooby against Storybook stories #115

Open
@andrico1234

Description

It would be great to provide a link to a Storybook.

Scooby can then access the Storybook, iterate over all of the stories and store the HTML to then compare as it does normally.

Here's a flow for what this could look like

%% Flowchart
graph TD
A[Run CLI]-->B{Is path a URL?}
B-->|Yes|C{Is Storybook URL}
B-->|No|D[Continue current flow...]
C-->|Yes|E[Access Storybook's iframe.html]
C-->|No|F[Access URL]
E-->G[Get stories data*]
G-->H[Create a list of story URLs to visit**]
H-->I[Access the story URL]
I-->J[Get HTML for Story***]
J-->K[Save HTML to file]
F-->K
K-->D
Loading
    • We can get this via global STORYBOOK_STORY_STORE (or something similar). And then the getStoriesJSONData function

** - URL of the stories equal to the key of the story in the JSON object.

e.g.,

const data = getStoriesJSONData;

// result
{
  "components-button--large": { ... }
}

const url = new URL("iframe.html",  "https://linktostory.com")
url.searchParams.append("id", "components-button--large")
const fullUrl = url.href

*** - We'll need to figure out how to pull out only the markup that we need.

Unknowns

  • How will we handle styles?
  • How can we determine which Storybook markup we need, and which we can discard?

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions