From ca060ab146359cbebf57fbe71f2386d65f274eee Mon Sep 17 00:00:00 2001 From: Antoine Clausse Date: Mon, 27 Oct 2025 18:28:35 +0100 Subject: [PATCH] [web] Fix flaky frontend test in UserNotifications -> Affiliation (#29315) * Temporary: forcibly reproduce the loading state and test failure with a `setTimeout` * Wait for the loading to be finished in the test * Revert "Temporary: forcibly reproduce the loading state and test failure with a `setTimeout`" This reverts commit fb0270cc0cacd49fcff74e186b50b55f822f7729. * Let the test pass if the loading text is not found * Replace `getByTest` to `findByText` so it awaits GitOrigin-RevId: 6cee6e3a86b6a5f24d95c7e3e1fcef4c4efcc094 --- .../features/project-list/components/notifications.test.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/services/web/test/frontend/features/project-list/components/notifications.test.tsx b/services/web/test/frontend/features/project-list/components/notifications.test.tsx index 1126fa432d..5d595f4156 100644 --- a/services/web/test/frontend/features/project-list/components/notifications.test.tsx +++ b/services/web/test/frontend/features/project-list/components/notifications.test.tsx @@ -885,7 +885,10 @@ describe('', function () { ) await waitForElementToBeRemoved(() => screen.getByText(/sending/i)) - screen.getByText(/Enter the 6-digit code sent to foo@overleaf.com/i) + // Sometimes we need to wait for useWaitForI18n to be ready + await screen.findByText( + /Enter the 6-digit code sent to foo@overleaf.com/i + ) expect(sendReconfirmationMock.callHistory.called()).to.be.true fireEvent.click( screen.getByRole('button', { name: /resend confirmation code/i })