From 44184486576a00aff9d6f55bc3f6240120c400f1 Mon Sep 17 00:00:00 2001 From: Prateek Surana Date: Sat, 27 Nov 2021 17:02:45 +0530 Subject: [PATCH 1/2] =?UTF-8?q?=E2=9C=85=20=20Use=20getByLabelText=20for?= =?UTF-8?q?=20opening=20query=20details?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/devtools/tests/devtools.test.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/devtools/tests/devtools.test.tsx b/src/devtools/tests/devtools.test.tsx index f94205191f6..a751b3da8bf 100644 --- a/src/devtools/tests/devtools.test.tsx +++ b/src/devtools/tests/devtools.test.tsx @@ -162,9 +162,7 @@ describe('ReactQueryDevtools', () => { await screen.findByText(getByTextContent(`1${currentQuery?.queryHash}`)) fireEvent.click( - screen.getByRole('button', { - name: `Open query details for ${currentQuery?.queryHash}`, - }) + screen.getByLabelText(`Open query details for ${currentQuery?.queryHash}`) ) await screen.findByText(/query details/i) From 2e230641c27c9d50432ab2d7371584bb31c42bfa Mon Sep 17 00:00:00 2001 From: Prateek Surana Date: Sun, 28 Nov 2021 14:20:24 +0530 Subject: [PATCH 2/2] :bug: Use findBy* instead of getBy* --- src/devtools/tests/devtools.test.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/devtools/tests/devtools.test.tsx b/src/devtools/tests/devtools.test.tsx index a751b3da8bf..d075feab0ce 100644 --- a/src/devtools/tests/devtools.test.tsx +++ b/src/devtools/tests/devtools.test.tsx @@ -161,9 +161,11 @@ describe('ReactQueryDevtools', () => { await screen.findByText(getByTextContent(`1${currentQuery?.queryHash}`)) - fireEvent.click( - screen.getByLabelText(`Open query details for ${currentQuery?.queryHash}`) - ) + const queryButton = await screen.findByRole('button', { + name: `Open query details for ${currentQuery?.queryHash}`, + }) + + fireEvent.click(queryButton) await screen.findByText(/query details/i) })