Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 无头铬合金断裂F描述并适合量角器试验_Angular_Google Chrome_Jasmine_Protractor_Headless - Fatal编程技术网

Angular 无头铬合金断裂F描述并适合量角器试验

Angular 无头铬合金断裂F描述并适合量角器试验,angular,google-chrome,jasmine,protractor,headless,Angular,Google Chrome,Jasmine,Protractor,Headless,我一直在Chrome浏览器上为Angular 4应用程序运行量角器测试。我想使用Headless Chrome,但当我切换到Headless Chrome配置时,它会阻止我在通过ng test运行测试时关注特定的测试。例如,如果我对一个测试用例执行“fDescribe”,它仍然会运行我的所有量角器测试。有人知道无头chrome的哪些配置变化会阻止focus为fDescribe and fIt工作吗 // Protractor configuration file, see link for mo

我一直在Chrome浏览器上为Angular 4应用程序运行量角器测试。我想使用Headless Chrome,但当我切换到Headless Chrome配置时,它会阻止我在通过ng test运行测试时关注特定的测试。例如,如果我对一个测试用例执行“fDescribe”,它仍然会运行我的所有量角器测试。有人知道无头chrome的哪些配置变化会阻止focus为fDescribe and fIt工作吗

// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts

const { SpecReporter } = require('jasmine-spec-reporter');
var jasmineReporters = require('jasmine-reporters');
var phantomJSPath = require('phantomjs-prebuilt').path;


exports.config = {
  allScriptsTimeout: 11000,
  specs: [
    './e2e/**/*.e2e-spec.ts'
  ],
  capabilities: {
    // 'browserName': 'phantomjs',
    'browserName': 'chrome',
    'loggingPrefs': { browser: "ALL" },
    'phantomjs.binary.path': phantomJSPath,
    'chromeOptions': {
      'args': ['--headless', '--disable-gpu', 'window-size=1400x800', 'disable-infobars']
    },
    shardTestFiles: true,
    //maxInstances: 3
  },
  directConnect: true,
  baseUrl: 'http://localhost:4200/',
  framework: 'jasmine',
  jasmineNodeOpts: {
    showColors: true,
    defaultTimeoutInterval: 60000,
    print: function () { }
  },
  onPrepare() {
    require('ts-node').register({
      project: 'e2e/tsconfig.e2e.json'
    });
    jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
    jasmine.getEnv().addReporter(new jasmineReporters.JUnitXmlReporter({
      consolidateAll: true,
      savePath: './',
      filePrefix: 'xmlresults'
    }));
    var fs = require('fs-extra');

    fs.emptyDir('screenshots/', function (err) {
              console.log(err);
          });

          jasmine.getEnv().addReporter({
              specDone: function(result) {
                  if (result.status == 'failed') {
                      browser.getCapabilities().then(function (caps) {
                          var browserName = caps.get('browserName');

                          browser.takeScreenshot().then(function (png) {
                              var stream = fs.createWriteStream('screenshots/' + browserName + '-' + result.fullName.substring(0, 20) + '.png');
                              stream.write(new Buffer(png, 'base64'));
                              stream.end();
                          });
                      });
                  }
              }
          });
  },

  //HTMLReport called once tests are finished 
  onComplete: function () {
    var browserName, browserVersion;
    var capsPromise = browser.getCapabilities();

    capsPromise.then(function (caps) {
      browserName = caps.get('browserName');
      browserVersion = caps.get('version');

      var HTMLReport = require('protractor-html-reporter');

      testConfig = {
        reportTitle: 'Query Tool e2e Test Execution Report',
        outputPath: './',
        screenshotPath: './screenshots',
        testBrowser: browserName,
        browserVersion: browserVersion,
        modifiedSuiteName: false,
        screenshotsOnlyOnFailure: true
      };
      new HTMLReport().from('./xmlresults.xml', testConfig);
    });
  }
};
--headless
没有破坏焦点,问题出在
shardTestFiles:true
中,它与jasmine
fdescribe()
fit()
不兼容

请点击此处: