aboutsummaryrefslogtreecommitdiff
path: root/venv/lib/python3.8/site-packages/dash/testing/composite.py
blob: 8a3abeeaa23a7c18b6160e380c9fd7643c63d6a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from dash.testing.browser import Browser


class DashComposite(Browser):
    def __init__(self, server, **kwargs):
        super().__init__(**kwargs)
        self.server = server

    def start_server(self, app, navigate=True, **kwargs):
        """Start the local server with app."""

        # start server with app and pass Dash arguments
        self.server(app, **kwargs)

        if navigate:
            # set the default server_url, it implicitly call wait_for_page
            self.server_url = self.server.url


class DashRComposite(Browser):
    def __init__(self, server, **kwargs):
        super().__init__(**kwargs)
        self.server = server

    def start_server(self, app, cwd=None):

        # start server with dashR app. The app sets its own run_server args
        # on the R side, but we support overriding the automatic cwd
        self.server(app, cwd=cwd)

        # set the default server_url, it implicitly call wait_for_page
        self.server_url = self.server.url


class DashJuliaComposite(Browser):
    def __init__(self, server, **kwargs):
        super().__init__(**kwargs)
        self.server = server

    def start_server(self, app, cwd=None):
        # start server with Dash.jl app. The app sets its own run_server args
        # on the Julia side, but we support overriding the automatic cwd
        self.server(app, cwd=cwd)

        # set the default server_url, it implicitly call wait_for_page
        self.server_url = self.server.url