Skip to content

Conversation

@servo-wpt-sync
Copy link
Collaborator

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 timeouts to be None but not pageLoad and implicit, 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

Copy link
Collaborator

@wpt-pr-bot wpt-pr-bot left a 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},
Copy link
Contributor

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}
Copy link
Contributor

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.

])
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])
Copy link
Contributor

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.

Suggested change
@pytest.mark.parametrize("value", [MAX_SAFE_INTEGER + 1, -11])
@pytest.mark.parametrize("value", [MAX_SAFE_INTEGER + 1, -1])

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):
Copy link
Contributor

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.

Copy link
Contributor

@whimboo whimboo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@servo-wpt-sync servo-wpt-sync merged commit 120ea8c into web-platform-tests:master Jan 5, 2026
25 checks passed
@servo-wpt-sync servo-wpt-sync deleted the servo_export_41631 branch January 5, 2026 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants