Skip to content

Commit 6431ca5

Browse files
authored
[Fix] Jest Tests.x-pack/solutions/observability/plugins/exploratory_view/public/components/shared/exploratory_view/components - FilterLabel should render properly (elastic#262207)
Resolves elastic#253320 **Root cause:** Anti-pattern of nesting findByText (async, retries) inside waitFor (also retries). The FilterItem component re-renders due to injectI18n() being called inside the render function, which makes element references go stale between the findByText resolution and the toBeInTheDocument() check. **Fix:** Replaced with waitFor(() => { getByText... }) — synchronous assertions inside waitFor so all checks run atomically in one retry cycle. Removed the duplicate assertion and unskipped the test. Verified: 155/155 consecutive runs pass locally.
1 parent 7de4899 commit 6431ca5

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

  • x-pack/solutions/observability/plugins/exploratory_view/public/components/shared/exploratory_view/components

x-pack/solutions/observability/plugins/exploratory_view/public/components/shared/exploratory_view/components/filter_label.test.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ import 'jest-canvas-mock';
1515

1616
jest.setTimeout(10 * 1000);
1717

18-
// FLAKY: https://github.com/elastic/kibana/issues/253320
19-
describe.skip('FilterLabel', function () {
18+
describe('FilterLabel', function () {
2019
mockAppDataView();
2120

2221
const invertFilter = jest.fn();
@@ -38,11 +37,10 @@ describe.skip('FilterLabel', function () {
3837
/>
3938
);
4039

41-
await waitFor(async () => {
42-
expect(await screen.findByText('elastic-co')).toBeInTheDocument();
43-
expect(await screen.findByText('elastic-co')).toBeInTheDocument();
44-
expect(await screen.findByText(/web application:/i)).toBeInTheDocument();
45-
expect(await screen.findByTitle('Delete Web Application: elastic-co')).toBeInTheDocument();
40+
await waitFor(() => {
41+
expect(screen.getByText('elastic-co')).toBeInTheDocument();
42+
expect(screen.getByText(/web application:/i)).toBeInTheDocument();
43+
expect(screen.getByTitle('Delete Web Application: elastic-co')).toBeInTheDocument();
4644
});
4745
});
4846

0 commit comments

Comments
 (0)