-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[Remote clusters] Fix flaky jest tests #58768
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
44705fa
d2bddee
12fbaf2
3692510
3cf9e00
9be24be
25ac8e9
1324097
7b1bc92
b0394fe
d2fbe4c
59610c5
a6f3c08
723b246
5886c5d
dc3de6f
016a2e1
2b11451
bbd93e8
a1f98a0
91cbee7
b00755a
58d4cc1
7c670a4
a174ef6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,7 @@ | |
| * or more contributor license agreements. Licensed under the Elastic License; | ||
| * you may not use this file except in compliance with the Elastic License. | ||
| */ | ||
| import { act } from 'react-dom/test-utils'; | ||
|
|
||
| import { | ||
| pageHelpers, | ||
|
|
@@ -17,8 +18,6 @@ import { getRemoteClusterMock } from '../../fixtures/remote_cluster'; | |
|
|
||
| import { PROXY_MODE } from '../../common/constants'; | ||
|
|
||
| jest.mock('ui/new_platform'); | ||
|
|
||
| const { setup } = pageHelpers.remoteClustersList; | ||
|
|
||
| describe('<RemoteClusterList />', () => { | ||
|
|
@@ -78,6 +77,7 @@ describe('<RemoteClusterList />', () => { | |
| let actions; | ||
| let tableCellsValues; | ||
| let rows; | ||
| let waitFor; | ||
|
|
||
| // For deterministic tests, we need to make sure that remoteCluster1 comes before remoteCluster2 | ||
| // in the table list that is rendered. As the table orders alphabetically by index name | ||
|
|
@@ -110,11 +110,11 @@ describe('<RemoteClusterList />', () => { | |
| beforeEach(async () => { | ||
| httpRequestsMockHelpers.setLoadRemoteClustersResponse(remoteClusters); | ||
|
|
||
| // Mount the component | ||
| ({ component, find, exists, table, actions } = setup()); | ||
| await act(async () => { | ||
| ({ component, find, exists, table, actions, waitFor } = setup()); | ||
|
|
||
| await nextTick(100); // Make sure that the Http request is fulfilled | ||
| component.update(); | ||
| await waitFor('remoteClusterListTable'); | ||
| }); | ||
|
|
||
| // Read the remote clusters list table | ||
| ({ rows, tableCellsValues } = table.getMetaData('remoteClusterListTable')); | ||
|
|
@@ -241,8 +241,10 @@ describe('<RemoteClusterList />', () => { | |
| actions.clickBulkDeleteButton(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not related to the changes in this PR but I am surprised that it does not complain to update the state outside an
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm going to leave this as is for now, since it is unrelated to the current changes. |
||
| actions.clickConfirmModalDeleteRemoteCluster(); | ||
|
|
||
| await nextTick(600); // there is a 500ms timeout in the api action | ||
| component.update(); | ||
| await act(async () => { | ||
| await nextTick(600); // there is a 500ms timeout in the api action | ||
| component.update(); | ||
| }); | ||
|
|
||
| ({ rows } = table.getMetaData('remoteClusterListTable')); | ||
|
|
||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.