From 32293a4f91306d41630071a07cd3f888ed2ecd9a Mon Sep 17 00:00:00 2001 From: Saravana Date: Mon, 7 Aug 2023 22:32:00 +0530 Subject: [PATCH] Snapshots enhancements --- .../DataTable/tests/DataTable.test.tsx | 12 +- .../__snapshots__/DataTable.test.tsx.snap | 565 +++++++++++----- .../EndpointLink/tests/EndpointLink.test.tsx | 16 +- .../__snapshots__/EndpointLink.test.tsx.snap | 292 +++----- .../FormFooter/tests/FormFooter.test.tsx | 10 +- .../__snapshots__/FormFooter.test.tsx.snap | 154 ++--- .../tests/FormNotification.test.tsx | 8 +- .../FormNotification.test.tsx.snap | 527 ++++++++------ .../FormRenderer/tests/FormRenderer.test.tsx | 76 +-- .../__snapshots__/FormRenderer.test.tsx.snap | 97 ++- .../tests/ItemDescriptor.test.tsx | 8 +- .../ItemDescriptor.test.tsx.snap | 140 +--- .../tests/KogitoEmptyState.test.tsx | 18 +- .../KogitoEmptyState.test.tsx.snap | 348 ++++------ .../tests/KogitoSpinner.test.tsx | 4 +- .../__snapshots__/KogitoSpinner.test.tsx.snap | 93 ++- .../LoadMore/tests/LoadMore.test.tsx | 6 +- .../__snapshots__/LoadMore.test.tsx.snap | 142 ++-- .../ServerErrors/tests/ServerErrors.test.tsx | 12 +- .../__snapshots__/ServerErrors.test.tsx.snap | 345 +++++----- .../packages/consoles-common/jest.config.js | 7 +- .../tests/AboutModalBox.test.tsx | 4 +- .../__snapshots__/AboutModalBox.test.tsx.snap | 55 +- .../PageLayout/tests/PageLayout.test.tsx | 12 +- .../__snapshots__/PageLayout.test.tsx.snap | 393 ++++++----- .../tests/PageSectionHeader.test.tsx | 4 +- .../PageSectionHeader.test.tsx.snap | 121 ++-- .../layout/PageTitle/tests/PageTitle.test.tsx | 10 +- .../__snapshots__/PageTitle.test.tsx.snap | 157 ++--- .../PageToolbar/tests/PageToolbar.test.tsx | 101 ++- .../__snapshots__/PageToolbar.test.tsx.snap | 640 +++++++++++------- .../tests/KeycloakUnavailablePage.test.tsx | 4 +- .../KeycloakUnavailablePage.test.tsx.snap | 123 ++-- .../pages/NoData/tests/NoData.test.tsx | 12 +- .../tests/__snapshots__/NoData.test.tsx.snap | 330 ++++----- .../PageNotFound/tests/PageNotFound.test.tsx | 12 +- .../__snapshots__/PageNotFound.test.tsx.snap | 330 ++++----- .../tests/ServerUnavailablePage.test.tsx | 8 +- .../ServerUnavailablePage.test.tsx.snap | 234 ++++--- 39 files changed, 2903 insertions(+), 2527 deletions(-) diff --git a/ui-packages/packages/components-common/src/components/DataTable/tests/DataTable.test.tsx b/ui-packages/packages/components-common/src/components/DataTable/tests/DataTable.test.tsx index ca25ae2c87..70c42f52b9 100644 --- a/ui-packages/packages/components-common/src/components/DataTable/tests/DataTable.test.tsx +++ b/ui-packages/packages/components-common/src/components/DataTable/tests/DataTable.test.tsx @@ -224,12 +224,12 @@ describe('DataTable component tests', () => { ErrorComponent: undefined }; - render( + const { container } = render( ); - expect(screen).toMatchSnapshot(); + expect(container).toMatchSnapshot(); }); it('Should render ErrorComponent', async () => { @@ -244,13 +244,13 @@ describe('DataTable component tests', () => { ErrorComponent: undefined }; - render( + const { container } = render( ); - expect(screen).toMatchSnapshot(); + expect(container).toMatchSnapshot(); }); it('Should render LoadingComponent', async () => { @@ -265,13 +265,13 @@ describe('DataTable component tests', () => { ErrorComponent: undefined }; - render( + const { container } = render( ); - expect(screen).toMatchSnapshot(); + expect(container).toMatchSnapshot(); }); it('check sorting functionality', async () => { diff --git a/ui-packages/packages/components-common/src/components/DataTable/tests/__snapshots__/DataTable.test.tsx.snap b/ui-packages/packages/components-common/src/components/DataTable/tests/__snapshots__/DataTable.test.tsx.snap index c2aae901c5..bdae364c8e 100644 --- a/ui-packages/packages/components-common/src/components/DataTable/tests/__snapshots__/DataTable.test.tsx.snap +++ b/ui-packages/packages/components-common/src/components/DataTable/tests/__snapshots__/DataTable.test.tsx.snap @@ -1,166 +1,419 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`DataTable component tests Should render DataTable correctly 1`] = ` -Object { - "debug": [Function], - "findAllByAltText": [Function], - "findAllByDisplayValue": [Function], - "findAllByLabelText": [Function], - "findAllByPlaceholderText": [Function], - "findAllByRole": [Function], - "findAllByTestId": [Function], - "findAllByText": [Function], - "findAllByTitle": [Function], - "findByAltText": [Function], - "findByDisplayValue": [Function], - "findByLabelText": [Function], - "findByPlaceholderText": [Function], - "findByRole": [Function], - "findByTestId": [Function], - "findByText": [Function], - "findByTitle": [Function], - "getAllByAltText": [Function], - "getAllByDisplayValue": [Function], - "getAllByLabelText": [Function], - "getAllByPlaceholderText": [Function], - "getAllByRole": [Function], - "getAllByTestId": [Function], - "getAllByText": [Function], - "getAllByTitle": [Function], - "getByAltText": [Function], - "getByDisplayValue": [Function], - "getByLabelText": [Function], - "getByPlaceholderText": [Function], - "getByRole": [Function], - "getByTestId": [Function], - "getByText": [Function], - "getByTitle": [Function], - "logTestingPlaygroundURL": [Function], - "queryAllByAltText": [Function], - "queryAllByDisplayValue": [Function], - "queryAllByLabelText": [Function], - "queryAllByPlaceholderText": [Function], - "queryAllByRole": [Function], - "queryAllByTestId": [Function], - "queryAllByText": [Function], - "queryAllByTitle": [Function], - "queryByAltText": [Function], - "queryByDisplayValue": [Function], - "queryByLabelText": [Function], - "queryByPlaceholderText": [Function], - "queryByRole": [Function], - "queryByTestId": [Function], - "queryByText": [Function], - "queryByTitle": [Function], -} +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ ProcessId + + + + Priority + + ProcessInstanceId + + +
+ travels + + VisaApplication + + 1 + + 9ae7ce3b-d49c-4f35-b843-8ac3d22fa427 + + + + Ready + + +
+ travels + + ConfirmTravel + + 1 + + 9ae407dd-cdfa-4722-8a49-0a6d2e14550d + + + + Ready + + +
+
`; exports[`DataTable component tests Should render ErrorComponent 1`] = ` -Object { - "debug": [Function], - "findAllByAltText": [Function], - "findAllByDisplayValue": [Function], - "findAllByLabelText": [Function], - "findAllByPlaceholderText": [Function], - "findAllByRole": [Function], - "findAllByTestId": [Function], - "findAllByText": [Function], - "findAllByTitle": [Function], - "findByAltText": [Function], - "findByDisplayValue": [Function], - "findByLabelText": [Function], - "findByPlaceholderText": [Function], - "findByRole": [Function], - "findByTestId": [Function], - "findByText": [Function], - "findByTitle": [Function], - "getAllByAltText": [Function], - "getAllByDisplayValue": [Function], - "getAllByLabelText": [Function], - "getAllByPlaceholderText": [Function], - "getAllByRole": [Function], - "getAllByTestId": [Function], - "getAllByText": [Function], - "getAllByTitle": [Function], - "getByAltText": [Function], - "getByDisplayValue": [Function], - "getByLabelText": [Function], - "getByPlaceholderText": [Function], - "getByRole": [Function], - "getByTestId": [Function], - "getByText": [Function], - "getByTitle": [Function], - "logTestingPlaygroundURL": [Function], - "queryAllByAltText": [Function], - "queryAllByDisplayValue": [Function], - "queryAllByLabelText": [Function], - "queryAllByPlaceholderText": [Function], - "queryAllByRole": [Function], - "queryAllByTestId": [Function], - "queryAllByText": [Function], - "queryAllByTitle": [Function], - "queryByAltText": [Function], - "queryByDisplayValue": [Function], - "queryByLabelText": [Function], - "queryByPlaceholderText": [Function], - "queryByRole": [Function], - "queryByTestId": [Function], - "queryByText": [Function], - "queryByTitle": [Function], -} +
+
+
+
+
+ +
+ Oops... error while loading +
+
+ Try using the refresh action to reload +
+ +
+
+
+
+
`; exports[`DataTable component tests Should render LoadingComponent 1`] = ` -Object { - "debug": [Function], - "findAllByAltText": [Function], - "findAllByDisplayValue": [Function], - "findAllByLabelText": [Function], - "findAllByPlaceholderText": [Function], - "findAllByRole": [Function], - "findAllByTestId": [Function], - "findAllByText": [Function], - "findAllByTitle": [Function], - "findByAltText": [Function], - "findByDisplayValue": [Function], - "findByLabelText": [Function], - "findByPlaceholderText": [Function], - "findByRole": [Function], - "findByTestId": [Function], - "findByText": [Function], - "findByTitle": [Function], - "getAllByAltText": [Function], - "getAllByDisplayValue": [Function], - "getAllByLabelText": [Function], - "getAllByPlaceholderText": [Function], - "getAllByRole": [Function], - "getAllByTestId": [Function], - "getAllByText": [Function], - "getAllByTitle": [Function], - "getByAltText": [Function], - "getByDisplayValue": [Function], - "getByLabelText": [Function], - "getByPlaceholderText": [Function], - "getByRole": [Function], - "getByTestId": [Function], - "getByText": [Function], - "getByTitle": [Function], - "logTestingPlaygroundURL": [Function], - "queryAllByAltText": [Function], - "queryAllByDisplayValue": [Function], - "queryAllByLabelText": [Function], - "queryAllByPlaceholderText": [Function], - "queryAllByRole": [Function], - "queryAllByTestId": [Function], - "queryAllByText": [Function], - "queryAllByTitle": [Function], - "queryByAltText": [Function], - "queryByDisplayValue": [Function], - "queryByLabelText": [Function], - "queryByPlaceholderText": [Function], - "queryByRole": [Function], - "queryByTestId": [Function], - "queryByText": [Function], - "queryByTitle": [Function], -} +
+ + + + + + + + + + + + + + + +
+ ProcessId + + Name + + Priority + + ProcessInstanceId + + State +
+
+
+
+
+ + + + + +
+

+ Loading ... +

+
+
+
+
+
`; diff --git a/ui-packages/packages/components-common/src/components/EndpointLink/tests/EndpointLink.test.tsx b/ui-packages/packages/components-common/src/components/EndpointLink/tests/EndpointLink.test.tsx index c03ad77e02..0a7bafde9a 100644 --- a/ui-packages/packages/components-common/src/components/EndpointLink/tests/EndpointLink.test.tsx +++ b/ui-packages/packages/components-common/src/components/EndpointLink/tests/EndpointLink.test.tsx @@ -43,19 +43,19 @@ const props4 = { }; describe('EndpointLink component tests', () => { it('snapshot testing for link shown', () => { - render(); - expect(screen).toMatchSnapshot(); + const { container } = render(); + expect(container).toMatchSnapshot(); }); it('snapshot testing for link hidden', () => { - render(); - expect(screen).toMatchSnapshot(); + const { container } = render(); + expect(container).toMatchSnapshot(); }); it('snapshot testing for link hidden with custom link label', () => { - render(); - expect(screen).toMatchSnapshot(); + const { container } = render(); + expect(container).toMatchSnapshot(); }); it('snapshot testing no service URL and link hidden', () => { - render(); - expect(screen).toMatchSnapshot(); + const { container } = render(); + expect(container).toMatchSnapshot(); }); }); diff --git a/ui-packages/packages/components-common/src/components/EndpointLink/tests/__snapshots__/EndpointLink.test.tsx.snap b/ui-packages/packages/components-common/src/components/EndpointLink/tests/__snapshots__/EndpointLink.test.tsx.snap index ea468367ee..b92e3b81a8 100644 --- a/ui-packages/packages/components-common/src/components/EndpointLink/tests/__snapshots__/EndpointLink.test.tsx.snap +++ b/ui-packages/packages/components-common/src/components/EndpointLink/tests/__snapshots__/EndpointLink.test.tsx.snap @@ -1,221 +1,93 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`EndpointLink component tests snapshot testing for link hidden 1`] = ` -Object { - "debug": [Function], - "findAllByAltText": [Function], - "findAllByDisplayValue": [Function], - "findAllByLabelText": [Function], - "findAllByPlaceholderText": [Function], - "findAllByRole": [Function], - "findAllByTestId": [Function], - "findAllByText": [Function], - "findAllByTitle": [Function], - "findByAltText": [Function], - "findByDisplayValue": [Function], - "findByLabelText": [Function], - "findByPlaceholderText": [Function], - "findByRole": [Function], - "findByTestId": [Function], - "findByText": [Function], - "findByTitle": [Function], - "getAllByAltText": [Function], - "getAllByDisplayValue": [Function], - "getAllByLabelText": [Function], - "getAllByPlaceholderText": [Function], - "getAllByRole": [Function], - "getAllByTestId": [Function], - "getAllByText": [Function], - "getAllByTitle": [Function], - "getByAltText": [Function], - "getByDisplayValue": [Function], - "getByLabelText": [Function], - "getByPlaceholderText": [Function], - "getByRole": [Function], - "getByTestId": [Function], - "getByText": [Function], - "getByTitle": [Function], - "logTestingPlaygroundURL": [Function], - "queryAllByAltText": [Function], - "queryAllByDisplayValue": [Function], - "queryAllByLabelText": [Function], - "queryAllByPlaceholderText": [Function], - "queryAllByRole": [Function], - "queryAllByTestId": [Function], - "queryAllByText": [Function], - "queryAllByTitle": [Function], - "queryByAltText": [Function], - "queryByDisplayValue": [Function], - "queryByLabelText": [Function], - "queryByPlaceholderText": [Function], - "queryByRole": [Function], - "queryByTestId": [Function], - "queryByText": [Function], - "queryByTitle": [Function], -} + `; exports[`EndpointLink component tests snapshot testing for link hidden with custom link label 1`] = ` -Object { - "debug": [Function], - "findAllByAltText": [Function], - "findAllByDisplayValue": [Function], - "findAllByLabelText": [Function], - "findAllByPlaceholderText": [Function], - "findAllByRole": [Function], - "findAllByTestId": [Function], - "findAllByText": [Function], - "findAllByTitle": [Function], - "findByAltText": [Function], - "findByDisplayValue": [Function], - "findByLabelText": [Function], - "findByPlaceholderText": [Function], - "findByRole": [Function], - "findByTestId": [Function], - "findByText": [Function], - "findByTitle": [Function], - "getAllByAltText": [Function], - "getAllByDisplayValue": [Function], - "getAllByLabelText": [Function], - "getAllByPlaceholderText": [Function], - "getAllByRole": [Function], - "getAllByTestId": [Function], - "getAllByText": [Function], - "getAllByTitle": [Function], - "getByAltText": [Function], - "getByDisplayValue": [Function], - "getByLabelText": [Function], - "getByPlaceholderText": [Function], - "getByRole": [Function], - "getByTestId": [Function], - "getByText": [Function], - "getByTitle": [Function], - "logTestingPlaygroundURL": [Function], - "queryAllByAltText": [Function], - "queryAllByDisplayValue": [Function], - "queryAllByLabelText": [Function], - "queryAllByPlaceholderText": [Function], - "queryAllByRole": [Function], - "queryAllByTestId": [Function], - "queryAllByText": [Function], - "queryAllByTitle": [Function], - "queryByAltText": [Function], - "queryByDisplayValue": [Function], - "queryByLabelText": [Function], - "queryByPlaceholderText": [Function], - "queryByRole": [Function], - "queryByTestId": [Function], - "queryByText": [Function], - "queryByTitle": [Function], -} + `; exports[`EndpointLink component tests snapshot testing for link shown 1`] = ` -Object { - "debug": [Function], - "findAllByAltText": [Function], - "findAllByDisplayValue": [Function], - "findAllByLabelText": [Function], - "findAllByPlaceholderText": [Function], - "findAllByRole": [Function], - "findAllByTestId": [Function], - "findAllByText": [Function], - "findAllByTitle": [Function], - "findByAltText": [Function], - "findByDisplayValue": [Function], - "findByLabelText": [Function], - "findByPlaceholderText": [Function], - "findByRole": [Function], - "findByTestId": [Function], - "findByText": [Function], - "findByTitle": [Function], - "getAllByAltText": [Function], - "getAllByDisplayValue": [Function], - "getAllByLabelText": [Function], - "getAllByPlaceholderText": [Function], - "getAllByRole": [Function], - "getAllByTestId": [Function], - "getAllByText": [Function], - "getAllByTitle": [Function], - "getByAltText": [Function], - "getByDisplayValue": [Function], - "getByLabelText": [Function], - "getByPlaceholderText": [Function], - "getByRole": [Function], - "getByTestId": [Function], - "getByText": [Function], - "getByTitle": [Function], - "logTestingPlaygroundURL": [Function], - "queryAllByAltText": [Function], - "queryAllByDisplayValue": [Function], - "queryAllByLabelText": [Function], - "queryAllByPlaceholderText": [Function], - "queryAllByRole": [Function], - "queryAllByTestId": [Function], - "queryAllByText": [Function], - "queryAllByTitle": [Function], - "queryByAltText": [Function], - "queryByDisplayValue": [Function], - "queryByLabelText": [Function], - "queryByPlaceholderText": [Function], - "queryByRole": [Function], - "queryByTestId": [Function], - "queryByText": [Function], - "queryByTitle": [Function], -} + `; -exports[`EndpointLink component tests snapshot testing no service URL and link hidden 1`] = ` -Object { - "debug": [Function], - "findAllByAltText": [Function], - "findAllByDisplayValue": [Function], - "findAllByLabelText": [Function], - "findAllByPlaceholderText": [Function], - "findAllByRole": [Function], - "findAllByTestId": [Function], - "findAllByText": [Function], - "findAllByTitle": [Function], - "findByAltText": [Function], - "findByDisplayValue": [Function], - "findByLabelText": [Function], - "findByPlaceholderText": [Function], - "findByRole": [Function], - "findByTestId": [Function], - "findByText": [Function], - "findByTitle": [Function], - "getAllByAltText": [Function], - "getAllByDisplayValue": [Function], - "getAllByLabelText": [Function], - "getAllByPlaceholderText": [Function], - "getAllByRole": [Function], - "getAllByTestId": [Function], - "getAllByText": [Function], - "getAllByTitle": [Function], - "getByAltText": [Function], - "getByDisplayValue": [Function], - "getByLabelText": [Function], - "getByPlaceholderText": [Function], - "getByRole": [Function], - "getByTestId": [Function], - "getByText": [Function], - "getByTitle": [Function], - "logTestingPlaygroundURL": [Function], - "queryAllByAltText": [Function], - "queryAllByDisplayValue": [Function], - "queryAllByLabelText": [Function], - "queryAllByPlaceholderText": [Function], - "queryAllByRole": [Function], - "queryAllByTestId": [Function], - "queryAllByText": [Function], - "queryAllByTitle": [Function], - "queryByAltText": [Function], - "queryByDisplayValue": [Function], - "queryByLabelText": [Function], - "queryByPlaceholderText": [Function], - "queryByRole": [Function], - "queryByTestId": [Function], - "queryByText": [Function], - "queryByTitle": [Function], -} -`; +exports[`EndpointLink component tests snapshot testing no service URL and link hidden 1`] = `
`; diff --git a/ui-packages/packages/components-common/src/components/FormFooter/tests/FormFooter.test.tsx b/ui-packages/packages/components-common/src/components/FormFooter/tests/FormFooter.test.tsx index 9573e48ae0..9bc15cbfc6 100644 --- a/ui-packages/packages/components-common/src/components/FormFooter/tests/FormFooter.test.tsx +++ b/ui-packages/packages/components-common/src/components/FormFooter/tests/FormFooter.test.tsx @@ -48,8 +48,8 @@ describe('Form Footer test', () => { } ]; - render(); - expect(screen).toMatchSnapshot(); + const { container } = render(); + expect(container).toMatchSnapshot(); const actionList = screen.getByTestId('action-list'); expect(actionList).toBeTruthy(); @@ -74,8 +74,10 @@ describe('Form Footer test', () => { } ]; - render(); - expect(screen).toMatchSnapshot(); + const { container } = render( + + ); + expect(container).toMatchSnapshot(); const actionList = screen.getByTestId('action-list'); expect(actionList).toBeTruthy(); diff --git a/ui-packages/packages/components-common/src/components/FormFooter/tests/__snapshots__/FormFooter.test.tsx.snap b/ui-packages/packages/components-common/src/components/FormFooter/tests/__snapshots__/FormFooter.test.tsx.snap index 0cddd7ae3c..b09af56ce2 100644 --- a/ui-packages/packages/components-common/src/components/FormFooter/tests/__snapshots__/FormFooter.test.tsx.snap +++ b/ui-packages/packages/components-common/src/components/FormFooter/tests/__snapshots__/FormFooter.test.tsx.snap @@ -1,111 +1,57 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Form Footer test showing actions 1`] = ` -Object { - "debug": [Function], - "findAllByAltText": [Function], - "findAllByDisplayValue": [Function], - "findAllByLabelText": [Function], - "findAllByPlaceholderText": [Function], - "findAllByRole": [Function], - "findAllByTestId": [Function], - "findAllByText": [Function], - "findAllByTitle": [Function], - "findByAltText": [Function], - "findByDisplayValue": [Function], - "findByLabelText": [Function], - "findByPlaceholderText": [Function], - "findByRole": [Function], - "findByTestId": [Function], - "findByText": [Function], - "findByTitle": [Function], - "getAllByAltText": [Function], - "getAllByDisplayValue": [Function], - "getAllByLabelText": [Function], - "getAllByPlaceholderText": [Function], - "getAllByRole": [Function], - "getAllByTestId": [Function], - "getAllByText": [Function], - "getAllByTitle": [Function], - "getByAltText": [Function], - "getByDisplayValue": [Function], - "getByLabelText": [Function], - "getByPlaceholderText": [Function], - "getByRole": [Function], - "getByTestId": [Function], - "getByText": [Function], - "getByTitle": [Function], - "logTestingPlaygroundURL": [Function], - "queryAllByAltText": [Function], - "queryAllByDisplayValue": [Function], - "queryAllByLabelText": [Function], - "queryAllByPlaceholderText": [Function], - "queryAllByRole": [Function], - "queryAllByTestId": [Function], - "queryAllByText": [Function], - "queryAllByTitle": [Function], - "queryByAltText": [Function], - "queryByDisplayValue": [Function], - "queryByLabelText": [Function], - "queryByPlaceholderText": [Function], - "queryByRole": [Function], - "queryByTestId": [Function], - "queryByText": [Function], - "queryByTitle": [Function], -} +
+