mardi 29 novembre 2016

How to check if an HTML5 validation was triggered using phantomjs?

I am testing my ember app(ember 1.6) using phantomjs. I want to assert that HTML 5 validation is triggered for invalid input. Here is my test:

fillIn('#MyInputField', 'some invalid data');
click('#MyButton');

andThen(function() {
    strictEqual(find('#MyInputField:invalid').length, 1, 'Expected HTML 5 validation triggered!');
});

This works fine when test it using karma when testing in browser. But when testing in phantomjs this fails. I have made screenshot and according to that image there is no HTML 5 validation.

Aucun commentaire:

Enregistrer un commentaire