test: Update and improve Camo/Dynamic tests
This commit is contained in:
@@ -30,29 +30,6 @@ class TestDynamicFetcherAsync:
|
||||
response = await fetcher.async_fetch(urls["status_200"])
|
||||
assert response.status == 200
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_networkidle(self, fetcher, urls):
|
||||
"""Test if waiting for `networkidle` make page does not finish loading or not"""
|
||||
response = await fetcher.async_fetch(urls["basic_url"], network_idle=True)
|
||||
assert response.status == 200
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_blocking_resources(self, fetcher, urls):
|
||||
"""Test if blocking resources make the page does not finish loading or not"""
|
||||
response = await fetcher.async_fetch(urls["basic_url"], disable_resources=True)
|
||||
assert response.status == 200
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_waiting_selector(self, fetcher, urls):
|
||||
"""Test if waiting for a selector make page does not finish loading or not"""
|
||||
response1 = await fetcher.async_fetch(urls["html_url"], wait_selector="h1")
|
||||
assert response1.status == 200
|
||||
|
||||
response2 = await fetcher.async_fetch(
|
||||
urls["html_url"], wait_selector="h1", wait_selector_state="visible"
|
||||
)
|
||||
assert response2.status == 200
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_cookies_loading(self, fetcher, urls):
|
||||
"""Test if cookies are set after the request"""
|
||||
@@ -77,12 +54,21 @@ class TestDynamicFetcherAsync:
|
||||
"kwargs",
|
||||
[
|
||||
{"disable_webgl": True, "hide_canvas": False},
|
||||
{"disable_webgl": False, "hide_canvas": True},
|
||||
{"disable_webgl": False, "hide_canvas": True, "disable_resources": True},
|
||||
{"stealth": True}, # causes issues with GitHub Actions
|
||||
{"wait_selector": "h1", "wait_selector_state": "attached"},
|
||||
{"wait_selector": "h1", "wait_selector_state": "visible"},
|
||||
{
|
||||
"useragent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:131.0) Gecko/20100101 Firefox/131.0"
|
||||
"google_search": True,
|
||||
"real_chrome": True,
|
||||
"wait": 10,
|
||||
"locale": "en-US",
|
||||
"extra_headers": {"ayo": ""},
|
||||
"useragent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:131.0) Gecko/20100101 Firefox/131.0",
|
||||
"cookies": [],
|
||||
"network_idle": True,
|
||||
"custom_config": {"keep_comments": False, "keep_cdata": False},
|
||||
},
|
||||
{"extra_headers": {"ayo": ""}},
|
||||
],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
|
||||
Reference in New Issue
Block a user