From 521b5f1ed27663736398974bfaf76b81ef62119c Mon Sep 17 00:00:00 2001 From: Janki Salvi <117571355+js-jankisalvi@users.noreply.github.com> Date: Fri, 11 Aug 2023 11:26:11 +0200 Subject: [PATCH] add retry to handle loading indicator timeout --- .../cases/attachment_framework.ts | 33 ++++++++++++------- .../search/cases/attachment_framework.ts | 10 ++++-- .../ftr/cases/attachment_framework.ts | 30 +++++++++++------ 3 files changed, 49 insertions(+), 24 deletions(-) diff --git a/x-pack/test_serverless/functional/test_suites/observability/cases/attachment_framework.ts b/x-pack/test_serverless/functional/test_suites/observability/cases/attachment_framework.ts index 86b0b73b75ebf..d75677b43dd61 100644 --- a/x-pack/test_serverless/functional/test_suites/observability/cases/attachment_framework.ts +++ b/x-pack/test_serverless/functional/test_suites/observability/cases/attachment_framework.ts @@ -6,7 +6,6 @@ */ import { expect } from 'expect'; -import { v4 as uuidv4 } from 'uuid'; import { ConnectorTypes } from '@kbn/cases-plugin/common/types/domain'; import { FtrProviderContext } from '../../../ftr_provider_context'; import { createCase } from './helper/api'; @@ -19,15 +18,13 @@ export default ({ getPageObject, getService }: FtrProviderContext) => { const testSubjects = getService('testSubjects'); const esArchiver = getService('esArchiver'); const kibanaServer = getService('kibanaServer'); - const dashboardAddPanel = getService('dashboardAddPanel'); const cases = getService('cases'); const find = getService('find'); const supertest = getService('supertest'); + const retry = getService('retry'); describe('persistable attachment', () => { describe('lens visualization', () => { - const myDashboardName = `My-dashboard-${uuidv4()}`; - before(async () => { await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/logstash_functional'); await kibanaServer.importExport.load( @@ -40,9 +37,13 @@ export default ({ getPageObject, getService }: FtrProviderContext) => { await dashboard.clickNewDashboard(); - await dashboardAddPanel.clickCreateNewLink(); + await retry.try(async () => { + await testSubjects.click('dashboardAddNewPanelButton'); + }); - await lens.goToTimeRange(); + await retry.try(async () => { + await lens.goToTimeRange(); + }); await lens.configureDimension({ dimension: 'lnsXY_xDimensionPanel > lns-empty-dimension', @@ -64,7 +65,6 @@ export default ({ getPageObject, getService }: FtrProviderContext) => { await lens.saveAndReturn(); await dashboard.waitForRenderComplete(); - await dashboard.saveDashboard(myDashboardName); }); after(async () => { @@ -83,10 +83,11 @@ export default ({ getPageObject, getService }: FtrProviderContext) => { await testSubjects.click('embeddablePanelMore-mainMenu'); await testSubjects.click('embeddablePanelAction-embeddable_addToNewCase'); - await cases.create.createCase({ - title: caseTitle, - description: 'test description', - }); + await testSubjects.existOrFail('create-case-flyout'); + + await testSubjects.setValue('input', caseTitle); + + await testSubjects.setValue('euiMarkdownEditorTextArea', 'test description'); // verify that solution picker is not visible await testSubjects.missingOrFail('caseOwnerSelector'); @@ -97,6 +98,11 @@ export default ({ getPageObject, getService }: FtrProviderContext) => { await testSubjects.click('toaster-content-case-view-link'); + if (await testSubjects.exists('appLeaveConfirmModal')) { + await testSubjects.exists('confirmModalConfirmButton'); + await testSubjects.click('confirmModalConfirmButton'); + } + const title = await find.byCssSelector('[data-test-subj="editable-title-header-value"]'); expect(await title.getVisibleText()).toEqual(caseTitle); @@ -137,6 +143,11 @@ export default ({ getPageObject, getService }: FtrProviderContext) => { await cases.common.expectToasterToContain(`${theCaseTitle} has been updated`); await testSubjects.click('toaster-content-case-view-link'); + if (await testSubjects.exists('appLeaveConfirmModal')) { + await testSubjects.exists('confirmModalConfirmButton'); + await testSubjects.click('confirmModalConfirmButton'); + } + const title = await find.byCssSelector('[data-test-subj="editable-title-header-value"]'); expect(await title.getVisibleText()).toEqual(theCaseTitle); diff --git a/x-pack/test_serverless/functional/test_suites/search/cases/attachment_framework.ts b/x-pack/test_serverless/functional/test_suites/search/cases/attachment_framework.ts index 35ba4c5853f4a..5617ddc2e823f 100644 --- a/x-pack/test_serverless/functional/test_suites/search/cases/attachment_framework.ts +++ b/x-pack/test_serverless/functional/test_suites/search/cases/attachment_framework.ts @@ -15,7 +15,7 @@ export default ({ getPageObject, getService }: FtrProviderContext) => { const lens = getPageObject('lens'); const svlSearchNavigation = getService('svlSearchNavigation'); const svlCommonNavigation = getPageObject('svlCommonNavigation'); - const dashboardAddPanel = getService('dashboardAddPanel'); + const retry = getService('retry'); describe('persistable attachment', () => { describe('lens visualization', () => { @@ -31,9 +31,13 @@ export default ({ getPageObject, getService }: FtrProviderContext) => { await dashboard.clickNewDashboard(); - await dashboardAddPanel.clickCreateNewLink(); + await retry.try(async () => { + await testSubjects.click('dashboardAddNewPanelButton'); + }); - await lens.goToTimeRange(); + await retry.try(async () => { + await lens.goToTimeRange(); + }); await lens.configureDimension({ dimension: 'lnsXY_xDimensionPanel > lns-empty-dimension', diff --git a/x-pack/test_serverless/functional/test_suites/security/ftr/cases/attachment_framework.ts b/x-pack/test_serverless/functional/test_suites/security/ftr/cases/attachment_framework.ts index e3627d83d69d6..ea15a39dd57b7 100644 --- a/x-pack/test_serverless/functional/test_suites/security/ftr/cases/attachment_framework.ts +++ b/x-pack/test_serverless/functional/test_suites/security/ftr/cases/attachment_framework.ts @@ -6,7 +6,6 @@ */ import { expect } from 'expect'; -import { v4 as uuidv4 } from 'uuid'; import { ConnectorTypes } from '@kbn/cases-plugin/common/types/domain'; import { FtrProviderContext } from '../../../../ftr_provider_context'; import { createCase } from './helper/api'; @@ -18,16 +17,13 @@ export default ({ getPageObject, getService }: FtrProviderContext) => { const testSubjects = getService('testSubjects'); const esArchiver = getService('esArchiver'); const kibanaServer = getService('kibanaServer'); - const dashboardAddPanel = getService('dashboardAddPanel'); const cases = getService('cases'); const find = getService('find'); - const listingTable = getService('listingTable'); const supertest = getService('supertest'); + const retry = getService('retry'); describe('persistable attachment', () => { describe('lens visualization', () => { - const myDashboardName = `My-dashboard-${uuidv4()}`; - before(async () => { await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/logstash_functional'); await kibanaServer.importExport.load( @@ -40,9 +36,13 @@ export default ({ getPageObject, getService }: FtrProviderContext) => { await dashboard.clickNewDashboard(); - await dashboardAddPanel.clickCreateNewLink(); + await retry.try(async () => { + await testSubjects.click('dashboardAddNewPanelButton'); + }); - await lens.goToTimeRange(); + await retry.try(async () => { + await lens.goToTimeRange(); + }); await lens.configureDimension({ dimension: 'lnsXY_xDimensionPanel > lns-empty-dimension', @@ -65,7 +65,6 @@ export default ({ getPageObject, getService }: FtrProviderContext) => { await lens.saveAndReturn(); await dashboard.waitForRenderComplete(); - await dashboard.saveDashboard(myDashboardName); }); after(async () => { @@ -100,6 +99,11 @@ export default ({ getPageObject, getService }: FtrProviderContext) => { await testSubjects.click('toaster-content-case-view-link'); + if (await testSubjects.exists('appLeaveConfirmModal')) { + await testSubjects.exists('confirmModalConfirmButton'); + await testSubjects.click('confirmModalConfirmButton'); + } + const title = await find.byCssSelector('[data-test-subj="editable-title-header-value"]'); expect(await title.getVisibleText()).toEqual(caseTitle); @@ -128,8 +132,9 @@ export default ({ getPageObject, getService }: FtrProviderContext) => { await testSubjects.click('solutionSideNavItemLink-dashboards'); - await listingTable.searchForItemWithName(myDashboardName); - await listingTable.clickItemLink('dashboard', myDashboardName); + if (await testSubjects.exists('edit-unsaved-New-Dashboard')) { + await testSubjects.click('edit-unsaved-New-Dashboard'); + } await testSubjects.click('embeddablePanelToggleMenuIcon'); await testSubjects.click('embeddablePanelMore-mainMenu'); @@ -143,6 +148,11 @@ export default ({ getPageObject, getService }: FtrProviderContext) => { await cases.common.expectToasterToContain(`${theCaseTitle} has been updated`); await testSubjects.click('toaster-content-case-view-link'); + if (await testSubjects.exists('appLeaveConfirmModal')) { + await testSubjects.exists('confirmModalConfirmButton'); + await testSubjects.click('confirmModalConfirmButton'); + } + const title = await find.byCssSelector('[data-test-subj="editable-title-header-value"]'); expect(await title.getVisibleText()).toEqual(theCaseTitle);