From 3155438a60e18b4b45695d5d1d7e4c473c4ae331 Mon Sep 17 00:00:00 2001 From: Kankana Bordoloi Date: Thu, 9 Nov 2023 15:56:35 +0530 Subject: [PATCH] QA 2857 made changes to few locators and steps and yml --- .github/workflows/formplayer.yml | 3 +-- .../testCases/test_04_basic_test_forms.py | 4 +-- .../basic_test_app/basic_test_app_preview.py | 11 +++++--- .../basic_test_app/basic_test_web_apps.py | 26 ++++++++++++------- 4 files changed, 27 insertions(+), 17 deletions(-) diff --git a/.github/workflows/formplayer.yml b/.github/workflows/formplayer.yml index ae1f5cd48..694072b1e 100644 --- a/.github/workflows/formplayer.yml +++ b/.github/workflows/formplayer.yml @@ -10,7 +10,6 @@ on: branches: [ master ] schedule: - cron: '0 0 * * 0' - workflow_dispatch: inputs: environment: @@ -71,7 +70,7 @@ jobs: echo "matrix environment: ${{ matrix.environment }}" echo "NOW=$(date +'%m-%d %H:%M')" >> $GITHUB_ENV echo ${{env.NOW}} - pytest -v --rootdir= Formplayer/testCases -n 3 --dist=loadfile --reruns 1 --html=formplayer_${{ matrix.environment }}.html + pytest -v --rootdir= Formplayer/testCases -n 4 --dist=loadfile --reruns 1 --html=formplayer_${{ matrix.environment }}.html - name: Set email vars if: ${{ success() || failure() }} id: configure_email diff --git a/Formplayer/testCases/test_04_basic_test_forms.py b/Formplayer/testCases/test_04_basic_test_forms.py index 1c1f88173..8429d8e9b 100644 --- a/Formplayer/testCases/test_04_basic_test_forms.py +++ b/Formplayer/testCases/test_04_basic_test_forms.py @@ -20,7 +20,7 @@ def test_case_16_incomplete_form_app_preview(driver, settings): basic.save_incomplete_form(basic.name_input2) basic.open_form(UserData.basic_tests_app['case_list'], UserData.basic_tests_app['form_name']) basic.save_incomplete_form(basic.name_input3) - basic.verify_number_of_forms(3) + basic.verify_number_of_forms(3, UserData.basic_tests_app['form_name']) basic.delete_first_form() app_preview.open_view_app_preview(UserData.basic_tests_app['tests_app']) basic.verify_saved_form_and_submit_unchanged(basic.name_input2) @@ -45,7 +45,7 @@ def test_case_17_incomplete_form_web_apps(driver, settings): login.open_basic_tests_app(UserData.basic_tests_app['tests_app']) basic.open_form(UserData.basic_tests_app['case_list'], UserData.basic_tests_app['form_name']) basic.save_incomplete_form(basic.name_input3) - basic.verify_number_of_forms(3) + basic.verify_number_of_forms(3, UserData.basic_tests_app['form_name']) basic.delete_first_form() basic.verify_saved_form_and_submit_unchanged(basic.name_input2) basic.verify_submit_history(basic.name_input2, UserData.app_preview_mobile_worker) diff --git a/Formplayer/testPages/basic_test_app/basic_test_app_preview.py b/Formplayer/testPages/basic_test_app/basic_test_app_preview.py index 73412b1b4..cf7289c88 100644 --- a/Formplayer/testPages/basic_test_app/basic_test_app_preview.py +++ b/Formplayer/testPages/basic_test_app/basic_test_app_preview.py @@ -70,6 +70,7 @@ def __init__(self, driver): self.name_question = (By.XPATH, "//label[.//span[.='Enter a Name']]/following-sibling::div//textarea[contains(@class,'textfield form-control')]") self.incomplete_form_list = (By.XPATH, "//tr[@class='formplayer-request']") + self.custom_incomplete_form_list = "//tr[@class='formplayer-request']/td[2][contains(.,'{}')]" self.incomplete_form_title = (By.XPATH, "//li[@class='breadcrumb-text'][.='Incomplete Forms']") self.incomplete_list_count = (By.XPATH, "//ul/li[@data-lp]") self.no_of_pages = (By.XPATH, "//li[contains(@class,'js-page')]") @@ -260,10 +261,12 @@ def delete_all_incomplete_forms(self): self.switch_to_default_content() self.webapp.wait_to_click(self.back_button) - def verify_number_of_forms(self, no_of_forms): + def verify_number_of_forms(self, no_of_forms, form_name): self.switch_to_frame(self.iframe) self.webapp.wait_to_click(self.incomplete_form) - list = self.find_elements(self.incomplete_form_list) + list = self.find_elements((By.XPATH, self.custom_incomplete_form_list.format(form_name))) + print("Number of forms present: ", len(list)) + print("Form count to compare with: ", no_of_forms) assert len(list) == no_of_forms self.switch_to_default_content() self.webapp.wait_to_click(self.back_button) @@ -1093,8 +1096,8 @@ def constraint_form(self): self.wait_for_element( (By.XPATH, self.text_success.format("greater than 20 and smaller than 8000"))) self.webapp.wait_to_click(self.next_question) - self.wait_for_element( - (By.XPATH, self.text_success.format("greater than 20 and smaller than 8000"))) + # self.wait_for_element( + # (By.XPATH, self.text_success.format("greater than 20 and smaller than 8000"))) self.wait_for_element((By.XPATH, self.input_field.format( "This date must be after today."))) self.click((By.XPATH, self.input_field.format( diff --git a/Formplayer/testPages/basic_test_app/basic_test_web_apps.py b/Formplayer/testPages/basic_test_app/basic_test_web_apps.py index 636de2bf5..6479fecd2 100644 --- a/Formplayer/testPages/basic_test_app/basic_test_web_apps.py +++ b/Formplayer/testPages/basic_test_app/basic_test_web_apps.py @@ -87,6 +87,7 @@ def __init__(self, driver): self.name_question = (By.XPATH, "//label[.//span[.='Enter a Name']]/following-sibling::div//textarea[contains(@class,'textfield form-control')]") self.incomplete_form_list = (By.XPATH, "//tr[@class='formplayer-request']") + self.custom_incomplete_form_list = "//tr[@class='formplayer-request']/td[2][contains(.,'{}')]" self.incomplete_list_count = (By.XPATH, "//ul/li[@data-lp]") self.delete_incomplete_form = "(//tr[@class='formplayer-request']/descendant::div[@aria-label='Delete form'])[{}]" self.edit_incomplete_form = ( @@ -216,7 +217,8 @@ def open_case_list(self, case_list): def save_incomplete_form(self, value): self.wait_for_element(self.name_question) - self.send_keys(self.name_question, value) + self.send_keys(self.name_question, value+Keys.TAB) + time.sleep(1) self.webapp.wait_to_click(self.home_button) time.sleep(2) @@ -262,9 +264,11 @@ def delete_all_incomplete_forms(self): print("No incomplete form present") self.driver.back() - def verify_number_of_forms(self, no_of_forms): + def verify_number_of_forms(self, no_of_forms, form_name): self.webapp.wait_to_click(self.incomplete_form) - list = self.find_elements(self.incomplete_form_list) + list = self.find_elements((By.XPATH, self.custom_incomplete_form_list.format(form_name))) + print("Number of forms present: ", len(list)) + print("Form count to compare with: ", no_of_forms) assert len(list) == no_of_forms self.driver.back() @@ -601,7 +605,9 @@ def update_a_case(self): self.webapp.wait_to_click(self.search_location_button) time.sleep(2) assert not self.is_present_and_displayed(self.blank_latitude, 10) - self.webapp.wait_to_click((By.XPATH, self.input_field.format( + self.scroll_to_element((By.XPATH, self.input_field.format( + "Enter a date:"))) + self.click((By.XPATH, self.input_field.format( "Enter a date:"))) self.webapp.wait_to_click(self.click_today_date) self.webapp.wait_to_click(self.close_date_picker) @@ -778,7 +784,9 @@ def unicode_verification_case(self, settings): time.sleep(2) assert not self.is_present_and_displayed(self.blank_latitude, 10) time.sleep(2) - self.webapp.wait_to_click((By.XPATH, self.input_field.format( + self.scroll_to_element((By.XPATH, self.input_field.format( + "Enter a date:"))) + self.click((By.XPATH, self.input_field.format( "Enter a date:"))) self.webapp.wait_to_click(self.click_today_date) self.webapp.wait_to_click(self.close_date_picker) @@ -815,14 +823,14 @@ def fixtures_form(self): self.wait_for_element( (By.XPATH, self.text_success.format("Select at least 2!"))) self.scroll_to_element( - (By.XPATH, self.radio_option_list.format('Only vl1 and 2 should be able to see this! Select a county!'))) + (By.XPATH, self.radio_option_list.format('Pick a county!'))) time.sleep(1) assert not self.is_present_and_displayed((By.XPATH, self.radio_option_list.format('Select a city!')), 10) time.sleep(1) self.wait_for_element( - (By.XPATH, self.radio_option_list.format('Only vl1 and 2 should be able to see this! Select a county!'))) + (By.XPATH, self.radio_option_list.format('Pick a county!'))) self.webapp.wait_to_click((By.XPATH, self.choose_radio_button.format( - 'Only vl1 and 2 should be able to see this! Select a county!', 'Essex'))) + 'Pick a county!', 'Essex'))) time.sleep(1) assert self.is_present_and_displayed((By.XPATH, self.radio_option_list.format('Select a city!')), 10) self.webapp.wait_to_click((By.XPATH, self.choose_radio_button.format('Select a city!', 'Andover'))) @@ -958,7 +966,7 @@ def constraint_form(self): "This date has to be today or in the past.")), self.input_date_add(2) + Keys.TAB) self.wait_for_element( (By.XPATH, self.danger_warning.format("This date has to be today or in the past."))) - self.webapp.wait_to_click((By.XPATH, self.input_field.format( + self.click((By.XPATH, self.input_field.format( "This date has to be today or in the past."))) self.webapp.wait_to_click(self.click_today_date) self.webapp.wait_to_click(self.close_date_picker)