From 40b00fd5aff832eb9e2de483c347d8d0e31b0174 Mon Sep 17 00:00:00 2001 From: Nikolay Vitkov <34244704+Lightning00Blade@users.noreply.github.com> Date: Tue, 12 Mar 2024 22:24:54 +0000 Subject: [PATCH] Bug 1882786 [wpt PR 44859] - [wdspec] fix test for `contexts` fields in add_intercept, a=testonly Automatic update from web-platform-tests [wdspec] fix test for `contexts` fields in add_intercept (#44859) * [WebDriverBiDi] Proper test for `contexts` fields * chore: fix -- wpt-commits: 4a4a7b84e2f64dadc59f3d3704aed4cb55eb6f99 wpt-pr: 44859 --- .../webdriver/tests/bidi/network/add_intercept/invalid.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/testing/web-platform/tests/webdriver/tests/bidi/network/add_intercept/invalid.py b/testing/web-platform/tests/webdriver/tests/bidi/network/add_intercept/invalid.py index 187fd9890e12..0821ba7782eb 100644 --- a/testing/web-platform/tests/webdriver/tests/bidi/network/add_intercept/invalid.py +++ b/testing/web-platform/tests/webdriver/tests/bidi/network/add_intercept/invalid.py @@ -147,7 +147,8 @@ async def test_params_url_patterns_pattern_protocol_file_invalid_value(bidi_sess with pytest.raises(error.InvalidArgumentException): await bidi_session.network.add_intercept( phases=["beforeRequestSent"], - url_patterns=[{"type": "pattern", "protocol": value, "hostname": "example.com"}], + url_patterns=[ + {"type": "pattern", "protocol": value, "hostname": "example.com"}], ) @@ -190,13 +191,17 @@ async def test_params_url_patterns_pattern_search_invalid_value(bidi_session, va @pytest.mark.parametrize("value", [False, 42, {}, ""]) async def test_params_contexts_invalid_type(bidi_session, value): with pytest.raises(error.InvalidArgumentException): - await bidi_session.network.add_intercept(phases=[value]) + await bidi_session.network.add_intercept(phases=["beforeRequestSent"], contexts=value) -@pytest.mark.parametrize("value", [[], ["does not exist"]]) -async def test_params_contexts_invalid_value(bidi_session, value): +async def test_params_contexts_empty_list(bidi_session): with pytest.raises(error.InvalidArgumentException): - await bidi_session.network.add_intercept(phases=["beforeRequestSent"], contexts=value) + await bidi_session.network.add_intercept(phases=["beforeRequestSent"], contexts=[]) + + +async def test_params_contexts_context_invalid_value(bidi_session): + with pytest.raises(error.NoSuchFrameException): + await bidi_session.network.add_intercept(phases=["beforeRequestSent"], contexts=["does not exist"]) async def test_params_contexts_context_non_top_level(bidi_session, new_tab, test_page_same_origin_frame): -- 2.11.4.GIT