jeudi 21 juillet 2016

protractor table.filter times out

I have written my first acceptance test for angular 2 using protractor + cucumber and it seems when i call table.filter the browser hangs and times out till the timeout time.

I am using chai-as-promised for expectations:

var chai = require('chai');
var chaiAsPromised = require('chai-as-promised');
chai.use(chaiAsPromised);
var expect = chai.expect;

Below is the code which doesn't work.

var grid = $$(".table tr");
grid.filter(function (row) {
    var cells = row.$$('td');
    expect(cells.get(0).getText()).to.eventually.equal(factoryName).and.notify(done);

I have managed to make my scenario pass by replacing above code with:

var grid = $$(".table tr");
for (var i = 1; i < grid.count() ; i++) {
    var cells = grid.get(i).$$('td');
    expect(cells.get(0).getText()).to.eventually.equal(factoryName).and.notify(done);
}

I am struggling to find the reason why table.filter is causing timeouts.

Can anyone also help me with article/post, how to convert these steps.js into TypeScript which is a proper way of testing in angular2?

Aucun commentaire:

Enregistrer un commentaire