Added a visibility log button to a panel

Signed-off-by: Bogdan Nechyporenko <bnechyporenko@bol.com>
This commit is contained in:
Bogdan Nechyporenko
2023-10-03 16:01:36 +02:00
parent 230f3bf8a6
commit a09d21f00a
@@ -112,4 +112,29 @@ describe('OngoingTask', () => {
expect(getByTestId('cancel-button')).toHaveClass('Mui-disabled');
});
});
it('should initially do not display logs', async () => {
const rendered = await renderInTestApp(
<TestApiProvider apis={[[scaffolderApiRef, mockScaffolderApi]]}>
<OngoingTask />
</TestApiProvider>,
{ mountedRoutes: { '/': rootRouteRef } },
);
await expect(rendered.findByText('Show Logs')).resolves.toBeInTheDocument();
});
it('should toggle logs visibility', async () => {
const rendered = await renderInTestApp(
<TestApiProvider apis={[[scaffolderApiRef, mockScaffolderApi]]}>
<OngoingTask />
</TestApiProvider>,
{ mountedRoutes: { '/': rootRouteRef } },
);
await act(async () => {
const element = await rendered.findByText('Show Logs');
fireEvent.click(element);
});
await expect(rendered.findByText('Hide Logs')).resolves.toBeInTheDocument();
});
});