diff --git a/x-pack/test/functional/apps/lens/drag_and_drop.ts b/x-pack/test/functional/apps/lens/drag_and_drop.ts index 1ab107becfb0e..21c0b30a92be3 100644 --- a/x-pack/test/functional/apps/lens/drag_and_drop.ts +++ b/x-pack/test/functional/apps/lens/drag_and_drop.ts @@ -119,7 +119,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { 'Unique count of @message.raw [2]', ]); }); - it('should duplicate the column when dragging to empty dimension in the same group', async () => { + it('should move duplicated column to non-compatible dimension group', async () => { await PageObjects.lens.dragDimensionToDimension( 'lnsXY_yDimensionPanel > lns-dimensionTrigger', 'lnsXY_xDimensionPanel > lns-empty-dimension' diff --git a/x-pack/test/functional/page_objects/lens_page.ts b/x-pack/test/functional/page_objects/lens_page.ts index 0b88ecca247c5..b8f1e6b3dd236 100644 --- a/x-pack/test/functional/page_objects/lens_page.ts +++ b/x-pack/test/functional/page_objects/lens_page.ts @@ -170,6 +170,7 @@ export function LensPageProvider({ getService, getPageObjects }: FtrProviderCont testSubjects.getCssSelector(`lnsFieldListPanelField-${field}`), testSubjects.getCssSelector('lnsWorkspace') ); + await this.waitForLensDragDropToFinish(); await PageObjects.header.waitUntilLoadingHasFinished(); }, @@ -183,6 +184,7 @@ export function LensPageProvider({ getService, getPageObjects }: FtrProviderCont testSubjects.getCssSelector(`lnsFieldListPanelField-${field}`), testSubjects.getCssSelector('lnsGeoFieldWorkspace') ); + await this.waitForLensDragDropToFinish(); await PageObjects.header.waitUntilLoadingHasFinished(); }, @@ -246,6 +248,7 @@ export function LensPageProvider({ getService, getPageObjects }: FtrProviderCont await browser.pressKeys(reverse ? browser.keys.LEFT : browser.keys.RIGHT); } await browser.pressKeys(browser.keys.ENTER); + await this.waitForLensDragDropToFinish(); await PageObjects.header.waitUntilLoadingHasFinished(); }, @@ -270,6 +273,7 @@ export function LensPageProvider({ getService, getPageObjects }: FtrProviderCont } await browser.pressKeys(browser.keys.ENTER); + await this.waitForLensDragDropToFinish(); await PageObjects.header.waitUntilLoadingHasFinished(); }, /** @@ -292,9 +296,19 @@ export function LensPageProvider({ getService, getPageObjects }: FtrProviderCont } await browser.pressKeys(browser.keys.ENTER); + await this.waitForLensDragDropToFinish(); await PageObjects.header.waitUntilLoadingHasFinished(); }, + async waitForLensDragDropToFinish() { + await retry.try(async () => { + const exists = await find.existsByCssSelector('.lnsDragDrop-isActiveGroup'); + if (exists) { + throw new Error('UI still in drag/drop mode'); + } + }); + }, + /** * Drags field to dimension trigger * @@ -306,6 +320,7 @@ export function LensPageProvider({ getService, getPageObjects }: FtrProviderCont testSubjects.getCssSelector(`lnsFieldListPanelField-${field}`), testSubjects.getCssSelector(dimension) ); + await this.waitForLensDragDropToFinish(); await PageObjects.header.waitUntilLoadingHasFinished(); }, @@ -320,6 +335,7 @@ export function LensPageProvider({ getService, getPageObjects }: FtrProviderCont testSubjects.getCssSelector(from), testSubjects.getCssSelector(to) ); + await this.waitForLensDragDropToFinish(); await PageObjects.header.waitUntilLoadingHasFinished(); }, @@ -333,6 +349,7 @@ export function LensPageProvider({ getService, getPageObjects }: FtrProviderCont const dragging = `[data-test-subj='${dimension}']:nth-of-type(${startIndex}) .lnsDragDrop`; const dropping = `[data-test-subj='${dimension}']:nth-of-type(${endIndex}) [data-test-subj='lnsDragDrop-reorderableDropLayer'`; await browser.html5DragAndDrop(dragging, dropping); + await this.waitForLensDragDropToFinish(); await PageObjects.header.waitUntilLoadingHasFinished(); },