Skip to content

Commit

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

* Update e2e-testing.md
  • Loading branch information
iBrianWarner authored Mar 1, 2024
1 parent e2b8e59 commit 79cef7b
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions e2e-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -522,15 +524,29 @@ export class QuestionsEditorPage {
await this.questionInList(question).waitForDisplayed();
});
}

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();
});
}
}

// ✅ recommended
export class QuestionsEditorPage {

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

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();
await expect(
await this.questionInList(question).isDisplayed(),
).toBeTruthy();
});
}
}
Expand Down

0 comments on commit 79cef7b

Please sign in to comment.