requirements.txt
pytest
pytest-playwright
Install browers
Call pytest!
See the test in the browser
or specify a specific brower
import pandas as pd
idx1 = pd.Index([1, 2, 3, 4, 5])
idx2 = pd.Index([2, 3, 4, 5, 6])
idx3 = pd.Index([3, 4, 5, 6, 7])
default = pd.Index([1, 2, 3, 4, 5, 6, 7])
def test_index_intersection_all():
to_intersect = [idx1, idx2, idx3]
expected = pd.Index([3, 4, 5])
calculated = index_intersection_all(
to_intersect,
default=default,
)
assert (calculated == expected).all()
assert calculated.equals(expected)https://shiny.posit.co/py/api/testing/
from shiny.playwright import controller
from shiny.run import ShinyAppProc
from playwright.sync_api import Page
from shiny.pytest import create_app_fixture
app = create_app_fixture("app.py")
def test_basic_app(page: Page, app: ShinyAppProc):
page.goto(app.url)
selectize_day = controller.InputSelectize(page, "adaptive-filter_day")
selectize_day.set("Fri")
selectize_day.expect_selected(["Fri"])
selectize_time = controller.InputSelectize(page, "adaptive-filter_time")
selectize_time.expect_choices(["Dinner"])DSCI 532: Data Visualization 2 https://github.com/UBC-MDS/DSCI_532_vis-2_book