diff --git a/.github/workflows/hq-smoke-tests.yml b/.github/workflows/hq-smoke-tests.yml index 0c203d2b3..920b5d2a3 100644 --- a/.github/workflows/hq-smoke-tests.yml +++ b/.github/workflows/hq-smoke-tests.yml @@ -21,6 +21,7 @@ on: - staging - production - eu + - india schedule: - cron: '30 6 * * 1-5' @@ -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: | diff --git a/.gitignore b/.gitignore index 20fd1542e..5aecd7f03 100644 --- a/.gitignore +++ b/.gitignore @@ -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 \ No newline at end of file +LocustScripts/update-scripts/project-config/co-carecoordination-perf/mobile_worker_credentials.json + +/POCs/AppPercyMobile/settings.cfg +/POCs/PercyWebApps/settings.cfg +/POCs/VisualComparison/settings.cfg \ No newline at end of file diff --git a/Features/CaseSearch/test_cases/test_02_casesearch_configs.py b/Features/CaseSearch/test_cases/test_02_casesearch_configs.py index 01c2522fe..5eed05220 100644 --- a/Features/CaseSearch/test_cases/test_02_casesearch_configs.py +++ b/Features/CaseSearch/test_cases/test_02_casesearch_configs.py @@ -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) diff --git a/Features/CaseSearch/test_cases/test_05_casesearch_inline_search.py b/Features/CaseSearch/test_cases/test_05_casesearch_inline_search.py index 2a97d58d8..c8733afbf 100644 --- a/Features/CaseSearch/test_cases/test_05_casesearch_inline_search.py +++ b/Features/CaseSearch/test_cases/test_05_casesearch_inline_search.py @@ -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 @@ -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, diff --git a/Features/CaseSearch/test_cases/test_07_casesearch_data_registry.py b/Features/CaseSearch/test_cases/test_07_casesearch_data_registry.py index e74ecdeef..e0d079a5e 100644 --- a/Features/CaseSearch/test_cases/test_07_casesearch_data_registry.py +++ b/Features/CaseSearch/test_cases/test_07_casesearch_data_registry.py @@ -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) diff --git a/Features/SplitScreenCaseSearch/test_cases/test_05_casesearch_inline_search.py b/Features/SplitScreenCaseSearch/test_cases/test_05_casesearch_inline_search.py index 0080179d5..5cd188a01 100644 --- a/Features/SplitScreenCaseSearch/test_cases/test_05_casesearch_inline_search.py +++ b/Features/SplitScreenCaseSearch/test_cases/test_05_casesearch_inline_search.py @@ -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 @@ -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, diff --git a/HQSmokeTests/testCases/test_07_applications.py b/HQSmokeTests/testCases/test_07_applications.py index 8c19ec751..9807e5026 100644 --- a/HQSmokeTests/testCases/test_07_applications.py +++ b/HQSmokeTests/testCases/test_07_applications.py @@ -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() @@ -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() diff --git a/HQSmokeTests/testPages/applications/application_page.py b/HQSmokeTests/testPages/applications/application_page.py index ed63fd58f..4caa0bb5f 100644 --- a/HQSmokeTests/testPages/applications/application_page.py +++ b/HQSmokeTests/testPages/applications/application_page.py @@ -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')]") @@ -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) @@ -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) diff --git a/HQSmokeTests/testPages/data/data_dictionary_page.py b/HQSmokeTests/testPages/data/data_dictionary_page.py index c4ac61682..da9e8252f 100644 --- a/HQSmokeTests/testPages/data/data_dictionary_page.py +++ b/HQSmokeTests/testPages/data/data_dictionary_page.py @@ -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""" @@ -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..") diff --git a/HQSmokeTests/testPages/data/export_data_page.py b/HQSmokeTests/testPages/data/export_data_page.py index 37d4d9499..3ec869880 100644 --- a/HQSmokeTests/testPages/data/export_data_page.py +++ b/HQSmokeTests/testPages/data/export_data_page.py @@ -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(.,'{}')]" @@ -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") diff --git a/HQSmokeTests/testPages/data/import_cases_page.py b/HQSmokeTests/testPages/data/import_cases_page.py index a1b3e435e..36e08845d 100644 --- a/HQSmokeTests/testPages/data/import_cases_page.py +++ b/HQSmokeTests/testPages/data/import_cases_page.py @@ -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) diff --git a/HQSmokeTests/testPages/messaging/messaging_page.py b/HQSmokeTests/testPages/messaging/messaging_page.py index 8e3e30f2e..11a63f67a 100644 --- a/HQSmokeTests/testPages/messaging/messaging_page.py +++ b/HQSmokeTests/testPages/messaging/messaging_page.py @@ -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) diff --git a/HQSmokeTests/testPages/users/mobile_workers_page.py b/HQSmokeTests/testPages/users/mobile_workers_page.py index a209328fe..f551ea45c 100644 --- a/HQSmokeTests/testPages/users/mobile_workers_page.py +++ b/HQSmokeTests/testPages/users/mobile_workers_page.py @@ -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 diff --git a/HQSmokeTests/testPages/users/org_structure_page.py b/HQSmokeTests/testPages/users/org_structure_page.py index 08e1dab27..fb7f3b0d1 100644 --- a/HQSmokeTests/testPages/users/org_structure_page.py +++ b/HQSmokeTests/testPages/users/org_structure_page.py @@ -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): diff --git a/HQSmokeTests/testPages/users/web_user_page.py b/HQSmokeTests/testPages/users/web_user_page.py index d9fa46eff..027aa2a09 100644 --- a/HQSmokeTests/testPages/users/web_user_page.py +++ b/HQSmokeTests/testPages/users/web_user_page.py @@ -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) @@ -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): diff --git a/HQSmokeTests/userInputs/test_data/reassign_cases.xlsx b/HQSmokeTests/userInputs/test_data/reassign_cases.xlsx index 902e7c6a9..9808474ab 100644 Binary files a/HQSmokeTests/userInputs/test_data/reassign_cases.xlsx and b/HQSmokeTests/userInputs/test_data/reassign_cases.xlsx differ diff --git a/common_utilities/selenium/base_page.py b/common_utilities/selenium/base_page.py index e7478f33b..5cadd892e 100644 --- a/common_utilities/selenium/base_page.py +++ b/common_utilities/selenium/base_page.py @@ -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}") diff --git a/common_utilities/selenium/webapps.py b/common_utilities/selenium/webapps.py index a0319950e..d95756f5e 100644 --- a/common_utilities/selenium/webapps.py +++ b/common_utilities/selenium/webapps.py @@ -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 @@ -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)