Skip to content

Commit

Permalink
QA 2857 made changes to few locators and steps and yml
Browse files Browse the repository at this point in the history
  • Loading branch information
kbo001 committed Nov 9, 2023
1 parent ba5e45d commit 3155438
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 17 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/formplayer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ on:
branches: [ master ]
schedule:
- cron: '0 0 * * 0'

workflow_dispatch:
inputs:
environment:
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Formplayer/testCases/test_04_basic_test_forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
11 changes: 7 additions & 4 deletions Formplayer/testPages/basic_test_app/basic_test_app_preview.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')]")
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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(
Expand Down
26 changes: 17 additions & 9 deletions Formplayer/testPages/basic_test_app/basic_test_web_apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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')))
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 3155438

Please sign in to comment.