Opened 3 years ago

Closed 2 years ago

#21158 closed Cleanup/optimization (wontfix)

Set an implicit wait for selenium.

Reported by: Florian Apolloner Owned by: bsilverberg
Component: Testing framework Version: master
Severity: Normal Keywords:
Cc: Tim Graham Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no


Selenium often tries to access elements before the page is loaded; it offers an implicitly_wait method which we could utilize and it might fix a few of our timing issues; I'd suggest a relatively high timeout of 10 seconds to cover our bases. See for this method.

Change History (9)

comment:1 Changed 3 years ago by Tim Graham

Triage Stage: UnreviewedAccepted

comment:2 Changed 2 years ago by bsilverberg

Owner: changed from nobody to bsilverberg
Status: newassigned

comment:3 Changed 2 years ago by bsilverberg

I have opened pull request for this. This is my first django pull request so any advice/feedback would be appreciated.

comment:4 Changed 2 years ago by bsilverberg

Has patch: set

comment:5 Changed 2 years ago by jmbowman

I'd advise a little caution on this approach. I've worked on projects which have assertions that just want to verify that an element is not on the page. If every such assertion takes 10 seconds of redundantly verifying that the element is still not on the page, that can make the tests take a lot longer to run. It's a pain to correctly do it consistently, but I've had better results fixing tests with implicit timing dependencies to wait explicitly when appropriate.

comment:6 Changed 2 years ago by bsilverberg

Thanks jmbowman. That certainly can be an issue. I ran the current test suite and it doesn't seem to suffer from this issue. In the suites that we use at work we do have a default implicit wait set up, and then we use helper methods when we want to check that an element is not present which switch off the implicit wait.

I think the approach used here is appropriate for the current test suite, but it is something to be careful about in the future, if this approach is adopted.

comment:7 Changed 2 years ago by Tim Graham

Cc: Tim Graham added
Patch needs improvement: set

I left an idea for improvement on the pull request.

@apollo13, any thoughts on the comments in the thread? Was the idea to commit this and see if it helps with the random failures on Jenkins?

comment:8 Changed 2 years ago by Florian Apolloner

We currently don't have any random failures (or at least not really often), so I think we can close this for now.

comment:9 Changed 2 years ago by Tim Graham

Resolution: wontfix
Status: assignedclosed
Note: See TracTickets for help on using tickets.
Back to Top