From 213bcff038dc4c08fca38afde1dd2afb5d773183 Mon Sep 17 00:00:00 2001 From: Kevin Cormier Date: Wed, 13 Nov 2024 12:23:12 -0500 Subject: [PATCH] Miscellaneous test fixes Signed-off-by: Kevin Cormier --- .../TemplateEditor/controls/ControlPanelLabels.test.js | 4 ++-- .../ManagedClusters/components/NodePoolsProgress.test.tsx | 8 ++------ .../ManagedClusters/components/NodePoolsTable.test.tsx | 5 ++--- frontend/src/ui-components/AcmSelect/AcmSelect.test.tsx | 2 +- 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/frontend/src/components/TemplateEditor/controls/ControlPanelLabels.test.js b/frontend/src/components/TemplateEditor/controls/ControlPanelLabels.test.js index ac17b7259fa..ac886873039 100644 --- a/frontend/src/components/TemplateEditor/controls/ControlPanelLabels.test.js +++ b/frontend/src/components/TemplateEditor/controls/ControlPanelLabels.test.js @@ -24,13 +24,13 @@ describe('ControlPanelLabels component', () => { const Component = () => { return } - const { getByTestId, asFragment, container } = render() + const { getByTestId, getByRole, asFragment } = render() expect(asFragment()).toMatchSnapshot() userEvent.type(getByTestId('controlId'), 'label=test{enter}') expect(control.active).toEqual([{ key: 'label', value: 'test' }]) userEvent.type(getByTestId('controlId'), 'label=test2{enter}') - container.querySelector('.pf-v5-c-button').click() + userEvent.click(getByRole('button', { name: 'Close label=test' })) expect(control.active).toEqual([]) userEvent.type(getByTestId('controlId'), 'label=test,') userEvent.type(getByTestId('controlId'), 'label={esc}') diff --git a/frontend/src/routes/Infrastructure/Clusters/ManagedClusters/components/NodePoolsProgress.test.tsx b/frontend/src/routes/Infrastructure/Clusters/ManagedClusters/components/NodePoolsProgress.test.tsx index a2c6d45b2c9..47658fb2364 100644 --- a/frontend/src/routes/Infrastructure/Clusters/ManagedClusters/components/NodePoolsProgress.test.tsx +++ b/frontend/src/routes/Infrastructure/Clusters/ManagedClusters/components/NodePoolsProgress.test.tsx @@ -27,18 +27,14 @@ const mockClusterImageSet0: ClusterImageSetK8sResource = { } const resultPending = { - icon: ( - - - - ), + icon: , text: 'Not ready', type: 'pending', } const resultOK = { icon: ( - + ), diff --git a/frontend/src/routes/Infrastructure/Clusters/ManagedClusters/components/NodePoolsTable.test.tsx b/frontend/src/routes/Infrastructure/Clusters/ManagedClusters/components/NodePoolsTable.test.tsx index 86133d26788..67597836da3 100644 --- a/frontend/src/routes/Infrastructure/Clusters/ManagedClusters/components/NodePoolsTable.test.tsx +++ b/frontend/src/routes/Infrastructure/Clusters/ManagedClusters/components/NodePoolsTable.test.tsx @@ -815,12 +815,11 @@ describe('NodePoolsTable', () => { expect(screen.queryAllByText('Node pool name').length).toBe(1) await waitForText('Cancel') userEvent.click(screen.getByTestId('cancel-nodepool-form')) - expect(screen.queryAllByTestId(/pf-dropdown-toggle-id-[0-9]*/)[0]).toBeTruthy() - userEvent.click(screen.queryAllByTestId(/pf-dropdown-toggle-id-[0-9]*/)[0]) + userEvent.click(screen.getAllByLabelText('Actions')[0]) userEvent.click(screen.getByText('Manage node pool')) expect(screen.queryAllByText('Manage node pool').length).toBe(1) userEvent.click(screen.getByTestId('cancel-nodepool-form')) - userEvent.click(screen.queryAllByTestId(/pf-dropdown-toggle-id-[0-9]*/)[0]) + userEvent.click(screen.getAllByLabelText('Actions')[0]) userEvent.click(screen.getByText('Remove node pool')) userEvent.click(screen.getByText('Cancel')) }) diff --git a/frontend/src/ui-components/AcmSelect/AcmSelect.test.tsx b/frontend/src/ui-components/AcmSelect/AcmSelect.test.tsx index 7a78e63e074..ae8ea482fea 100644 --- a/frontend/src/ui-components/AcmSelect/AcmSelect.test.tsx +++ b/frontend/src/ui-components/AcmSelect/AcmSelect.test.tsx @@ -57,7 +57,7 @@ describe('AcmSelect', () => { ) } const { container } = render() - expect(container.querySelector('.pf-v5-c-select__toggle-typeahead')).toHaveAttribute( + expect(container.querySelector('.pf-v5-c-select__toggle-typeahead input')).toHaveAttribute( 'placeholder', 'Select one' )