Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ shiny = py.typed

[options.entry_points]
pytest11 =
shiny-test = shiny.test._pytest
shiny-test = shiny.pytest._pytest
console_scripts =
shiny = shiny._main:main

Expand Down
4 changes: 4 additions & 0 deletions shiny/playwright/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from ._expect import expect_to_change
from . import controls

__all__ = ["expect_to_change", "controls"]
File renamed without changes.
95 changes: 95 additions & 0 deletions shiny/playwright/controls/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
from ._controls import (
InputActionButton,
InputActionLink,
InputCheckbox,
InputCheckboxGroup,
InputDarkMode,
InputDate,
InputDateRange,
InputFile,
InputNumeric,
InputPassword,
InputRadioButtons,
InputSelect,
InputSelectize,
InputSlider,
InputSliderRange,
InputSwitch,
InputTaskButton,
InputText,
InputTextArea,
OutputCode,
OutputDataFrame,
OutputImage,
OutputPlot,
OutputTable,
OutputText,
OutputTextVerbatim,
OutputUi,
ValueBox,
Card,
Accordion,
Sidebar,
Popover,
Tooltip,
LayoutNavItem,
LayoutNavSetBar,
LayoutNavSetCardPill,
LayoutNavSetCardTab,
LayoutNavSetCardUnderline,
LayoutNavSetHidden,
LayoutNavSetPill,
LayoutNavSetPillList,
LayoutNavsetTab,
LayoutNavSetUnderline,
DownloadButton,
DownloadLink,
)

__all__ = [
"InputActionButton",
"InputActionLink",
"InputCheckbox",
"InputCheckboxGroup",
"InputDarkMode",
"InputDate",
"InputDateRange",
"InputFile",
"InputNumeric",
"InputPassword",
"InputRadioButtons",
"InputSelect",
"InputSelectize",
"InputSlider",
"InputSliderRange",
"InputSwitch",
"InputTaskButton",
"InputText",
"InputTextArea",
"OutputCode",
"OutputDataFrame",
"OutputImage",
"OutputPlot",
"OutputTable",
"OutputText",
"OutputTextVerbatim",
"OutputUi",
"ValueBox",
"Card",
"Accordion",
"Sidebar",
"Popover",
"Tooltip",
"LayoutNavItem",
"LayoutNavSetBar",
"LayoutNavSetCardPill",
"LayoutNavSetCardTab",
"LayoutNavSetCardUnderline",
"LayoutNavSetHidden",
"LayoutNavSetPill",
"LayoutNavSetPillList",
"LayoutNavsetTab",
"LayoutNavSetUnderline",
"DownloadButton",
"DownloadLink",
]
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@
import typing
from typing import Literal, Optional, Protocol

from playwright.sync_api import FilePayload, FloatRect, Locator, Page, Position
from playwright.sync_api import expect as playwright_expect

