I am writing some protractor tests for an Angular app. After blurring an input field, a CSS file is reloaded in the application, and I'd like to test if that style has effectively being applied to the elements that uses classes from that CSS file.
我正在为Angular应用程序编写一些量角器测试。在模糊输入字段之后,在应用程序中重新加载CSS文件,并且我想测试该样式是否已经有效地应用于使用该CSS文件中的类的元素。
I've seen I can read values that are effectively on the styles attribute.
我已经看到我可以读取有效的样式属性值。
If it is not possible, then is there any way to test some element is rendered correctly using protractor??
如果不可能,那么有没有办法测试一些元素使用量角器正确渲染?
element.all(by.css('.input')).get(0).then(function(styleProperty){
styleProperty.clear();
styleProperty.sendKeys('10px', protractor.Key.TAB);
element(by.css('.element')).getCssValue('border').then(function (borderCssValue) {
expect(borderCssValue).toBe('10px');
});
Message:
Expected '' to be '10px'.
1 个解决方案
#1
16
border
is not a valid css value, since it expands to border-top
, border-left
, etc. Try
border不是有效的css值,因为它会扩展到border-top,border-left等。尝试
element(by.css('.element')).getCssValue('border-top').then(...)
#1
16
border
is not a valid css value, since it expands to border-top
, border-left
, etc. Try
border不是有效的css值,因为它会扩展到border-top,border-left等。尝试
element(by.css('.element')).getCssValue('border-top').then(...)