vendredi 6 octobre 2017

NightWatch.js test is failing when it shouldnt?

I am running a test which iterates over elements, and clicks on them, and then checks if they have an active class, this is my current test:

'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();
}

The current error I get in the console is this:

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"

As you can tell, it looks like my test should pass. it seems like the word "has" is what is causing my test to fail. Is there a way to remove that?

Aucun commentaire:

Enregistrer un commentaire