Skip to content

Commit 15468a2

Browse files
juliandescottesmoz-wptsync-bot
authored andcommitted
[wdspec] Update invalid test for addDataCollector to check top level contexts
Differential Revision: https://phabricator.services.mozilla.com/D259620 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1971780 gecko-commit: 99ff0e815ae4de4d41214f5eadac7fca1bbd44d3 gecko-reviewers: webdriver-reviewers, Sasha
1 parent 4403ee0 commit 15468a2

File tree

1 file changed

+21
-0
lines changed
  • webdriver/tests/bidi/network/add_data_collector

1 file changed

+21
-0
lines changed

webdriver/tests/bidi/network/add_data_collector/invalid.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,27 @@ async def test_params_contexts_invalid_value(bidi_session):
108108
)
109109

110110

111+
async def test_params_contexts_context_non_top_level(bidi_session, new_tab, test_page_same_origin_frame):
112+
await bidi_session.browsing_context.navigate(
113+
context=new_tab["context"],
114+
url=test_page_same_origin_frame,
115+
wait="complete",
116+
)
117+
118+
contexts = await bidi_session.browsing_context.get_tree(root=new_tab["context"])
119+
120+
assert len(contexts) == 1
121+
assert len(contexts[0]["children"]) == 1
122+
child_info = contexts[0]["children"][0]
123+
124+
with pytest.raises(error.InvalidArgumentException):
125+
await bidi_session.network.add_data_collector(
126+
data_types=["response"],
127+
max_encoded_data_size=1000,
128+
contexts=[child_info['context']]
129+
)
130+
131+
111132
@pytest.mark.parametrize("value", [False, 42, {}, ""])
112133
async def test_params_user_contexts_invalid_type(bidi_session, value):
113134
with pytest.raises(error.InvalidArgumentException):

0 commit comments

Comments
 (0)