浏览代码

[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
Antoine Clausse 9 月之前
父节点
当前提交
62a401c98d
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4 1
      services/web/test/frontend/features/project-list/components/notifications.test.tsx

+ 4 - 1
services/web/test/frontend/features/project-list/components/notifications.test.tsx

@@ -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 })