-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Addon Test: Add interactions functionality #29232
Conversation
☁️ Nx Cloud ReportCI is running/has finished running commands for commit 3c49ac3. 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. |
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.
30 file(s) reviewed, 33 comment(s)
Edit PR Review Bot Settings
([end]: any) => setScrollTarget(end.isIntersecting ? undefined : end.target), | ||
{ root: global.document.querySelector('#panel-tab-content') } |
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.
style: Type assertion to 'any' here may be unsafe. Consider using a more specific type or adding a type guard.
|
||
const storyFilePath = useParameter('fileName', ''); | ||
const [fileName] = storyFilePath.toString().split('/').slice(-1); | ||
const scrollToTarget = () => scrollTarget?.scrollIntoView({ behavior: 'smooth', block: 'end' }); |
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.
style: Consider memoizing this function to prevent unnecessary re-creation on each render.
const hasException = | ||
!!caughtException || | ||
!!unhandledErrors || | ||
interactions.some((v) => v.status === CallStates.ERROR); |
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.
style: This logic for determining hasException is duplicated in the state. Consider refactoring to use a single source of truth.
Interaction tests allow you to verify the functional aspects of UIs. Write a play function | ||
for your story and you'll see it run here. |
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.
style: consider wrapping long lines for better readability
title: 'Interaction', | ||
component: Interaction, | ||
args: { | ||
callsById: new Map(getCalls(CallStates.DONE).map((call) => [call.id, call])), |
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.
style: Consider using a more descriptive variable name instead of 'call' for clarity
); | ||
} | ||
|
||
addons.register(ADDON_ID, (api) => { |
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.
style: The 'api' parameter is unused. Consider removing it if not needed
ancestors: ['story--id [6] waitFor'], | ||
path: ['expect'], | ||
method: 'stringMatching', | ||
args: [{ __regexp__: { flags: 'gi', source: '([A-Z])w+' } }], |
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.
syntax: The regular expression '([A-Z])w+' might be incorrect. Did you mean '([A-Z])\w+'?
/** Interaction Testing Theme PLACEHOLDER until SB is updated <3 */ | ||
interface Colors { | ||
pure?: { | ||
gray?: any; |
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.
style: Consider using a more specific type than 'any' for better type safety
colors, | ||
}; | ||
|
||
export default theme; |
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.
style: Remove this empty line at the end of the file
export function isTestAssertionError(error: unknown) { | ||
return isChaiError(error) || isJestError(error); | ||
} |
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.
style: Consider adding a more specific return type (e.g., boolean
) for clarity
44872e5
to
8444fd3
Compare
8444fd3
to
e8fd5cf
Compare
e8fd5cf
to
ff5ee95
Compare
4e63442
to
9ca737d
Compare
Closes #29215
What I did
This PR brings the addon-interactions panel and functionality into addon test. It's mostly a copy-paste, including e2e tests and unit tests!
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/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
This PR introduces the interactions functionality from addon-interactions into addon-test, focusing on integrating the Interactions panel and related components.
src/Panel.tsx
to handle rendering and state management of interactionssrc/components/InteractionsPanel.tsx
for displaying test results and exceptionssrc/manager.tsx
to include the new Component Tests panel with dynamic title showing interaction count and exceptionssrc/utils.ts
for error handling and ANSI to HTML conversionstories/basics.stories.ts
demonstrating various interaction testing scenarios