storybookjs / storybook

Storybook is the industry standard workshop for building, documenting, and testing UI components in isolation
https://storybook.js.org
MIT License
83.95k stars 9.21k forks source link

Server/browser state for status API from JUnit report [yann, gert] #28688

Open yannbf opened 1 month ago

greptile-apps[bot] commented 1 month ago

Disclaimer This information might be inaccurate, due to it being generated automatically To implement server/browser state for status API from JUnit report:

  1. Define Server Parameters: Update the story JSON files to include the necessary server parameters for the status API.

    {
     "title": "Example/Status",
     "parameters": {
       "server": {
         "url": "https://your-server-url/api",
         "id": "status",
         "params": { "report": "junit" }
       }
     },
     "stories": [
       {
         "name": "StatusReport",
         "args": { "status": "pass" }
       }
     ]
    }
  2. Fetch Status Data: Implement the fetchStoryHtml function to fetch data from the status API.

    // .storybook/preview.js
    const fetchStoryHtml = async (url, id, params, context) => {
     const response = await fetch(`${url}/${id}?report=${params.report}`);
     const html = await response.text();
     return html;
    };
    
    export const parameters = {
     server: {
       url: 'https://your-server-url/api',
       fetchStoryHtml,
     },
    };
  3. Update Stories: Ensure stories are defined to reflect the status API data.

    {
     "title": "Example/Status",
     "stories": [
       {
         "name": "StatusReport",
         "args": { "status": "pass" }
       }
     ]
    }

References

/.github/DISCUSSION_TEMPLATE/help.yml /.github/DISCUSSION_TEMPLATE/ideas.yml /.github/comments/invalid-link.md /.github/DISCUSSION_TEMPLATE/rfc.yml /.github/comments /code/renderers/server/template/cli/header.stories.json /code/renderers/server/template/cli/button.stories.json /docs/_snippets/test-runner-with-index-json.md /docs/_snippets/custom-build-script-production.md /code/presets/server-webpack/src/lib/compiler/testfixtures/kitchen_sink.snapshot /.github/DISCUSSION_TEMPLATE /code/lib/cli/src/automigrate/fixes/new-frameworks.ts /test-storybooks/ember-cli/ember-output/storybook-docgen /code/frameworks/server-webpack5/README.md /code/core/src/core-server/utils/mockdata/errors/NoMeta.stories.ts /docs/get-started/why-storybook.mdx /.github/PULL_REQUEST_TEMPLATE.md /code/core/src/server-errors.ts /code/renderers/server/template/cli /docs/_snippets/test-runner-no-index-json.md /CONTRIBUTING.md /code/core/src/preview-errors.ts /test-storybooks/portable-stories-kitchen-sink/svelte/cypress/fixtures /docs/_snippets/checkbox-story-grouped.md /code/core/src/preview-api/modules/preview-web/PreviewWeb.integration.test.ts

#### About Greptile This response provides a starting point for your research, not a precise solution. Help us improve! Please leave a ๐Ÿ‘ if this is helpful and ๐Ÿ‘Ž if it is irrelevant. [Ask Greptile](https://app.greptile.com/chat/github/storybookjs/storybook/next) ยท [Edit Issue Bot Settings](https://app.greptile.com/apps/github)