Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/23.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
Angularjs 访问multiCapabilities配置对象内的自定义属性_Angularjs_Protractor - Fatal编程技术网

Angularjs 访问multiCapabilities配置对象内的自定义属性

Angularjs 访问multiCapabilities配置对象内的自定义属性,angularjs,protractor,Angularjs,Protractor,我在multiCapabilities配置属性中有一个自定义属性screenSize,如下所示: multiCapabilities: [{ browserName: 'chrome', screenSize: 'large', chromeOptions : { args: [ '--start-maximized' ] }, shardTestFiles: true }, { browserName:

我在multiCapabilities配置属性中有一个自定义属性
screenSize
,如下所示:

multiCapabilities: [{
    browserName: 'chrome',
    screenSize: 'large',
    chromeOptions : {
      args: [
        '--start-maximized'
      ]
    },
    shardTestFiles: true
  }, {
    browserName: 'chrome',
    screenSize: 'medium',
    chromeOptions : {
      args: [
        '--window-size=960,1000']
    },
    shardTestFiles: true
  }]
我希望能够在测试期间访问此属性,因为它将确定在每次测试运行期间需要单击哪些元素

在我尝试运行的测试套件中的beforeAll()中,我有以下内容:

browser.getCapabilities().then(function(caps) {
        console.log(caps);
        screenSize = caps.get('screenSize');
        console.log('SCREEN SIZE IS - ' + screenSize.toUpperCase());
      });
注销时caps的值为:

[chrome #11] Capabilities {
[chrome #11]   'acceptSslCerts' => true,
[chrome #11]   'applicationCacheEnabled' => false,
[chrome #11]   'browserConnectionEnabled' => false,
[chrome #11]   'browserName' => 'chrome',
[chrome #11]   'chrome' => { chromedriverVersion: '2.25.426923 (0390b88869384d6e
b0d5d09729679f934aab9eed)',
[chrome #11]   userDataDir: 'C:\\Users\\rparker\\AppData\\Local\\Temp\\scoped_di
r12912_15516' },
[chrome #11]   'cssSelectorsEnabled' => true,
[chrome #11]   'databaseEnabled' => false,
[chrome #11]   'handlesAlerts' => true,
[chrome #11]   'hasTouchScreen' => false,
[chrome #11]   'javascriptEnabled' => true,
[chrome #11]   'locationContextEnabled' => true,
[chrome #11]   'mobileEmulationEnabled' => false,
[chrome #11]   'nativeEvents' => true,
[chrome #11]   'networkConnectionEnabled' => false,
[chrome #11]   'pageLoadStrategy' => 'normal',
[chrome #11]   'platform' => 'Windows NT',
[chrome #11]   'rotatable' => false,
[chrome #11]   'takesHeapSnapshot' => true,
[chrome #11]   'takesScreenshot' => true,
[chrome #11]   'version' => '55.0.2883.87',
[chrome #11]   'webStorageEnabled' => true }
可以看出,我的额外财产在这里不可用

我怎样才能做到呢?这可能吗

另一方面(很抱歉,这应该是另一个问题),我注意到两个测试运行是同时执行的,我在args选项中定义的每个屏幕大小一个测试运行。我认为这是定义多个配置时的默认行为?你能让这些程序按顺序而不是并行运行吗


谢谢

我有你第二个问题的答案

问题2:你能让这些程序按顺序运行而不是并行运行吗? A2:是的,正如下面的摘录所说,选项
shardTestFiles
决定测试是否并行运行。完全

  /**
     * If this is set to be true, specs will be sharded by file (i.e. all
     * files to be run by this set of capabilities will run in parallel).
     * Default is false.
     */
    shardTestFiles?: boolean;