Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/hq-smoke-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ on:
- staging
- production
- eu
- india
schedule:
- cron: '30 6 * * 1-5'

Expand All @@ -42,11 +43,11 @@ jobs:
- id: set-matrix-manual
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
echo "::set-output name=matrix::{\"environment\": [\"${{ inputs.environment }}\"]}"
echo "::set-output name=matrix::{\"environment\": [\"production\", \"staging\", \"india\"]}"
- id: set-matrix-default
if: ${{ github.event_name != 'repository_dispatch' }}
run: |
echo "::set-output name=matrix::{\"environment\": [\"production\", \"staging\",\"eu\"]}"
echo "::set-output name=matrix::{\"environment\": [\"production\", \"staging\", \"india\",\"eu\"]}"
- id: invalid-deploy
if: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.environment != 'production' }}
run: |
Expand Down
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -271,4 +271,8 @@ P1P2Tests/settings.cfg
/P1P2Tests/userInputs/test_data/mobile_workers_*
/P1P2Tests/userInputs/test_data/import_to_parent_*

LocustScripts/update-scripts/project-config/co-carecoordination-perf/mobile_worker_credentials.json
LocustScripts/update-scripts/project-config/co-carecoordination-perf/mobile_worker_credentials.json

/POCs/AppPercyMobile/settings.cfg
/POCs/PercyWebApps/settings.cfg
/POCs/VisualComparison/settings.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,7 @@ def test_case_15_sticky_search_without_default_value(driver, settings):
casesearch.search_against_property(search_property=CaseSearchUserInput.mood,
input_value=CaseSearchUserInput.four,
property_type=TEXT_INPUT)
time.sleep(2)
casesearch.search_against_property(search_property=CaseSearchUserInput.rating,
input_value=CaseSearchUserInput.three_star,
property_type=COMBOBOX)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import time

