[Question]How to add cookie to cookie.json and which elements are required?
See original GitHub issue- env:
- node: V8.9.4, BackstopJS v3.1.19, tomcat : 7.0.85
- test flow:
-
config tomcat-user , startup tomcat , listening port :8080, and service is working, tomcat-user can access tomcat example system;
-
execute “backstop init” to generate test project and config backstop.json : ` { “id”:“backstop_default”, “viewports”:[ { “label”:“tablet”, “width”:1024, “height”:768 } ], “onBeforeScript”:“chromy/onBefore.js”, “onReadyScript”:“chromy/onReady.js”, “scenarios”:[ { “label”:“Tomcat Homepage”, “cookiePath”:“backstop_data/engine_scripts/cookies.json”, “url”:“http://localhost:8080/manager/status”, “referenceUrl”:“”, “readyEvent”:“”, “readySelector”:“”, “delay”:10, “hideSelectors”:[
], "removeSelectors":[ ], "hoverSelector":"", "clickSelector":"", "postInteractionWait":"", "selectors":[ ], "selectorExpansion":true, "misMatchThreshold":0.1, "requireSameDimensions":true }
], “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” }, “report”:[ “browser” ], “engine”:“chrome”, “engineFlags”:[
], “asyncCaptureLimit”:5, “asyncCompareLimit”:50, “debug”:true, “debugWindow”:true }
`
- config cookie.json file : `
[ { “domain”:“.127.0.0.1:8080”, “path”:“/”, “name”:“tomcat”, “value”:“tomcat”, “expirationDate”:1551261424, “hostOnly”:false, “httpOnly”:false, “secure”:false, “session”:false } ]
` 4. executed “backstop reference”, and debugWindow notice to input tomcat-user and password.
-
change context of cookie.json to “SESSIONID” (copy from browser)
-
run “backstop reference” and notice authorization. but it works successfully in browser.
- my question:
- how to set cookies in cookie.json file and what elements are required?
- are the username and password fields which in cookie.json parts of page submit-form?
- can backstopJS work with cookie-info generated by browser?
thanks~
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (1 by maintainers)
Top GitHub Comments
@heaven1025 your cookies is right. If you use chrome, try to find the backstop_data/chromy/loadCookies.js, replace the
cookie.url = 'https://' + cookie.domain;
=>cookie.url = 'http://' + cookie.domain;
Here is the full sample:
@Kenith thanks for help at first!! And it works successfully after changing “https” to “http” protocol. Thanks very much~
But I want to know reasons, is user authentication specified by the Chrome browser?