From a09d21f00ab648b3e54d9b7e09194ae0b421b7c0 Mon Sep 17 00:00:00 2001 From: Bogdan Nechyporenko Date: Tue, 3 Oct 2023 16:01:36 +0200 Subject: [PATCH] Added a visibility log button to a panel Signed-off-by: Bogdan Nechyporenko --- .../src/next/OngoingTask/OngoingTask.test.tsx | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/plugins/scaffolder/src/next/OngoingTask/OngoingTask.test.tsx b/plugins/scaffolder/src/next/OngoingTask/OngoingTask.test.tsx index 16d9740c15..9d3f29fe7b 100644 --- a/plugins/scaffolder/src/next/OngoingTask/OngoingTask.test.tsx +++ b/plugins/scaffolder/src/next/OngoingTask/OngoingTask.test.tsx @@ -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( + + + , + { mountedRoutes: { '/': rootRouteRef } }, + ); + await expect(rendered.findByText('Show Logs')).resolves.toBeInTheDocument(); + }); + + it('should toggle logs visibility', async () => { + const rendered = await renderInTestApp( + + + , + { mountedRoutes: { '/': rootRouteRef } }, + ); + await act(async () => { + const element = await rendered.findByText('Show Logs'); + fireEvent.click(element); + }); + + await expect(rendered.findByText('Hide Logs')).resolves.toBeInTheDocument(); + }); });