-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add rsconnect json files(shinyapps.io tests) and folium tests (#928)
- Loading branch information
1 parent
f926cc3
commit 3e587ab
Showing
37 changed files
with
341 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,6 +83,7 @@ test = | |
missingno | ||
rsconnect-python | ||
scikit-learn | ||
folium | ||
|
||
dev = | ||
black>=23.1.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import datetime | ||
|
||
from shiny import render, ui | ||
from shiny.express import input, layout | ||
|
||
with layout.card(id="card"): | ||
ui.input_slider("val", "slider", 0, 100, 50) | ||
"Text outside of render display call" | ||
ui.tags.br() | ||
f"Rendered time: {str(datetime.datetime.now())}" | ||
|
||
@render.display | ||
def render_display(): | ||
"Text inside of render display call" | ||
ui.tags.br() | ||
"Dynamic slider value: " | ||
input.val() | ||
ui.tags.br() | ||
f"Display's rendered time: {str(datetime.datetime.now())}" |
13 changes: 6 additions & 7 deletions
13
tests/playwright/deploys/apps/plotly_app/rsconnect-python/plotly_app.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
{ | ||
"https://rsc.radixu.com/": { | ||
"server_url": "https://rsc.radixu.com/", | ||
"filename": "/Users/karangathani/Documents/GitHub/py-shiny/tests/playwright/deploys/apps/plotly_app", | ||
"app_url": "https://rsc.radixu.com/content/fc82dde5-c4ba-4748-971b-aacc09613faa/", | ||
"app_id": "fc82dde5-c4ba-4748-971b-aacc09613faa", | ||
"app_guid": "fc82dde5-c4ba-4748-971b-aacc09613faa", | ||
"https://api.shinyapps.io": { | ||
"server_url": "https://api.shinyapps.io", | ||
"app_url": "https://testing-apps.shinyapps.io/example_deploy_app_a1/", | ||
"app_id": 10800241, | ||
"app_guid": null, | ||
"title": "example_deploy_app_A", | ||
"app_mode": "python-shiny", | ||
"app_store_version": 1 | ||
} | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
tests/playwright/deploys/apps/shiny-express-accordion/requirements.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
git+https://github.com/posit-dev/py-shiny.git#egg=shiny | ||
git+https://github.com/posit-dev/py-shiny | ||
git+https://github.com/posit-dev/py-htmltools.git#egg=htmltools |
11 changes: 11 additions & 0 deletions
11
...wright/deploys/apps/shiny-express-accordion/rsconnect-python/shiny-express-accordion.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"https://api.shinyapps.io": { | ||
"server_url": "https://api.shinyapps.io", | ||
"app_url": "https://testing-apps.shinyapps.io/shiny_express_accordion/", | ||
"app_id": 10800240, | ||
"app_guid": null, | ||
"title": "shiny_express_accordion", | ||
"app_mode": "python-shiny", | ||
"app_store_version": 1 | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
tests/playwright/deploys/apps/shiny-express-dataframe/app.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import pandas as pd | ||
|
||
from shiny import render | ||
from shiny.express import ui | ||
|
||
data = { | ||
"A": [1, 2, 3, 4, 5, 6], | ||
"B": ["a", "b", "c", "d", "e", "f"], | ||
"C": [10.1, 20.2, 30.3, 40.4, 50.5, 60.6], | ||
"D": ["apple", "banana", "cherry", "date", "elderberry", "fig"], | ||
"E": [True, False, True, False, True, False], | ||
"F": ["John", "Jane", "Jim", "Jessie", "Jack", "Jill"], | ||
} | ||
|
||
df = pd.DataFrame(data) | ||
|
||
ui.page_opts(fillable=True) | ||
|
||
with ui.card(id="card"): | ||
ui.h2("Below is a sample dataframe") | ||
|
||
@render.data_frame | ||
def sample_data_frame(id: str = "dataframe"): | ||
return df |
3 changes: 3 additions & 0 deletions
3
tests/playwright/deploys/apps/shiny-express-dataframe/requirements.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
git+https://github.com/posit-dev/py-shiny | ||
git+https://github.com/posit-dev/py-htmltools.git#egg=htmltools | ||
pandas |
11 changes: 11 additions & 0 deletions
11
...wright/deploys/apps/shiny-express-dataframe/rsconnect-python/shiny-express-dataframe.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"https://api.shinyapps.io": { | ||
"server_url": "https://api.shinyapps.io", | ||
"app_url": "https://testing-apps.shinyapps.io/shiny-express-dataframe/", | ||
"app_id": 10800260, | ||
"app_guid": null, | ||
"title": "shiny-express-dataframe", | ||
"app_mode": "python-shiny", | ||
"app_store_version": 1 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import folium # pyright: ignore[reportMissingTypeStubs] | ||
|
||
from shiny import render | ||
from shiny.express import input, ui | ||
|
||
locations_coords = { | ||
"San Francisco": (37.79554, -122.39348), | ||
"Los Angeles": (34.05026, -118.25768), | ||
"New York": (40.71222, -74.00490), | ||
} | ||
ui.page_opts(full_width=False) | ||
|
||
with ui.card(id="card"): | ||
"Static Map" | ||
folium.Map( | ||
location=locations_coords["San Francisco"], tiles="USGS.USTopo", zoom_start=12 | ||
) | ||
ui.input_radio_buttons( | ||
"location", "Location", ["San Francisco", "New York", "Los Angeles"] | ||
) | ||
|
||
@render.display | ||
def folium_map(): | ||
"Map inside of render display call" | ||
folium.Map( | ||
location=locations_coords[input.location()], | ||
tiles="cartodb positron", | ||
zoom_start=12, | ||
) | ||
input.location() |
3 changes: 3 additions & 0 deletions
3
tests/playwright/deploys/apps/shiny-express-folium/requirements.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
git+https://github.com/posit-dev/py-shiny | ||
git+https://github.com/posit-dev/py-htmltools.git#egg=htmltools | ||
folium |
11 changes: 11 additions & 0 deletions
11
...s/playwright/deploys/apps/shiny-express-folium/rsconnect-python/shiny-express-folium.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"https://api.shinyapps.io": { | ||
"server_url": "https://api.shinyapps.io", | ||
"app_url": "https://testing-apps.shinyapps.io/shiny-express-folium/", | ||
"app_id": 10827011, | ||
"app_guid": null, | ||
"title": "shiny-express-folium", | ||
"app_mode": "python-shiny", | ||
"app_store_version": 1 | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
tests/playwright/deploys/apps/shiny-express-page-default/requirements.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
git+https://github.com/posit-dev/py-shiny.git#egg=shiny | ||
git+https://github.com/posit-dev/py-shiny | ||
git+https://github.com/posit-dev/py-htmltools.git#egg=htmltools |
11 changes: 11 additions & 0 deletions
11
.../deploys/apps/shiny-express-page-default/rsconnect-python/shiny-express-page-default.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"https://api.shinyapps.io": { | ||
"server_url": "https://api.shinyapps.io", | ||
"app_url": "https://testing-apps.shinyapps.io/shiny_express_page_default/", | ||
"app_id": 10800233, | ||
"app_guid": null, | ||
"title": "shiny_express_page_default", | ||
"app_mode": "python-shiny", | ||
"app_store_version": 1 | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
tests/playwright/deploys/apps/shiny-express-page-fillable/app.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
tests/playwright/deploys/apps/shiny-express-page-fillable/requirements.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
git+https://github.com/posit-dev/py-shiny.git#egg=shiny | ||
git+https://github.com/posit-dev/py-shiny | ||
git+https://github.com/posit-dev/py-htmltools.git#egg=htmltools |
11 changes: 11 additions & 0 deletions
11
...eploys/apps/shiny-express-page-fillable/rsconnect-python/shiny-express-page-fillable.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"https://api.shinyapps.io": { | ||
"server_url": "https://api.shinyapps.io", | ||
"app_url": "https://testing-apps.shinyapps.io/express_page_fillable/", | ||
"app_id": 10800242, | ||
"app_guid": null, | ||
"title": "express_page_fillable", | ||
"app_mode": "python-shiny", | ||
"app_store_version": 1 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
tests/playwright/deploys/apps/shiny-express-page-fluid/requirements.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
git+https://github.com/posit-dev/py-shiny.git#egg=shiny | ||
git+https://github.com/posit-dev/py-shiny | ||
git+https://github.com/posit-dev/py-htmltools.git#egg=htmltools |
11 changes: 11 additions & 0 deletions
11
...ight/deploys/apps/shiny-express-page-fluid/rsconnect-python/shiny-express-page-fluid.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"https://api.shinyapps.io": { | ||
"server_url": "https://api.shinyapps.io", | ||
"app_url": "https://testing-apps.shinyapps.io/express_page_fluid/", | ||
"app_id": 10800235, | ||
"app_guid": null, | ||
"title": "express_page_fluid", | ||
"app_mode": "python-shiny", | ||
"app_store_version": 1 | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
tests/playwright/deploys/apps/shiny-express-page-sidebar/app.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
tests/playwright/deploys/apps/shiny-express-page-sidebar/requirements.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
git+https://github.com/posit-dev/py-shiny.git#egg=shiny | ||
git+https://github.com/posit-dev/py-shiny | ||
git+https://github.com/posit-dev/py-htmltools.git#egg=htmltools |
11 changes: 11 additions & 0 deletions
11
.../deploys/apps/shiny-express-page-sidebar/rsconnect-python/shiny-express-page-sidebar.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"https://api.shinyapps.io": { | ||
"server_url": "https://api.shinyapps.io", | ||
"app_url": "https://testing-apps.shinyapps.io/express_page_sidebar/", | ||
"app_id": 10800234, | ||
"app_guid": null, | ||
"title": "express_page_sidebar", | ||
"app_mode": "python-shiny", | ||
"app_store_version": 1 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import os | ||
|
||
import pytest | ||
from playwright.sync_api import Page | ||
from utils.deploy_utils import deploy | ||
from utils.express_utils import verify_express_dataframe | ||
|
||
APP_DIR = "shiny-express-dataframe" | ||
APP_NAME = "shiny-express-dataframe" | ||
PAGE_TIMEOUT = 120 * 1000 | ||
EXPECT_TIMEOUT = 30 * 1000 | ||
current_dir = os.path.dirname(os.path.abspath(__file__)) | ||
app_file_path = os.path.join(os.path.dirname(current_dir), "apps", APP_DIR) | ||
|
||
|
||
@pytest.mark.integrationtest | ||
@pytest.mark.only_browser("chromium") | ||
@pytest.mark.parametrize("location", ["connect", "shinyapps"]) | ||
def test_express_dataframe(page: Page, location: str) -> None: | ||
page_url = deploy(location, APP_NAME, app_file_path) | ||
page.goto(page_url, timeout=PAGE_TIMEOUT) | ||
verify_express_dataframe(page) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import os | ||
|
||
import pytest | ||
from playwright.sync_api import Page | ||
from utils.deploy_utils import deploy | ||
from utils.express_utils import verify_express_folium_render | ||
|
||
APP_DIR = "shiny-express-folium" | ||
APP_NAME = "shiny-express-folium" | ||
PAGE_TIMEOUT = 120 * 1000 | ||
EXPECT_TIMEOUT = 30 * 1000 | ||
current_dir = os.path.dirname(os.path.abspath(__file__)) | ||
app_file_path = os.path.join(os.path.dirname(current_dir), "apps", APP_DIR) | ||
|
||
|
||
@pytest.mark.integrationtest | ||
@pytest.mark.only_browser("chromium") | ||
@pytest.mark.parametrize("location", ["connect", "shinyapps"]) | ||
def test_folium_map(page: Page, location: str) -> None: | ||
page_url = deploy(location, APP_NAME, app_file_path) | ||
page.goto(page_url, timeout=PAGE_TIMEOUT) | ||
verify_express_folium_render(page) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import pandas as pd | ||
|
||
from shiny import render | ||
from shiny.express import ui | ||
|
||
data = { | ||
"A": [1, 2, 3, 4, 5, 6], | ||
"B": ["a", "b", "c", "d", "e", "f"], | ||
"C": [10.1, 20.2, 30.3, 40.4, 50.5, 60.6], | ||
"D": ["apple", "banana", "cherry", "date", "elderberry", "fig"], | ||
"E": [True, False, True, False, True, False], | ||
"F": ["John", "Jane", "Jim", "Jessie", "Jack", "Jill"], | ||
} | ||
|
||
df = pd.DataFrame(data) | ||
|
||
ui.page_opts(fillable=True) | ||
|
||
with ui.card(id="card"): | ||
ui.h2("Below is a sample dataframe") | ||
|
||
@render.data_frame | ||
def sample_data_frame(id: str = "dataframe"): | ||
return df |
8 changes: 8 additions & 0 deletions
8
tests/playwright/shiny/shiny-express/dataframe/test_dataframe.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from conftest import ShinyAppProc | ||
from playwright.sync_api import Page | ||
from utils.express_utils import verify_express_dataframe | ||
|
||
|
||
def test_page_default(page: Page, local_app: ShinyAppProc) -> None: | ||
page.goto(local_app.url) | ||
verify_express_dataframe(page) |
Oops, something went wrong.