Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
44705fa
TEST commit: rerun flaky test suite 30 times
alisonelizabeth Feb 27, 2020
d2bddee
Revert "TEST commit: rerun flaky test suite 30 times"
alisonelizabeth Mar 25, 2020
12fbaf2
Merge branch 'master' of github.com:elastic/kibana into remote_cluste…
alisonelizabeth Mar 25, 2020
3692510
re-enable remote_cluster_edit jest tests
alisonelizabeth Mar 25, 2020
3cf9e00
Merge branch 'master' of github.com:elastic/kibana into remote_cluste…
alisonelizabeth Mar 26, 2020
9be24be
wrap component updates in act()
alisonelizabeth Mar 26, 2020
25ac8e9
Merge branch 'master' into remote_clusters/flaky_tests
elasticmachine Mar 26, 2020
1324097
Merge branch 'master' of github.com:elastic/kibana into remote_cluste…
alisonelizabeth Apr 3, 2020
7b1bc92
add waitFor
alisonelizabeth Apr 3, 2020
b0394fe
update jest test snapshot
alisonelizabeth Apr 3, 2020
d2fbe4c
Merge branch 'master' into remote_clusters/flaky_tests
elasticmachine Apr 3, 2020
59610c5
Merge branch 'master' into remote_clusters/flaky_tests
elasticmachine Apr 4, 2020
a6f3c08
Merge branch 'master' into remote_clusters/flaky_tests
elasticmachine Apr 5, 2020
723b246
Merge branch 'master' into remote_clusters/flaky_tests
elasticmachine Apr 6, 2020
5886c5d
Merge branch 'master' into remote_clusters/flaky_tests
elasticmachine Apr 6, 2020
dc3de6f
Merge branch 'master' into remote_clusters/flaky_tests
elasticmachine Apr 6, 2020
016a2e1
Merge branch 'master' into remote_clusters/flaky_tests
elasticmachine Apr 7, 2020
2b11451
address feedback
alisonelizabeth Apr 7, 2020
bbd93e8
fix typo
alisonelizabeth Apr 7, 2020
a1f98a0
Merge branch 'master' of github.com:elastic/kibana into remote_cluste…
alisonelizabeth Apr 7, 2020
91cbee7
Merge branch 'master' into remote_clusters/flaky_tests
elasticmachine Apr 8, 2020
b00755a
Merge branch 'master' into remote_clusters/flaky_tests
elasticmachine Apr 8, 2020
58d4cc1
Merge branch 'master' into remote_clusters/flaky_tests
elasticmachine Apr 8, 2020
7c670a4
Merge branch 'master' into remote_clusters/flaky_tests
elasticmachine Apr 8, 2020
a174ef6
Merge branch 'master' into remote_clusters/flaky_tests
elasticmachine Apr 8, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import { pageHelpers, nextTick, setupEnvironment } from './helpers';
import { NON_ALPHA_NUMERIC_CHARS, ACCENTED_CHARS } from './helpers/constants';

jest.mock('ui/new_platform');

const { setup } = pageHelpers.remoteClustersAdd;

describe('Create Remote cluster', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,22 @@
* you may not use this file except in compliance with the Elastic License.
*/

jest.mock('ui/new_platform');
import { act } from 'react-dom/test-utils';

import { RemoteClusterForm } from '../../public/application/sections/components/remote_cluster_form';
// import { pageHelpers, setupEnvironment, nextTick } from './helpers';
import { pageHelpers, nextTick } from './helpers';
import { pageHelpers, setupEnvironment } from './helpers';
import { REMOTE_CLUSTER_EDIT, REMOTE_CLUSTER_EDIT_NAME } from './helpers/constants';

// const { setup } = pageHelpers.remoteClustersEdit;
const { setup } = pageHelpers.remoteClustersEdit;
const { setup: setupRemoteClustersAdd } = pageHelpers.remoteClustersAdd;

// FLAKY: https://github.com/elastic/kibana/issues/57762
// FLAKY: https://github.com/elastic/kibana/issues/57997
// FLAKY: https://github.com/elastic/kibana/issues/57998
describe.skip('Edit Remote cluster', () => {
// let server;
// let httpRequestsMockHelpers;
describe('Edit Remote cluster', () => {
let server;
let httpRequestsMockHelpers;
let component;
let find;
let exists;

/**
*
* commented out due to hooks being called regardless of skip
* https://github.com/facebook/jest/issues/8379
let waitFor;

beforeAll(() => {
({ server, httpRequestsMockHelpers } = setupEnvironment());
Expand All @@ -39,13 +32,12 @@ describe.skip('Edit Remote cluster', () => {
beforeEach(async () => {
httpRequestsMockHelpers.setLoadRemoteClustersResponse([REMOTE_CLUSTER_EDIT]);

({ component, find, exists } = setup());
await nextTick(100); // We need to wait next tick for the mock server response to kick in
component.update();
await act(async () => {
({ component, find, exists, waitFor } = setup());
await waitFor('remoteClusterForm');
});
});

*/

test('should have the title of the page set correctly', () => {
expect(exists('remoteClusterPageTitle')).toBe(true);
expect(find('remoteClusterPageTitle').text()).toEqual('Edit remote cluster');
Expand All @@ -60,14 +52,16 @@ describe.skip('Edit Remote cluster', () => {
* the "create" remote cluster, we won't test it again but simply make sure that
* the form component is indeed shared between the 2 app sections.
*/
test('should use the same Form component as the "<RemoteClusterEdit />" component', async () => {
const { component: addRemoteClusterComponent } = setupRemoteClustersAdd();
test('should use the same Form component as the "<RemoteClusterAdd />" component', async () => {
let addRemoteClusterTestBed;

await nextTick();
addRemoteClusterComponent.update();
await act(async () => {
addRemoteClusterTestBed = setupRemoteClustersAdd();
addRemoteClusterTestBed.waitFor('remoteClusterAddPage');
});

const formEdit = component.find(RemoteClusterForm);
const formAdd = addRemoteClusterComponent.find(RemoteClusterForm);
const formAdd = addRemoteClusterTestBed.component.find(RemoteClusterForm);

expect(formEdit.length).toBe(1);
expect(formAdd.length).toBe(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 />', () => {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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'));
Expand Down Expand Up @@ -241,8 +241,10 @@ describe('<RemoteClusterList />', () => {
actions.clickBulkDeleteButton();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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 act() call for those 2 actions

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The 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'));

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,7 @@ export class RemoteClusterForm extends Component {
<Fragment>
{this.renderSaveErrorFeedback()}

<EuiForm>
<EuiForm data-test-subj="remoteClusterForm">
<EuiDescribedFormGroup
title={
<EuiTitle size="s">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ export class RemoteClusterAdd extends PureComponent {
const { isAddingCluster, addClusterError } = this.props;

return (
<EuiPageContent horizontalPosition="center" className="remoteClusterAddPage">
<EuiPageContent
horizontalPosition="center"
className="remoteClusterAddPage"
data-test-subj="remoteClusterAddPage"
>
<RemoteClusterPageTitle
title={
<FormattedMessage
Expand Down