diff --git a/x-pack/test/functional/apps/transform/cloning.ts b/x-pack/test/functional/apps/transform/cloning.ts index 6bf3c9afb3547..a6a46888edda8 100644 --- a/x-pack/test/functional/apps/transform/cloning.ts +++ b/x-pack/test/functional/apps/transform/cloning.ts @@ -238,7 +238,7 @@ export default function ({ getService }: FtrProviderContext) { await transform.table.assertTransformRowActions(testData.originalConfig.id, false); await transform.testExecution.logTestStep('should display the define pivot step'); - await transform.table.clickTransformRowAction('Clone'); + await transform.table.clickTransformRowAction(testData.originalConfig.id, 'Clone'); await transform.wizard.assertSelectedTransformFunction(testData.type); await transform.wizard.assertDefineStepActive(); }); diff --git a/x-pack/test/functional/apps/transform/creation_index_pattern.ts b/x-pack/test/functional/apps/transform/creation_index_pattern.ts index 8b5a8c93b00b8..d8867527ba2ac 100644 --- a/x-pack/test/functional/apps/transform/creation_index_pattern.ts +++ b/x-pack/test/functional/apps/transform/creation_index_pattern.ts @@ -589,7 +589,7 @@ export default function ({ getService }: FtrProviderContext) { await transform.table.assertTransformRowActions(testData.transformId, false); await transform.testExecution.logTestStep('should navigate to discover'); - await transform.table.clickTransformRowAction('Discover'); + await transform.table.clickTransformRowAction(testData.transformId, 'Discover'); if (testData.discoverAdjustSuperDatePicker) { await transform.discover.assertNoResults(testData.destinationIndex); diff --git a/x-pack/test/functional/apps/transform/deleting.ts b/x-pack/test/functional/apps/transform/deleting.ts index ce75c4c8b27c2..68530c586b6e2 100644 --- a/x-pack/test/functional/apps/transform/deleting.ts +++ b/x-pack/test/functional/apps/transform/deleting.ts @@ -99,7 +99,7 @@ export default function ({ getService }: FtrProviderContext) { ); await transform.testExecution.logTestStep('should stop the transform'); - await transform.table.clickTransformRowAction('Stop'); + await transform.table.clickTransformRowAction(testData.originalConfig.id, 'Stop'); } await transform.testExecution.logTestStep('should display the stopped transform'); @@ -117,7 +117,7 @@ export default function ({ getService }: FtrProviderContext) { 'Delete', true ); - await transform.table.clickTransformRowAction('Delete'); + await transform.table.clickTransformRowAction(testData.originalConfig.id, 'Delete'); await transform.table.assertTransformDeleteModalExists(); await transform.testExecution.logTestStep('should delete the transform'); diff --git a/x-pack/test/functional/apps/transform/editing.ts b/x-pack/test/functional/apps/transform/editing.ts index b1e24eeb3de95..01f93d9e8c0a8 100644 --- a/x-pack/test/functional/apps/transform/editing.ts +++ b/x-pack/test/functional/apps/transform/editing.ts @@ -112,7 +112,7 @@ export default function ({ getService }: FtrProviderContext) { await transform.table.assertTransformRowActions(testData.originalConfig.id, false); await transform.testExecution.logTestStep('should show the edit flyout'); - await transform.table.clickTransformRowAction('Edit'); + await transform.table.clickTransformRowAction(testData.originalConfig.id, 'Edit'); await transform.editFlyout.assertTransformEditFlyoutExists(); }); diff --git a/x-pack/test/functional/apps/transform/permissions/full_transform_access.ts b/x-pack/test/functional/apps/transform/permissions/full_transform_access.ts index 1f81b687800c7..d50943fad991a 100644 --- a/x-pack/test/functional/apps/transform/permissions/full_transform_access.ts +++ b/x-pack/test/functional/apps/transform/permissions/full_transform_access.ts @@ -137,7 +137,7 @@ export default function ({ getService }: FtrProviderContext) { it('should display controls in the edit flyout correctly', async () => { await transform.testExecution.logTestStep('should show the edit flyout'); - await transform.table.clickTransformRowActionWithRetry(transformConfigWithPivot.id, 'Edit'); + await transform.table.clickTransformRowAction(transformConfigWithPivot.id, 'Edit'); await transform.editFlyout.assertTransformEditFlyoutExists(); await transform.testExecution.logTestStep('should have the description input enabled'); diff --git a/x-pack/test/functional/apps/transform/starting.ts b/x-pack/test/functional/apps/transform/starting.ts index 2de0bd2eea257..a4459e26a49be 100644 --- a/x-pack/test/functional/apps/transform/starting.ts +++ b/x-pack/test/functional/apps/transform/starting.ts @@ -77,7 +77,7 @@ export default function ({ getService }: FtrProviderContext) { await transform.testExecution.logTestStep('should start the transform'); await transform.table.assertTransformRowActionEnabled(transformId, 'Start', true); - await transform.table.clickTransformRowAction('Start'); + await transform.table.clickTransformRowAction(transformId, 'Start'); await transform.table.confirmStartTransform(); await transform.table.clearSearchString(testDataList.length); diff --git a/x-pack/test/functional/services/transform/transform_table.ts b/x-pack/test/functional/services/transform/transform_table.ts index 9011466033da9..7c4a45fb601ea 100644 --- a/x-pack/test/functional/services/transform/transform_table.ts +++ b/x-pack/test/functional/services/transform/transform_table.ts @@ -12,6 +12,7 @@ import { FtrProviderContext } from '../../ftr_provider_context'; type TransformRowActionName = 'Clone' | 'Delete' | 'Edit' | 'Start' | 'Stop' | 'Discover'; export function TransformTableProvider({ getService }: FtrProviderContext) { + const find = getService('find'); const retry = getService('retry'); const testSubjects = getService('testSubjects'); const browser = getService('browser'); @@ -235,6 +236,30 @@ export function TransformTableProvider({ getService }: FtrProviderContext) { return !subSelector ? row : `${row} > ${subSelector}`; } + public async ensureTransformActionsMenuOpen(transformId: string) { + await retry.tryForTime(30 * 1000, async () => { + await this.ensureTransformActionsMenuClosed(); + + if (!(await find.existsByCssSelector('.euiContextMenuPanel', 1000))) { + await testSubjects.click(this.rowSelector(transformId, 'euiCollapsedItemActionsButton')); + expect(await find.existsByCssSelector('.euiContextMenuPanel', 1000)).to.eql( + true, + 'Actions popover should exist' + ); + } + }); + } + + public async ensureTransformActionsMenuClosed() { + await retry.tryForTime(30 * 1000, async () => { + await browser.pressKeys(browser.keys.ESCAPE); + expect(await find.existsByCssSelector('.euiContextMenuPanel', 1000)).to.eql( + false, + 'Actions popover should not exist' + ); + }); + } + public async assertTransformRowActionsButtonEnabled( transformId: string, expectedValue: boolean @@ -251,7 +276,7 @@ export function TransformTableProvider({ getService }: FtrProviderContext) { } public async assertTransformRowActions(transformId: string, isTransformRunning = false) { - await testSubjects.click(this.rowSelector(transformId, 'euiCollapsedItemActionsButton')); + await this.ensureTransformActionsMenuOpen(transformId); await testSubjects.existOrFail('transformActionClone'); await testSubjects.existOrFail('transformActionDelete'); @@ -265,6 +290,8 @@ export function TransformTableProvider({ getService }: FtrProviderContext) { await testSubjects.existOrFail('transformActionStart'); await testSubjects.missingOrFail('transformActionStop'); } + + await this.ensureTransformActionsMenuClosed(); } public async assertTransformRowActionEnabled( @@ -276,8 +303,7 @@ export function TransformTableProvider({ getService }: FtrProviderContext) { await retry.tryForTime(60 * 1000, async () => { await this.refreshTransformList(); - await browser.pressKeys(browser.keys.ESCAPE); - await testSubjects.click(this.rowSelector(transformId, 'euiCollapsedItemActionsButton')); + await this.ensureTransformActionsMenuOpen(transformId); await testSubjects.existOrFail(selector, { timeout: 1000 }); const isEnabled = await testSubjects.isEnabled(selector); @@ -288,26 +314,14 @@ export function TransformTableProvider({ getService }: FtrProviderContext) { }')` ); - // Close the actions menu - await browser.pressKeys(browser.keys.ESCAPE); - }); - } - - public async clickTransformRowActionWithRetry( - transformId: string, - action: TransformRowActionName - ) { - await retry.tryForTime(30 * 1000, async () => { - await browser.pressKeys(browser.keys.ESCAPE); - await testSubjects.click(this.rowSelector(transformId, 'euiCollapsedItemActionsButton')); - await testSubjects.existOrFail(`transformAction${action}`, { timeout: 1000 }); - await testSubjects.click(`transformAction${action}`); - await testSubjects.missingOrFail(`transformAction${action}`, { timeout: 1000 }); + await this.ensureTransformActionsMenuClosed(); }); } - public async clickTransformRowAction(action: TransformRowActionName) { + public async clickTransformRowAction(transformId: string, action: TransformRowActionName) { + await this.ensureTransformActionsMenuOpen(transformId); await testSubjects.click(`transformAction${action}`); + await testSubjects.missingOrFail(`transformAction${action}`); } public async waitForTransformsExpandedRowPreviewTabToLoad() {