Skip to content

Instantly share code, notes, and snippets.

@akiya64
Created May 12, 2021 08:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akiya64/c94e6fdb613b289327748855d823e588 to your computer and use it in GitHub Desktop.
Save akiya64/c94e6fdb613b289327748855d823e588 to your computer and use it in GitHub Desktop.
Backstopjs on GitLab CI and Pages
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
{
"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
}
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