Using transporter with Angular2

I have a small project in angular2 that I am trying to write some simple tests for using a protractor ..

I use ngFor to round the list of "foos" and display them on the page (quite simple).

Then I want my test to get the 1st text and check if it is a “bar”:

element.all(by.repeater('foo of foos')).get(1).then(function(x){
  expect(x.getText()).toEqual('bar');
});

But when I run my test, I get:

Failed: element.all (...). get (...) and then not a function

Any idea what I'm doing wrong?

+1
source share
1 answer

The problem is that:

  • element.all(by.repeater('foo of foos')).get(1) - this ElementFinder
  • ElementFinder then() ( Protractor 2.0.0)

:

var elm = element.all(by.repeater('foo of foos')).get(1);
expect(elm.getText()).toEqual('bar');
+1

Source: https://habr.com/ru/post/1675023/


All Articles