New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unable to login with puppeteer onBefore script #1061
Comments
Best way to log in is to grab a valid set of cookies from your server, then modify the cookies.json file. Logging in manually is not really recommended. Maybe this issue will help... #688 |
Using cookies with backstop is very very very confusing. Is there a good tutorial on how to maintain a session throughout the backstop browsing process? Also, all of these examples tell you to "just export cookies" from your browser. Every browser I try has the cookies stored as a database. How do we export them? I've seen one site that gives you a python script and another that suggests a random tool from the internet... I have trust issues with these options. Where should we put them after we export them? Why wouldn't either Chromy or Puppetteer simply maintain their own set of cookies naturally instead of resetting the session after every scenario? |
Wow, you sound really frustrated. Don't worry -- It's going to be ok! Did you read the setting cookies section of the doc? https://github.com/garris/BackstopJS#setting-cookies Please note -- you'll need this plugin to export cookies 👉 https://chrome.google.com/webstore/detail/cookie-inspector/jgbbilmfbammlbbhmmgaagdkbkepnijn?hl=en Please try again using that plugin. It will export a JSON file -- you should store that with your test files and set the cookie path in your config to point to that file. Hopefully this helps some. ☮️ |
After almost loosing my mind, I think I finally figured it out :) Which is weird, since a domain shouldn't and even the "export cookies" extension linked doesn't (rightfully so). When that check fails, it simply assumes "https" without checking the "secure" flag from the cookie. I suggest something like this instead:
If plain http is not supported for cookies, I think that should be clear in the documentation. |
Hi, I'm new in backstopjs and puppeteer and I'm trying to login to my app through the onBefore.json file but it doesn't seem to work correctly. It even doesn't perform.
{
"id": "backstop_default",
"viewports": [
{
"label": "tablet",
"width": 1024,
"height": 768
}
],
"onBeforeScript": "puppet/onBefore.js",
"onReadyScript": "puppet/onReady.js",
"scenarios": [
{
"label": "BackstopJS Homepage",
"cookiePath": "backstop_data/engine_scripts/cookies.json",
"url": "myUrl",
"referenceUrl": "",
"readyEvent": "",
"readySelector": "",
"delay": 0,
"hideSelectors": [],
"removeSelectors": [],
"hoverSelector": "",
"clickSelector": "",
"postInteractionWait": 0,
"selectors": [],
"selectorExpansion": true,
"expect": 0,
"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": "puppeteer",
"engineOptions": {
"args": [ "--no-sandbox" ]
},
"asyncCaptureLimit": 5,
"asyncCompareLimit": 50,
"debug": true,
"debugWindow": true
}
Or maybe there is something wrong with my puppeteer script?
(async () => {
const puppeteer = require('puppeteer');
const browser = await puppeteer.launch();
const page = await browser.newPage({ waitUntil: 'domcontentloaded' });
})();
Could you please help me?
The text was updated successfully, but these errors were encountered: