Skip to content

Commit

Permalink
added helper to ensure browser is installed before running integratio…
Browse files Browse the repository at this point in the history
…n tests that need it
  • Loading branch information
DinisCruz committed Oct 4, 2024
1 parent bba2e72 commit 9cab4a8
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
from unittest import TestCase

from integration.fast_api_objs_for_tests import ensure_browser_is_installed
from osbot_serverless_flows.fast_api.routes.Routes__Browser import Routes__Browser


class test_Routes_Browser(TestCase):
class test__u__Routes_Browser(TestCase):

@classmethod
def setUpClass(cls):
ensure_browser_is_installed()
cls.routes_browser = Routes__Browser()

def test_url_html(self):
Expand Down
6 changes: 6 additions & 0 deletions tests/integration/fast_api_objs_for_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,9 @@
client__serverless_flows = fast_api__serverless_flows.client()

assert duration.seconds < 1 # make sure the setup time is less than 1 second


def ensure_browser_is_installed():
from osbot_serverless_flows.playwright.Playwright__Serverless import Playwright__Serverless
playwright_browser = Playwright__Serverless()
playwright_browser.browser__install()
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
from unittest import TestCase

from integration.fast_api_objs_for_tests import ensure_browser_is_installed
from osbot_serverless_flows.flows.browser_based.Flow__Playwright__Get_Page_Html import Flow__Playwright__Get_Page_Html


class test_Flow__Playwright__Get_Page_Html(TestCase):
class test__i__Flow__Playwright__Get_Page_Html(TestCase):

@classmethod
def setUpClass(cls) -> None:
ensure_browser_is_installed()
cls.flow__get_page_html = Flow__Playwright__Get_Page_Html()


def test_run(self):
flow_data = self.flow__get_page_html.run()
page_content = flow_data.get('page_content')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
from unittest import TestCase

from integration.fast_api_objs_for_tests import ensure_browser_is_installed
from osbot_utils.utils.Misc import base64_to_bytes

from osbot_serverless_flows.flows.browser_based.Flow__Playwright__Get_Page_Screenshot import Flow__Playwright__Get_Page_Screenshot


class test_Flow__Playwright__Get_Page_Screenshot(TestCase):
class test__i__Flow__Playwright__Get_Page_Screenshot(TestCase):

@classmethod
def setUpClass(cls) -> None:
ensure_browser_is_installed()
cls.flow__get_page_screenshot = Flow__Playwright__Get_Page_Screenshot()

def test_run(self):
Expand Down

0 comments on commit 9cab4a8

Please sign in to comment.