3

I am trying to test the accessibility of the login experience of a website I am working on using pa11y. I am using pa11y-ci with the config below but can't seem to get it to work:

{
   "urls": [
    {
      "url": "https://somewhere/home",
      "actions": [
        "set field #email to jondoe@somewhere.com",
        "click element #passwordsignin",
        "wait for url to be https://somewhere/password"
      ],
      "timeout": 60000
    }
  ]
}

It fails with the following error:

Error: Failed action: no element matching selector "#email"

I can see the input with id #email is in the HTML (based on the code and inspecting the HTML). I suspect the problem is that the tests are run before the input is rendered in the DOM (it is a single page application written in React). I tried to add something like below to the actions:

"wait for element #email to be added"

But it didn't work. I get the following error:

Error: Evaluation failed: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "default-src 'self'".

at new Function (<anonymous>)
at waitForPredicatePageFunction (<anonymous>:2:21)

Any help would be greatly appreciated, many thanks.

(FYI I am able to run the example listed here without any problems)

Carole
  • 31
  • 2

0 Answers0