Skip to content

Commit

Permalink
Update readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
krishnapollu authored Aug 9, 2023
1 parent 5babb6d commit d3ccd63
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,51 @@ Uses SwagLabs demo app for test execution
`` npx playwright tests ``
- headed
`` npx playwright tests --headed ``

## Reports

#### Default Playwright Reports
`` npx playwright show-report ``

#### Allure Integration

Install allure reportet for playwright
`` npm i -D @playwright/test allure-playwright ``

Update playwright.config.js
```
reporter: [
['html'],
['allure-playwright', {
detail: true,
suiteTitle: false,
}]
],
```

Reporting Util
```
exports.ReportUtil = class ReportUtil {
constructor(page, testInfo){
this.page = page;
this.testInfo = testInfo;
}
async takeScreenshot(){
await this.testInfo.attach("login success", {
body: await this.page.screenshot(),
contentType: "image/png",
});
}
};
```

Add attachment from code
```
this.ru = new ReportUtil(this.page, this.testInfo);
...
await this.ru.takeScreenshot();
```

Generate and View Allure report
`` allure serve ``

0 comments on commit d3ccd63

Please sign in to comment.