mardi 6 janvier 2015

Protractor browser.wait doesn't actually wait

I am assuming that browser.wait should be a blocking call, but it is not working as I expected. Here is my sample:



describe("browser.wait", function() {

beforeEach(function() {

browser.wait(function() {
console.log('1 - BeforeEach WAIT');
return true;
});

console.log('2 - BeforeEach after wait');

});

afterEach(function() {

browser.wait(function() {
console.log('4 - afterEach WAIT');
return true;
});

console.log('5 - afterEach after wait');

});

it('should probably actually wait.', function() {

console.log('3 - IT statement');
expect(1).toBe(1);

});

});


Now, because I assumed browser.wait was actually blocking, I thought that my console.log calls would be run in order; 1,2,3,4,5;


The actual output I get is:


2 - BeforeEach after wait

1 - BeforeEach WAIT

3 - IT statement

5 - afterEach after wait

4 - afterEach WAIT


How can I get browser.wait to actually wait? Or am I using the wrong function completely? I need things to block until my browser gets to where it needs to be for the next call.


Aucun commentaire:

Enregistrer un commentaire