|
| 1 | +import os |
| 2 | +from typing import Generator |
| 3 | + |
1 | 4 | import pytest
|
2 |
| -from playwright.sync_api import Playwright, sync_playwright |
3 | 5 | from dotenv import load_dotenv
|
4 |
| -import os |
| 6 | +from playwright.sync_api import Playwright, sync_playwright |
5 | 7 | from browserbase import Browserbase
|
6 | 8 |
|
7 | 9 | from .. import (
|
8 | 10 | BROWSERBASE_API_KEY,
|
9 | 11 | playwright_basic,
|
| 12 | + playwright_proxy, |
| 13 | + playwright_upload, |
10 | 14 | playwright_captcha,
|
11 | 15 | playwright_contexts,
|
12 | 16 | playwright_downloads,
|
|
15 | 19 | bb = Browserbase(api_key=BROWSERBASE_API_KEY)
|
16 | 20 | load_dotenv()
|
17 | 21 |
|
18 |
| -SKIP_CAPTCHA_SOLVING = os.getenv("SKIP_CAPTCHA_SOLVING", "true").lower() == "true" |
| 22 | +CI = os.getenv("CI", "false").lower() == "true" |
19 | 23 |
|
20 | 24 |
|
21 | 25 | @pytest.fixture(scope="session")
|
22 |
| -def playwright(): |
| 26 | +def playwright() -> Generator[Playwright, None, None]: |
23 | 27 | with sync_playwright() as p:
|
24 | 28 | yield p
|
25 | 29 |
|
26 |
| - |
27 |
| -def test_playwright_basic(playwright: Playwright): |
| 30 | +def test_playwright_basic(playwright: Playwright) -> None: |
28 | 31 | playwright_basic.run(playwright)
|
29 | 32 |
|
30 | 33 |
|
31 |
| -def test_playwright_captcha(playwright: Playwright): |
32 |
| - if SKIP_CAPTCHA_SOLVING: |
33 |
| - pytest.skip("Skipping captcha solving") |
| 34 | +@pytest.mark.skipif(True, reason="Flaky and fails often") |
| 35 | +def test_playwright_captcha(playwright: Playwright) -> None: |
34 | 36 | playwright_captcha.run(playwright)
|
35 | 37 |
|
36 | 38 |
|
37 |
| -def test_playwright_contexts(playwright: Playwright): |
| 39 | +def test_playwright_contexts(playwright: Playwright) -> None: |
38 | 40 | playwright_contexts.run(playwright)
|
39 | 41 |
|
40 | 42 |
|
41 |
| -def test_playwright_downloads(playwright: Playwright): |
| 43 | +def test_playwright_downloads(playwright: Playwright) -> None: |
42 | 44 | playwright_downloads.run(playwright)
|
| 45 | + |
| 46 | + |
| 47 | +def test_playwright_proxy_enable_via_create_session(playwright: Playwright) -> None: |
| 48 | + playwright_proxy.run_enable_via_create_session(playwright) |
| 49 | + |
| 50 | + |
| 51 | +def test_playwright_proxy_enable_via_querystring(playwright: Playwright) -> None: |
| 52 | + playwright_proxy.run_enable_via_querystring_with_created_session(playwright) |
| 53 | + |
| 54 | + |
| 55 | +@pytest.mark.skipif(CI, reason="Flaky and fails on CI") |
| 56 | +def test_playwright_proxy_geolocation_country(playwright: Playwright) -> None: |
| 57 | + playwright_proxy.run_geolocation_country(playwright) |
| 58 | + |
| 59 | + |
| 60 | +@pytest.mark.skipif(CI, reason="Flaky and fails on CI") |
| 61 | +def test_playwright_proxy_geolocation_state(playwright: Playwright) -> None: |
| 62 | + playwright_proxy.run_geolocation_state(playwright) |
| 63 | + |
| 64 | + |
| 65 | +@pytest.mark.skipif(CI, reason="Flaky and fails on CI") |
| 66 | +def test_playwright_proxy_geolocation_american_city(playwright: Playwright) -> None: |
| 67 | + playwright_proxy.run_geolocation_american_city(playwright) |
| 68 | + |
| 69 | + |
| 70 | +@pytest.mark.skipif(CI, reason="Flaky and fails on CI") |
| 71 | +def test_playwright_proxy_geolocation_non_american_city(playwright: Playwright) -> None: |
| 72 | + playwright_proxy.run_geolocation_non_american_city(playwright) |
| 73 | + |
| 74 | + |
| 75 | +def test_playwright_upload(playwright: Playwright) -> None: |
| 76 | + playwright_upload.run(playwright) |
0 commit comments