Skip to content

Instantly share code, notes, and snippets.

@torounit
Created December 28, 2017 18:55
Show Gist options
  • Save torounit/33cdc09cbb698f4b4287085da23c7fe5 to your computer and use it in GitHub Desktop.
Save torounit/33cdc09cbb698f4b4287085da23c7fe5 to your computer and use it in GitHub Desktop.
Basic auth for backstopJS and Chromy
{
"username" : "foo",
"password" : "bar",
}
const basic = require('./basic.json')
const btoa = function (str) { return new Buffer(str).toString('base64') }
module.exports = function (chromy, scenario, vp) {
require('./loadCookies')(chromy, scenario)
const authHeader = btoa(basic.username + ':' + basic.password);
chromy.userAgent(vp.userAgent);
chromy.headers({
'Authorization': 'Basic ' + authHeader
} )
chromy.ignoreCertificateErrors()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment