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

storybook docs #162

Merged
merged 2 commits into from
Oct 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions packages/storybook/docs/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
title: Storybook
slug: /storybook
---

# Argos Storybook SDK

Integrate visual testing with your Storybook seamlessly using Argos. This SDK allows you to capture and review visual changes in your Storybook components directly within your CI.

## Getting Started

To get started with Argos and Storybook, check out our [Storybook Quickstart Guide](/quickstart/storybook).

## Comparing Argos and Chromatic

While both Argos and Chromatic provide visual testing for Storybook, they take different approaches:

- **Argos** captures screenshots of your Storybook components **in your CI using Playwright**.
- **Chromatic** captures screenshots of your Storybook components **in the cloud**.

For a deeper comparison, see our [Argos vs Chromatic guide](https://argos-ci.com/compare/chromatic).

## API Overview

### argosScreenshot(page, context[, options])

- **`page`**: The [Playwright Page](https://playwright.dev/docs/api/class-page) instance.
- **`context`**: The test context provided by the Storybook test runner.
- **`options`**: Customizable options for `argosScreenshot`. Explore [available options](https://argos-ci.com/docs/playwright#argosscreenshotpage-name-options).
- **`options.fitToContent`**: Adjusts the screenshot to the content size (default: `true`).
- **`options.fitToContent.padding`**: Sets padding around the content in pixels (default: `16`).
- **`options.fitToContent.zoom`**: Specifies the zoom level (default: `2`).

## Additional Resources

- [Quickstart with Argos + Storybook](/quickstart/storybook)
- [Quickstart for Argos + Storybook Legacy (\<v8)](/quickstart/legacy-storybook)
- [Storybook + Playwright example](https://github.com/argos-ci/argos/tree/main/examples/storybook)
- [@argos-ci/storybook on GitHub](https://github.com/argos-ci/argos-javascript/tree/main/packages/storybook)
- [@argos-ci/storybook on npm](https://www.npmjs.com/package/@argos-ci/storybook)
6 changes: 1 addition & 5 deletions packages/storybook/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,7 @@ export async function argosScreenshot(

await DO_NOT_USE_setMetadataConfig({
sdk: { name: "@argos-ci/storybook", version },
playwrightLibraries: [
"@storybook/test-runner",
"playwright",
"playwright-core",
],
playwrightLibraries: ["@storybook/test-runner"],
});

await argosPlaywrightScreenshot(page, join(context.title, context.name), {
Expand Down