-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[Resolver] Snapshot and screenshot tests #72791
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
Conversation
| ); | ||
| }); | ||
| it('should render 1 resolver node', () => { | ||
| expect(reactRenderResult.queryAllByTestId('resolverNode')).toMatchInlineSnapshot(` |
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.
Nice, but this is gonna fail every time we visually change anything even though nothing functionally may have actually changed in the resolver
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.
no more functionality or visual changes allowed
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.
Cool, looks like my work is done for the day. 👍
| const coreStart: CoreStart = coreMock.createStart(); | ||
|
|
||
| const history = createMemoryHistory(); | ||
| reactRenderResult = render( |
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.
Wonder if we should put all our resolver tests in this file, or break them apart. I can see this file becoming massive as functionality of resolver expands... Thoughts?
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 is the only test.
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.
no more tests allowed
| const coreStart: CoreStart = coreMock.createStart(); | ||
|
|
||
| const history = createMemoryHistory(); | ||
| reactRenderResult = render( |
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.
ℹ️ wow cool
| | null; | ||
| } = React.createRef(); | ||
| const { colorMap, cubeAssetsForNode } = useResolverTheme(); | ||
| const { colorMap, cubeAssetsForNode } = useResolverTheme(resolverComponentInstanceID); |
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.
❔ I may have missed this, but why are we passing in a component instance ID to the theming hook? You won't have different themes for different Resolvers (AFAIK), right? But this makes it look like you could.
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.
just to have stable (non-random) html IDs for symbols
| <g> | ||
| <use | ||
| xlinkHref={`#${SymbolIds.processCubeActiveBacking}`} | ||
| xlinkHref={`#${symbolIDs(resolverComponentInstanceID).processCubeActiveBacking}`} |
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.
❔ Something isn't right here, this more or less defeats the purpose of using <symbol>s
| * A hook to bring Resolver theming information into components. | ||
| */ | ||
| export const useResolverTheme = (): { | ||
| export const useResolverTheme = ( |
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.
❔ re my comment in chat, we could memoize this right?
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.
ya
| const resolverComponentInstanceID = useSelector(selectors.resolverComponentInstanceID); | ||
| return ( | ||
| <svg className={className}> | ||
| <defs> |
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 reflects "1 defs for each resolver". I think we should try instead for "1 defs for all Resolvers".
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.
but this is more correct than what we're doing now (1 def per resolver with duplicate IDs) so we should merge this 1st.
💔 Build Failed
Failed CI StepsBuild metricsasync chunks size
History
To update your PR or re-run it, just comment with: |
Summary
This can 'render' resolver via
@testing-library/react. next step is to render it in the functional test runner and take a screenshot.Checklist
Delete any items that are not applicable to this PR.
For maintainers