Using Cookies or useIncognitoBrowserContext in Pa11y-ci

Viewed 29

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"
  ]
}
0 Answers
Related