From 460d2943e15410e508a9eb4868f13e7b005d174d Mon Sep 17 00:00:00 2001 From: Matthias Wilhelm Date: Thu, 30 Jul 2020 08:31:22 +0200 Subject: [PATCH] Check for submit button to be disabled --- test/functional/page_objects/discover_page.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/test/functional/page_objects/discover_page.ts b/test/functional/page_objects/discover_page.ts index 6894e4b74c867..c558d9e2d8a31 100644 --- a/test/functional/page_objects/discover_page.ts +++ b/test/functional/page_objects/discover_page.ts @@ -51,11 +51,16 @@ export function DiscoverPageProvider({ getService, getPageObjects }: FtrProvider public async saveSearch(searchName: string) { await this.clickSaveSearchButton(); // preventing an occasional flakiness when the saved object wasn't set and the form can't be submitted - await retry.waitFor(`saved search can be persisted name ${searchName}`, async () => { - await testSubjects.setValue('savedObjectTitle', searchName); - await testSubjects.click('confirmSaveSavedObjectButton'); - return (await header.isGlobalLoadingIndicatorVisible()) === true; - }); + 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.click('confirmSaveSavedObjectButton'); + await header.waitUntilLoadingHasFinished(); // LeeDr - this additional checking for the saved search name was an attempt // to cause this method to wait for the reloading of the page to complete so // that the next action wouldn't have to retry. But it doesn't really solve