尝试使用量角器进行测试我遇到了一个我无法解释或解决的大问题。
当我运行测试时,Protractor完全忽略所有测试并认为它已经成功完成。
这是我作为报告得到的:
[16:32:02] I/local - Starting selenium standalone server...
[16:32:02] I/launcher - Running 1 instances of WebDriver
[16:32:02] I/local - Selenium standalone server started at http://192.168.0.33:54345/wd/hub
problem trying to remove a folder
Started
....................................
36 specs, 0 failures
Finished in 0.249 seconds
[16:32:15] I/local - Shutting down selenium standalone server.
[16:32:15] I/launcher - 0 instance(s) of WebDriver still running
[16:32:15] I/launcher - chromeANY #01 passed
通常测试大约需要15分钟。
我正在使用grunt-protractor-runner来运行我的测试。
我的配置是:
Windows 10
grunt: 1.0.1
grunt-protractor-runner: 3.2.0
selenium-webdriver: 3.0.0
protractor-jasmine2-html-reporter: 0.0.5
我的conf文件是:
'use strict';
var env = require('./environment.js');
var Jasmine2HtmlReporter = require('protractor-jasmine2-html-reporter');
// conf.js
exports.config = {
capabilities: {
'browserName': 'chrome',
'version': 'ANY'
},
specs: [
'specs/01-basic.js',
'specs/02-login.js',
'specs/03-dmp.js',
'specs/04-cmp.js',
'specs/05-account.js'
],
suites: {
basic: 'specs/01-basic.js',
login: 'specs/02-login.js',
dmp: 'specs/03-dmp.js',
cmp: 'specs/04-cmp.js',
account: 'specs/05-account.js'
},
baseUrl: env.baseUrl + '/#/',
onPrepare: function() {
jasmine.getEnv().addReporter(
new Jasmine2HtmlReporter({
savePath: 'report/html',
screenshotsFolder: 'images/',
takeScreenshotsOnlyOnFailures: true,
consolidate: true,
consolidateAll: true
})
);
browser.driver.manage().window().maximize();
browser.driver.get(env.baseUrl + '/#/login');
element(by.model('user.Username')).sendKeys(env.login);
element(by.model('user.Password')).sendKeys(env.mdp);
element(by.id('loginSubmit')).click();
browser.waitForAngular();
}
};
谢谢!