Closed Bug 1846744 Opened 1 year ago Closed 1 year ago

Intermittent /webdriver/tests/bidi/script/call_function/arguments.py | test_primitive_value[Number.NaN-argument4] - webdriver.bidi.modules.script.ScriptEvaluateResultException: Error: Argument should be Number.NaN, but was NaN

Categories

(Remote Protocol :: WebDriver BiDi, defect, P1)

defect
Points:
1

Tracking

(firefox118 fixed)

RESOLVED FIXED
118 Branch
Tracking Status
firefox118 --- fixed

People

(Reporter: whimboo, Assigned: whimboo)

References

(Blocks 1 open bug)

Details

(Keywords: intermittent-failure, Whiteboard: [webdriver:m8], [wptsync upstream])

Attachments

(1 file)

This test fails upstream on wpt.fyi for all the browsers with:

  FAIL test_primitive_value[Number.NaN-argument4] - webdriver.bidi.modules.script.ScriptEvaluateResultException: Error: Argument should be Number.NaN, but was NaN
bidi_session = <webdriver.bidi.client.BidiSession object at 0x107cab3a0>
top_context = {'children': [], 'context': '4068abf3-5df0-4269-a378-7d2e896d4d99', 'parent': None, 'url': 'about:blank'}
argument = {'type': 'number', 'value': 'NaN'}, expected = 'Number.NaN'

    @pytest.mark.asyncio
    @pytest.mark.parametrize("expected, argument", PRIMITIVE_VALUES)
    async def test_primitive_value(bidi_session, top_context, argument, expected):
>       result = await bidi_session.script.call_function(
            function_declaration=f"""(arg) => {{
                if (arg !== {expected}) {{
                    throw new Error(`Argument should be {expected}, but was ` + arg);
                }}
                return arg;
            }}""",
            arguments=[argument],
            await_promise=False,
            target=ContextTarget(top_context["context"]),
        )

argument   = {'type': 'number', 'value': 'NaN'}
bidi_session = <webdriver.bidi.client.BidiSession object at 0x107cab3a0>
expected   = 'Number.NaN'
top_context = {'children': [],
 'context': '4068abf3-5df0-4269-a378-7d2e896d4d99',
 'parent': None,
 'url': 'about:blank'}

The problem here is that the NaN check needs to be done by using isNaN(), which is not done here. But there is a separate test test_primitive_value_NaN which does it right and duplicates it.

One idea was to remove NaN from PRIMITIVE_VALUES but that's not good for other tests. As such we might need some funky checks in the callFunction call. Note that isNaN() also fails for BigInt values.

Assignee: nobody → hskupin
Status: NEW → ASSIGNED
Severity: -- → S3
Points: --- → 1
Priority: -- → P1
Whiteboard: [webdriver:m8]
Pushed by hskupin@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/fe331e7b17f9 [wdspec] Fix call_function/arguments.py | test_primitive_value for Number.NaN. r=webdriver-reviewers,jdescottes
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/41290 for changes under testing/web-platform/tests
Whiteboard: [webdriver:m8] → [webdriver:m8], [wptsync upstream]
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 118 Branch
Upstream PR was closed without merging
Upstream PR merged by moz-wptsync-bot
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: