From abaead49f6aa757597285fdb70cadf1be52b3279 Mon Sep 17 00:00:00 2001 From: Christos Nasikas Date: Tue, 27 Jun 2023 10:34:58 +0300 Subject: [PATCH] Fix flaky --- .../functional/services/cases/single_case_view.ts | 11 +++++++++++ .../apps/cases/group1/view_case.ts | 7 ++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/x-pack/test/functional/services/cases/single_case_view.ts b/x-pack/test/functional/services/cases/single_case_view.ts index c3e668557af57..961ee05a33a52 100644 --- a/x-pack/test/functional/services/cases/single_case_view.ts +++ b/x-pack/test/functional/services/cases/single_case_view.ts @@ -58,6 +58,17 @@ export function CasesSingleViewServiceProvider({ getService, getPageObject }: Ft }); }, + async addComment(comment: string) { + const addCommentElement = await find.byCssSelector( + '[data-test-subj="add-comment"] textarea.euiMarkdownEditorTextArea' + ); + + await addCommentElement.focus(); + await addCommentElement.type(comment); + + await this.submitComment(); + }, + async addVisualizationToNewComment(visName: string) { // open saved object finder const addCommentElement = await testSubjects.find('add-comment'); diff --git a/x-pack/test/functional_with_es_ssl/apps/cases/group1/view_case.ts b/x-pack/test/functional_with_es_ssl/apps/cases/group1/view_case.ts index 5ab289bd94623..d681a2fd82661 100644 --- a/x-pack/test/functional_with_es_ssl/apps/cases/group1/view_case.ts +++ b/x-pack/test/functional_with_es_ssl/apps/cases/group1/view_case.ts @@ -296,6 +296,9 @@ export default ({ getPageObject, getService }: FtrProviderContext) => { }); it('shows unsaved comment message when page is refreshed', async () => { + await cases.singleCase.addComment('my comment'); + await header.waitUntilLoadingHasFinished(); + await testSubjects.click('property-actions-user-action-ellipses'); await header.waitUntilLoadingHasFinished(); @@ -319,7 +322,9 @@ export default ({ getPageObject, getService }: FtrProviderContext) => { await header.waitUntilLoadingHasFinished(); - await testSubjects.existOrFail('user-action-comment-unsaved-draft'); + retry.tryForTime(2000, async () => { + await testSubjects.existOrFail('user-action-comment-unsaved-draft'); + }); }); it('shows unsaved description message when page is refreshed', async () => {