Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default Timeouts #129

Closed
haggyj opened this issue Apr 8, 2014 · 10 comments · Fixed by #137
Closed

Default Timeouts #129

haggyj opened this issue Apr 8, 2014 · 10 comments · Fixed by #137

Comments

@haggyj
Copy link
Contributor

haggyj commented Apr 8, 2014

Any thoughts on having default timeouts around some of the commands? For example, I find myself littering tests with the same timeout for waitForElementPresent

The below example is fairly simplistic but the default timeout could easily be 5000ms perhaps? Or set as a global?

browser
  .url("https://www.google.com")
  .waitForElementVisible("body", 1000)
  .assert.title("Google")
  .waitForElementVisible("button[name=btnG]", 1000)
  .click("button[name=btnG]")
  .end()
@beatfactor
Copy link
Member

Hmm, it could be nice to have something like that. Are you suggesting to make this available as part of the globals object?

@haggyj
Copy link
Contributor Author

haggyj commented Apr 8, 2014

That would seem like a reasonable approach to me - use the global setting unless someone has specified the timeout on the method.

If neither of those are specified we could change the error to have some useful feedback, or going one step further we could pick a reasonable default for people.

My vote would probably be to implement the first piece and then see if we get any more feedback around it....

@beatfactor
Copy link
Member

Allowing a global setting to be defined which will be used if no time
parameter is passed can't do any harm. It's just a matter of finding a good
meaningful name for it. Maybe we can come up with a pattern which might be
used in the future for other kind of globals.

On Tue, Apr 8, 2014 at 2:59 PM, Jonathan Haggarty
[email protected]:

That would seem like a reasonable approach to me - use the global setting
unless someone has specified the timeout on the method.

If neither of those are specified we could change the error to have some
useful feedback, or going one step further we could pick a reasonable
default for people.

My vote would probably be to implement the first piece and then see if we
get any more feedback around it....

Reply to this email directly or view it on GitHubhttps://github.com/beatfactor/nightwatch/issues/129#issuecomment-39844128
.

@haggyj
Copy link
Contributor Author

haggyj commented Apr 8, 2014

{ "operationTimeout": 5000 }

or perhaps...

{ 
  "nightwatch": {
    "waitOperationTimeout": 5000 
  }
}

One small issue with the name is that it might be suggestive that the pause command would respect it, whereas it just waits indefinitely (which is fairly useful for debugging)

@beatfactor
Copy link
Member

how about waitForConditionTimeout?

On Tue, Apr 8, 2014 at 4:14 PM, Jonathan Haggarty
[email protected]:

{ "operationTimeout": 5000 }

or perhaps...

{
"nightwatch": {
"waitOperationTimeout": 5000
}}

One small issue with the name is that it might be suggestive that the
pause command would respect it, whereas it just waits indefinitely (which
is fairly useful for debugging)

Reply to this email directly or view it on GitHubhttps://github.com/beatfactor/nightwatch/issues/129#issuecomment-39852557
.

@sabind
Copy link

sabind commented Apr 8, 2014

Looks like a good idea :)

haggyj pushed a commit to haggyj/nightwatch that referenced this issue Apr 15, 2014
beatfactor added a commit that referenced this issue Apr 24, 2014
* 'master' of github.com:beatfactor/nightwatch:
  added results and errors properties on the test object available from inside tearDown to satisfy #135
  updated tests for waitForElementPresent
  added waitForConditionPollInterval also, changed the set milliseconds logic a bit and updated the api doc
  Fixed an issue where the set locateStrategy wasn't used correctly in the case of xpath
  Fixed an issue when the selenium server wasn't being stopped after a session create error
  added <no such element> to array of DO_NOT_LOG_ERRORS
  add missing semicolon
  add global timeout for waitFor commands. Fixes #129
  Standardize return - important for callbacks.
@LolaYan
Copy link

LolaYan commented Aug 13, 2017

is this default setting called 'waitForConditionTimeout'?

@sparda2
Copy link

sparda2 commented Jan 25, 2018

Would this setting apply for the pages/chai expect command? page.expect.element('@element').to.be.present.after(xxxx)???

@rhuanbarreto
Copy link

I'm wondering the same. Is this applicable for expectations?

@beatfactor
Copy link
Member

beatfactor commented Jun 7, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants