Skip to content

Commit

Permalink
Custom reports Readme
Browse files Browse the repository at this point in the history
  • Loading branch information
justyna-olszak-wttech committed Jan 17, 2022
1 parent 5151249 commit 59f1cfe
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,36 @@ If you choose the CI-only reporting or even no reporting (CLI is always on) you
$ backstop openReport
```

### Reporting in custom format

To format tests output in a custom way you may provide a script that will transform data. Add below configuration to your test config.

```json
"customReports": {
"reports": [
{
"script": "customReports/customReport.js",
"name": "resultName.json"
}
],
"reportLocation": "backstop_data/custom_report"
}
```

Your script `customReport.js` should take `config, reporter, resultName` as parameters and return a `Promise` when result is processed.
To see example see `/test/configs/backstop_data/engine_scripts/customReports/xrayReport.js`. It can also incorporate additional information passed within scenarios like below:
```json
"scenarios": [
{
"label": "BackstopJstop_data/engine_scripts/cookies.json",
"url": "https://garris.github.io/BackstopJS/",
"metadata": ["TEST-1"]
}
```



Additionally
#### Test report integration with a build system like Jenkins/Travis

The following config would enable the CI - report (*default: junit format*)
Expand Down
2 changes: 1 addition & 1 deletion core/util/engineTools.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ function generateTestPair (config, scenario, viewport, variantOrScenarioLabelSaf
requireSameDimensions: getRequireSameDimensions(scenario, config),
misMatchThreshold: getMisMatchThreshHold(scenario, config),
expect: getScenarioExpect(scenario),
veportLabel: viewport.label,
viewportLabel: viewport.label,
...scenario
};
}
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ENV \
RUN apt-get update && \
apt-get install -y git sudo software-properties-common

RUN sudo npm install -g --unsafe-perm=true --allow-root https://github.com/justyna-olszak-wttech/BackstopJS.git#v5.4.5
RUN sudo npm install -g --unsafe-perm=true --allow-root https://github.com/justyna-olszak-wttech/BackstopJS.git#v6.0.4

RUN wget https://dl-ssl.google.com/linux/linux_signing_key.pub && sudo apt-key add linux_signing_key.pub
RUN sudo add-apt-repository "deb http://dl.google.com/linux/chrome/deb/ stable main"
Expand Down

0 comments on commit 59f1cfe

Please sign in to comment.