From 79cef7b8e3a4e22356e77014b21bbc79852e8479 Mon Sep 17 00:00:00 2001 From: Yaroslav Kostenko Date: Fri, 1 Mar 2024 13:48:55 +0200 Subject: [PATCH] Update e2e-testing.md (#46) * Update e2e-testing.md * Update e2e-testing.md --- e2e-testing.md | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/e2e-testing.md b/e2e-testing.md index 60ca025..297537b 100644 --- a/e2e-testing.md +++ b/e2e-testing.md @@ -513,6 +513,8 @@ export class QuestionsEditorPage { ##### 4.2.2. Appium +Split methods for waitings and assertions. If the method is called 'assert' it should contain expect. If the method contains only waitForDisplayed, name it as 'waitFor...'. + ```typescript // ❌ not recommended export class QuestionsEditorPage { @@ -522,15 +524,29 @@ export class QuestionsEditorPage { await this.questionInList(question).waitForDisplayed(); }); } + + async assertQuestionIsPresentInTheList(question: string): Promise { + await step(`Assert question is present in the list`, async () => { + await this.questionInList(question).waitForDisplayed(); + await expect(await this.questionInList(question).isDisplayed()).toBeTruthy(); + }); + } } // ✅ recommended export class QuestionsEditorPage { + async waitForQuestionIsPresentInTheList(question: string): Promise { + await step(`Wait for question is present in the list`, async () => { + await this.questionInList(question).waitForDisplayed(); + }); + } + async assertQuestionIsPresentInTheList(question: string): Promise { await step(`Assert question is present in the list`, async () => { - await this.questionInList(question).waitForDisplayed(); - await expect(await this.questionInList(question).isDisplayed()).toBeTruthy(); + await expect( + await this.questionInList(question).isDisplayed(), + ).toBeTruthy(); }); } }