Angular 有没有办法让量角器只重新运行失败的浏览器测试?

Angular 有没有办法让量角器只重新运行失败的浏览器测试?,angular,automation,protractor,Angular,Automation,Protractor,我正在使用量角器flake并使用selenium网格并行运行浏览器测试。如果其中一个浏览器失败,我不想重新运行所有浏览器测试 是否有办法在配置中设置为仅重新运行失败的浏览器? 量角器配置文件 exports.config = { seleniumAddress: 'http://localhost:4444/wd/hub', getPageTimeout: 600000, allScriptsTimeout: 500000, def

我正在使用量角器flake并使用selenium网格并行运行浏览器测试。如果其中一个浏览器失败,我不想重新运行所有浏览器测试

是否有办法在配置中设置为仅重新运行失败的浏览器? 量角器配置文件

exports.config = {
        seleniumAddress: 'http://localhost:4444/wd/hub',
        getPageTimeout: 600000,
        allScriptsTimeout: 500000,
        defaultTimeoutInterval: 30000,
        framework: 'custom',
        // path relative to the current config file
        frameworkPath: require.resolve('protractor-cucumber-framework'),
        multiCapabilities:
        [{
          'browserName': 'chrome',
          specs: 'features/chrome/*.feature'
        },
        {
          'browserName': 'firefox',
          specs: 'features/firefox/*.feature'
        }],
        baseUrl: 'https://localhost:8080',
        ignoreSynchronization: true,
        cucumberOpts: {
          strict: true,
          require: [
            'hooks/hooks.js',
            'specs/*Spec.js'
          ],
          tags: [
            "@runThis", 
            "~@ignoreThis"
          ],
          profile: false,
          format: 'json:e2e/reports/cucumber-report.json',
          resultJsonOutputFile: 'e2e/reports/cucumber-report.json'
        },
        onPrepare: async function() {

          const fs = require('fs');
          const path = require('path');

          const directory = 'e2e/reports';

          //cleans up the json results from the previous build when using node flake
          fs.readdir(directory, (err, files) => {
            if (err) throw err;

            for (const file of files) {
              fs.unlink(path.join(directory, file), err => {
                if (err) throw err;
              });
            }
          });

          var chai = require('chai');
          chai.use(require('chai-as-promised'));
          global.expect = chai.expect;
          browser.ignoreSynchronization = true;
          await browser.manage().window().maximize();
          browser.waitForAngular();           
          browser.manage().timeouts().implicitlyWait(30000); 

        },
        onComplete: function() {

        }
    }

是的,为此,您需要使用要提供给输出的文件名重新运行报告程序:

format: ['pretty', 'rerun:@rerun.txt']
然后,您必须使用指定文件名的CUMBURE选项运行量角器:

protractor test/cucumber/conf/cucumber1Conf.js --cucumberOpts.rerun test/cucumber/@rerun.txt

更多信息可在此处找到:

谢谢您的评论!如何输入当前配置?我的格式设置为:“json:e2e/reports/cucumber report.json”。那么我会把它添加到数组中吗?格式:['pretty',json:e2e/reports/cucumber report.json','rerun:@rerun.txt']?是的,它将是config对象(可以是数组)的format属性中的一个新项:
exports.config={…format:[],…}