Skip to content

Commit 59f1cfe

Browse files
Custom reports Readme
1 parent 5151249 commit 59f1cfe

File tree

3 files changed

+32
-2
lines changed

3 files changed

+32
-2
lines changed

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,36 @@ If you choose the CI-only reporting or even no reporting (CLI is always on) you
529529
$ backstop openReport
530530
```
531531

532+
### Reporting in custom format
533+
534+
To format tests output in a custom way you may provide a script that will transform data. Add below configuration to your test config.
535+
536+
```json
537+
"customReports": {
538+
"reports": [
539+
{
540+
"script": "customReports/customReport.js",
541+
"name": "resultName.json"
542+
}
543+
],
544+
"reportLocation": "backstop_data/custom_report"
545+
}
546+
```
547+
548+
Your script `customReport.js` should take `config, reporter, resultName` as parameters and return a `Promise` when result is processed.
549+
To see example see `/test/configs/backstop_data/engine_scripts/customReports/xrayReport.js`. It can also incorporate additional information passed within scenarios like below:
550+
```json
551+
"scenarios": [
552+
{
553+
"label": "BackstopJstop_data/engine_scripts/cookies.json",
554+
"url": "https://garris.github.io/BackstopJS/",
555+
"metadata": ["TEST-1"]
556+
}
557+
```
558+
559+
560+
561+
Additionally
532562
#### Test report integration with a build system like Jenkins/Travis
533563

534564
The following config would enable the CI - report (*default: junit format*)

core/util/engineTools.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ function generateTestPair (config, scenario, viewport, variantOrScenarioLabelSaf
141141
requireSameDimensions: getRequireSameDimensions(scenario, config),
142142
misMatchThreshold: getMisMatchThreshHold(scenario, config),
143143
expect: getScenarioExpect(scenario),
144-
veportLabel: viewport.label,
144+
viewportLabel: viewport.label,
145145
...scenario
146146
};
147147
}

docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ENV \
99
RUN apt-get update && \
1010
apt-get install -y git sudo software-properties-common
1111

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

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

0 commit comments

Comments
 (0)