From 04df613c920b74547e4999a77e968731561f0fd9 Mon Sep 17 00:00:00 2001 From: Antonio Date: Mon, 11 Sep 2023 15:35:36 +0200 Subject: [PATCH] [Cases] Unhandled promises in tests (#166142) Fixes #166123 Fixes #166027 Fixes #166127 ## Summary This PR fixes the unhandled promises mentioned in https://github.com/elastic/kibana/issues/166127#issuecomment-1712493492 I unskipped the potentially affected tests [and the flaky test runner is running](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3078). If the tests pass and these changes have fixed them, I will unskip the serverless version of the tests too. --- .../apps/cases/group1/view_case.ts | 6 +++--- .../apps/cases/group2/list_view.ts | 9 +++------ .../test_suites/observability/cases/list_view.ts | 9 +++------ .../test_suites/observability/cases/view_case.ts | 6 +++--- .../test_suites/security/ftr/cases/list_view.ts | 9 +++------ .../test_suites/security/ftr/cases/view_case.ts | 6 +++--- 6 files changed, 18 insertions(+), 27 deletions(-) diff --git a/x-pack/test/functional_with_es_ssl/apps/cases/group1/view_case.ts b/x-pack/test/functional_with_es_ssl/apps/cases/group1/view_case.ts index 8a5b935df34ee..a62af7f5e23d6 100644 --- a/x-pack/test/functional_with_es_ssl/apps/cases/group1/view_case.ts +++ b/x-pack/test/functional_with_es_ssl/apps/cases/group1/view_case.ts @@ -805,7 +805,7 @@ export default ({ getPageObject, getService }: FtrProviderContext) => { }); it('initially renders user actions list correctly', async () => { - expect(testSubjects.missingOrFail('cases-show-more-user-actions')); + await testSubjects.missingOrFail('cases-show-more-user-actions'); const userActionsLists = await find.allByCssSelector( '[data-test-subj="user-actions-list"]' @@ -821,7 +821,7 @@ export default ({ getPageObject, getService }: FtrProviderContext) => { totalUpdates: 4, }); - expect(testSubjects.missingOrFail('user-actions-loading')); + await testSubjects.missingOrFail('user-actions-loading'); await header.waitUntilLoadingHasFinished(); @@ -829,7 +829,7 @@ export default ({ getPageObject, getService }: FtrProviderContext) => { await header.waitUntilLoadingHasFinished(); - expect(testSubjects.existOrFail('cases-show-more-user-actions')); + await testSubjects.existOrFail('cases-show-more-user-actions'); const userActionsLists = await find.allByCssSelector( '[data-test-subj="user-actions-list"]' diff --git a/x-pack/test/functional_with_es_ssl/apps/cases/group2/list_view.ts b/x-pack/test/functional_with_es_ssl/apps/cases/group2/list_view.ts index a48075dc0d2fe..38dbc575ae494 100644 --- a/x-pack/test/functional_with_es_ssl/apps/cases/group2/list_view.ts +++ b/x-pack/test/functional_with_es_ssl/apps/cases/group2/list_view.ts @@ -76,8 +76,7 @@ export default ({ getPageObject, getService }: FtrProviderContext) => { }); }); - // FLAKY: https://github.com/elastic/kibana/issues/166027 - describe.skip('status', () => { + describe('status', () => { before(async () => { await cases.api.createNthRandomCases(2); await header.waitUntilLoadingHasFinished(); @@ -96,8 +95,7 @@ export default ({ getPageObject, getService }: FtrProviderContext) => { }); }); - // FLAKY: https://github.com/elastic/kibana/issues/166123 - describe.skip('severity', () => { + describe('severity', () => { before(async () => { await cases.api.createNthRandomCases(2); await header.waitUntilLoadingHasFinished(); @@ -503,8 +501,7 @@ export default ({ getPageObject, getService }: FtrProviderContext) => { }); }); - // FLAKY: https://github.com/elastic/kibana/issues/166127 - describe.skip('severity filtering', () => { + describe('severity filtering', () => { before(async () => { await cases.navigation.navigateToApp(); await cases.api.createCase({ severity: CaseSeverity.LOW }); diff --git a/x-pack/test_serverless/functional/test_suites/observability/cases/list_view.ts b/x-pack/test_serverless/functional/test_suites/observability/cases/list_view.ts index 7e6f94e87b5c5..d4dfdca15e82d 100644 --- a/x-pack/test_serverless/functional/test_suites/observability/cases/list_view.ts +++ b/x-pack/test_serverless/functional/test_suites/observability/cases/list_view.ts @@ -53,8 +53,7 @@ export default ({ getPageObject, getService }: FtrProviderContext) => { }); }); - // FLAKY: https://github.com/elastic/kibana/issues/166027 - describe.skip('status', () => { + describe('status', () => { createNCasesBeforeDeleteAllAfter(2, getPageObject, getService); it('change the status of cases to in-progress correctly', async () => { @@ -64,8 +63,7 @@ export default ({ getPageObject, getService }: FtrProviderContext) => { }); }); - // FLAKY: https://github.com/elastic/kibana/issues/166123 - describe.skip('severity', () => { + describe('severity', () => { createNCasesBeforeDeleteAllAfter(2, getPageObject, getService); it('change the severity of cases to medium correctly', async () => { @@ -145,8 +143,7 @@ export default ({ getPageObject, getService }: FtrProviderContext) => { }); }); - // FLAKY: https://github.com/elastic/kibana/issues/166127 - describe.skip('severity filtering', () => { + describe('severity filtering', () => { before(async () => { await svlCommonNavigation.sidenav.clickLink({ deepLinkId: 'observability-overview:cases' }); diff --git a/x-pack/test_serverless/functional/test_suites/observability/cases/view_case.ts b/x-pack/test_serverless/functional/test_suites/observability/cases/view_case.ts index 97271fe33048b..8a2a776c68858 100644 --- a/x-pack/test_serverless/functional/test_suites/observability/cases/view_case.ts +++ b/x-pack/test_serverless/functional/test_suites/observability/cases/view_case.ts @@ -313,7 +313,7 @@ export default ({ getPageObject, getService }: FtrProviderContext) => { }); it('initially renders user actions list correctly', async () => { - expect(testSubjects.missingOrFail('cases-show-more-user-actions')); + await testSubjects.missingOrFail('cases-show-more-user-actions'); const userActionsLists = await find.allByCssSelector( '[data-test-subj="user-actions-list"]' @@ -329,7 +329,7 @@ export default ({ getPageObject, getService }: FtrProviderContext) => { totalUpdates: 4, }); - expect(testSubjects.missingOrFail('user-actions-loading')); + await testSubjects.missingOrFail('user-actions-loading'); await header.waitUntilLoadingHasFinished(); @@ -337,7 +337,7 @@ export default ({ getPageObject, getService }: FtrProviderContext) => { await header.waitUntilLoadingHasFinished(); - expect(testSubjects.existOrFail('cases-show-more-user-actions')); + await testSubjects.existOrFail('cases-show-more-user-actions'); const userActionsLists = await find.allByCssSelector( '[data-test-subj="user-actions-list"]' diff --git a/x-pack/test_serverless/functional/test_suites/security/ftr/cases/list_view.ts b/x-pack/test_serverless/functional/test_suites/security/ftr/cases/list_view.ts index 253b5eef3fa86..e05c16551982b 100644 --- a/x-pack/test_serverless/functional/test_suites/security/ftr/cases/list_view.ts +++ b/x-pack/test_serverless/functional/test_suites/security/ftr/cases/list_view.ts @@ -53,8 +53,7 @@ export default ({ getPageObject, getService }: FtrProviderContext) => { }); }); - // FLAKY: https://github.com/elastic/kibana/issues/166027 - describe.skip('status', () => { + describe('status', () => { createNCasesBeforeDeleteAllAfter(2, getPageObject, getService); it('change the status of cases to in-progress correctly', async () => { @@ -64,8 +63,7 @@ export default ({ getPageObject, getService }: FtrProviderContext) => { }); }); - // FLAKY: https://github.com/elastic/kibana/issues/166123 - describe.skip('severity', () => { + describe('severity', () => { createNCasesBeforeDeleteAllAfter(2, getPageObject, getService); it('change the severity of cases to medium correctly', async () => { @@ -145,8 +143,7 @@ export default ({ getPageObject, getService }: FtrProviderContext) => { }); }); - // FLAKY: https://github.com/elastic/kibana/issues/166127 - describe.skip('severity filtering', () => { + describe('severity filtering', () => { before(async () => { await testSubjects.click('solutionSideNavItemLink-cases'); diff --git a/x-pack/test_serverless/functional/test_suites/security/ftr/cases/view_case.ts b/x-pack/test_serverless/functional/test_suites/security/ftr/cases/view_case.ts index bd0e496a1ba4d..4ef63da784e21 100644 --- a/x-pack/test_serverless/functional/test_suites/security/ftr/cases/view_case.ts +++ b/x-pack/test_serverless/functional/test_suites/security/ftr/cases/view_case.ts @@ -312,7 +312,7 @@ export default ({ getPageObject, getService }: FtrProviderContext) => { }); it('initially renders user actions list correctly', async () => { - expect(testSubjects.missingOrFail('cases-show-more-user-actions')); + await testSubjects.missingOrFail('cases-show-more-user-actions'); const userActionsLists = await find.allByCssSelector( '[data-test-subj="user-actions-list"]' @@ -328,7 +328,7 @@ export default ({ getPageObject, getService }: FtrProviderContext) => { totalUpdates: 4, }); - expect(testSubjects.missingOrFail('user-actions-loading')); + await testSubjects.missingOrFail('user-actions-loading'); await header.waitUntilLoadingHasFinished(); @@ -336,7 +336,7 @@ export default ({ getPageObject, getService }: FtrProviderContext) => { await header.waitUntilLoadingHasFinished(); - expect(testSubjects.existOrFail('cases-show-more-user-actions')); + await testSubjects.existOrFail('cases-show-more-user-actions'); const userActionsLists = await find.allByCssSelector( '[data-test-subj="user-actions-list"]'