Angularjs 量角器配置-有没有办法将一些规范文件从异步运行中分离出来?
我对angular web应用程序(本文底部的conf.js文件)进行了一些量角器测试 有几个测试存储在不同的.js文件中,然后加载到中 除了测试之外,我还使用了多种功能,以便它能够以不同的分辨率测试我的网站,同时启动5个浏览器。这个很好用 但是,我的一个测试套件不需要与所有其他功能同时运行,这是因为我必须要求服务器更改一些设置,以使我正在执行的测试正常工作。我无法“模拟”这些服务器调用,因为来自服务器的响应对我正在运行的测试至关重要,我需要看到我调用并接收了来自实际服务器的预期响应,而不是模拟对象 因此,如果来自其他功能之一的任何其他测试同时运行,它们将从服务器返回错误信息 作为一种解决方法,我在conf文件中设置了maxSessions:1,这就停止了上述问题,但意味着我的测试将永远无法运行 有没有一种方法可以给spec声明两个数组,这样它就知道只有在没有其他测试运行的情况下才能运行一组测试?(我发明了SeparateSpecs属性来说明我得到了什么) 例如: 规范:[testCanRunInTandom1.js、testCanRunInTandom2.js、testCanRunInTandom3.js], 单独的规范:[MustRunAloneWithoutOtherCapabilities.js,mustrunalonewithouthercapabilities2.js] 我到处找了找,但什么也找不到。回答“不,你真的不能那样做”是可以接受的,但我希望有人知道一些秘密命令,你可以给量角器 以下是我当前的conf.js文件供参考:Angularjs 量角器配置-有没有办法将一些规范文件从异步运行中分离出来?,angularjs,protractor,Angularjs,Protractor,我对angular web应用程序(本文底部的conf.js文件)进行了一些量角器测试 有几个测试存储在不同的.js文件中,然后加载到中 除了测试之外,我还使用了多种功能,以便它能够以不同的分辨率测试我的网站,同时启动5个浏览器。这个很好用 但是,我的一个测试套件不需要与所有其他功能同时运行,这是因为我必须要求服务器更改一些设置,以使我正在执行的测试正常工作。我无法“模拟”这些服务器调用,因为来自服务器的响应对我正在运行的测试至关重要,我需要看到我调用并接收了来自实际服务器的预期响应,而不是模拟
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
};
是的,这是可能的,但您需要将gulp构建工具与运行序列()一起使用,或花费大量时间编写您自己的解决方案。是的,这是可能的,但您需要将gulp构建工具与运行序列()一起使用,或花费大量时间编写您自己的解决方案。