Skip to content

Commit

Permalink
ci test;
Browse files Browse the repository at this point in the history
  • Loading branch information
m-wrzr committed Nov 1, 2024
1 parent fdbf3bd commit 1943867
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 20 deletions.
12 changes: 10 additions & 2 deletions .github/actions/setup_backend/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ inputs:
python-version:
description: 'Python version to use'
required: true
default: '3.11'
default: '3.12'
streamlit-version:
description: 'Streamlit version to use'
required: true
default: '1.31'
default: '1.36'

runs:
using: composite
Expand All @@ -20,6 +20,14 @@ runs:
with:
python-version: ${{ inputs.python-version }}

- name: Cache Python dependencies
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Display Python version
run: python -c "import sys; print(sys.version)"
shell: bash --login -eo pipefail {0}
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/setup_frontend/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ runs:
steps:

- name: Use Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 16
node-version: 20
cache: 'npm'
cache-dependency-path: streamlit_searchbox/frontend/package-lock.json

Expand Down
27 changes: 11 additions & 16 deletions tests/playwright.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,18 +172,20 @@ def test_e2e(search_function, label: str, i: int, status: StatusType, page: Page
search_term = "x"
search_result = search_function(search_term)[0]

loc_searchbox.focus()
loc_searchbox.fill(search_term)

screenshot(page, label)

loc_searchbox.press("Enter")

# wait for options to appear
wait_for_reload(page)

###### 4. check if the option is displayed ######
time.sleep(0.5)

screenshot(page, label)

###### 4. check if the option is displayed ######

if not isinstance(search_result, tuple):
search_text = str(search_result)
else:
Expand All @@ -196,22 +198,15 @@ def test_e2e(search_function, label: str, i: int, status: StatusType, page: Page
l_option.focus()
l_option.press("Enter")

wait_for_reload(page)

screenshot(page, label)

###### 5. check if the result is displayed in main page ######

wait_for_reload(page)

# results are be displayed in main page, since it's not part of the searchbox iframe
assert (
page.get_by_text(
selection_to_text(
search_result
if not isinstance(search_result, tuple)
else search_result[1]
)
).count()
== 1
text_displayed = selection_to_text(
search_result if not isinstance(search_result, tuple) else search_result[1]
)

screenshot(page, label)
# results are be displayed in main page, since it's not part of the searchbox iframe
assert page.get_by_text(text_displayed).count() == 1

0 comments on commit 1943867

Please sign in to comment.