from Features.CaseSearch.test_pages.casesearch_page import CaseSearchWorkflows
from Features.CaseSearch.user_inputs.casesearch_user_inputs import CaseSearchUserInput
from common_utilities.selenium.webapps import WebApps
Expand Down Expand Up @@ -60,6 +62,7 @@ def test_case_03_search_property_settings(driver, settings):
casesearch.search_against_property(search_property=CaseSearchUserInput.rating,
input_value=CaseSearchUserInput.four_star,
property_type=COMBOBOX)
time.sleep(2)
casesearch.search_against_property(search_property=CaseSearchUserInput.rating,
input_value=CaseSearchUserInput.five_star,
property_type=COMBOBOX,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def test_case_08_smart_link_search_first_shadow(driver, settings):
print("casesearch-1 present in url")
webapps.submit_the_form()


@pytest.mark.skip
def test_case_09_smart_link_skip_default_shadow(driver, settings):
webapps = WebApps(driver, settings)
casesearch = CaseSearchWorkflows(driver)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import time

from Features.CaseSearch.test_pages.casesearch_page import CaseSearchWorkflows
from Features.CaseSearch.user_inputs.casesearch_user_inputs import CaseSearchUserInput
from common_utilities.selenium.webapps import WebApps
Expand Down Expand Up @@ -59,6 +61,7 @@ def test_case_03_search_property_settings(driver, settings):
casesearch.search_against_property(search_property=CaseSearchUserInput.rating,
input_value=CaseSearchUserInput.four_star,
property_type=COMBOBOX)
time.sleep(2)
casesearch.search_against_property(search_property=CaseSearchUserInput.rating,
input_value=CaseSearchUserInput.five_star,
property_type=COMBOBOX,
Expand Down
5 changes: 4 additions & 1 deletion HQSmokeTests/testCases/test_07_applications.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def test_case_37_form_xml_download_upload(driver):
3. Ensure this new form is a copy of the original form
"""
load = ApplicationPage(driver)
load.create_new_application()
load.form_xml_download_upload()


Expand Down Expand Up @@ -104,8 +105,10 @@ def test_case_38_create_new_build_deploy_to_mobile(driver, settings):
"""
if 'staging' in settings['url']:
pytest.xfail("Failing on Staging due to QA-7314")
elif "eu" in settings["url"]:
if "eu" in settings["url"]:
pytest.skip("App code is not getting displayed")
if "india" in settings["url"]:
pytest.skip("App code limit exhausted for the month")
load = ApplicationPage(driver)
load.opening_dashboard()
install_code, field_text = load.update_form_field()
Expand Down
16 changes: 12 additions & 4 deletions HQSmokeTests/testPages/applications/application_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def __init__(self, driver):
self.confirm_change = (By.XPATH, "(//button[@data-bind=\"click: save, hasFocus: saveHasFocus, visible: !isSaving()\"])[1]")
self.add_module = (By.XPATH, "//a[contains(@class,'new-module') or contains(@class,'appnav-add js-add-new-item')]/i")
self.add_case_list = (By.XPATH, "//button[@data-type='case']")
self.add_questions = (By.XPATH, "//div[@class='dropdown fd-add-question-dropdown']")
self.add_questions = (By.XPATH, "//div[@class='dropdown fd-add-question-dropdown']/button")
self.text_question = (By.XPATH, "//a[@data-qtype='Text']")
self.advanced_question = (By.XPATH, "//a[@data-qtype='Geopoint'][contains(.,'Advanced')]")
self.location_question = (By.XPATH, "//a[@data-qtype='Geopoint'][contains(.,'GPS')]")
Expand Down Expand Up @@ -186,7 +186,17 @@ def form_xml_download_upload(self):
self.js_click(self.actions_tab)
self.wait_for_element(self.download_xml)
self.click(self.download_xml)
wait_for_download_to_finish(file_extension=".xml")
file_name=wait_for_download_to_finish(file_extension=".xml")
time.sleep(5)
# newest_file = latest_download_file(".xml")
if 'xml' in file_name:
file_that_was_downloaded = PathSettings.DOWNLOAD_PATH / file_name
else:
print("Not the expected file. Downloading again...")
self.js_click(self.download_xml)
file_name = wait_for_download_to_finish(file_extension=".xml")
# newest_file = latest_download_file(".xml")
file_that_was_downloaded = PathSettings.DOWNLOAD_PATH / file_name
print("XML downloaded successfully")
time.sleep(4)
self.wait_to_click(self.add_form_button)
Expand All @@ -200,8 +210,6 @@ def form_xml_download_upload(self):
self.click(self.actions_tab)
self.wait_for_element(self.upload_xml)
self.click(self.upload_xml)
newest_file = latest_download_file(".xml")
file_that_was_downloaded = PathSettings.DOWNLOAD_PATH / newest_file
print(f"file_that_was_downloaded: {file_that_was_downloaded}")
self.send_keys(self.choose_file, str(file_that_was_downloaded))
self.wait_to_click(self.upload)
Expand Down
12 changes: 9 additions & 3 deletions HQSmokeTests/testPages/data/data_dictionary_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
from common_utilities.generate_random_string import fetch_random_string
from common_utilities.selenium.base_page import BasePage
from common_utilities.path_settings import PathSettings
from HQSmokeTests.testPages.users.org_structure_page import latest_download_file

from HQSmokeTests.testPages.users.org_structure_page import latest_download_file, wait_for_download_to_finish

""""Contains test page elements and functions related to data dictionary module"""

Expand Down Expand Up @@ -40,7 +39,14 @@ def export_data_dictionary(self):
self.click(self.export_button)
time.sleep(2)
newest_file = latest_download_file()
self.assert_downloaded_file(newest_file, "data_dictionary"), "Download Not Completed!"
if 'data_dictionary' in newest_file:
self.assert_downloaded_file(newest_file, "data_dictionary"), "Download Not Completed!"
else:
print("Not the expected file. Downloading again...")
self.js_click(self.export_button)
wait_for_download_to_finish()
newest_file = latest_download_file()
self.assert_downloaded_file(newest_file, "data_dictionary"), "Download Not Completed!"
print("File download successful")
except TimeoutException:
print("TIMEOUT ERROR: Still preparing for download..Celery might be down..")
Expand Down
9 changes: 7 additions & 2 deletions HQSmokeTests/testPages/data/export_data_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ def __init__(self, driver):
self.web_users_option = (By.XPATH, "//li/span[.='[Web Users]']")
self.all_data_option = (By.XPATH, "//li/span[.='[All Data]']")
self.users_field = (By.XPATH, "(//textarea[@class='select2-search__field'])[1]")
self.user_selected = "//span[contains(@class, 'choice') and .='{}']"
self.users_list_item = "//ul[@role='listbox']/li[contains(.,'{}')]"
self.users_list = (By.XPATH, "//ul[contains(@class,'select2-results__options')]/li")
self.user_from_list = "//li[contains(.,'{}')]"
Expand Down Expand Up @@ -199,8 +200,12 @@ def prepare_and_download_export(self, name, flag=None):
time.sleep(2)
self.date_filter()
if flag == None:
self.send_keys(self.users_field, UserData.web_user)
self.wait_to_click((By.XPATH, self.users_list_item.format(UserData.web_user)))
if not self.is_present((By.XPATH, self.user_selected.format(UserData.web_user))):
print("Web User option is not already selected")
self.send_keys(self.users_field, UserData.web_user)
self.wait_to_click((By.XPATH, self.users_list_item.format(UserData.web_user)))
else:
print("Web User option is already selected")
self.wait_and_sleep_to_click(self.prepare_export_button, timeout=10)
try:
self.wait_till_progress_completes("exports")
Expand Down
9 changes: 8 additions & 1 deletion HQSmokeTests/testPages/data/import_cases_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,15 @@ def replace_property_and_upload(self):
self.wait_for_element(self.choose_file)
print(str(self.renamed_file))
self.send_keys(self.choose_file, self.renamed_file)

self.wait_for_element(self.next_step)
if self.is_present(self.alert_msg):
print("Upload might have failed. Reuploading...")
self.reload_page()
self.wait_for_element(self.choose_file)
self.send_keys(self.choose_file, self.renamed_file)
self.wait_for_element(self.next_step)
else:
print("Upload successful.")
self.click(self.next_step)
self.is_visible_and_displayed(self.case_type)
self.select_by_text(self.case_type, UserData.case_pregnancy)
Expand Down
9 changes: 8 additions & 1 deletion HQSmokeTests/testPages/messaging/messaging_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,14 @@ def cond_alert_download(self):

def cond_alert_upload(self):
newest_file = latest_download_file()
file_that_was_downloaded = PathSettings.DOWNLOAD_PATH / newest_file
if 'Alerts' in newest_file:
file_that_was_downloaded = PathSettings.DOWNLOAD_PATH / newest_file
else:
print("Not the expected file. Downloading again...")
self.js_click(self.download_id)
wait_for_download_to_finish()
newest_file = latest_download_file()
file_that_was_downloaded = PathSettings.DOWNLOAD_PATH / newest_file
self.send_keys(self.choose_file, str(file_that_was_downloaded))
self.wait_to_click(self.upload)
self.wait_for_element(self.upload_success_message)
Expand Down
9 changes: 8 additions & 1 deletion HQSmokeTests/testPages/users/mobile_workers_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,14 @@ def download_mobile_worker(self):
assert False
# verify_downloaded_workers
newest_file = latest_download_file()
self.assert_downloaded_file(newest_file, "_users_"), "Download Not Completed!"
if '_users_' in newest_file:
self.assert_downloaded_file(newest_file, "_users_"), "Download Not Completed!"
else:
print("Not the expected file. Downloading again...")
self.js_click(self.download_users_btn)
wait_for_download_to_finish()
newest_file = latest_download_file()
self.assert_downloaded_file(newest_file, "_users_"), "Download Not Completed!"
print("File download successful")

return newest_file
Expand Down
9 changes: 8 additions & 1 deletion HQSmokeTests/testPages/users/org_structure_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,14 @@ def download_locations(self):
assert False
# verify_downloaded_location
newest_file = latest_download_file()
self.assert_downloaded_file(newest_file, "_locations"), "Download not completed!"
if '_locations' in newest_file:
self.assert_downloaded_file(newest_file, "_locations"), "Download Not Completed!"
else:
print("Not the expected file. Downloading again...")
self.js_click(self.download_loc_btn)
wait_for_download_to_finish()
newest_file = latest_download_file()
self.assert_downloaded_file(newest_file, "_locations"), "Download Not Completed!"
print("File download successful")

def upload_locations(self):
Expand Down
11 changes: 10 additions & 1 deletion HQSmokeTests/testPages/users/web_user_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ def invite_new_web_user(self, role):
self.wait_to_clear_and_send_keys(self.email_input, UserData.yahoo_user_name)
self.select_by_value(self.select_project_role_id, role)
self.wait_to_click(self.send_invite)
print("Waiting for sometime for the status to get updated...")
time.sleep(5)

def assert_invitation_sent(self):
time.sleep(2)
Expand Down Expand Up @@ -162,7 +164,14 @@ def download_web_users(self):
# verify_downloaded_workers
newest_file = latest_download_file()
print(newest_file)
self.assert_downloaded_file(newest_file, "_users_"), "Download Not Completed!"
if '_users_' in newest_file:
self.assert_downloaded_file(newest_file, "_users_"), "Download Not Completed!"
else:
print("Not the expected file. Downloading again...")
self.js_click(self.download_users_btn)
wait_for_download_to_finish()
newest_file = latest_download_file()
self.assert_downloaded_file(newest_file, "_users_"), "Download Not Completed!"
print("File download successful")

def upload_web_users(self):
Expand Down
Binary file modified HQSmokeTests/userInputs/test_data/reassign_cases.xlsx
Binary file not shown.
2 changes: 2 additions & 0 deletions common_utilities/selenium/base_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,11 +594,13 @@ def _is_jquery_present(self):
def back(self):
try:
self.driver.back()
self.wait_after_interaction(timeout=20)
print("[INFO] Navigated back using driver.back()")
except WebDriverException as e:
print(f"[WARNING] driver.back() failed: {e}. Trying JavaScript fallback...")
try:
self.driver.execute_script("window.history.back();")
self.wait_after_interaction(timeout=20)
print("[INFO] Navigated back using JavaScript")
except Exception as js_e:
print(f"[ERROR] JavaScript fallback also failed: {js_e}")
Expand Down
2 changes: 2 additions & 0 deletions common_utilities/selenium/webapps.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ def continue_to_forms(self):
def select_case_and_continue(self, case_name):
self.select_case(case_name)
self.continue_to_forms()
self.wait_after_interaction(timeout=20)
self.wait_for_element(self.content_container, timeout=30)
form_names = self.find_elements_texts(self.form_names)
return form_names
Expand Down Expand Up @@ -364,6 +365,7 @@ def go_to_page(self, page_number):

def open_data_preview(self):
self.wait_to_click(self.data_preview)
time.sleep(5)

def present_in_data_preview(self, value):
value_in_data_preview = self.get_element(self.value_in_data_preview, value)
Expand Down
Loading