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 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.
Returns
section warns you that this is aPromise
. See: angular.github.io/protractor/#/… Example from the doc:var started = startTestServer(); driver.wait(started, 5 * 1000, 'Server should start within 5 seconds'); driver.get(getServerUrl());
– Reinsure