Skip to content

Commit

Permalink
fixed test
Browse files Browse the repository at this point in the history
  • Loading branch information
DinisCruz committed Oct 6, 2024
1 parent 1e6c3a7 commit fa8524c
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 10 deletions.
73 changes: 65 additions & 8 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ requests = "*"
httpx = "*"
osbot_playwright = "*"
bs4 = "*"
pytest = "^8.3.3"

[build-system]
requires = ["poetry-core>=1.0.0"]
Expand Down
20 changes: 18 additions & 2 deletions tests/qa/fast_api/routes/test__q__Playwright__Serverless.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
from osbot_utils.utils.Dev import pprint

from osbot_utils.utils.Env import load_dotenv, get_env
from osbot_utils.utils.Misc import url_encode

from tests.qa.for_qa_tests import qa__endpoint_url


Expand All @@ -22,7 +24,21 @@ def test_install_browser(self):

def test__url_html(self):
target_url = 'https://httpbin.org/get?answer=42'
get_url = f'{self.endpoint_url}/browser/url-html?url={target_url}'
get_url = f'{self.endpoint_url}/browser/url-html?url={url_encode(target_url)}'
response = requests.get(get_url)
assert response.status_code == 200
assert target_url in response.json().get('page_content')
assert target_url in response.json().get('page_content')

def test__url_screenshot(self):
target_url = 'https://httpbin.org/get?answer=42'
get_url = f'{self.endpoint_url}/browser/url-screenshot?url={url_encode(target_url)}'
response = requests.get(get_url)
assert response.status_code == 200
assert len(response.json().get('screenshot_base64')) > 10000

def test__url_pdf(self):
target_url = 'https://httpbin.org/get?answer=42'
get_url = f'{self.endpoint_url}/browser/url-pdf?url={url_encode(target_url)}'
response = requests.get(get_url)
assert response.status_code == 200
assert len(response.json().get('pdf_base64')) > 10000

0 comments on commit fa8524c

Please sign in to comment.