webdriver: improve session commands (#38397)

Add timeout and strictFileInteractability capabilities to response of
new session command.
Allow delete session command to run without a session.

Testing: Clear some unexpected results of session tests in webdriver CI
and
`tests/wpt/meta/webdriver/tests/classic/delete_session/delete.py.ini`

---------

Signed-off-by: batu_hoang <hoang.binh.trong@huawei.com>
Signed-off-by: batu_hoang <longvatrong111@gmail.com>
This commit is contained in:
batu_hoang 2025-08-01 14:39:03 +08:00 committed by GitHub
parent c836ed374c
commit 929fd0aa3c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 19 additions and 11 deletions

View file

@ -46,9 +46,15 @@ pub(crate) fn deserialize_as_timeouts_configuration(
})? as u64;
},
"script" => {
config.script = Some(value.as_f64().ok_or_else(|| {
WebDriverError::new(ErrorStatus::InvalidArgument, "Invalid script timeout")
})? as u64);
config.script = match value {
Value::Null => None,
_ => Some(value.as_f64().ok_or_else(|| {
WebDriverError::new(
ErrorStatus::InvalidArgument,
"Invalid script timeout",
)
})? as u64),
};
},
_ => {
return Err(WebDriverError::new(
@ -69,9 +75,7 @@ pub(crate) fn deserialize_as_timeouts_configuration(
pub(crate) fn serialize_timeouts_configuration(timeouts: &TimeoutsConfiguration) -> Value {
let mut map = serde_json::Map::new();
if let Some(script_timeout) = timeouts.script {
map.insert("script".to_string(), Value::from(script_timeout));
}
map.insert("script".to_string(), Value::from(timeouts.script));
map.insert("pageLoad".to_string(), Value::from(timeouts.page_load));
map.insert("implicit".to_string(), Value::from(timeouts.implicit_wait));
Value::Object(map)