Skip to content

Commit

Permalink
script: add missing serialization tests: iterator, generator, proxy (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagowfx authored Jul 5, 2023
1 parent b01e8eb commit 0374f91
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 12 deletions.
13 changes: 10 additions & 3 deletions webdriver/tests/bidi/script/call_function/exception_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,16 @@ async def test_invalid_function(bidi_session, top_context):
("new WeakMap()", {"type": "weakmap", },),
("new WeakSet()", {"type": "weakset", },),
("new Error('SOME_ERROR_TEXT')", {"type": "error"},),
# TODO(sadym): add `iterator` test.
# TODO(sadym): add `generator` test.
# TODO(sadym): add `proxy` test.
("([1, 2][Symbol.iterator]())", {
"type": "iterator",
}),
("new Proxy({}, {})", {
"type": "proxy"
}),
# generator
("(function*() { yield 'a'; })", {
"type": "generator"
}),
("Promise.resolve()", {"type": "promise", },),
("new Int32Array()", {"type": "typedarray", },),
("new ArrayBuffer()", {"type": "arraybuffer", },),
Expand Down
14 changes: 11 additions & 3 deletions webdriver/tests/bidi/script/call_function/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

pytestmark = pytest.mark.asyncio


@pytest.mark.parametrize("await_promise", [True, False])
@pytest.mark.parametrize(
"expression, expected",
Expand Down Expand Up @@ -119,9 +120,16 @@ async def test_primitive_values(bidi_session, top_context, await_promise, expres
("new WeakMap()", {"type": "weakmap"}),
("new WeakSet()", {"type": "weakset"}),
("new Error('SOME_ERROR_TEXT')", {"type": "error"}),
# TODO(sadym): add `iterator` test.
# TODO(sadym): add `generator` test.
# TODO(sadym): add `proxy` test.
("([1, 2][Symbol.iterator]())", {
"type": "iterator",
}),
("new Proxy({}, {})", {
"type": "proxy"
}),
# generator
("(function*() { yield 'a'; })", {
"type": "generator"
}),
("new Int32Array()", {"type": "typedarray"}),
("new ArrayBuffer()", {"type": "arraybuffer"}),
("window", {"type": "window"}),
Expand Down
13 changes: 10 additions & 3 deletions webdriver/tests/bidi/script/evaluate/exception_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,16 @@ async def test_invalid_script(bidi_session, top_context):
("new WeakMap()", {"type": "weakmap", },),
("new WeakSet()", {"type": "weakset", },),
("new Error('SOME_ERROR_TEXT')", {"type": "error"},),
# TODO(sadym): add `iterator` test.
# TODO(sadym): add `generator` test.
# TODO(sadym): add `proxy` test.
("([1, 2][Symbol.iterator]())", {
"type": "iterator",
}),
("new Proxy({}, {})", {
"type": "proxy"
}),
# generator
("(function*() { yield 'a'; })", {
"type": "generator"
}),
("Promise.resolve()", {"type": "promise", },),
("new Int32Array()", {"type": "typedarray", },),
("new ArrayBuffer()", {"type": "arraybuffer", },),
Expand Down
13 changes: 10 additions & 3 deletions webdriver/tests/bidi/script/evaluate/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,16 @@ async def test_primitive_values(bidi_session, top_context, expression, expected)
("new WeakMap()", {"type": "weakmap", },),
("new WeakSet()", {"type": "weakset", },),
("new Error('SOME_ERROR_TEXT')", {"type": "error"},),
# TODO(sadym): add `iterator` test.
# TODO(sadym): add `generator` test.
# TODO(sadym): add `proxy` test.
("([1, 2][Symbol.iterator]())", {
"type": "iterator",
}),
("new Proxy({}, {})", {
"type": "proxy"
}),
# generator
("(function*() { yield 'a'; })", {
"type": "generator"
}),
("Promise.resolve()", {"type": "promise", },),
("new Int32Array()", {"type": "typedarray", },),
("new ArrayBuffer()", {"type": "arraybuffer", },),
Expand Down

0 comments on commit 0374f91

Please sign in to comment.