量角器配置 - 有没有办法将一些spec文件与asycnronously运行分开?

时间:2015-06-30 08:09:45

标签: angularjs protractor

我的角网页应用程序有一些量角器测试(本文底部的conf.js文件)。

有几个测试存储在不同的.js文件中,然后加载。

除了测试之外,我还使用多种功能,以便能够以各种分辨率测试我的网站,同时启动5个浏览器。这很好。

然而,我的一个测试套件不需要与所有其他功能同时运行,这是因为我必须要求服务器更改我正在执行的测试的某些设置才能工作。我无法嘲笑'这些服务器调用,因为来自服务器的响应对我正在运行的测试至关重要,我需要看到我调用并接收了来自实际服务器而不是模拟对象的预期响应。

因此,如果其他功能中的任何其他测试同时运行,则会从服务器返回错误的信息。

作为解决方法,我在我的conf文件中设置 maxSessions:1 ,这可以解决上述问题,但这意味着我的测试需要永远运行!

有没有办法给规范声明两个数组,所以它知道只有在没有其他运行的情况下运行一堆测试? (我发明了seperateSpecs属性来说明我所得到的)

例如: 规格:[testCanRunInTandom1.js,testCanRunInTandom2.js,testCanRunInTandom3.js],

seperateSpecs:[MustRunAloneWithoutOtherCapabilities.js,MustRunAloneWithoutOtherCapabilities2.js]

我已经看过了,但找不到任何东西。回答“不,你真的不能这样做'是可以接受的,但我希望有人知道你可以给量角器一些秘密命令!

这是我当前的conf.js文件供参考:

 var specFiles = ['NavigationTests.js', 'HeaderTests.js', 'TableTypeTests.js', 'DepositTests.js','loginTests.js','userPrefsTests.js', 'progressBarTests.js', 'aboutPageTests.js'];


// multiCapabilities stuff set now near bottom of file to make it easier to add/change/remove capabilities

var HtmlReporter = require('protractor-html-screenshot-reporter');
var request = require('request');

var desktopSpec=  
{
    // Desktop
   'browserName': 'chrome',
   'chromeOptions' : 
   {
       args: ['--lang=en', '--window-size=1690,800']
   },
   specs: specFiles,

};

var iPhone3gSpec=
{
  //iphone 3G portrait
 'browserName': 'chrome',
 'chromeOptions' : 
 {
  args: ['--lang=en',
         '--window-size=320,480']
 },
 specs: specFiles
};

var iPhone3gLandscapeSpec=
{
  //iphone 3G landscape
 'browserName': 'chrome',
 'chromeOptions' : 
 {
  args: ['--lang=en',
         '--window-size=480,320']
 },
 specs: specFiles
};

var iPadSpec=
  {
    //ipad portrait
   'browserName': 'chrome',
   'chromeOptions' : 
   {
    args: ['--lang=en',
           '--window-size=1024,768']
   },
   specs: specFiles
  };

var iPadLandscapeSpec=
{
  //ipad landscape
 'browserName': 'chrome',
 'chromeOptions' : 
 {
  args: ['--lang=en',
         '--window-size=768,1024']
 },
 specs: specFiles
};

var multiCapabilities=[];
multiCapabilities.push(desktopSpec);
multiCapabilities.push(iPhone3gSpec);
multiCapabilities.push(iPhone3gLandscapeSpec);
multiCapabilities.push(iPadSpec);
multiCapabilities.push(iPadLandscapeSpec);


// Configuration file
exports.config = {
  directConnect: true,

  // Options to be passed to Jasmine-node.
  jasmineNodeOpts: {
    showColors: true,
    includeStackTrace: false,
    defaultTimeoutInterval: 30000
  },

  // Run the tests in the different windows sizes
  multiCapabilities: multiCapabilities,

   onPrepare: function() {
      // Add a screenshot reporter and store screenshots to `/tmp/testresults/screnshots`: 
      jasmine.getEnv().addReporter(new HtmlReporter({
         baseDirectory: 'tmp/testresults/screenshots'
      }));
   },

   maxSessions: 1
   };

0 个答案:

没有答案
相关问题