Sar*_*rav 7 unit-testing jasmine selenium-webdriver protractor angular
我是一个新的量角器。我正在尝试在我的第一个 Angular2 应用程序上运行示例单元测试。
我的 conf.js 文件有:
exports.config = {
seleniumAddress: 'http://localhost:3000/login',
specs: ['todo-spec.js'],
capabilities: {
'browserName': 'chrome',
chromeOnly:true ,
directConnect: true }
};
Run Code Online (Sandbox Code Playgroud)
2.我的“todo-spec.js”文件有:
describe('Authentication capabilities', function() {
var email = element(by.id('inputusername'));
var password = element(by.id('inputPassword'));
var loginButton = element(by.class('btn-success'));
it('should redirect to the login page if trying to load protected page while not authenticated', function() {
browser.get('http://localhost:3000/login');
loginURL = browser.getCurrentUrl();
email.sendKeys("demo");
password.sendKeys("demo");
loginButton.click();
});
});
Run Code Online (Sandbox Code Playgroud)
但是当我尝试通过以下命令“量角器”filepath\conf.js”运行量角器时,
出现“E/launcher - 进程退出,错误代码 199”错误。
任何人都可以让我知道,我在哪里做错了吗?
useAllAngular2AppRoots: true,我通过添加配置文件来修复它。
还评论了"seleniumAddress: 'http://localhost:4444/wd/hub"
所以现在我的代码是这样的,并且可以工作。
exports.config = {
//seleniumAddress: 'http://localhost:4444/wd/hub',
//directConnect: true,
specs: ['todo-spec.js'],
capabilities: {
'browserName': 'chrome',
},
useAllAngular2AppRoots: true,
framework: 'jasmine'
};
Run Code Online (Sandbox Code Playgroud)