Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: CI

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Install extension dependencies
run: npm ci
- name: Build extension
run: npm run build
- name: Install task dependencies
run: npm ci
working-directory: tasks/UploadPortalHtmlReport
- name: Test upload task
run: npm test
working-directory: tasks/UploadPortalHtmlReport
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
node_modules/
package-lock.json
dist/
out/
*.vsix
Expand Down
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
save-exact=true
16 changes: 8 additions & 8 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Upload Postman Task",
"program": "${workspaceFolder}/tasks/UploadPostmanHtmlReport/index.js",
"name": "Upload HTML Report Task",
"program": "${workspaceFolder}/tasks/UploadPortalHtmlReport/index.js",
"outputCapture": "std",
"env": {
"AGENT_JOBNAME": "jobname",
"SYSTEM_DISPLAYNAME": "displayname",
"SYSTEM_STAGEDISPLAYNAME": "stagedisplayname",
"SYSTEM_STAGEATTEMPT": 1,
"INPUT_CWD": "${workspaceFolder}/tasks/UploadPostmanHtmlReport/test"
"SYSTEM_STAGEATTEMPT": "1",
"INPUT_REPORTDIR": "${workspaceFolder}/tasks/UploadPortalHtmlReport/tests/fixtures",
"INPUT_TABNAME": "HTML Report",
"INPUT_REDACTSECRETS": "false",
"INPUT_FAILONEMPTY": "true"
},
"skipFiles": [
"<node_internals>/**"
]
}
]
}
}
77 changes: 63 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,90 @@
# Azure Devops Postman HTML Report
# Azure DevOps HTML Report Portal

## About
Publish self-contained HTML reports (Newman HTML Extra, Playwright, Cypress, coverage, or any other HTML file) and view them as a tab on Azure Pipelines build and release results.

This Azure DevOps extension provides task for Publishing Postman / Newman HTML Reports into built into Azure Storage.
Each tab embeds the report in the pipeline UI and provides a download link.

