YahooArchive / arrow

FE Test framework designed to promote TDD
http://yahoo.github.io/arrow/arrow_intro.html
BSD 3-Clause "New" or "Revised" License
55 stars 59 forks source link

Allow the implicit wait to be settable. #247

Open nottoseethesun opened 10 years ago

nottoseethesun commented 10 years ago

It would be good to not be tied to the default wait timeout for an html element being present on a web page, because often the timeout is too short for larger data-driven requests on test systems where resources to make things go faster are constrained. The end result is false fails.

To set the implicit wait under the Selenium webdriverjs, the static 'webdriver' object used in test creation is needed (I tried importing it as static code, but '.schedule' is undefined in that case, causing an error).

At least for those drivers that have a significant static component (like Selenium's webdriverjs), I suggest passing it in after the driver parameter below, or finding some other suitable way so that developers are not stuck with the default timeout. Passing in the static webdriver object will also allow access to many other features.

From Arrow's controller/default.js :

Controller.call(this, testConfig, testParams, driver);

From Selenium's selenium/javascript/webdriver/webdriver.js :

webdriver.WebDriver.Timeouts.prototype.implicitlyWait = function(ms) {
  return this.driver_.schedule(
      new webdriver.Command(webdriver.CommandName.IMPLICITLY_WAIT).
          setParameter('ms', ms < 0 ? 0 : ms),
      'WebDriver.manage().timeouts().implicitlyWait(' + ms + ')');
};

See: http://selenium.googlecode.com/git/docs/api/javascript/class_webdriver_WebDriver_Timeouts.html