Zarkonnen / se-interpreter

Interpreter for Selenium Builder JSON scripts based on node.js and wd.
34 stars 31 forks source link

Per-step wait support #38

Open heydenberk opened 9 years ago

heydenberk commented 9 years ago

While testing a rich web app with lots of DOM updates that don't trigger new page loads, I find myself doing a lot of this in my "steps":

{
  "type": "waitForElementPresent",
  "locator": {
    "type": "id",
    "value": "someId"
  }
},
{
  "type": "clickElement",
  "locator": {
    "type": "id",
    "value": "someId"
  }
},
{
  "type": "waitForElementPresent",
  "locator": {
    "type": "id",
    "value": "anotherId"
  }
},
{
  "type": "clickElement",
  "locator": {
    "type": "id",
    "value": "anotherId"
  }
}

I'd like to be able to specify a "globalWait" on the top level of the JSON, or a "wait" parameter per step. On my fork, I hacked together a version of the interperter that works this way, but I'm not comfortable issuing a PR unless there is some interest in implementing this feature. I'm not sure how it would interoperate with existing "waitFor" step types

Thanks and let me know what you think!

Zarkonnen commented 9 years ago

You shouldn't have to do the waits before the click! Webdriver, which se-interpreter is built on, uses implicit waits, so the playback should wait for the appearance for the element anyway. Will double-check this works in the generic case.