Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions webdriver/tests/classic/execute_async_script/promise.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,33 @@ def test_promise_reject_timeout(session):
resolve(promise);
""")
assert_error(response, "script timeout")


def test_promise_resolve_timeout_none(session):
session.timeouts.script = None
response = execute_async_script(session, """
let resolve = arguments[0];
let promise = new Promise(
(resolve) => setTimeout(
() => resolve('foobar'),
200
)
);
resolve(promise);
""")
assert_success(response, "foobar")


def test_promise_reject_timeout_none(session):
session.timeouts.script = None
response = execute_async_script(session, """
let resolve = arguments[0];
let promise = new Promise(
(resolve, reject) => setTimeout(
() => reject(new Error('my error')),
200
)
);
resolve(promise);
""")
assert_error(response, "javascript error")
26 changes: 26 additions & 0 deletions webdriver/tests/classic/execute_script/promise.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,29 @@ def test_promise_reject_timeout(session):
);
""")
assert_error(response, "script timeout")


def test_promise_resolve_timeout_none(session):
Copy link
Copy Markdown
Contributor

@yezhizhen yezhizhen Jan 29, 2026

Choose a reason for hiding this comment

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

This test is exactly same as

def test_promise_resolve_delayed(session):
response = execute_script(session, """
return new Promise(
(resolve) => setTimeout(
() => resolve('foobar'),
50
)
);
""")
assert_success(response, "foobar")
, except setTimeout changed from 50 to 200.

But somehow Firefox is passing test_promise_resolve_delayed but failing test_promise_resolve_timeout_none?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe this is related to #57160 and other recently opened issues around promises.

Can this PR wait a bit until the others have been done?

Copy link
Copy Markdown
Contributor

@yezhizhen yezhizhen Jan 29, 2026

Choose a reason for hiding this comment

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

This has nothing to do with #57160 tho. The tests here are essentially same as existing ones.

session.timeouts.script = None
response = execute_script(session, """
return new Promise(
(resolve) => setTimeout(
() => resolve('foobar'),
200
)
);
""")
assert_success(response, "foobar")


def test_promise_reject_timeout_none(session):
session.timeouts.script = None
response = execute_script(session, """
return new Promise(
(resolve, reject) => setTimeout(
() => reject(new Error('my error')),
200
)
);
""")
assert_error(response, "javascript error")