How to use Chrome profile?

21 views
Skip to first unread message

Peter Boomsma

unread,
Mar 8, 2018, 10:31:26 AM3/8/18
to CasperJS
I'm using BackstopJS to run multiple test scenarios. It seems to be working as intended on different pages such as tweakers.net and tourisme,groningen.nl but when I try to get a screenshot of my localhost:8080 I don't get the intended result.

allMyBackstopTests.js
var myButtonScenarios = require('./buttons').scenarios;
var myDialogScenarios = require('./dialog').scenarios;
var myTooltipScenarios = require('./tooltip').scenarios;

var allScenarios = [].concat(myTooltipScenarios, myDialogScenarios, myButtonScenarios);

//console.log(allScenarios);
module.exports = {
"viewports": [
{
"name": "tablet_h",
"width": 1024,
"height": 768
}
],
"onBeforeScript": "casper/onBefore.js",
"onReadyScript": "casper/onReady.js",
scenarios: allScenarios,
"paths": {
"bitmaps_reference": "backstop_data/bitmaps_reference",
"bitmaps_test": "backstop_data/bitmaps_test",
"engine_scripts": "backstop_data/engine_scripts",
"html_report": "backstop_data/html_report",
"ci_report": "backstop_data/ci_report"
},
"engine": "phantomjs",
"report": ["browser", "CLI"],
"debug": false,
"port": 3001
};

buttons.js,
exports.scenarios = {
"label": "Umbrella",
"selectorExpansion": true,
"misMatchThreshold" : 0.1,
"requireSameDimensions": true
}

dialog.js
exports.scenarios = {
"label": "Groningen",
"selectors": [
"#header"
],
"selectorExpansion": true,
"misMatchThreshold" : 0.1,
"requireSameDimensions": true
}



tooltip.js
exports.scenarios = {
"label": "Tweakers",
"selectorExpansion": true,
"misMatchThreshold" : 0.1,
"requireSameDimensions": true
}



I do get the intended 3 screenshots and when I run the test command I get 3 successes. 

The problem is that when I open a incognito browser in Chrome and visit localhost:8080 it takes about 2 seconds of loading, in this time the background of the page does change (this is reflected on the screenshot) but after 2 seconds the page is redirected to our Microsoft login page.

Is it possible to either pass in my Chrome profile so Casper can use my cache/history/cookies to go straight into the application and skip the Microsoft login page. Or either target the form, insert the login data and get redirected to the localhost:8080 page?

Ken Soh

unread,
Mar 17, 2018, 12:03:13 AM3/17/18
to CasperJS
BackstopJS (https://github.com/garris/BackstopJS) has since moved on to Chromium browser as the underlying browser (through Chromy project - https://github.com/OnetapInc/chromy). You might want to check out the latest BackstopJS and its implementation versus the current version you are using based on CasperJS + PhantomJS.
Reply all
Reply to author
Forward
0 new messages