Skip to content

Commit

Permalink
Merge pull request #73 from alexneo2003/72-the-azure_pw_test_run_id-i…
Browse files Browse the repository at this point in the history
…s-not-available-as-a-variable-for-other-tasks

72 the azure pw test run id is not available as a variable for other tasks
  • Loading branch information
alexneo2003 authored Aug 6, 2024
2 parents c97f2fa + e6e3449 commit dd4a7a0
Show file tree
Hide file tree
Showing 16 changed files with 625 additions and 4,461 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@ on:

jobs:
publish:
runs-on: ubuntu-latest
permissions:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
packages: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '16.x'
node-version: '>=18'
registry-url: 'https://registry.npmjs.org'
# Defaults to the user or organization that owns the workflow file
scope: '@alex_neo'
- name: Install dependencies
run: yarn
run: yarn --ignore-engines
- name: Build
run: yarn build
- name: Publish
run: yarn publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '16.x'
node-version: '>=18'
- name: Install dependencies
run: yarn
run: yarn --ignore-engines
- name: Install Playwright
run: npx playwright install chromium
- name: Build project
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ test-results/
playwright-report/
dist
yarn-error.log
.vscode
.vscode
.taskkey
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
# [1.10.0](https://github.com/alexneo2003/playwright-azure-reporter/compare/v1.10.0-beta.0...v1.10.0) (2024-08-06)


### Features

* rework logger and reporter ([1186113](https://github.com/alexneo2003/playwright-azure-reporter/commit/118611375dac554c6671fd19b6a3d036e7052ad5))



# [1.10.0-beta.0](https://github.com/alexneo2003/playwright-azure-reporter/compare/v1.9.1...v1.10.0-beta.0) (2024-08-05)


### Features

* AZURE_PW_TEST_RUN_ID as Task variable ([8c7693a](https://github.com/alexneo2003/playwright-azure-reporter/commit/8c7693a510bf93ac2cb10c801a7d3b71295af420))



## [1.9.1](https://github.com/alexneo2003/playwright-azure-reporter/compare/v1.9.0...v1.9.1) (2024-06-04)


Expand Down
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@ Reporter options (\* - required):
- `testPointMapper` - A callback to map the test runs to test configurations, e.g. by browser

```
import { TestCase } from '@playwright/test/reporter'
import { TestPoint } from 'azure-devops-node-api/interfaces/TestInterfaces'
testPointMapper: async (testCase: TestCase, testPoints: TestPoint[]) => {
switch(testCase.parent.project()?.use.browserName) {
case 'chromium':
Expand Down Expand Up @@ -209,4 +212,19 @@ Reporter options (\* - required):
## Usefulness

- **AZURE_PW_TEST_RUN_ID** - Id of current test run. It will be set in environment variables after test run created. Can be accessed by `process.env.AZURE_PW_TEST_RUN_ID`. Pay attention what `publishTestResultsMode` configuration you use.
- **AZURE_PW_TEST_RUN_ID** - Id of current test run. It will be set in environment variables after test run created. Can be accessed by `process.env.AZURE_PW_TEST_RUN_ID`. Pay attention what `publishTestResultsMode` configuration you use. If you use `testResult` mode - this variable will be set when test run created, at the start of tests execution, if you use `testRun` mode - this variable will be set when test run completed, at the end of tests execution.

> **Since version 1.10.0 you have access to `AZURE_PW_TEST_RUN_ID` environment variable in your ADO pipeline. You can get it from the Task Variables.**
Example of usage in Azure DevOps pipeline:

```yaml
- script: npx playwright test
displayName: 'Run Playwright tests'
name: 'playwright'
env:
CI: 'true'

- script: echo $(playwright.AZURE_PW_TEST_RUN_ID)
displayName: 'Print test run id'
```
Loading

0 comments on commit dd4a7a0

Please sign in to comment.