[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
This commit is contained in:
Antoine Clausse
2025-10-27 18:28:35 +01:00
committed by Copybot
parent e3efc885e4
commit ca060ab146

View File

@@ -885,7 +885,10 @@ describe('<UserNotifications />', 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 })