0
我运行它迭代元素,并在其上点击,如果他们有一个活跃的类,然后检查测试,这是我目前的测试:NightWatch.js测试失败时,它不应该?
'testing if executing a function works': function(client) {
client.elements('css selector', '#home-main-content .swiper-container-vertical>.swiper-pagination-bullets .swiper-pagination-bullet', function(res) {
var numberOfElements = res.value.length;
for (var i = 1; i <= numberOfElements; i++) {
clicked('.swiper-pagination-bullet:nth-of-type' + '(' + i + ')')
}
function clicked(iteration) {
client.click(iteration, function(res2) {
client.assert.cssClassPresent(iteration, '.swiper-pagination-bullet swiper-pagination-bullet-active');
})
}
}).end();
}
的当前错误我在控制台得到的是这个:
Testing if element <.swiper-pagination-bullet:nth-of-type(1)> has css class:
".swiper-pagination-bullet swiper-pagination-bullet-active".
- expected "has .swiper-pagination-bullet swiper-pagination-bullet-active"
but got: "swiper-pagination-bullet swiper-pagination-bullet-active"
正如你所看到的,它看起来像我的测试应该通过。似乎“有”这个词就是导致我的测试失败的原因。有没有办法消除这种情况?