Created
May 12, 2021 08:23
-
-
Save akiya64/c94e6fdb613b289327748855d823e588 to your computer and use it in GitHub Desktop.
Backstopjs on GitLab CI and Pages
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stages: | |
- get_reference | |
- regression_test | |
- publish | |
backstopjs_reference: | |
stage: get_reference | |
image: | |
name: backstopjs/backstopjs:latest | |
entrypoint: [""] | |
dependencies: | |
- deploy-staging | |
script: | |
- backstop reference | |
artifacts: | |
when: always | |
paths: | |
- backstop_data/html_report | |
allow_failure: true | |
backstopjs_test: | |
stage: regression_test | |
dependencies: | |
- backstopjs_reference | |
image: | |
name: backstopjs/backstopjs:latest | |
entrypoint: [""] | |
script: | |
- backstop test | |
artifacts: | |
when: always | |
paths: | |
- backstop_data/html_report | |
allow_failure: true | |
pages: | |
stage: publish | |
dependencies: | |
- backstopjs_test | |
script: | |
- mv backstop_data/html_report public | |
artifacts: | |
paths: | |
- public |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"id": "autumnsky.jp", | |
"viewports": [ | |
{ | |
"label": "phone", | |
"width": 320, | |
"height": 480 | |
}, | |
{ | |
"label": "midium", | |
"width": 1024, | |
"height": 768 | |
} | |
], | |
"onBeforeScript": "puppet/onBefore.js", | |
"onReadyScript": "puppet/onReady.js", | |
"scenarios": [ | |
{ | |
} | |
], | |
"paths": { | |
"bitmaps_reference": "backstop_data/html_report/bitmaps_reference", | |
"bitmaps_test": "backstop_data/html_report/bitmaps_test", | |
"engine_scripts": "backstop_data/engine_scripts", | |
"html_report": "backstop_data/html_report", | |
"ci_report": "backstop_data/ci_report" | |
}, | |
"report": ["browser"], | |
"engine": "puppeteer", | |
"engineOptions": { | |
"args": [""] | |
}, | |
"asyncCaptureLimit": 2, | |
"asyncCompareLimit": 10, | |
"debug": false, | |
"debugWindow": false | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = async (page, scenario, vp) => { | |
const USERNAME = 'USER'; | |
const PASSWORD = 'PASS'; | |
await page.setExtraHTTPHeaders({ | |
Authorization: `Basic ${new Buffer(`${USERNAME}:${PASSWORD}`).toString('base64')}` | |
}); | |
await require('./loadCookies')(page, scenario); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment