Skip to content

Commit

Permalink
Update e2e-testing.md (#44)
Browse files Browse the repository at this point in the history
* Update e2e-testing.md

* Update e2e-testing.md
  • Loading branch information
iBrianWarner authored Feb 27, 2024
1 parent 79ae8b4 commit 73ba06e
Showing 1 changed file with 31 additions and 2 deletions.
33 changes: 31 additions & 2 deletions e2e-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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 {
Expand All @@ -508,6 +511,32 @@ export class QuestionsEditorPage {

```

##### 4.2.2. Appium

```typescript
// ❌ not recommended
export class QuestionsEditorPage {

async assertQuestionIsPresentInTheList(question: string): Promise<void> {
await step(`Assert question is present in the list`, async () => {
await this.questionInList(question).waitForDisplayed();
});
}
}

// ✅ recommended
export class QuestionsEditorPage {

async assertQuestionIsPresentInTheList(question: string): Promise<void> {
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
--------------

Expand Down

0 comments on commit 73ba06e

Please sign in to comment.