Skip to content

Commit

Permalink
Added wait for Flask app to start
Browse files Browse the repository at this point in the history
  • Loading branch information
ciioprof0 committed Aug 18, 2024
1 parent 32573e6 commit 996c456
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion ling508/demos/demo_clex_importer.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@
"output_type": "stream",
"text": [
"\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m [100%]\u001b[0m\n",
"\u001b[32m\u001b[32m\u001b[1m32 passed\u001b[0m\u001b[32m in 45.40s\u001b[0m\u001b[0m\n"
"\u001b[32m\u001b[32m\u001b[1m32 passed\u001b[0m\u001b[32m in 50.15s\u001b[0m\u001b[0m\n"
]
},
{
Expand Down
12 changes: 7 additions & 5 deletions ling508/tests/test_90_e2e_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from ling508.api import app

@pytest.fixture(scope="module")
Expand Down Expand Up @@ -52,11 +54,11 @@ def test_form_submission(init_driver, test_client):
# Open the form in the browser
driver.get("http://localhost:5000/")

# Fill out the form
uri_field = driver.find_element(By.ID, "uri")
uri_field.send_keys(
"https://raw.githubusercontent.com/ciioprof0/stixd/main/lexicon/test_clex.pl"
# Wait for the URI field to be present
uri_field = WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.ID, "uri"))
)
uri_field.send_keys("https://raw.githubusercontent.com/ciioprof0/stixd/main/lexicon/test_clex.pl")

# Submit the form
submit_button = driver.find_element(By.TAG_NAME, "button")
Expand All @@ -71,4 +73,4 @@ def test_form_submission(init_driver, test_client):
finally:
# Terminate the Flask server process
flask_process.terminate()
flask_process.join()
flask_process.join()
10 changes: 7 additions & 3 deletions ling508/tests/test_95_e2e_ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from ling508.api import app

@pytest.fixture(scope="module")
Expand Down Expand Up @@ -51,8 +53,10 @@ def test_form_submission(init_driver, test_client):
# Open the form in the browser
driver.get("http://localhost:5000/")

# Fill out the form
uri_field = driver.find_element(By.ID, "uri")
# Wait for the URI field to be present
uri_field = WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.ID, "uri"))
)
uri_field.send_keys("https://raw.githubusercontent.com/ciioprof0/stixd/main/lexicon/test_clex.pl")

# Submit the form
Expand All @@ -68,4 +72,4 @@ def test_form_submission(init_driver, test_client):
finally:
# Terminate the Flask server process
flask_process.terminate()
flask_process.join()
flask_process.join()

0 comments on commit 996c456

Please sign in to comment.