Fixes #38714 - use common LabelIcon for popup help#1000
Fixes #38714 - use common LabelIcon for popup help#1000MariaAga merged 1 commit intotheforeman:masterfrom
Conversation
da65663 to
d936099
Compare
MariaAga
left a comment
There was a problem hiding this comment.
Works well, a few optional requests:
There was a problem hiding this comment.
Since tests are run from foreman core directly, using npm run test:plugins foreman_remote_execution its not necessary to mock foreman components any more
There was a problem hiding this comment.
fixed, there is always the need to mock the component though with jest, not sure i there is a better way yet..
There was a problem hiding this comment.
Why is there always a need to mock a component through jest?
There was a problem hiding this comment.
the module cannot be resolved, looking at the jest config maybe is missing some entry (is absent)
There was a problem hiding this comment.
When removing this file I only saw:
TestingLibraryElementError: Unable to find an element with the text: Identifier of the Host interface for Remote execution. This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible.
Which is expected since its a button with a tooltip, that only opens on click, and the test didnt click it.
you can amend the test to be:
it('should render label with help icon and popover instructions', async () => {
jest.useFakeTimers();
render(<RexInterface {...fixtures.renders} />);
await act(async () => {
await fireEvent.click(screen.getByRole('button'));
jest.advanceTimersByTime(1000);
});And then it passes
|
|
||
| const fixtures = { | ||
| renders: { isLoading: false, onChange: () => {} }, | ||
| renders: { |
There was a problem hiding this comment.
Since its a small component, do you mind also updating the test from snapshot test to React Testing library test? (instead of updating the snapshot)
caff037 to
0e53773
Compare
Refactors the popup help icon to use the shared LabelIcon component. The Enzyme tests for this component have been replaced with new tests using React Testing Library to align with our current testing standards Fixes ddc986e (Fixes #32218 - Host Registration - New form)
0e53773 to
5540fe1
Compare
The info button after Hosts -> Create Host -> Advanced -> "Remote Execution Interface" looks ok.