# Import `shiny`'s typing extentions.
# Since this is a private file, tell pyright to ignore the import
from .._typing_extensions import TypeGuard # pyright: ignore[reportPrivateImportUsage]
from .._typing_extensions import (
from ..._typing_extensions import TypeGuard # pyright: ignore[reportPrivateImportUsage]
from ..._typing_extensions import (
assert_type, # pyright: ignore[reportPrivateImportUsage]
)
from ..types import MISSING, MISSING_TYPE
from ._playwright import FilePayload, FloatRect, Locator, Page, Position
from ._playwright import expect as playwright_expect
from ...types import MISSING, MISSING_TYPE

"""
Questions:
Expand Down
3 changes: 3 additions & 0 deletions shiny/pytest/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from ._fixture import create_app_fixture, ScopeName

__all__ = ("create_app_fixture", "ScopeName")
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import pytest

from .._conftest import shiny_app_gen
from ..run._conftest import shiny_app_gen

__all__ = (
"create_app_fixture",
Expand Down
2 changes: 1 addition & 1 deletion shiny/test/_pytest.py → shiny/pytest/_pytest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import pytest

from ._conftest import ShinyAppProc, shiny_app_gen
from ..run._conftest import ShinyAppProc, shiny_app_gen


@pytest.fixture(scope="module")
Expand Down
5 changes: 1 addition & 4 deletions shiny/test/__init__.py → shiny/run/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,11 @@
from ._conftest import ShinyAppProc

# from ._expect import expect_to_change
from ._playwright import Locator, Page, expect


__all__ = (
# TODO-future: Find the proper location for these methods to be returned
# "run_shiny_app",
# "expect_to_change",
"ShinyAppProc",
"Page",
"Locator",
"expect",
)
File renamed without changes.
17 changes: 0 additions & 17 deletions shiny/test/_playwright.py

This file was deleted.

3 changes: 0 additions & 3 deletions shiny/test/fixture/__init__.py

This file was deleted.

4 changes: 2 additions & 2 deletions tests/playwright/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ as the calling `test_*.py` file.
```python

import re
from shiny.test import Page, ShinyAppProc, expect
from playwright.sync_api import Locator, Page, expect ShinyAppProc, expect


def test_airmass(page: Page, local_app: ShinyAppProc):
Expand All @@ -67,7 +67,7 @@ use it from test funcs.
```python
import re

from shiny.test import Page, ShinyAppProc
from playwright.sync_api import Locator, Page, expect ShinyAppProc
from conftest import create_example_fixture

airmass_app = create_example_fixture("airmass")
Expand Down
6 changes: 3 additions & 3 deletions tests/playwright/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
from pathlib import PurePath

import pytest
from playwright.sync_api import BrowserContext, Page

from shiny.test._playwright import BrowserContext, Page
from shiny.test.fixture import create_app_fixture
from shiny.test.fixture._fixture import ScopeName as ScopeName
from shiny.pytest import ScopeName as ScopeName
from shiny.pytest import create_app_fixture

__all__ = (
"create_doc_example_fixture",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import pytest
from playwright.sync_api import Page
from utils.deploy_utils import (
create_deploys_app_url_fixture,
reruns,
reruns_delay,
skip_if_not_chrome,
)

from shiny.test import Page
from shiny.test._controls import Accordion
from shiny.playwright.controls import Accordion

app_url = create_deploys_app_url_fixture("shiny_express_accordion")

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import pytest
from playwright.sync_api import Page
from utils.deploy_utils import (
create_deploys_app_url_fixture,
reruns,
reruns_delay,
skip_if_not_chrome,
)

from shiny.test import Page
from shiny.test._controls import OutputDataFrame
from shiny.playwright.controls import OutputDataFrame

app_url = create_deploys_app_url_fixture("shiny-express-dataframe")

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import pytest
from playwright.sync_api import Page, expect
from utils.deploy_utils import (
create_deploys_app_url_fixture,
reruns,
reruns_delay,
skip_if_not_chrome,
)

from shiny.test import Page, expect

app_url = create_deploys_app_url_fixture("shiny-express-folium")


Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import pytest
from playwright.sync_api import Page, expect
from utils.deploy_utils import (
create_deploys_app_url_fixture,
reruns,
reruns_delay,
skip_if_not_chrome,
)

from shiny.test import Page, expect
from shiny.test._controls import LayoutNavsetTab
from shiny.playwright.controls import LayoutNavsetTab

TIMEOUT = 2 * 60 * 1000

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import pytest
from playwright.sync_api import Page
from utils.deploy_utils import (
create_deploys_app_url_fixture,
reruns,
reruns_delay,
skip_if_not_chrome,
)

from shiny.test import Page
from shiny.test._controls import Card, OutputTextVerbatim
from shiny.playwright.controls import Card, OutputTextVerbatim

app_url = create_deploys_app_url_fixture("express_page_fillable")

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import pytest
from playwright.sync_api import Page
from utils.deploy_utils import (
create_deploys_app_url_fixture,
reruns,
reruns_delay,
skip_if_not_chrome,
)

from shiny.test import Page
from shiny.test._controls import Card, OutputTextVerbatim
from shiny.playwright.controls import Card, OutputTextVerbatim

app_url = create_deploys_app_url_fixture("express_page_fluid")

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import pytest
from playwright.sync_api import Page
from utils.deploy_utils import (
create_deploys_app_url_fixture,
reruns,
reruns_delay,
skip_if_not_chrome,
)

from shiny.test import Page
from shiny.test._controls import OutputTextVerbatim, Sidebar
from shiny.playwright.controls import OutputTextVerbatim, Sidebar

app_url = create_deploys_app_url_fixture("express_page_sidebar")

Expand Down
3 changes: 1 addition & 2 deletions tests/playwright/deploys/plotly/test_plotly_app.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import pytest
from playwright.sync_api import Page, expect
from utils.deploy_utils import (
create_deploys_app_url_fixture,
reruns,
reruns_delay,
skip_if_not_chrome,
)

from shiny.test import Page, expect

TIMEOUT = 2 * 60 * 1000
app_url = create_deploys_app_url_fixture("example_deploy_app_A")

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import pytest
from playwright.sync_api import Page, expect
from utils.deploy_utils import (
create_deploys_app_url_fixture,
reruns,
reruns_delay,
skip_if_not_chrome,
)

from shiny.test import Page, expect

app_url = create_deploys_app_url_fixture("shiny_client_console_error")


Expand Down
4 changes: 2 additions & 2 deletions tests/playwright/examples/example_apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

from playwright.sync_api import ConsoleMessage, Page

from shiny.test import ShinyAppProc
from shiny.test._conftest import run_shiny_app
from shiny.run import ShinyAppProc
from shiny.run._conftest import run_shiny_app

here_tests_e2e_examples = PurePath(__file__).parent
pyshiny_root = here_tests_e2e_examples.parent.parent.parent
Expand Down
3 changes: 1 addition & 2 deletions tests/playwright/examples/test_api_examples.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import pytest
from example_apps import get_apps, reruns, reruns_delay, validate_example

from shiny.test import Page
from playwright.sync_api import Page


@pytest.mark.flaky(reruns=reruns, reruns_delay=reruns_delay)
Expand Down
3 changes: 2 additions & 1 deletion tests/playwright/examples/test_cpuinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
import re

from conftest import create_example_fixture
from playwright.sync_api import Page, expect

from shiny.test import Page, ShinyAppProc, expect
from shiny.run import ShinyAppProc

cpuinfo_app = create_example_fixture("cpuinfo")

Expand Down
Loading