-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add network interception fail request invalidation tests
- Loading branch information
Thiago Perrotta
committed
Oct 23, 2023
1 parent
47d5fbd
commit a97349b
Showing
4 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import pytest | ||
import webdriver.bidi.error as error | ||
|
||
pytestmark = pytest.mark.asyncio | ||
|
||
PAGE_EMPTY_TEXT = "/webdriver/tests/bidi/network/support/empty.txt" | ||
|
||
|
||
@pytest.mark.parametrize("value", [None, False, 42, {}, []]) | ||
async def test_params_request_invalid_type(bidi_session, value): | ||
with pytest.raises(error.InvalidArgumentException): | ||
await bidi_session.network.fail_request(request=value) | ||
|
||
|
||
@pytest.mark.parametrize("value", ["", "foo"]) | ||
async def test_params_request_invalid_value(bidi_session, value): | ||
with pytest.raises(error.NoSuchRequestException): | ||
await bidi_session.network.fail_request(request=value) | ||
|
||
|
||
async def test_params_request_no_such_request(bidi_session, setup_network_test, | ||
wait_for_event, fetch, url): | ||
await setup_network_test(events=[ | ||
"network.responseCompleted", | ||
]) | ||
on_response_completed = wait_for_event("network.responseCompleted") | ||
|
||
text_url = url(PAGE_EMPTY_TEXT) | ||
await fetch(text_url) | ||
|
||
response_completed_event = await on_response_completed | ||
request = response_completed_event["request"]["request"] | ||
|
||
with pytest.raises(error.NoSuchRequestException): | ||
await bidi_session.network.fail_request(request=request) |