Created
December 28, 2017 18:55
-
-
Save torounit/33cdc09cbb698f4b4287085da23c7fe5 to your computer and use it in GitHub Desktop.
Basic auth for backstopJS and Chromy
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
{ | |
"username" : "foo", | |
"password" : "bar", | |
} |
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
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