Skip to content

Commit

Permalink
Added screenshot support for Playwright.
Browse files Browse the repository at this point in the history
Fixed empty TestRun creation.
  • Loading branch information
gevorg-vardanyan-im committed May 31, 2024
1 parent 69b7d8b commit dff02a8
Show file tree
Hide file tree
Showing 7 changed files with 442 additions and 193 deletions.
38 changes: 36 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ The reporter supports the following features
- Update the test run results in TestRail either after running all test cases or simultaneously.
- You have an option to update the test results of the same test run which executed several times, by saving all history data. Or you can create a new test run for every execution.
- If a test case fails, you can observe an error message in the comment field of the TestRail test result.
- Supports screenshots and videos attachment to the test results for Playwright.

## Installation

Expand Down Expand Up @@ -163,10 +164,19 @@ To generate a report with [Vitest](https://vitest.dev/) or [Playwright](https://
<summary><b>Click to see Playwright usage</b></summary>

##### Add reporter to the config file
Open your config file (e.g., `playwright.config.js` or `playwright.config.ts`) and add `'@zealteam/testrail-reporter'` into the `reporters` array.
Open your config file (e.g., `playwright.config.js` or `playwright.config.ts`)
and add `'@zealteam/testrail-reporter'` into the `reporters` array.

```javascript
reporter: [['list'], ['@zealteam/testrail-reporter']],
export default defineConfig({

...

reporter: [['list'], ['@zealteam/testrail-reporter']],

...

});
```


Expand Down Expand Up @@ -200,6 +210,30 @@ test("@C123 has title", async ({ page }) => {
});
```

##### Schreenshots and Videos
No extra configuration is needed in the testrail.config.js file. Instead,
you can use Playwright configurations to generate screenshots and videos.

For instance, if you want to capture a screenshot when a test fails,
you should include the following configuration in your config file (e.g., `playwright.config.js` or `playwright.config.ts`):

```javascript
export default defineConfig({

...

use: {
screenshot: 'only-on-failure',
video: 'retain-on-failure',
},

...

});
```
Generated screenshots will be available in testrail run tests' attachments.


##### Run your tests

```code
Expand Down
39 changes: 37 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@zealteam/testrail-reporter",
"version": "1.0.8",
"version": "1.0.9",
"description": "A custom reporter for Vitest, Jest, and Playwright designed to synchronize with Testrail.",
"author": "Davit Manukyan <davit_m@zealous.tech>",
"repository": {
Expand Down Expand Up @@ -34,6 +34,7 @@
"dependencies": {
"@dlenroc/testrail": "^1.9.1",
"@playwright/test": "^1.40.1",
"axios": "^1.7.2",
"colorette": "^2.0.20",
"jest": "^29.7.0",
"log4js": "^6.9.1",
Expand Down
Loading

0 comments on commit dff02a8

Please sign in to comment.