量角器角度2失败:未知错误:未定义角度 [英] Protractor Angular 2 Failed: unknown error: angular is not defined
问题描述
我收到以下错误:
- 失败:未知错误:未定义角度
只有在使用像by.model这样的角度特定选择器时才会发生这种情况。但是诸如by.css之类的选择器可以正常工作。这是一个Angular 2应用...
测试
它('应该设置焦点',()=> {
//这个工作
// var input = element(by.css('myclass'));
//这个失败
var input = element(by.model('config.value'));
input.clear();
input.sendKeys('test');
input。 sendKeys(Key.TAB);
input.click();
var highlightedText = browser.executeScript(function getSelectionText()
{
return window.getSelection()。toString( );
});
expect(highlightedText).toEqual('test');
});
exports.config = {
baseUrl:'http:// localhost:5555',
specs:[
'rad /dev/**/*.e2e.js'
],
排除:[],
框架:'jasmine2',
allScriptsTimeout :110000,
jasmineNodeOpts:{
showTiming:true,
showColors:true,
isVerbose:false,
includeStackTrace:false,
defaultTimeoutInterval:400000
},
directConnect:true,
功能:{
'browserName':'chrome'
},
onPrepare:function(){
var SpecReporter = require('jasmine-spec-reporter');
jasmine.getEnv()。addReporter(new SpecReporter({displayStacktrace:true}));
browser.ignoreSynchronization = false;
},
useAllAngular2AppRoots:true
};
chrome = 49.0.2623.87
chromedriver = 2.9.248315
platform = Windows NT 6.1 SP1 x86_64
node = 5.9.1
我在开发人员的angular.io网站上找到了答案文档。
现在不支持.model和by.binding的角度选择器。目前尚不清楚这些是可能的功能还是他们正在为角度2工作。
I'm getting the following error:
- Failed: unknown error: angular is not defined
This only happens when using angular specific selectors like "by.model". But selectors such as "by.css" work correctly . This is an Angular 2 app...
Test
it('should set focus', () => {
//This works
//var input = element(by.css('myclass'));
//This fails
var input = element(by.model('config.value'));
input.clear();
input.sendKeys('test');
input.sendKeys(Key.TAB);
input.click();
var highlightedText = browser.executeScript(function getSelectionText()
{
return window.getSelection().toString();
});
expect(highlightedText).toEqual('test');
});
exports.config = {
baseUrl: 'http://localhost:5555',
specs: [
'dist/dev/**/*.e2e.js'
],
exclude: [],
framework: 'jasmine2',
allScriptsTimeout: 110000,
jasmineNodeOpts: {
showTiming: true,
showColors: true,
isVerbose: false,
includeStackTrace: false,
defaultTimeoutInterval: 400000
},
directConnect: true,
capabilities: {
'browserName': 'chrome'
},
onPrepare: function() {
var SpecReporter = require('jasmine-spec-reporter');
jasmine.getEnv().addReporter(new SpecReporter({displayStacktrace: true}));
browser.ignoreSynchronization = false;
},
useAllAngular2AppRoots: true
};
chrome=49.0.2623.87 chromedriver=2.9.248315 platform=Windows NT 6.1 SP1 x86_64 node=5.9.1
I found the answer on the angular.io site under developer docs.
Right now angular selectors by.model and by.binding are not supported. Its not clear if these are features that are possible or that they are working on for angular 2.
这篇关于量角器角度2失败:未知错误:未定义角度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!