javascript - Why must I use browser.sleep while writing protractor tests -
my first run @ e2e tests. i'm trying digest else's protractor tests.
problem: there lot of browser.driver.sleep
, seems fragile.
goal: not use browser.driver.sleep
question: better approach browser.driver.sleep
? less fragile promise or dont know lol?
var config = require('../../protractor.conf.js').config; describe('this homepage body tests', function(){ browser.driver.get(config.homepageurl); it("should open find clinic page", function(){ // page loads :: want fix random wait interval browser.driver.sleep(2000); browser.ignoresynchronization = true; var string = 'clinic'; var main = '.search-large-text'; var link = element(by.csscontainingtext('.submenu li a', string)); link.click().then(function() { // page reloads :: want fix random wait interval browser.driver.sleep(3000); var title = element(by.csscontainingtext(main, string)); expect(title.gettext()).tobe(string); }); }); });
since there ignoresynchronization
turned on, cannot use waitforangular()
, solution in case of angular-site testing.
a better solution here set page load timeout:
browser.manage().timeouts().pageloadtimeout(10000); // 10 seconds
see these relevant threads on explicit waits , timeouts:
Comments
Post a Comment