0

I just wanted to point out that if you have something like this:

element(by.model('someModel')).sendKeys('some value');
expect(by.model('someModel').getText()).toMatch('some value');

will fail!

giri-sh
  • 6,934
  • 2
  • 25
  • 50
Kevin Friedheim
  • 324
  • 1
  • 9
  • What is "someModel"? getText() works for me. But probably doesn't work in inputs. Have you tried this? expect(element(by.css('input[name="something"]')).getAttribute('value')).toMatch('some value'); – hhaamm Oct 07 '15 at 12:48
  • `someModel` is the value of an element's `ng-model` angular attribute. Regarding the latter part of your comment - see the solution I provided below. – Kevin Friedheim Oct 07 '15 at 18:19
  • when working with inputs don't use get text use getAttribute – Evan Burbidge Jan 04 '16 at 10:12

1 Answers1

2

This is because getText() will return an empty string - no matter what!

Instead, you should use:

expect(element(by.model('someModel')).getAttribute('value')).toMatch('some value');
alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195
Kevin Friedheim
  • 324
  • 1
  • 9