Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs updates for Storybook Test #30035

Open
wants to merge 1 commit into
base: next
Choose a base branch
from
Open

Docs updates for Storybook Test #30035

wants to merge 1 commit into from

Conversation

kylegach
Copy link
Contributor

@kylegach kylegach commented Dec 12, 2024

Closes #29794

What I did

  • Focused tests
  • Coverage
  • A11y
  • Remove test.include & test.isolate from example Vitest configs
  • Streamline Test addon introduction
  • Address feedback from EAP

Checklist for Contributors

Testing

Manual testing

  1. Sync this branch with locally running docs

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli-storybook/src/sandbox-templates.ts

  • Make sure this PR contains one of the labels below:

    Available labels
    • bug: Internal changes that fixes incorrect behavior.
    • maintenance: User-facing maintenance tasks.
    • dependencies: Upgrading (sometimes downgrading) dependencies.
    • build: Internal-facing build tooling & test updates. Will not show up in release changelog.
    • cleanup: Minor cleanup style change. Will not show up in release changelog.
    • documentation: Documentation only changes. Will not show up in release changelog.
    • feature request: Introducing a new feature.
    • BREAKING CHANGE: Changes that break compatibility in some way with current major version.
    • other: Changes that don't fit in the above categories.

Greptile Summary

Based on the provided files and context, I'll create a concise summary of the documentation updates for the Storybook Test addon:

Major documentation update for Storybook Test addon (v8.5) introducing focused testing capabilities, enhanced coverage reporting, and improved accessibility testing integration.

  • Added documentation for focused test functionality at story/component/group levels in /docs/writing-tests/test-addon.mdx
  • Updated coverage reporting with new features including HTML reports at localhost:6006/coverage/index.html and watermark configurations
  • Integrated accessibility testing with Test addon, replacing parameters.a11y.manual with globals.a11y.manual
  • Removed deprecated test.include and test.isolate configurations from Vitest example configs
  • Added framework-specific plugin configurations for React, Vue, and Svelte in Vitest setup examples

This summary focuses on the most important changes while maintaining clarity and avoiding repetition. It highlights the key technical updates across the documentation files and configuration examples.

💡 (1/5) You can manually trigger the bot by mentioning @greptileai in a comment!

- Focused tests
- Coverage
- A11y
- Remove `test.include` & `test.isolate` from example Vitest configs
- Streamline Test addon introduction
- Address feedback from EAP
@kylegach kylegach added documentation ci:docs Run the CI jobs for documentation checks only. labels Dec 12, 2024
@kylegach kylegach self-assigned this Dec 12, 2024
Copy link
Contributor

Fails
🚫 PR title must be in the format of "Area: Summary", With both Area and Summary starting with a capital letter Good examples: - "Docs: Describe Canvas Doc Block" - "Svelte: Support Svelte v4" Bad examples: - "add new api docs" - "fix: Svelte 4 support" - "Vue: improve docs"

Generated by 🚫 dangerJS against 6fb17c9

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

7 file(s) reviewed, 7 comment(s)
Edit PR Review Bot Settings | Greptile

Comment on lines +38 to +39
- Storybook ≥ 8.5
- A Storybook framework that uses Vite (e.g. [`vue3-vite`](../get-started/frameworks/vue3-vite.mdx), [`react-vite`](../get-started/frameworks/react-vite.mdx), ['sveltekit`](../get-started/frameworks/sveltekit.mdx), etc.), or the [Storybook Next.js framework with Vite](../get-started/frameworks/nextjs.mdx#with-vite)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

syntax: Incorrect backtick in 'sveltekit` link syntax

Comment on lines +226 to +227
[TK: Screenshot of story sidebar item with open menu]
![Screenshot of story sidebar item with open menu](../_assets/writing-tests/addon-test-sidebar-item-menu.png)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Placeholder [TK] text should be removed before merging

Comment on lines +351 to +352
[TK - Test module edit mode with only coverage]
![Screenshot of test module, expanded, edit mode, coverage is checked](../_assets/writing-tests/addon-test-module-expanded-edit-coverage.png)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Placeholder [TK] text should be removed before merging

Comment on lines +361 to +362
[TK - Sidebar item menu with edit mode]
![Screenshot of story sidebar item with open menu, edit mode](../_assets/writing-tests/addon-test-sidebar-item-menu-edit.png)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Placeholder [TK] text should be removed before merging

// ...
coverage: {
// ...
provider: 'instanbul', // 'v8' is the default
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

syntax: 'instanbul' is misspelled, should be 'istanbul'

Comment on lines +158 to +159
[TK - Coverage result]
![Screenshot of test module, expanded, showing coverage result](../_assets/writing-tests/addon-test-coverage-result.png)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: This image is duplicated from line 20-21 and should be removed or replaced with a different screenshot

tags: ['a11ytest'],
};

export default preview;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: export default meta instead of preview here

Copy link

nx-cloud bot commented Dec 12, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 6fb17c9. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


✅ Successfully ran 1 target

Sent with 💌 from NxCloud.

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

7 file(s) reviewed, 3 comment(s)
Edit PR Review Bot Settings | Greptile

@@ -120,43 +120,69 @@ Customize the a11y ruleset at the story level by updating your story to include

## Test addon integration

The accessibility addon provides seamless integration with Storybook's [test addon](./test-addon.mdx), enabling you to run automated accessibility checks for all your tests in the background while you run component tests. If there are any violations, the test will fail, and you will see the results in the sidebar without any additional setup.
The accessibility addon provides seamless integration with the [Test addon](./test-addon.mdx), enabling you to run automated accessibility checks for all your tests in the background while you run component tests. If there are any violations, the test will fail, and you will see the results in the sidebar without any additional setup.

{/* TODO: add asset of the changed UI here */}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: TODO comment should be removed before merging

Comment on lines 229 to +231
After running your tests, you will now see status indicators on stories and components for their pass, fail, or error state. You can press on these indicators to see more details and jump straight to the failure in the Component tests addon panel. That panel provides an interactive debugger for your component test, allowing you to step through each simulated behavior or assertion.

{/* TODO: 👆 Revise this to not be limited to Component tests */}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: This paragraph references Component tests specifically but should be generalized since it applies to all test types

Comment on lines +335 to +341
## How it works

The Test addon works by using a Vitest plugin to transform your stories into [Vitest](https://vitest.dev) tests using [portable stories](../api/portable-stories/portable-stories-vitest.mdx). It also configures Vitest to run those tests in [browser mode](https://vitest.dev/guide/browser/), using Playwright's Chromium browser. Because it is built on top of Vitest, the addon requires a Vite-based Storybook framework.

Stories are tested in two ways: a smoke test to ensure it renders and, if a [play function](../writing-tests/component-testing#write-a-component-test) is defined, that function is run and any [assertions made](../writing-tests/component-testing.mdx#assert-tests-with-vitests-apis) within it are validated.

When you run tests in the [Storybook UI](#storybook-ui), the addon runs Vitest in the background and reports the results in the sidebar.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: This 'How it works' section duplicates information from the introduction. Consider consolidating to avoid repetition

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci:docs Run the CI jobs for documentation checks only. documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Document Component Testing changes in 8.5
1 participant