How to catch chrome shape validation popups

I am writing protractor tests to validate my form.

I want to check that the chrome validation popup appears when the required feed is not given in the form.

When the feed is not set, I get a "Please fill in this field" from chrome.

I want to do something like this:

submitBtn = element(by.id('submitBtn'));
submitBtn.click();
validationMessage = ???
expect((validationMessage ).getText()).toBe('Please fill out this field');

      

How do I get it?

+3


source to share


1 answer


You don't need to check internal Chrome implementations. Chrome devs would have tests for hiding and showing popups.

You check that your form is written correctly by finding the element that the attribute should be set required

to and claiming that it is indeed set.



myInput = element(by.id('myInput'));
expect(myInput.getAttribute('required')).toBeDefined();

      

+1


source







All Articles