Skip to content

add asgiref dep + set default timeout on page #776

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion docs/source/about/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@ more info, see the :ref:`Contributor Guide <Creating a Changelog Entry>`.
Unreleased
----------

No changes.
**Added**

- :pull:`123` - ``asgiref`` as a dependency

**Changed**

- :pull:`123` - set default timeout on playwright page for testing


v0.39.0
Expand Down
1 change: 1 addition & 0 deletions requirements/pkg-deps.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ jsonpatch >=1.32
fastjsonschema >=2.14.5
requests >=2
colorlog >=6
asgiref >=3
3 changes: 2 additions & 1 deletion src/idom/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@

IDOM_TESTING_DEFAULT_TIMEOUT = _Option(
"IDOM_TESTING_DEFAULT_TIMEOUT",
3.0,
5.0,
mutable=False,
validator=float,
)
"""A default timeout for testing utilities in IDOM"""
3 changes: 3 additions & 0 deletions src/idom/testing/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from playwright.async_api import Browser, BrowserContext, Page, async_playwright

from idom import html
from idom.config import IDOM_TESTING_DEFAULT_TIMEOUT
from idom.types import RootComponentConstructor

from .backend import BackendFixture
Expand Down Expand Up @@ -57,6 +58,8 @@ async def __aenter__(self) -> DisplayFixture:
browser = self._browser
self.page = await browser.new_page()

self.page.set_default_timeout(IDOM_TESTING_DEFAULT_TIMEOUT.current * 1000)

if not hasattr(self, "backend"):
self.backend = BackendFixture()
await es.enter_async_context(self.backend)
Expand Down