|
1 | 1 | import * as React from 'react'; |
2 | 2 |
|
3 | | -import { render, screen } from '../../../test-utils/testing-library'; |
| 3 | +import { render, screen, waitFor } from '../../../test-utils/testing-library'; |
4 | 4 | import Classification from '../Classification'; |
5 | 5 |
|
6 | 6 | import messages from '../messages'; |
@@ -258,23 +258,23 @@ describe('features/classification/Classification', () => { |
258 | 258 | }); |
259 | 259 |
|
260 | 260 | // Wait for the async component to load |
261 | | - const boxAiIcon = await screen.findByTestId('box-ai-icon'); |
262 | | - const appliedByTitle = screen.getByText(messages.appliedByTitle.defaultMessage); |
263 | | - const appliedByDetails = screen.getByText('Box AI on January 15, 2024'); // expected text based on provided mocks |
264 | | - const reasonText = screen.getByText(aiClassificationReason.answer); |
265 | | - const citationsLabel = screen.queryByTestId('content-answers-references-label'); |
266 | | - const citationElements = screen.getAllByTestId('content-answers-citation-status'); |
267 | | - const modifiedByPlaintext = screen.queryByTestId('classification-modifiedby'); |
268 | | - |
269 | | - expect(boxAiIcon).toBeVisible(); |
270 | | - expect(appliedByTitle).toBeVisible(); |
271 | | - expect(appliedByDetails).toBeVisible(); |
272 | | - expect(reasonText).toBeVisible(); |
273 | | - expect(citationsLabel).toBeVisible(); |
274 | | - expect(citationElements).toHaveLength(expectedCitationsCount); |
275 | | - |
276 | | - // Assert the plaintext version of modified by details is not rendered |
277 | | - expect(modifiedByPlaintext).not.toBeInTheDocument(); |
| 261 | + await waitFor(() => { |
| 262 | + const appliedByTitle = screen.getByText(messages.appliedByTitle.defaultMessage); |
| 263 | + const appliedByDetails = screen.getByText('Box AI on January 15, 2024'); // expected text based on provided mocks |
| 264 | + const reasonText = screen.getByText(aiClassificationReason.answer); |
| 265 | + const citationsLabel = screen.queryByTestId('content-answers-references-label'); |
| 266 | + const citationElements = screen.getAllByTestId('content-answers-citation-status'); |
| 267 | + const modifiedByPlaintext = screen.queryByTestId('classification-modifiedby'); |
| 268 | + |
| 269 | + expect(appliedByTitle).toBeVisible(); |
| 270 | + expect(appliedByDetails).toBeVisible(); |
| 271 | + expect(reasonText).toBeVisible(); |
| 272 | + expect(citationsLabel).toBeVisible(); |
| 273 | + expect(citationElements).toHaveLength(expectedCitationsCount); |
| 274 | + |
| 275 | + // Assert the plaintext version of modified by details is not rendered |
| 276 | + expect(modifiedByPlaintext).not.toBeInTheDocument(); |
| 277 | + }); |
278 | 278 | }, |
279 | 279 | ); |
280 | 280 |
|
|
0 commit comments