1

I am trying to test some form by adding appropriate text to my input fields, but for some reason I am not getting what I'm sending. The problem I am having is with ['name=type_input]' and sendKeys('Ciężarówka'). When I run the test the input field gets filled with letters in the wrong order, for example "kaCiężaów" or "aCiężarówk" and that causes my entire test to fail. Sometimes the order is correct and than the test passes. Can someone explain what is happening?

it('should add vehicle', function() {
   element(by.css('[name=type_input]')).sendKeys('Ciężarówka').sendKeys(protractor.Key.TAB);

   element(by.css('[name=name]')).sendKeys('Nie Super Auto 555').sendKeys(protractor.Key.TAB);
   element(by.model('model.carId')).sendKeys('54536');
   element(by.css('[name=numberPlate]')).sendKeys('KU PAA').sendKeys(protractor.Key.TAB);
   helpers.selectAnyFromKendoComboBox('vehicle', 'haulier');
   helpers.save('vehicle');

   alertify.expectSuccessMessage('Zapisano');

});
sinsuren
  • 1,745
  • 2
  • 23
  • 26

1 Answers1

0

First of all, isolate the problem:

  • is this input the only one with this behavior in your application? Does it have an input validation or any animations related to typing?
  • would the test fail if you would type, say, test instead of Ciężarówka?
  • can you reproduce the problem in other browsers or other machines?

Here is a couple of things to try:

Community
  • 1
  • 1
alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195
  • That is the only input that is giving me a problem. Other types of vehicles are "Naczepa", "Przyczepa" and "Ciągnik". They all pass the test. I thought that the problem is related to Polish letters ą, ę, ó etc. since there is so many of them in "Ciężarówka" , but in a word "Ciągnik" there is a letter "ą" and protractor doesn't have a problem with it. – Lukasz Kisicki Aug 03 '16 at 06:42
  • No validation or animation. Still have to check it on other browsers – Lukasz Kisicki Aug 03 '16 at 06:45
  • I've run same tests muliple times on different machine, where internet connection is much slower and all the tests passed? Any ideas how to fix this so I don't have this problem on the machine I usually work. I like the idea of "slow typing" but when I was trying to implement it in my code I received an error saying ".sleep is not a function" – Lukasz Kisicki Aug 03 '16 at 18:11
  • @LukaszKisicki yeah, cause you need to introduce the `sleep` action. There is a note about that in the linked topic. Thanks. – alecxe Aug 03 '16 at 18:12