From f69a1913e1f41da5430bea74b0ef304ad72a9e20 Mon Sep 17 00:00:00 2001 From: austincalvelage Date: Fri, 30 Oct 2026 14:29:07 -0600 Subject: [PATCH] test(mosaic): wait for initial focus in phone verification tests --- .changeset/fresh-phones-wait.md | 2 ++ .../__tests__/user-profile-phone-section.feature.test.tsx | 2 ++ 2 files changed, 4 insertions(+) create mode 100644 .changeset/fresh-phones-wait.md diff --git a/.changeset/fresh-phones-wait.md b/.changeset/fresh-phones-wait.md new file mode 100644 index 00000000000..a845151cc84 --- /dev/null +++ b/.changeset/fresh-phones-wait.md @@ -0,0 +1,2 @@ +--- +--- diff --git a/packages/mosaic/src/features/user-profile/user-profile-phone-section/__tests__/user-profile-phone-section.feature.test.tsx b/packages/mosaic/src/features/user-profile/user-profile-phone-section/__tests__/user-profile-phone-section.feature.test.tsx index b796c5bf17d..5bc04540616 100644 --- a/packages/mosaic/src/features/user-profile/user-profile-phone-section/__tests__/user-profile-phone-section.feature.test.tsx +++ b/packages/mosaic/src/features/user-profile/user-profile-phone-section/__tests__/user-profile-phone-section.feature.test.tsx @@ -149,6 +149,7 @@ describe('the user profile phone section', () => { expect(within(row()).getByText(WORK_LABEL).parentElement).toHaveTextContent('Unverified'); await manage(actor, WORK_LABEL, 'Verify phone number'); + await waitFor(() => expect(screen.getByRole('button', { name: 'Close' })).toHaveFocus()); await enterCode(actor, VERIFICATION_CODE); await waitFor(() => expect(screen.queryByRole('dialog')).not.toBeInTheDocument()); @@ -171,6 +172,7 @@ describe('the user profile phone section', () => { prepare.release(); } + await waitFor(() => expect(screen.getByRole('button', { name: 'Close' })).toHaveFocus()); await enterCode(actor, VERIFICATION_CODE); expect(screen.queryByRole('menu')).toBeNull(); await waitFor(() => expect(screen.queryByRole('dialog')).not.toBeInTheDocument());