Merge lp://qastaging/~coreygoldberg/selenium-simple-test/fix-set-window into lp://qastaging/selenium-simple-test
Proposed by
Corey Goldberg
Status: | Merged |
---|---|
Approved by: | Corey Goldberg |
Approved revision: | 399 |
Merged at revision: | 398 |
Proposed branch: | lp://qastaging/~coreygoldberg/selenium-simple-test/fix-set-window |
Merge into: | lp://qastaging/selenium-simple-test |
Diff against target: |
101 lines (+26/-30) 2 files modified
src/sst/actions.py (+5/-8) src/sst/selftests/window_size.py (+21/-22) |
To merge this branch: | bzr merge lp://qastaging/~coreygoldberg/selenium-simple-test/fix-set-window |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Corey Goldberg (community) | Approve | ||
Vincent Ladeuil (community) | Approve | ||
Review via email:
|
Commit message
made set_window_size less flaky
Description of the change
this MP changes the resize logic inside set_window_size()
this test was/is intermittently failing on Jenkins, because setting window size in selenium is asynchronous.
this change may not completely fix the issue, but the code is clearer and easier to understand.
To post a comment you must log in.
9 + 'Checking attribute %r of %r' % (attribute, element_ to_string( elem)))
This is another example showing that we lack coverage. I think it's time to start addressing those by writing failing tests for them as we encounter them.
24 + def _was_resized(width, height):
This function is used only once and will work equally well without the parameters (which are just hiding the set_window_size ones).
17 + # Do not actually resize if the specified size is same as original.
18 if (orig_width == width) and (orig_height == height):
19 return (width, height)
I don't think the optimization is worth it there, presumably test writers will use set_window_size() when they intend the size to change so this code path is rarely reached and one can even argue that it may come in the way:
I can imagine cases where I want to shuffle the browser a bit and ensure *something* reaches it when I use set_window_size. Bypassing my request then comes in my way.
34 return (width, height)
If there is no way to return values different from the ones I passed, why should I care about what is returned ?
If that was available, I would rather get the *previous* values. But that would require querying the browser with get_window_size() which I can equally well call myself.
So, I'd rather return something else, including nothing ;)
In the same spirit, I think you can further simplify the tests while making them clearer (their intent is almost clear but comments won't hurt).
Basically, testing {get|set} _window_ size requires to start with a known heigth/width and making sure set_window_size change it or errors out.