|
6 | 6 | pytestmark = pytest.mark.asyncio
|
7 | 7 |
|
8 | 8 |
|
9 |
| -@pytest.mark.parametrize("value", [None, False, 42, {}, []]) |
| 9 | +@pytest.mark.parametrize("value", [False, 42, {}, []]) |
10 | 10 | async def test_params_context_invalid_type(bidi_session, value):
|
11 | 11 | with pytest.raises(error.InvalidArgumentException):
|
12 | 12 | await bidi_session.browsing_context.set_viewport(context=value, viewport={
|
@@ -89,3 +89,72 @@ async def test_params_devicePixelRatio_invalid_value(bidi_session, new_tab, devi
|
89 | 89 | device_pixel_ratio=device_pixel_ratio,
|
90 | 90 | viewport=None
|
91 | 91 | )
|
| 92 | + |
| 93 | + |
| 94 | +@pytest.mark.parametrize("value", [True, "foo", 42, {}]) |
| 95 | +async def test_params_user_contexts_invalid_type(bidi_session, value): |
| 96 | + with pytest.raises(error.InvalidArgumentException): |
| 97 | + await bidi_session.browsing_context.set_viewport( |
| 98 | + user_contexts=value, |
| 99 | + viewport={ |
| 100 | + "width": 100, |
| 101 | + "height": 200, |
| 102 | + } |
| 103 | + ) |
| 104 | + |
| 105 | + |
| 106 | +async def test_params_user_contexts_empty_list(bidi_session): |
| 107 | + with pytest.raises(error.InvalidArgumentException): |
| 108 | + await bidi_session.browsing_context.set_viewport( |
| 109 | + user_contexts=[], |
| 110 | + viewport={ |
| 111 | + "width": 100, |
| 112 | + "height": 200, |
| 113 | + } |
| 114 | + ) |
| 115 | + |
| 116 | + |
| 117 | +@pytest.mark.parametrize("value", [None, False, 42, {}, []]) |
| 118 | +async def test_params_user_contexts_entry_invalid_type(bidi_session, value): |
| 119 | + with pytest.raises(error.InvalidArgumentException): |
| 120 | + await bidi_session.browsing_context.set_viewport( |
| 121 | + user_contexts=[value], |
| 122 | + viewport={ |
| 123 | + "width": 100, |
| 124 | + "height": 200, |
| 125 | + } |
| 126 | + ) |
| 127 | + |
| 128 | + |
| 129 | +@pytest.mark.parametrize("value", ["", "somestring"]) |
| 130 | +async def test_params_user_contexts_entry_invalid_value(bidi_session, value): |
| 131 | + with pytest.raises(error.NoSuchUserContextException): |
| 132 | + await bidi_session.browsing_context.set_viewport( |
| 133 | + user_contexts=[value], |
| 134 | + viewport={ |
| 135 | + "width": 100, |
| 136 | + "height": 200, |
| 137 | + } |
| 138 | + ) |
| 139 | + |
| 140 | + |
| 141 | +async def test_params_both_user_contexts_and_context(bidi_session, top_context): |
| 142 | + with pytest.raises(error.InvalidArgumentException): |
| 143 | + await bidi_session.browsing_context.set_viewport( |
| 144 | + context=top_context["context"], |
| 145 | + user_contexts=["default"], |
| 146 | + viewport={ |
| 147 | + "width": 100, |
| 148 | + "height": 200, |
| 149 | + } |
| 150 | + ) |
| 151 | + |
| 152 | + |
| 153 | +async def test_params_no_user_contexts_and_context(bidi_session): |
| 154 | + with pytest.raises(error.InvalidArgumentException): |
| 155 | + await bidi_session.browsing_context.set_viewport( |
| 156 | + viewport={ |
| 157 | + "width": 100, |
| 158 | + "height": 200, |
| 159 | + } |
| 160 | + ) |
0 commit comments