-
Notifications
You must be signed in to change notification settings - Fork 104
test: Test apps locally before deploying via pytest fixtures. #1055
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
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
a0da1e5
Move deploy tests under playwright-shiny
karangattu 156ee9e
pyright changes
karangattu 70b975f
move it to a different directory
karangattu ffea0a1
Merge branch 'main' into deploy-tests-under-playwright-shiny
karangattu 7658a52
Modify path to deploys
karangattu 1a202b7
Modify path to deploys tests
karangattu da0f7fe
don't skip plotly app
karangattu dc18116
black formatting
karangattu 0e31c72
rename the shinyapps.io json files
karangattu 9ea2628
Rename the plotly shinyapps.io json file
karangattu 20639a0
Merge branch 'main' into deploy-tests-under-playwright-shiny
schloerke ac1b0b7
Add plotly deploys app to transformer error list. Expand on path name…
schloerke 15cb922
Missed app name update
schloerke 1119b36
Discard changes to ...playwright/deploys/apps/plotly_app/app.py
schloerke 1e23071
Revert playwright-deploys job and makefile entry
schloerke 756f213
Move deploys apps
schloerke 4c8c490
Deploy app to consistent locations
schloerke d18671b
Ignore more apps
schloerke a3b5880
Merge branch 'main' into deploy-tests-under-playwright-shiny
schloerke 6ff659a
rename the rsconnect json files
karangattu 518d575
Delete app.py
schloerke a25e410
Revert init deletion
schloerke e31dba9
Add flag to/not to deploy _deploys_ apps during testing
schloerke 5e23d00
Pass through yielded app to write logic once
schloerke a656d32
Make fixture that deploys or runs an app locally
schloerke cd46c05
Use new fixture
schloerke e20575e
Add comment of debug options
schloerke 3ef4aab
Merge branch 'main' into deploy-tests-under-playwright-shiny
schloerke 949569f
pyright lint
schloerke a8b530a
Delete test_deploys_examples.py
schloerke 3e8c5d1
Update deploy_utils.py
schloerke e483251
Make CI playwright more descriptive when testing
schloerke fd8f5c8
Update pytest.yaml
schloerke db70485
Explicitly wait up to 2 mins for text to resolve
schloerke d1107ed
remove fastapi from app_requirements.txt
karangattu 2e239a8
add timeout to page default
karangattu dcda99b
Move pre-test to be in deploys GHA job. Only deploy if on push or PR …
schloerke fda6e8b
Remove skip if python version != 3.10
schloerke 66cdbf9
Test deploy apps using 12 processes
schloerke dd80734
Do not use dynamic locator property
schloerke 67d2e49
Get the __file__ info from request in fixture
schloerke 72aa4c5
Do not first use locator that must internally resolve. Instead, nativ…
schloerke 168aad9
Use correct deploy name
schloerke 1838875
Shorten folder names
schloerke 5c3b353
Rename deploy files
schloerke File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Use new fixture
- Loading branch information
commit cd46c05e3c3ea59dde1ee693a5f4458971df4ebb
There are no files selected for viewing
This file contains hidden or 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,31 +1,21 @@ | ||
import os | ||
|
||
import pytest | ||
from playwright.sync_api import Page, expect | ||
from utils.deploy_utils import ( | ||
deploy_locations, | ||
prepare_deploy_and_open_url, | ||
skip_if_not_python_310, | ||
create_deploys_app_url_fixture, | ||
skip_if_not_python_310_or_chrome, | ||
) | ||
|
||
COUNTRY = "Afghanistan" | ||
APP_NAME = "example_deploy_app_A" | ||
app_file_path = os.path.dirname(os.path.abspath(__file__)) | ||
EXPECT_TIMEOUT = 120 * 1000 | ||
app_url = create_deploys_app_url_fixture(__file__, "example_deploy_app_A") | ||
|
||
|
||
@skip_if_not_python_310 | ||
@pytest.mark.only_browser("chromium") | ||
@pytest.mark.parametrize("location", deploy_locations) | ||
def test_deploys(page: Page, location: str) -> None: | ||
prepare_deploy_and_open_url(page, app_file_path, location, APP_NAME) | ||
@skip_if_not_python_310_or_chrome | ||
def test_deploys(page: Page, app_url: str) -> None: | ||
if "127.0.0.1" not in app_url: | ||
page.set_default_timeout(120 * 1000) | ||
page.goto(app_url) | ||
|
||
expect(page.get_by_text(COUNTRY)).to_have_count(1, timeout=EXPECT_TIMEOUT) | ||
page.get_by_role("cell", name=COUNTRY).click(timeout=EXPECT_TIMEOUT) | ||
expect(page.locator("#country_detail_pop")).to_contain_text( | ||
COUNTRY, timeout=EXPECT_TIMEOUT | ||
) | ||
expect(page.locator("#country_detail_percap")).to_contain_text( | ||
COUNTRY, timeout=EXPECT_TIMEOUT | ||
) | ||
expect(page.get_by_text(COUNTRY)).to_have_count(3, timeout=EXPECT_TIMEOUT) | ||
COUNTRY = "Afghanistan" | ||
expect(page.get_by_text(COUNTRY)).to_have_count(1) | ||
page.get_by_role("cell", name=COUNTRY).click() | ||
expect(page.locator("#country_detail_pop")).to_contain_text(COUNTRY) | ||
expect(page.locator("#country_detail_percap")).to_contain_text(COUNTRY) | ||
expect(page.get_by_text(COUNTRY)).to_have_count(3) |
19 changes: 6 additions & 13 deletions
19
tests/playwright/deploys/shiny-express-accordion/test_accordion.py
This file contains hidden or 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
19 changes: 6 additions & 13 deletions
19
tests/playwright/deploys/shiny-express-dataframe/test_dataframe.py
This file contains hidden or 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,23 +1,16 @@ | ||
import os | ||
|
||
import pytest | ||
from controls import OutputDataFrame | ||
from playwright.sync_api import Page | ||
from utils.deploy_utils import ( | ||
deploy_locations, | ||
prepare_deploy_and_open_url, | ||
skip_if_not_python_310, | ||
create_deploys_app_url_fixture, | ||
skip_if_not_python_310_or_chrome, | ||
) | ||
|
||
APP_NAME = "shiny-express-dataframe" | ||
app_file_path = os.path.dirname(os.path.abspath(__file__)) | ||
app_url = create_deploys_app_url_fixture(__file__, "shiny-express-dataframe") | ||
|
||
|
||
@skip_if_not_python_310 | ||
@pytest.mark.only_browser("chromium") | ||
@pytest.mark.parametrize("location", deploy_locations) | ||
def test_express_dataframe_deploys(page: Page, location: str) -> None: | ||
prepare_deploy_and_open_url(page, app_file_path, location, APP_NAME) | ||
@skip_if_not_python_310_or_chrome | ||
def test_express_dataframe_deploys(page: Page, app_url: str) -> None: | ||
page.goto(app_url) | ||
|
||
dataframe = OutputDataFrame(page, "sample_data_frame") | ||
dataframe.expect_n_row(6) |
19 changes: 6 additions & 13 deletions
19
tests/playwright/deploys/shiny-express-folium/test_folium.py
This file contains hidden or 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
20 changes: 7 additions & 13 deletions
20
tests/playwright/deploys/shiny-express-page_default/test_page_default.py
This file contains hidden or 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
19 changes: 6 additions & 13 deletions
19
tests/playwright/deploys/shiny-express-page_fillable/test_page_fillable.py
This file contains hidden or 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
19 changes: 6 additions & 13 deletions
19
tests/playwright/deploys/shiny-express-page_fluid/test_page_fluid.py
This file contains hidden or 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
19 changes: 6 additions & 13 deletions
19
tests/playwright/deploys/shiny-express-page_sidebar/test_page_sidebar.py
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.