From 07dc5e55e095e34a6e6aabf74bce0d6d606d5e3d Mon Sep 17 00:00:00 2001 From: Sonia Sanz Vivas Date: Wed, 8 Jan 2025 11:51:34 +0100 Subject: [PATCH] Add waitUntilLoadingHasFinished in failing tests (#205485) Fixes: https://github.com/elastic/kibana/issues/205535 Fixes: https://github.com/elastic/kibana/issues/205514 Fixes: https://github.com/elastic/kibana/issues/205498 Fixes: https://github.com/elastic/kibana/issues/205464 Fixes: https://github.com/elastic/kibana/issues/205456 Fixes: https://github.com/elastic/kibana/issues/205453 Fixes: https://github.com/elastic/kibana/issues/205450 Fixes: https://github.com/elastic/kibana/issues/205412 Fixes: https://github.com/elastic/kibana/issues/205410 Fixes: https://github.com/elastic/kibana/issues/205401 Fixes: https://github.com/elastic/kibana/issues/205400 Fixes: https://github.com/elastic/kibana/issues/205399 Fixes: https://github.com/elastic/kibana/issues/205350 Fixes: https://github.com/elastic/kibana/issues/205349 Fixes: https://github.com/elastic/kibana/issues/205316 Fixes: https://github.com/elastic/kibana/issues/205288 Fixes: https://github.com/elastic/kibana/issues/205287 ## Summary It seems that the step tabs are not loading fast enough for the tests to find the expected element in a [bunch of test](https://github.com/elastic/kibana/issues?q=is%3Aopen%20label%3A%22Team%3AKibana%20Management%22%20label%3A%22failed-test%22%20created%3A%3E%40today-1w%20). This PR attempt to fix it. It also adds the `data-test-subj="indexModeValue"` tag in `TabSummary` that was missing. --- .../template_details/tabs/tab_summary.tsx | 2 +- .../data_streams_tab/data_streams_tab.ts | 33 ++++++++----------- .../index_templates_tab/index_template_tab.ts | 14 +++----- .../index_management/data_streams.ts | 31 +++++++---------- .../index_management/index_templates.ts | 2 ++ 5 files changed, 31 insertions(+), 51 deletions(-) diff --git a/x-pack/platform/plugins/shared/index_management/public/application/sections/home/template_list/template_details/tabs/tab_summary.tsx b/x-pack/platform/plugins/shared/index_management/public/application/sections/home/template_list/template_details/tabs/tab_summary.tsx index 6958a32845fe6..a6fbe93642813 100644 --- a/x-pack/platform/plugins/shared/index_management/public/application/sections/home/template_list/template_details/tabs/tab_summary.tsx +++ b/x-pack/platform/plugins/shared/index_management/public/application/sections/home/template_list/template_details/tabs/tab_summary.tsx @@ -234,7 +234,7 @@ export const TabSummary: React.FunctionComponent = ({ templateDetails }) defaultMessage="Index mode" /> - + {indexModeLabels[indexMode]} diff --git a/x-pack/test/functional/apps/index_management/data_streams_tab/data_streams_tab.ts b/x-pack/test/functional/apps/index_management/data_streams_tab/data_streams_tab.ts index e91bdeeb5e417..ae32297fe96a0 100644 --- a/x-pack/test/functional/apps/index_management/data_streams_tab/data_streams_tab.ts +++ b/x-pack/test/functional/apps/index_management/data_streams_tab/data_streams_tab.ts @@ -282,6 +282,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { // Click update template await pageObjects.indexManagement.clickNextButton(); + await pageObjects.header.waitUntilLoadingHasFinished(); // Verify index mode and close detail tab expect(await testSubjects.getVisibleText('indexModeValue')).to.be(indexModeName); @@ -322,11 +323,8 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { await changeIndexMode('index_mode_logsdb'); // Navigate to the last step of the wizard - await testSubjects.click('nextButton'); - await testSubjects.click('nextButton'); - await testSubjects.click('nextButton'); - await testSubjects.click('nextButton'); - await testSubjects.click('nextButton'); + await testSubjects.click('formWizardStep-5'); + await pageObjects.header.waitUntilLoadingHasFinished(); await verifyModeHasBeenChanged(INDEX_MODE.LOGSDB); }); @@ -339,11 +337,8 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { await changeIndexMode('index_mode_standard'); // Navigate to the last step of the wizard - await testSubjects.click('nextButton'); - await testSubjects.click('nextButton'); - await testSubjects.click('nextButton'); - await testSubjects.click('nextButton'); - await testSubjects.click('nextButton'); + await testSubjects.click('formWizardStep-5'); + await pageObjects.header.waitUntilLoadingHasFinished(); await verifyModeHasBeenChanged(INDEX_MODE.STANDARD); }); @@ -357,16 +352,15 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { await changeIndexMode('index_mode_logsdb'); - await testSubjects.click('nextButton'); - await testSubjects.click('nextButton'); + await testSubjects.click('formWizardStep-2'); + await pageObjects.header.waitUntilLoadingHasFinished(); // Modify Index settings await testSubjects.setValue('kibanaCodeEditor', '{}', { clearWithKeyboard: true, }); // Navigate to the last step of the wizard - await testSubjects.click('nextButton'); - await testSubjects.click('nextButton'); - await testSubjects.click('nextButton'); + await testSubjects.click('formWizardStep-5'); + await pageObjects.header.waitUntilLoadingHasFinished(); await verifyModeHasBeenChanged(INDEX_MODE.LOGSDB); }); @@ -379,8 +373,8 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { await changeIndexMode('index_mode_time_series'); - await testSubjects.click('nextButton'); - await testSubjects.click('nextButton'); + await testSubjects.click('formWizardStep-2'); + await pageObjects.header.waitUntilLoadingHasFinished(); // Modify Index settings await testSubjects.setValue( 'kibanaCodeEditor', @@ -390,9 +384,8 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { } ); // Navigate to the last step of the wizard - await testSubjects.click('nextButton'); - await testSubjects.click('nextButton'); - await testSubjects.click('nextButton'); + await testSubjects.click('formWizardStep-5'); + await pageObjects.header.waitUntilLoadingHasFinished(); await verifyModeHasBeenChanged(INDEX_MODE.TIME_SERIES); }); diff --git a/x-pack/test/functional/apps/index_management/index_templates_tab/index_template_tab.ts b/x-pack/test/functional/apps/index_management/index_templates_tab/index_template_tab.ts index 75f022eaf7555..32337c04f05ad 100644 --- a/x-pack/test/functional/apps/index_management/index_templates_tab/index_template_tab.ts +++ b/x-pack/test/functional/apps/index_management/index_templates_tab/index_template_tab.ts @@ -47,11 +47,8 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { await testSubjects.click('show-filters-button'); await testSubjects.click('filter-option-h'); // Navigate to the last step of the wizard - await testSubjects.click('nextButton'); - await testSubjects.click('nextButton'); - await testSubjects.click('nextButton'); - await testSubjects.click('nextButton'); - await testSubjects.click('nextButton'); + await testSubjects.click('formWizardStep-5'); + await pageObjects.header.waitUntilLoadingHasFinished(); expect(await testSubjects.getVisibleText('lifecycleValue')).to.be('7 hours'); @@ -71,11 +68,8 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { await testSubjects.click('index_mode_logsdb'); // Navigate to the last step of the wizard - await testSubjects.click('nextButton'); - await testSubjects.click('nextButton'); - await testSubjects.click('nextButton'); - await testSubjects.click('nextButton'); - await testSubjects.click('nextButton'); + await testSubjects.click('formWizardStep-5'); + await pageObjects.header.waitUntilLoadingHasFinished(); expect(await testSubjects.exists('indexModeTitle')).to.be(true); expect(await testSubjects.getVisibleText('indexModeValue')).to.be('LogsDB'); diff --git a/x-pack/test_serverless/functional/test_suites/common/management/index_management/data_streams.ts b/x-pack/test_serverless/functional/test_suites/common/management/index_management/data_streams.ts index f1b0b34ba94ac..7b7b71d5cfa5e 100644 --- a/x-pack/test_serverless/functional/test_suites/common/management/index_management/data_streams.ts +++ b/x-pack/test_serverless/functional/test_suites/common/management/index_management/data_streams.ts @@ -199,6 +199,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { // Click update template await pageObjects.indexManagement.clickNextButton(); + await pageObjects.header.waitUntilLoadingHasFinished(); // Verify index mode and close detail tab expect(await testSubjects.getVisibleText('indexModeValue')).to.be(indexModeName); @@ -246,11 +247,8 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { await changeIndexMode('index_mode_logsdb'); // Navigate to the last step of the wizard - await testSubjects.click('nextButton'); - await testSubjects.click('nextButton'); - await testSubjects.click('nextButton'); - await testSubjects.click('nextButton'); - await testSubjects.click('nextButton'); + await testSubjects.click('formWizardStep-5'); + await pageObjects.header.waitUntilLoadingHasFinished(); await verifyModeHasBeenChanged(INDEX_MODE.LOGSDB); }); @@ -263,11 +261,8 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { await changeIndexMode('index_mode_standard'); // Navigate to the last step of the wizard - await testSubjects.click('nextButton'); - await testSubjects.click('nextButton'); - await testSubjects.click('nextButton'); - await testSubjects.click('nextButton'); - await testSubjects.click('nextButton'); + await testSubjects.click('formWizardStep-5'); + await pageObjects.header.waitUntilLoadingHasFinished(); await verifyModeHasBeenChanged(INDEX_MODE.STANDARD); }); @@ -281,16 +276,14 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { await changeIndexMode('index_mode_logsdb'); - await testSubjects.click('nextButton'); - await testSubjects.click('nextButton'); + await testSubjects.click('formWizardStep-2'); + await pageObjects.header.waitUntilLoadingHasFinished(); // Modify Index settings await testSubjects.setValue('kibanaCodeEditor', '{}', { clearWithKeyboard: true, }); // Navigate to the last step of the wizard - await testSubjects.click('nextButton'); - await testSubjects.click('nextButton'); - await testSubjects.click('nextButton'); + await testSubjects.click('formWizardStep-5'); await verifyModeHasBeenChanged(INDEX_MODE.LOGSDB); }); @@ -303,8 +296,8 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { await changeIndexMode('index_mode_time_series'); - await testSubjects.click('nextButton'); - await testSubjects.click('nextButton'); + await testSubjects.click('formWizardStep-2'); + await pageObjects.header.waitUntilLoadingHasFinished(); // Modify Index settings await testSubjects.setValue( 'kibanaCodeEditor', @@ -314,9 +307,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { } ); // Navigate to the last step of the wizard - await testSubjects.click('nextButton'); - await testSubjects.click('nextButton'); - await testSubjects.click('nextButton'); + await testSubjects.click('formWizardStep-5'); await verifyModeHasBeenChanged(INDEX_MODE.TIME_SERIES); }); diff --git a/x-pack/test_serverless/functional/test_suites/common/management/index_management/index_templates.ts b/x-pack/test_serverless/functional/test_suites/common/management/index_management/index_templates.ts index 30ed3c30104e3..5e2cfba50997f 100644 --- a/x-pack/test_serverless/functional/test_suites/common/management/index_management/index_templates.ts +++ b/x-pack/test_serverless/functional/test_suites/common/management/index_management/index_templates.ts @@ -117,10 +117,12 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { // Click form summary step and then the submit button await testSubjects.click('formWizardStep-5'); + await pageObjects.header.waitUntilLoadingHasFinished(); expect(await testSubjects.getVisibleText('indexModeValue')).to.be('LogsDB'); // Click update template await pageObjects.indexManagement.clickNextButton(); + await pageObjects.header.waitUntilLoadingHasFinished(); // Close detail tab expect(await testSubjects.getVisibleText('indexModeValue')).to.be('LogsDB');