From ba46a99bc151b258ac2504cf96b174e740e037d9 Mon Sep 17 00:00:00 2001 From: Matthias Wilhelm Date: Thu, 27 Apr 2023 10:19:29 +0200 Subject: [PATCH] Attempt to fix flaky test --- .../functional/tests/discover_integration.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/x-pack/test/saved_object_tagging/functional/tests/discover_integration.ts b/x-pack/test/saved_object_tagging/functional/tests/discover_integration.ts index b2772cec74ea1..4529bf260fef1 100644 --- a/x-pack/test/saved_object_tagging/functional/tests/discover_integration.ts +++ b/x-pack/test/saved_object_tagging/functional/tests/discover_integration.ts @@ -20,6 +20,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { 'timePicker', 'discover', ]); + const retry = getService('retry'); /** * Select tags in the searchbar's tag filter. @@ -118,6 +119,16 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { it('allows to create a tag from the tag selector', async () => { await PageObjects.discover.clickSaveSearchButton(); + const searchName = 'search-with-new-tag'; + // preventing an occasional flakiness when the saved object wasn't set and the form can't be submitted + await retry.waitFor( + `saved search title is set to ${searchName} and save button is clickable`, + async () => { + const saveButton = await testSubjects.find('confirmSaveSavedObjectButton'); + await testSubjects.setValue('savedObjectTitle', searchName); + return (await saveButton.getAttribute('disabled')) !== 'true'; + } + ); await testSubjects.setValue('savedObjectTitle', 'search-with-new-tag'); await testSubjects.click('savedObjectTagSelector'); await testSubjects.click(`tagSelectorOption-action__create`);