Skip to content

Commit

Permalink
Merge pull request #91 from reportportal/develop
Browse files Browse the repository at this point in the history
Release 5.0.9
  • Loading branch information
AmsterGet authored Mar 21, 2023
2 parents 2733028 + b9c2121 commit a49648e
Show file tree
Hide file tree
Showing 26 changed files with 4,491 additions and 3,828 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CI-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: 12.x
node-version: 18
- name: Clean install of node dependencies
run: npm ci
- name: Build the source code
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: 12.x
node-version: 18
- name: Clean install of node dependencies
run: npm ci
- name: Build the source code
Expand All @@ -45,7 +45,7 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: 12.x
node-version: 18
registry-url: 'https://registry.npmjs.org'
- name: Clean install of node dependencies
run: npm ci
Expand All @@ -61,7 +61,7 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: 12.x
node-version: 18
registry-url: 'https://npm.pkg.github.com'
scope: '@reportportal'
- name: Publish to GPR
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
### Fixed
- Issue [#79](https://github.com/reportportal/agent-js-playwright/issues/79) with duplicating tests with wrong statuses using `testInfo.fail()`.
- Issue [#85](https://github.com/reportportal/agent-js-playwright/issues/85) with suites finishing when retrying statically annotated (`.fixme()` or `.skip()`) tests. The issue still reproducible in some rare cases, refer [Issues troubleshooting](./README.md#issues-troubleshooting) for details.
### Changed
- `testCase.outcome()` used instead of `testResult.status` to calculate the final status for the test case in RP. Thanks to [clouddra](https://github.com/clouddra).
- `testCase.id` used instead of full test path to identify the test case.
- `engines` field in `package.json`. The agent supports the minimal version of `Node.js` required by `@playwright/test` (>=14).
- TypeScript compilation target changed to ES6.
- Docs [Attachments](./README.md#attachments) section actualized.
- `@reportportal/client-javascript` bumped to version `5.0.8`.

## [5.0.8] - 2022-09-28
### Fixed
Expand Down
40 changes: 32 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ npm install --save-dev @reportportal/agent-js-playwright
}
}
```

## Reporting

When organizing tests, specify titles for `test.describe` blocks, as this is necessary to build the correct structure of reports.
Expand All @@ -73,25 +74,26 @@ It is also required to specify playwright project names in `playwright.config.ts

### Attachments

Attachments can be easily added during test run via `testInfo.attachments` according to the Playwright [docs](https://playwright.dev/docs/api/class-testinfo#test-info-attachments).
Attachments can be easily added during test run via `testInfo.attach` according to the Playwright [docs](https://playwright.dev/docs/api/class-testinfo#test-info-attach).

```typescript
import { test, expect } from '@playwright/test';

test('basic test', async ({ page }, testInfo) => {
await page.goto('https://playwright.dev');

// Capture a screenshot and attach it.
const path = testInfo.outputPath('screenshot.png');
await page.screenshot({ path });
testInfo.attachments.push({ name: 'screenshot', path, contentType: 'image/png' });
// Capture a screenshot and attach it
const screenshot = await page.screenshot();
await testInfo.attach('screenshot', { body: screenshot, contentType: 'image/png' });
});
```

*Note:* attachment body can be provided instead of path.

As an alternative to this approach the [`ReportingAPI`](#log) methods can be used.

*Note:* [`ReportingAPI`](#log) methods will send attachments to ReportPortal right after their call, unlike attachments provided via `testInfo.attach` that will be reported only on the test item finish.

### Logging

You can use the following `console` native methods to report logs to tests:
Expand All @@ -104,10 +106,9 @@ console.warn();
console.error();
```

console`log`, `info`,`dubug` report as info log.
console's `log`, `info`,`dubug` reports as info log.

console `error`, `warn` report as error log if message contains "error" mention.
In other cases report as warn log.
console's `error`, `warn` reports as error log if message contains "error" mention, otherwise as warn log.

As an alternative to this approach the [`ReportingAPI`](#log) methods can be used.

Expand Down Expand Up @@ -335,3 +336,26 @@ To integrate with Sauce Labs just add attributes for the test case:
"value": "EU (your job region in Sauce Labs)"
}]
```

## Issues troubleshooting

### Launches stuck in progress on RP side

There is known issue that in some cases launches not finished as expected in ReportPortal while using static annotations (`.skip()`, `.fixme()`) that expect the test to be 'SKIPPED'.<br/>
This may happen in case of error thrown from `before`/`beforeAll` hooks, retries enabled and `fullyParallel: false`. Associated with [#85](https://github.com/reportportal/agent-js-playwright/issues/85).<br/>
In this case as a workaround we suggest to use `.skip()` and `.fixme()` annotations inside the test body:

use
```javascript
test('example fail', async ({}) => {
test.fixme();
expect(1).toBeGreaterThan(2);
});
```

instead of
```javascript
test.fixme('example fail', async ({}) => {
expect(1).toBeGreaterThan(2);
});
```
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.0.8
5.0.9-SNAPSHOT
Loading

0 comments on commit a49648e

Please sign in to comment.