plugins - 报告辅助功能插件结果

标签 plugins protractor

protractor.conf 文件配置为根据 https://github.com/larrymyers/jasmine-reporters#protractor 以 junit 格式报告 jasmine 测试结果

// An example configuration file.
// https://raw.github.com/angular/protractor/master/example/conf.js



exports.config = {
    // The address of a running selenium server.
 //   seleniumServerJar: './node_modules/protractor/selenium/selenium-server-standalone-2.41.0.jar', // Make use you check the version in the folder
    //seleniumAddress: 'http://localhost:4444/wd/hub',
    // Capabilities to be passed to the webdriver instance.
    capabilities: {
        'browserName': 'chrome'
    },
    framework: "jasmine2",
    onPrepare: function() {
        var jasmineReporters = require('jasmine-reporters');
        jasmine.getEnv().addReporter(new jasmineReporters.JUnitXmlReporter({
            consolidateAll: true,
            filePrefix: 'xmloutput',
            savePath: 'testresults'
        }));
    },
    // Options to be passed to Jasmine-node.
    jasmineNodeOpts: {
        showColors: true,
        defaultTimeoutInterval: 30000
    },
    plugins: [{
        chromeA11YDevTools: true,
        path: 'node_modules/protractor/plugins/accessibility'
    }]
};

不幸的是,它没有报告辅助功能插件的结果。

在终端中我看到:

   Pass:  Chrome A11Y - Audio elements should have controls 
     Pass:  Chrome A11Y - ARIA state and property values must be valid 
     Pass:  Chrome A11Y - Elements with ARIA roles must use a valid, non-abstract ARIA role 
     Fail:  Chrome A11Y - Controls and media elements should have labels 

            2 elements failed:
            <input type="checkbox" ng-model="todo.done" class="ng-pristine ng-untouched ng-valid">
            <input type="checkbox" ng-model="todo.done" class="ng-pristine ng-untouched ng-valid">

            https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#-ax_text_01--controls-and-media-elements-should-have-labels

如何实现这一目标?

最佳答案

这对于插件框架来说是不可能的。问题在于插件与所使用的测试框架无关,因此它们不会以 jasmine-reporters 特有的方式发出测试结果。

您可以使用配置中的 resultJsonOutputFile 获取 JSON 格式的所有测试和插件结果。我建议这样做,然后以您需要的任何方式处理它。

关于plugins - 报告辅助功能插件结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29913799/

相关文章:

从加载的共享对象库中调用主程序函数

java - 基于模块或插件开发系统应该如何入手?

eclipse - 运行 Eclipse 插件/更新镜像

javascript - 找不到模块 - 相对路径

javascript - 元素当前不可见,因此单击按钮时可能无法与之交互

typescript - 如何将 'describe' 、 'expect' 和 'it' 导入 IDE 的 typescript 测试中以不突出显示它们

plugins - 仅在maven-war-plugin中复制修改的文件

java - 用于主菜单栏选择的 Eclipse 监听器

angularjs - Protractor 中有 before() 函数吗?

javascript - 使用 Protractor 进行数据驱动测试