Zarkonnen / se-interpreter

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

waitFor timeout is hardcoded and depends on step duration #32

Closed briangough closed 9 years ago

briangough commented 10 years ago

The waitFor timer currently does 120 iterations of the step with a 500ms delay. There are a couple of problems with this

Below is an example of a script that waits for a single non-existent element using a script timeout of 10s and takes over 1300s to terminate.

I've submitted a patch in https://github.com/Zarkonnen/se-interpreter/pull/31

$ time -p node interpreter.js examples/tests/waitForElement_timeout.json
SE-Interpreter 1.0.6
waitForElement_timeout: Starting test (firefox) waitForElement_timeout
waitForElement_timeout: Success {"type":"get","url":"http://saucelabs.com/test/guinea-pig/"}
waitForElement_timeout: Failed [Error: Wait timed out.]
waitForElement_timeout: Test failed: [Error: Wait timed out.]
0/1 tests ran successfully. Exiting
real 1316.17
user 5.68
sys 0.55

Here's the example test

{
  "type": "script",
  "seleniumVersion": "2",
  "formatVersion": 1,
  "steps": [
    {
      "type": "get",
      "url": "http://saucelabs.com/test/guinea-pig/"
    },
    {
      "type": "waitForElementPresent",
      "locator": {
        "type": "id",
        "value": "nonexistent-element-3998ac91-3b12-453d-a3a7-6a5f66ff5aed"
      }
    }
  ],
  "timeoutSeconds": 10
}
davidlinse commented 9 years ago

Indeed, this is pretty ugly.. Would like to see that merged.. @Zarkonnen any news on that ?

Edit: This is issue is already resolved via #31.

Zarkonnen commented 9 years ago

Quite, I just missed this issue re:closing. Thanks for bumping it.