-
Notifications
You must be signed in to change notification settings - Fork 3.6k
webdriver: Fix outdated timeouts test and remove redundant check #56959
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
webdriver: Fix outdated timeouts test and remove redundant check #56959
Conversation
wpt-pr-bot
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The review process for this patch is being conducted in the Servo project.
| {"implicit": 0, "pageLoad": 300000,"script": 444}, | ||
| {"implicit": 0, "pageLoad": None,"script": 30000}, | ||
| {"implicit": None, "pageLoad": 300000,"script": 444}, | ||
| {"implicit": 0, "pageLoad": 300000,"script": None}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better to have multiple paramerizations like the following to cover all valid cases for each timeout type:
@pytest.mark.parametrize("value", [None, 0, 3000])
@pytest.mark.parametrize("key", ["implicit", "pageLoad", "script")
| {"implicit": None, "pageLoad": None,"script": None} | ||
| {"implicit": None, "pageLoad": MAX_SAFE_INTEGER + 2,"script": 30000}, | ||
| {"implicit": MAX_SAFE_INTEGER + 2, "pageLoad": None,"script": 30000}, | ||
| {"implicit": None, "pageLoad": None,"script": MAX_SAFE_INTEGER + 2} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that we can simplify the test as well and only have the invalid case.
ee883f0 to
96c0a8b
Compare
| ]) | ||
| def test_invalid_timeouts(new_session, add_browser_capabilities, timeouts): | ||
| response, _ = new_session({"capabilities": {"alwaysMatch": add_browser_capabilities({"timeouts": timeouts})}}) | ||
| @pytest.mark.parametrize("value", [MAX_SAFE_INTEGER + 1, -11]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any negative integer should cause a failure. So please use the closest number as possible.
| @pytest.mark.parametrize("value", [MAX_SAFE_INTEGER + 1, -11]) | |
| @pytest.mark.parametrize("value", [MAX_SAFE_INTEGER + 1, -1]) |
96c0a8b to
0cc4642
Compare
| response, _ = new_session({"capabilities": {"alwaysMatch": add_browser_capabilities({"timeouts": timeouts})}}) | ||
| @pytest.mark.parametrize("value", [MAX_SAFE_INTEGER + 1, -1]) | ||
| @pytest.mark.parametrize("key", ["implicit", "pageLoad", "script"]) | ||
| def test_invalid_timeouts(new_session, add_browser_capabilities, key, value): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Bonus points if we could name this method test_invalid_timeout_value and have another test with test_invalid_timeout_type where we specify false, "foo", [], {} as parameters.
0cc4642 to
0222494
Compare
whimboo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Signed-off-by: Euclid Ye <[email protected]>
Signed-off-by: Euclid Ye <[email protected]>
Signed-off-by: Euclid Ye <[email protected]>
Signed-off-by: Euclid Ye <[email protected]>
Signed-off-by: Euclid Ye <[email protected]>
Signed-off-by: Euclid Ye <[email protected]>
0222494 to
9bee018
Compare
Initially the attempt is to validate params according to spec. But it turns out validation is already done at webdriver crate so I reverted the change.
But Chrome/Firefox are not compliant with spec: https://wpt.fyi/results/webdriver/tests/classic/new_session/timeouts.py?label=experimental&label=master&aligned. They only allow
script timeoutsto beNonebut notpageLoadandimplicit, which is how the test is currently written.Testing: Updated the test to be compliant with spec. New failures are because it is validated at webdriver crate.
Reviewed in servo/servo#41631