Reports can be viewed as a tab in Build and Release result pages.
Tab contains embeded reports as well as direct download links.
This project is a fork of [maciejmaciejewski/azure-pipelines-postman](https://github.com/maciejmaciejewski/azure-pipelines-postman), generalized beyond Postman reports.

## Configuration

In order to use this extension first add `Upload Postman HTML Report` task to your pipeline. In your Postman / Newman execution task add `htmlextra` reporter that will generate `HTML` reports.
Add the **Upload HTML Report** task after your tests produce HTML output. Use `condition: succeededOrFailed()` so reports still publish when tests fail.

This tasks takes two parameters - required `cwd` which is path to the location where Postman / Newman HTML reports are stored and also optional `tabName` which is the name of the tab displayed within Azure DevOps report.
The task takes:

```YAML
- `reportDir` (required) — a single `.html`/`.htm` file, or a directory that is searched recursively
- `tabName` (optional) — tab label on the pipeline run (default: `HTML Report`)
- `redactSecrets` (optional) — mask Bearer tokens and common secret keys before upload (default: `false`)
- `failOnEmpty` (optional) — fail the task when no HTML files are found (default: `true`)

Reports should be **self-contained** HTML (CSS/JS inlined). Companion assets such as Playwright's `playwright-report/` folder are not published as a static site.

```yaml
steps:
- task: UploadPostmanHtmlReport@1
displayName: 'Upload Postman Html Report'
- task: UploadPortalHtmlReport@1
displayName: Upload HTML reports
condition: succeededOrFailed()
inputs:
reportDir: '$(System.DefaultWorkingDirectory)/reports'
tabName: 'Test Reports'
```

### Newman / Postman HTML Extra

```yaml
- script: npx newman run collection.json -r htmlextra --reporter-htmlextra-export reports/newman.html
- task: UploadPortalHtmlReport@1
condition: succeededOrFailed()
inputs:
reportDir: '$(System.DefaultWorkingDirectory)/reports/newman.html'
tabName: 'Postman'
redactSecrets: true
```

### Directory of reports

```yaml
- task: UploadPortalHtmlReport@1
condition: succeededOrFailed()
inputs:
cwd: '$(System.DefaultWorkingDirectory)'
tabName: 'Postman Test'
reportDir: '$(System.DefaultWorkingDirectory)/reports'
tabName: 'QA Reports'
```

Run the task more than once with different `tabName` values to publish multiple report groups.

![](./docs/postman-report-2.png)

## Example

### Report summary on build tab
### Report summary on the build tab

![](./docs/postman-report-1.png)

## Development

```bash
npm install
npm run build
npm install --prefix tasks/UploadPortalHtmlReport
npm test
```

The upload task runs on Node 16 and Node 20 pipeline agents. Node 10 is no longer supported.

## Contributors

<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
<tr>
<td align="center">
<a href="https://github.com/joneja09">
<img src="https://avatars.githubusercontent.com/u/33398109?v=4" width="100px;" alt=""/>
<br />
<b>Jeff Jones</b>
</td>
<td align="center">
<a href="https://github.com/maciejmaciejewski">
<img src="https://avatars1.githubusercontent.com/u/15831316?v=4" width="100px;" alt=""/>
<br />
Expand All @@ -50,4 +99,4 @@ steps:
</tr>
</table>
<!-- markdownlint-enable -->
<!-- prettier-ignore-end -->
<!-- prettier-ignore-end -->
47 changes: 25 additions & 22 deletions azure-devops-extension.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,38 @@
{
"manifestVersion": 1,
"id": "postman-report",
"name": "Postman Report",
"publisher": "MaciejMaciejewski",
"id": "html-report-portal",
"name": "HTML Report Portal",
"publisher": "joneja09",
"public": false,
"author": "Maciej Maciejewski",
"version": "1.1.3",
"description": "Embed Postman HTML reports in Azure Pipelines",
"author": "Jeff Jones",
"version": "1.2.0",
"description": "Embed HTML reports in Azure Pipelines",
"galleryFlags": [],
"repository": {
"type": "git",
"uri": "https://github.com/maciejmaciejewski/azure-pipelines-postman"
"uri": "https://github.com/joneja09/azure-pipelines-html-viewer"
},
"targets": [{ "id": "Microsoft.VisualStudio.Services" }],
"scopes": [
"vso.build_execute",
"vso.release_execute"
],
"icons": {
"default": "images/postman-icon-large.png"
"default": "images/HtmlPortal.png"
},
"demands": [
"api-version/3.0"
],
"tags": [
"Postman",
"Newman",
"HTML",
"Report",
"Viewer",
"Build",
"Release",
"Azure Pipelines",
"Visual Studio Extensions"
"Postman",
"Newman",
"Playwright"
],
"categories": [
"Azure Pipelines"
Expand All @@ -56,45 +59,45 @@
"addressable": true
},
{
"path": "tasks/UploadPostmanHtmlReport",
"path": "tasks/UploadPortalHtmlReport",
"addressable": false
}
],
"contributions": [
{
"id": "build-postman-tab",
"id": "build-html-portal-tab",
"type": "ms.vss-build-web.build-results-tab",
"description": "Embed Postman HTML report in Azure Pipelines Build",
"description": "Embed HTML Reports in Azure Pipelines Build",
"targets": ["ms.vss-build-web.build-results-view"],
"properties": {
"name": "Postman",
"name": "HTML Report",
"uri": "dist/tabContent.html",
"registeredObjectId": "registerBuild",
"supportsTasks": ["f5384bf0-1b5c-11ea-b0cc-5b064956a213", "0e9f302d-865d-52f6-aba0-a0e258493f6d"],
"supportsTasks": ["4d9a74ab-346a-4549-936a-6a3d3ad77227"],
"dynamic": true
},
"includes": ["ms.vss-releaseManagement-web.release-service-data-external"]
},
{
"id": "release-postman-tab",
"id": "release-html-portal-tab",
"type": "ms.vss-web.tab",
"description": "Embed Postman HTML report in Azure Pipelines Release",
"description": "Embed HTML Reports in Azure Pipelines Release",
"targets": [ "ms.vss-releaseManagement-web.release-environment-editor-tab" ],
"properties": {
"name": "Postman",
"name": "HTML Report",
"uri": "dist/tabContent.html",
"registeredObjectId": "registerRelease",
"dynamic": true
},
"includes": ["ms.vss-releaseManagement-web.release-service-data-external"]
},
{
"id": "UploadPostmanHtmlReport",
"id": "UploadPortalHtmlReport",
"type": "ms.vss-distributed-task.task",
"targets": ["ms.vss-distributed-task.tasks"],
"properties": {
"name": "tasks/UploadPostmanHtmlReport",
"displayName": "Upload Postman Report"
"name": "tasks/UploadPortalHtmlReport",
"displayName": "Upload HTML Report"
}
}
]
Expand Down
Loading
Loading