From 9e0f486ac245378711edabc6158fd522062b6377 Mon Sep 17 00:00:00 2001 From: Carlos Esteban Lopez Date: Wed, 19 Apr 2023 12:33:08 -0500 Subject: [PATCH] fix(search): Fix broken tests Signed-off-by: Carlos Esteban Lopez --- .../components/SearchBar/SearchBar.test.tsx | 24 ++++++++++++++----- .../SearchModal/SearchModal.test.tsx | 2 +- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/plugins/search-react/src/components/SearchBar/SearchBar.test.tsx b/plugins/search-react/src/components/SearchBar/SearchBar.test.tsx index 30df27aba7..5846d02013 100644 --- a/plugins/search-react/src/components/SearchBar/SearchBar.test.tsx +++ b/plugins/search-react/src/components/SearchBar/SearchBar.test.tsx @@ -133,7 +133,9 @@ describe('SearchBar', () => { ); await waitFor(() => { - expect(screen.getByRole('textbox', { name: 'Search' })).toHaveValue(term); + expect( + screen.getByRole('textbox', { name: 'Search in Mock title' }), + ).toHaveValue(term); }); }); @@ -154,7 +156,9 @@ describe('SearchBar', () => { , ); - const textbox = screen.getByRole('textbox', { name: 'Search' }); + const textbox = screen.getByRole('textbox', { + name: 'Search in Mock title', + }); const value = 'value'; @@ -191,7 +195,9 @@ describe('SearchBar', () => { , ); - const textbox = screen.getByRole('textbox', { name: 'Search' }); + const textbox = screen.getByRole('textbox', { + name: 'Search in Mock title', + }); await waitFor(() => { expect(textbox).toHaveValue(term); @@ -249,7 +255,9 @@ describe('SearchBar', () => { , ); - const textbox = await screen.findByRole('textbox', { name: 'Search' }); + const textbox = await screen.findByRole('textbox', { + name: 'Search in Mock title', + }); const value = 'value'; @@ -293,7 +301,9 @@ describe('SearchBar', () => { , ); - const textbox = await screen.findByRole('textbox', { name: 'Search' }); + const textbox = await screen.findByRole('textbox', { + name: 'Search in Mock title', + }); const value = 'value'; @@ -343,7 +353,9 @@ describe('SearchBar', () => { , ); - const textbox = await screen.findByRole('textbox', { name: 'Search' }); + const textbox = await screen.findByRole('textbox', { + name: 'Search in Mock title', + }); let value = 'value'; diff --git a/plugins/search/src/components/SearchModal/SearchModal.test.tsx b/plugins/search/src/components/SearchModal/SearchModal.test.tsx index d24764f5d4..b45046c429 100644 --- a/plugins/search/src/components/SearchModal/SearchModal.test.tsx +++ b/plugins/search/src/components/SearchModal/SearchModal.test.tsx @@ -166,6 +166,6 @@ describe('SearchModal', () => { }, ); - expect(screen.getByLabelText('Search')).toHaveFocus(); + expect(screen.getByLabelText('Search in Mock app')).toHaveFocus(); }); });