[8.6] [Discover] Fix flaky jest test (#146668) (#146725)

# Backport

This will backport the following commits from `main` to `8.6`:
- [[Discover] Fix flaky jest test
(#146668)](https://github.com/elastic/kibana/pull/146668)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Julia
Rechkunova","email":"julia.rechkunova@elastic.co"},"sourceCommit":{"committedDate":"2022-11-30T16:31:24Z","message":"[Discover]
Fix flaky jest test (#146668)\n\nCloses
https://github.com/elastic/kibana/issues/145894","sha":"c7cc58df3fe295c462190e1cfff50e9bf241c559","branchLabelMapping":{"^v8.7.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:DataDiscovery","backport:prev-minor","v8.7.0"],"number":146668,"url":"https://github.com/elastic/kibana/pull/146668","mergeCommit":{"message":"[Discover]
Fix flaky jest test (#146668)\n\nCloses
https://github.com/elastic/kibana/issues/145894","sha":"c7cc58df3fe295c462190e1cfff50e9bf241c559"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.7.0","labelRegex":"^v8.7.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/146668","number":146668,"mergeCommit":{"message":"[Discover]
Fix flaky jest test (#146668)\n\nCloses
https://github.com/elastic/kibana/issues/145894","sha":"c7cc58df3fe295c462190e1cfff50e9bf241c559"}}]}]
BACKPORT-->

Co-authored-by: Julia Rechkunova <julia.rechkunova@elastic.co>
This commit is contained in:
Kibana Machine 2022-11-30 12:25:21 -05:00 committed by GitHub
parent 262f09cf9b
commit b46c0f71ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -204,6 +204,7 @@ async function mountComponent(
// DiscoverMainContent uses UnifiedHistogramLayout which
// is lazy loaded, so we need to wait for it to be loaded
await act(() => setTimeout(0));
await component.update();
return component;
}
@ -223,7 +224,7 @@ describe('Discover component', () => {
expect(
container.querySelector('[data-test-subj="unifiedHistogramChartOptionsToggle"]')
).not.toBeNull();
});
}, 10000);
test('sql query displays no chart toggle', async () => {
const container = document.createElement('div');
@ -248,7 +249,7 @@ describe('Discover component', () => {
expect(
component.find('[data-test-subj="discoverSavedSearchTitle"]').getDOMNode()
).toHaveFocus();
});
}, 10000);
describe('sidebar', () => {
test('should be opened if discover:sidebarClosed was not set', async () => {