Protractor - 无障碍测试结果 - 分析结果

4

我正在使用Accessibility插件+Protractor。

如下所列,运行一些烟雾测试后,我看到了一些无障碍错误,但我不确定在E2E测试期间是否实际执行了无障碍审计。

由于我是新手,请告知是否有任何方法在E2E测试期间导航到新的网页后触发无障碍审计。

e2e-tests $ grunt protractor:websiteSmokeTests --website="https://testsite/"

Running "protractor:websiteSmokeTests" (protractor) task Using the selenium server at http://localhost:4444/wd/hub [launcher] Running 1 instances of WebDriver

website home page functionality
Homepage - check invalid search return 0 Results - pass
Check Webmaster tools - BingSiteAuth and Google - pass
WebMaster Tools - Check Robots.txt - pass

website onpage feedback functionality
Check on page feedback for an Article - Give No - pass

Finished in 28.875 seconds 8 tests, 101 assertions, 0 failure

plugin: 0 (teardown) Chrome A11Y - This element does not support ARIA roles, states and properties Chrome A11Y - aria-owns should not be used if ownership is implicit in the DOM Chrome A11Y - Elements with ARIA roles must be in the correct scope Chrome A11Y - Audio elements should have controls Chrome A11Y - This element has an invalid ARIA attribute Chrome A11Y - ARIA state and property values must be valid

    2 elements failed:
    <div id="cookie-notice" class="notification" aria-describedby="cookieinfo">
    <div class="cont ... " id="close-cookie-notification" class="close-notification">Close</button>
    </div>
</div>
    <div id="decommissioned-site-notice" class="notification strong hidden" aria-describedby="decommissi ... -site-notification"

class="close-notification">Close

    https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#ax_aria_04
Chrome A11Y - Elements with ARIA roles must use a valid, non-abstract ARIA role
Chrome A11Y - Controls and media elements should have labels
Chrome A11Y - An element's ID must be unique in the DOM
Chrome A11Y - (WARNING) These elements are focusable but either invisible or obscured by another element (10 elements failed)
Chrome A11Y - The web page should have the content's human language indicated in the markup
Chrome A11Y - Images should have an alt attribute
Chrome A11Y - (WARNING) The purpose of each link should be clear from the link text (3 elements failed)
Chrome A11Y - (WARNING) Text elements should have a reasonable contrast ratio (4 elements failed)
Chrome A11Y - role=main should only appear on significant elements
Chrome A11Y - Meaningful images should not be used in element backgrounds
Chrome A11Y - An element's ID must not be present in more that one aria-owns attribute at any time
Chrome A11Y - ARIA attributes which refer to other elements by ID should refer to elements which exist in the DOM

    2 elements failed:
    <div id="cookie-notice" class="notification" aria-describedby="cookieinfo">
    <div class="cont ... " id="close-cookie-notification" class="close-notification">Close</button>
    </div>
</div>
    <div id="decommissioned-site-notice" class="notification strong hidden" aria-describedby="decommissi ... -site-notification"

class="close-notification">Close

    https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#ax_aria_02

Chrome A11Y - This element has an unsupported ARIA attribute

    2 elements failed:
    <div id="cookie-notice" class="notification" aria-describedby="cookieinfo">
    <div class="cont ... " id="close-cookie-notification" class="close-notification">Close</button>
    </div>
</div>
    <div id="decommissioned-site-notice" class="notification strong hidden" aria-describedby="decommissi ... -site-notification"

class="close-notification">Close

    https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#ax_aria_10
Chrome A11Y - Video elements should use <track> elements to provide captions [launcher] 0 instance(s) of WebDriver still running

[launcher] chrome #1 failed 4 test(s) [launcher] overall: 4 failed spec(s) [launcher] Process exited with error code 1

Test failed but keep the grunt process alive.

Done, without errors.

4个回答

1
当激活时,辅助插件将与您现有的protractor测试一起运行,并审核测试所访问的每个完整页面。即使您的测试只是着陆在一个页面上以导航到另一个页面,并且在此过程中没有执行任何功能。
顺便提一下:我无法让 ngHint插件在我的测试中运行。任何帮助都将不胜感激。

0

我曾经遇到同样的问题,因此写了一个 protractor-accessibility-plugin 的衍生版本:protractor-axe-report-plugin。它只使用 aXe 引擎生成报告,但可以在测试中运行多个页面。


0

触发审核的方法是编写可让无障碍插件附加的测试...它不会爬行您的站点来运行审核。


0

如果您愿意自己动手,不使用您遇到困难的无障碍插件,webaccessibility.com提供了“Protractor Continuum”的免费实现示例,可能是一个很好的起点;您可以使用它将自动化可访问性测试集成到现有的Protractor测试中,或者轻松编写新的测试。 这里有更多信息,如果您感兴趣。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接