pa11y / pa11y-ci

Pa11y CI is a CI-centric accessibility test runner, built using Pa11y
https://pa11y.org
GNU Lesser General Public License v3.0
515 stars 63 forks source link

Using Cookies or useIncognitoBrowserContext in Pa11y-ci #190

Closed brownie1 closed 10 months ago

brownie1 commented 1 year ago

I am trying to test a website that requires a login for the site. The issue I am running into is that pa11y-ci is not able to get past the login screen. I know the username and password are correct. I have tried to set the useIncognitoBrowserContext to false with and without quotes. I have also tried to login via the browser and then steal the cookie from the browser. Below is what my .pa11yci file looks like right now.

{
  "defaults": {
     "useIncognitoBrowserContext": "false"
  },
  "urls": [
    {
      "url": "https://example.com/#/login?redirect=%2Fwidgets&isFreshLogin=true",
      "actions": [
         "set field #username to username@example.com",
         "set field #password to p@ssword123",
         "click element #login",
         "wait for element #widgets-list to be visible",
         "navigate to https://example.com/#/widgets"
      ],
      "screenCapture": "./after-login.png"
    },
    {
      "url": "https://example.com/#/widgets",
      "headers": {
        "Cookie": "login-token=0d3ce622baab4f46b31067bbcbfb5a4f"
      },
      "screenCapture": "./widgets.png"
    },
    "https://example.com/#/projects"
  ]
}
danyalaytekin commented 10 months ago

Hi @brownie1 👋 did you make any progress with this, or do you still need help? The version you've posted with "false" would set useIncognitoBrowserContext to true because it'll get converted to a Boolean but I realise you've mentioned you tried setting it to false as well (it does also default to false if the property is absent). I'll close this for now but please simply reopen it if you do need help.