Skip to content

Conversation

@oatkiller
Copy link
Contributor

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

);
});
it('should render 1 resolver node', () => {
expect(reactRenderResult.queryAllByTestId('resolverNode')).toMatchInlineSnapshot(`
Copy link
Contributor

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

Copy link
Contributor Author

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

Copy link
Contributor

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(
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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(
Copy link
Contributor

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);
Copy link
Contributor

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.

Copy link
Contributor Author

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}`}
Copy link
Contributor

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 = (
Copy link
Contributor

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?

Copy link
Contributor Author

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>
Copy link
Contributor

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".

Copy link
Contributor

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.

@kibanamachine
Copy link
Contributor

kibanamachine commented Jul 22, 2020

💔 Build Failed

Failed CI Steps

Build metrics

async chunks size

id value diff baseline
securitySolution 7.3MB +3.2KB 7.3MB

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@oatkiller oatkiller closed this Aug 3, 2020
@oatkiller oatkiller deleted the screenshot-test branch March 31, 2022 11:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants