简体   繁体   English

pa11y json 动作配置文件:https://github.com/pa11y/pa11y#actions

[英]pa11y json configuration file for actions : https://github.com/pa11y/pa11y#actions

We use jenkins CI tool for automated accessibility testing provided by pa11y.我们使用 jenkins CI 工具进行 pa11y 提供的自动化可访问性测试。 As such i use the below Jenkinsfile to run the tests.因此,我使用下面的 Jenkinsfile 来运行测试。

 node('mypod') { container('centos') { def NODEJS_HOME env.NODEJS_HOME = "${tool 'Node-12.0.0'}" env.PATH="${env.NODEJS_HOME}/bin:${env.PATH}" sh "'${env.NODEJS_HOME}'/bin/node --version" sh "npm install -g pa11y --unsafe-perm" sh "pa11y -V" sh '''curl -O https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm yum -y install./google-chrome-stable_current_*.rpm yum -y install libXScrnSaver yum -y install atk java-atk-wrapper at-spi2-atk gtk3 libXt''' withCredentials([file(credentialsId: '***', variable: 'pa11yconfig')]) { sh "cat $pa11yconfig > config.json" sh "pa11y --config config.json --ignore WCAG2AA.Principle3.Guideline3_2.3_2_2.H32.2 --ignore WCAG2AA.Principle1.Guideline1_4.1_4_3.G145.Fail --ignore WCAG2AA.Principle1.Guideline1_4.1_4_3.G18.Fail --threshold 6 --reporter cli https://$URL > results.json" } } }

It installs the necessary things to run pa11y against the specified URL on linux based node.它安装必要的东西来在基于 linux 的节点上针对指定的 URL 运行 pa11y。 Windows are too much of a hassle so we use linux for this implementaion. Windows 太麻烦了,所以我们使用 linux 来实现。 Also to make this work for the browser to launch we use the below config.json file for pa11y to work.为了让浏览器启动,我们使用下面的 config.json 文件让 pa11y 工作。

 { "chromeLaunchConfig": { "args": [ "--no-sandbox", "--disable-setuid-sandbox", "--disable-dev-shm-usage" ] } }

All of this works like a charm for any URl we provide.对于我们提供的任何 URl,所有这些都像是一种魅力。 Now we would like to have some advanced configurations for lets say test if login works or filling a form on a webpage of a site so may be use Actions provided by pa11y.现在我们想要一些高级配置,比如测试登录是否有效或在网站的网页上填写表单,因此可以使用 pa11y 提供的操作。 How should i merge Actions code into this json configuration file to achieve that.我应该如何将 Actions 代码合并到这个 json 配置文件中来实现这一点。 Actions is documented under:- https://github.com/pa11y/pa11y#actions操作记录在:- https://github.com/pa11y/pa11y#actions

Any help or suggestions here would be greatly appreciated!任何帮助或建议将不胜感激!

Something like this:像这样的东西:

    "chromeLaunchConfig": {
        "args": [
            "--no-sandbox",
            "--disable-setuid-sandbox",
            "--disable-dev-shm-usage"
        ],
    },
    "reporter": "cli",
    "threshold": 6,
    "ignore:" [
        'WCAG2AA.Principle3.Guideline3_2.3_2_2.H32.2',
        'WCAG2AA.Principle1.Guideline1_4.1_4_3.G145.Fail',
        'WCAG2AA.Principle1.Guideline1_4.1_4_3.G18.Fail'
    ]
    "actions": [
        "navigate to $URL",
        "wait for $ThingToHappen"
    ]
}

(I also included options that you're currently passing to the CLI directly, in case that's of interest to you) (我还包括了您当前直接传递给 CLI 的选项,以防您感兴趣)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM