From 73ba06e247f06af67b76042295a86ed9e908cb97 Mon Sep 17 00:00:00 2001 From: Yaroslav Kostenko Date: Tue, 27 Feb 2024 16:16:08 +0200 Subject: [PATCH] Update e2e-testing.md (#44) * Update e2e-testing.md * Update e2e-testing.md --- e2e-testing.md | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/e2e-testing.md b/e2e-testing.md index c8b6c1a..8346bf8 100644 --- a/e2e-testing.md +++ b/e2e-testing.md @@ -21,7 +21,9 @@ - [4\. Assertions](#4-assertions) - [4.1 One assertion per one test step method](#41-one-assertion-per-one-test-step-method) - [4.2 Use expect for assertions](#42-use-expect-for-assertions) -- [5\. Files naming](#3-files-naming) + - [4.2.1](#421-Playwright) + - [4.2.2](#422-Appium) +- [5\. Files naming](#5-files-naming) - [5.1. Name test files without should at the beginning](#51-name-test-files-without-should-at-the-beggining) - [6\. Class methods with conditional logic](#6-class-methods-with-conditional-logic) - [6.1. Use ternary operator for conditional logic ](#61-use-ternary-operator-for-conditional-logic) @@ -482,9 +484,10 @@ export class QuestionsEditorPage { #### 4.2. Use expect for assertions - Always use expect for assertions. +##### 4.2.1. Playwright + ```typescript // ❌ not recommended export class QuestionsEditorPage { @@ -508,6 +511,32 @@ export class QuestionsEditorPage { ``` +##### 4.2.2. Appium + +```typescript +// ❌ not recommended +export class QuestionsEditorPage { + + async assertQuestionIsPresentInTheList(question: string): Promise { + await step(`Assert question is present in the list`, async () => { + await this.questionInList(question).waitForDisplayed(); + }); + } +} + +// ✅ recommended +export class QuestionsEditorPage { + + 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(); + }); + } +} + +``` + 5\. Files naming --------------