You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following PR #260 refactored tests to be more readable/debuggable, however, they have become a bit slow due to needing to startup/shutdown Playwright in-between each PlaywrightTestCase class.
It would be better to re-use Playwright in between test modules.
Proposed Actions
I attempted to implement a PlaywrightFixture, however, I was getting a variety of errors during integration that I didn't have time to resolve. Here's a copy-paste of the important stuff.
################################ tests/test_app/tests/utils.py###############################@pytest.mark.usefixtures("playwright_fixture")classPlaywrightTestCase(ChannelsLiveServerTestCase):
...
classPlaywrightFixture:
playwright: Playwrightbrowser: Browserpage: Pagedef__init__(self) ->None:
# Open a Playwright browser windowifsys.platform=="win32":
asyncio.set_event_loop_policy(asyncio.WindowsProactorEventLoopPolicy())
self.playwright=sync_playwright().start()
headless=strtobool(os.environ.get("PLAYWRIGHT_HEADLESS", GITHUB_ACTIONS))
self.browser=self.playwright.chromium.launch(headless=bool(headless))
self.page=self.browser.new_page()
self.page.set_default_timeout(5000)
def__enter__(self):
yieldselfdef__exit__(self, exc_type, exc_value, traceback):
# Close the Playwright browserself.playwright.stop()
Current Situation
The following PR #260 refactored tests to be more readable/debuggable, however, they have become a bit slow due to needing to startup/shutdown Playwright in-between each
PlaywrightTestCase
class.It would be better to re-use
Playwright
in between test modules.Proposed Actions
I attempted to implement a
PlaywrightFixture
, however, I was getting a variety of errors during integration that I didn't have time to resolve. Here's a copy-paste of the important stuff.The text was updated successfully, but these errors were encountered: