Reputation: 1327
I using in my work protractor with jasmine . What found annoying and disturbing is ways I have to write always tests. I really don't like to do this waitsFor for promise from getCssValue. Can someone can show me better solution for asynchronous tests then this. At moment using Jasmine 2.0"
describe('And I see a “Burger Menu” option on the Header section', function () {
it('And the Left Hand Navigation is not visible When I access a Burger menu option on the ' +
'Header section Then I want to see the Left Hand Navigation menu', function () {
runs(function () {
Homepage.burger.click();
});
waits(500);
runs(function () {
Homepage.leftHandNav.getCssValue('display').then(function (item) {
displayStatus = item;
});
});
waitsFor(function () {
return displayStatus;
}, 200);
runs(function () {
expect(displayStatus).toBe('block');
});
});
It seems like very complicated code for such functionality.
Upvotes: 0
Views: 1299
Reputation: 13725
Have you tried this?
expect(Homepage.leftHandNav.getCssValue('display')).toBe('block');
With the most recent versions it looks like working.
AFAIK expect waits internally for the related promises.
Upvotes: 2