-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Test: E2E tests for new Component Testing features #29826
Conversation
…e-tests-for-testing-improvements
…ybookjs/storybook into 29745-e2e-tests-for-testing-improvements
…ts-for-testing-improvements
…:storybookjs/storybook into 29745-e2e-tests-for-testing-improvements
test-storybooks/portable-stories-kitchen-sink/react/package.json
Outdated
Show resolved
Hide resolved
☁️ Nx Cloud ReportCI is running/has finished running commands for commit a19b0f5. 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 targetSent with 💌 from NxCloud. |
…ts-for-testing-improvements
…ybookjs/storybook into 29745-e2e-tests-for-testing-improvements
…:storybookjs/storybook into 29745-e2e-tests-for-testing-improvements
await expect(page.locator('#storybook-explorer-menu').getByRole('status', { name: 'Test status: error' })).toHaveCount(2); | ||
}); | ||
|
||
test("should run focused tests without coverage, even when enabled", async ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this test is slightly excessive.
It:
- enables coverage
- do a focus test
- assert that coverage is not collected
- do a full test
- assert that coverage is collected
I'm not sure if we should keep it or not, you could also argue that it's largely covered by the unit test here:
WDYT @yannbf ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's too taxing or flake-prone, I'd say remove it. Seems to be well tested elsewhere, but this E2E test does involve more elements in a real scenario. However I think these elements are tested in the other tests above
…ybookjs/storybook into 29745-e2e-tests-for-testing-improvements
…ybookjs/storybook into 29745-e2e-tests-for-testing-improvements
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
12 file(s) reviewed, 10 comment(s)
Edit PR Review Bot Settings | Greptile
test-storybooks/portable-stories-kitchen-sink/react/e2e-tests/component-testing.spec.ts
Outdated
Show resolved
Hide resolved
test-storybooks/portable-stories-kitchen-sink/react/e2e-tests/component-testing.spec.ts
Show resolved
Hide resolved
test-storybooks/portable-stories-kitchen-sink/react/package.json
Outdated
Show resolved
Hide resolved
test-storybooks/portable-stories-kitchen-sink/react/stories/AddonTest.stories.tsx
Show resolved
Hide resolved
test-storybooks/portable-stories-kitchen-sink/react/stories/AddonTest.stories.tsx
Show resolved
Hide resolved
test-storybooks/portable-stories-kitchen-sink/react/stories/AddonTest.stories.tsx
Show resolved
Hide resolved
test-storybooks/portable-stories-kitchen-sink/react/stories/OtherComponent.stories.tsx
Outdated
Show resolved
Hide resolved
test-storybooks/portable-stories-kitchen-sink/react/stories/OtherComponent.stories.tsx
Show resolved
Hide resolved
…e-tests-for-testing-improvements
…storybook into 29745-e2e-tests-for-testing-improvements
…e-tests-for-testing-improvements
Package BenchmarksCommit: No significant changes detected, all good. 👏 |
@@ -12,8 +12,9 @@ | |||
"playwright-ct": "playwright test -c playwright-ct.config.ts", | |||
"playwright-e2e": "playwright test -c playwright-e2e.config.ts", | |||
"preview": "vite preview", | |||
"storybook": "storybook dev -p 6006", | |||
"vitest": "echo 'not running'" | |||
"storybook": "NODE_OPTIONS=\"--preserve-symlinks --preserve-symlinks-main\" storybook dev -p 6006", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this speeds up the story loading of the kitchen sink, at least on my machine.
Co-authored-by: Norbert de Langen <ndelangen@me.com>
.circleci/config.yml
Outdated
@@ -757,6 +757,10 @@ jobs: | |||
name: Run E2E tests | |||
command: yarn playwright-e2e | |||
working_directory: test-storybooks/portable-stories-kitchen-sink/react | |||
- run: | |||
name: Run Vitest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need this? If you want the vitest script to be tested as part of CI, just move the contents of vitest-skip-fail-on-purpose
and move it to vitest
, which will be automatically run as part of this CI step:
https://github.com/storybookjs/storybook/blob/29745-e2e-tests-for-testing-improvements/.circleci/config.yml#L794
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah yeah that's much better, it's to test these scenarios: https://github.com/storybookjs/storybook/pull/29826/files#diff-0550ef2a360c5242f25677cd964d3afce1c0412497a76eded7d03c0838941611R68-R92
Another alternative would be to move those stories into the UI Storybook instead, no strong opinion.
Telescopes on to #29808
Closes #29745
What I did
preview-head.html
functionality. They don't need to be E2E tested, they can be tested by just running Vitest. So I added that to CI too, skipping the tests that fail on purpose.Checklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Manual testing
This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!
Documentation
MIGRATION.MD
Checklist for Maintainers
When this PR is ready for testing, make sure to add
ci:normal
,ci:merged
orci:daily
GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found incode/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.🦋 Canary release
This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the
@storybookjs/core
team here.core team members can create a canary release here or locally with
gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=<PR_NUMBER>
Greptile Summary
Here's my concise summary of the PR changes:
Added end-to-end tests and infrastructure for Storybook's component testing features, focusing on Vitest integration and coverage reporting.
portable-stories-kitchen-sink/react/e2e-tests/component-testing.spec.ts
for focused tests and coverage reportingcode/addons/test/src/node/vitest-manager.ts
to handle coverage options and test filteringcode/addons/test/src/node/coverage-reporter.ts
with watermark supportcode/addons/test/src/components/TestProviderRender.tsx
portable-stories-kitchen-sink/react/
for validating component testing features