webdriver: Fix outdated timeouts test and remove redundant check#56959
webdriver: Fix outdated timeouts test and remove redundant check#56959servo-wpt-sync merged 6 commits intoweb-platform-tests:masterfrom
Conversation
wpt-pr-bot
left a comment
There was a problem hiding this comment.
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.
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.
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.
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.
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
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