Skip to content

Commit

Permalink
QA 2857 updates new method and made changes to all testpages, made fe…
Browse files Browse the repository at this point in the history
…w corrections in yml
  • Loading branch information
kbo001 committed Nov 7, 2023
1 parent ac9056a commit ca46c66
Show file tree
Hide file tree
Showing 13 changed files with 604 additions and 587 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/formplayer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ jobs:
- id: set-matrix-default
if: ${{ !contains(github.event_name , 'dispatch') }}
run: |
echo "::set-output name=matrix::{\"environment\": [\"production\", \"staging\"]}"
echo "::set-output name=matrix::{\"environment\": [\"staging\"]}"
build:
needs: set_matrix
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.set_matrix.outputs.matrix) }}
name: Lookup tests on '${{ matrix.environment }}'
name: Formplayer tests on '${{ matrix.environment }}'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand Down
132 changes: 67 additions & 65 deletions Formplayer/testPages/app_preview/app_preview_basics.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import time

from Formplayer.testPages.webapps.webapps_basics import WebAppsBasics
from common_utilities.generate_random_string import fetch_random_string, fetch_phone_number
from common_utilities.selenium.base_page import BasePage
from Formplayer.userInputs.user_inputs import UserData
Expand All @@ -9,12 +10,13 @@

""""Contains test page elements and functions related to the WebApps Access/Basics of Commcare"""


global webapp
class AppPreviewBasics(BasePage):

def __init__(self, driver):
super().__init__(driver)

webapp = WebAppsBasics(self.driver)

self.name_input = "name " + fetch_random_string()
self.test_question = "Test " + fetch_random_string()

Expand Down Expand Up @@ -106,7 +108,7 @@ def verify_toggle_functionality(self):

def icons_are_present(self):
self.switch_to_frame(self.iframe)
self.wait_to_click(self.start_option)
webapp.wait_to_click(self.start_option)
self.wait_for_element(self.form_list)
self.switch_to_default_content()
assert self.is_present_and_displayed(self.back_button)
Expand All @@ -118,12 +120,12 @@ def icons_are_present(self):

def back_button_functionality(self):
self.switch_to_frame(self.iframe)
self.wait_to_click(self.start_option)
webapp.wait_to_click(self.start_option)
self.wait_for_element(self.form_list)
assert not self.is_present_and_displayed(self.start_option)
time.sleep(2)
self.switch_to_default_content()
self.wait_to_click(self.back_button)
webapp.wait_to_click(self.back_button)
self.switch_to_frame(self.iframe)
assert self.is_present_and_displayed(self.start_option)
print("Back button works!!")
Expand All @@ -132,43 +134,43 @@ def back_button_functionality(self):

def refresh_button_functionality_01(self):
self.switch_to_frame(self.iframe)
self.wait_to_click(self.start_option)
self.wait_to_click(self.case_list_menu)
webapp.wait_to_click(self.start_option)
webapp.wait_to_click(self.case_list_menu)
self.switch_to_default_content()
time.sleep(5)
self.wait_to_click(self.refresh_button)
webapp.wait_to_click(self.refresh_button)
time.sleep(3)
self.switch_to_frame(self.iframe)
assert self.is_present_and_displayed(self.start_option)
print("Refresh Button works!!")
self.switch_to_default_content()

def refresh_button_functionality_02(self):
self.wait_to_click(self.form_builder_registration_form)
self.wait_to_click(self.add_question)
self.wait_to_click(self.text_question_type)
webapp.wait_to_click(self.form_builder_registration_form)
webapp.wait_to_click(self.add_question)
webapp.wait_to_click(self.text_question_type)
time.sleep(5)
self.wait_to_clear_and_send_keys(self.text_question_display_text, self.test_question)
self.wait_to_click(self.save_question_button)
self.wait_to_click(self.refresh_button)
webapp.wait_to_click(self.save_question_button)
webapp.wait_to_click(self.refresh_button)
self.switch_to_frame(self.iframe)
self.wait_to_click(self.start_option)
self.wait_to_click(self.case_list_menu)
self.wait_to_click(self.registration_form)
webapp.wait_to_click(self.start_option)
webapp.wait_to_click(self.case_list_menu)
webapp.wait_to_click(self.registration_form)
self.wait_to_clear_and_send_keys(self.name_question, self.name_input)
self.js_click(self.next_question)
assert self.is_present_and_displayed(self.new_test_question)
self.switch_to_default_content()
time.sleep(3)
self.wait_to_click(self.formplayer_test_question)
self.wait_to_click(self.delete_button)
self.wait_to_click(self.save_question_button)
webapp.wait_to_click(self.formplayer_test_question)
webapp.wait_to_click(self.delete_button)
webapp.wait_to_click(self.save_question_button)
time.sleep(3)
self.wait_to_click(self.refresh_button)
webapp.wait_to_click(self.refresh_button)
self.switch_to_frame(self.iframe)
self.wait_to_click(self.start_option)
self.wait_to_click(self.case_list_menu)
self.wait_to_click(self.registration_form)
webapp.wait_to_click(self.start_option)
webapp.wait_to_click(self.case_list_menu)
webapp.wait_to_click(self.registration_form)
self.wait_to_clear_and_send_keys(self.name_question, self.name_input)
self.js_click(self.next_question)
assert not self.is_present_and_displayed(self.new_test_question)
Expand All @@ -177,14 +179,14 @@ def refresh_button_functionality_02(self):

def web_user_submission(self):
self.switch_to_frame(self.iframe)
self.wait_to_click(self.start_option)
self.wait_to_click(self.case_list_menu)
self.wait_to_click(self.registration_form)
webapp.wait_to_click(self.start_option)
webapp.wait_to_click(self.case_list_menu)
webapp.wait_to_click(self.registration_form)
self.wait_to_clear_and_send_keys(self.name_question, self.name_input)
self.js_click(self.next_question)
self.wait_to_click(self.dob_question)
self.wait_to_click(self.click_today_date)
self.wait_to_click(self.close_date_picker)
webapp.wait_to_click(self.dob_question)
webapp.wait_to_click(self.click_today_date)
webapp.wait_to_click(self.close_date_picker)
self.js_click(self.next_question)
self.wait_to_clear_and_send_keys(self.mobileno_question, fetch_phone_number())
self.js_click(self.next_question)
Expand All @@ -195,7 +197,7 @@ def web_user_submission(self):
assert self.is_present_and_displayed(self.success_message)
assert self.is_present_and_displayed(self.view_form_link)
assert self.is_present_and_displayed(self.export_form_link)
self.wait_to_click(self.view_form_link)
webapp.wait_to_click(self.view_form_link)
time.sleep(4)
self.switch_to_default_content()
self.switch_to_next_tab()
Expand All @@ -206,23 +208,23 @@ def web_user_submission(self):

def one_question_per_screen_negative(self):
self.switch_to_frame(self.iframe)
self.wait_to_click(self.start_option)
self.wait_to_click(self.case_list_menu)
self.wait_to_click(self.registration_form)
webapp.wait_to_click(self.start_option)
webapp.wait_to_click(self.case_list_menu)
webapp.wait_to_click(self.registration_form)
assert self.is_present_and_displayed(self.name_question)
self.wait_to_clear_and_send_keys(self.name_question, self.name_input)
self.wait_to_click(self.next_question)
webapp.wait_to_click(self.next_question)
assert self.is_present_and_displayed(self.dob_question)
self.wait_to_click(self.dob_question)
self.wait_to_click(self.click_today_date)
self.wait_to_click(self.close_date_picker)
self.wait_to_click(self.next_question)
webapp.wait_to_click(self.dob_question)
webapp.wait_to_click(self.click_today_date)
webapp.wait_to_click(self.close_date_picker)
webapp.wait_to_click(self.next_question)
assert self.is_present_and_displayed(self.mobileno_question)
self.switch_to_default_content()

def one_question_per_screen_positive(self):
self.switch_to_frame(self.iframe)
self.wait_to_click(self.settings_option)
webapp.wait_to_click(self.settings_option)
time.sleep(2)
isChecked = self.is_present(self.turn_on_one_question_toggle_button)
print(isChecked)
Expand All @@ -232,19 +234,19 @@ def one_question_per_screen_positive(self):
self.js_click_direct(self.toggle_button_one_question)
time.sleep(2)
print("Toggled OFF")
# self.wait_to_click((By.XPATH, "//th[(text()='Use one question per screen')]/following-sibling::td//input"))
# webapp.wait_to_click((By.XPATH, "//th[(text()='Use one question per screen')]/following-sibling::td//input"))
assert self.is_present(self.turn_off_one_question_toggle_button)
self.wait_to_click(self.done_button)
self.wait_to_click(self.start_option)
self.wait_to_click(self.case_list_menu)
self.wait_to_click(self.registration_form)
webapp.wait_to_click(self.done_button)
webapp.wait_to_click(self.start_option)
webapp.wait_to_click(self.case_list_menu)
webapp.wait_to_click(self.registration_form)
self.wait_to_clear_and_send_keys(self.name_question, self.name_input)
self.wait_to_click(self.dob_question)
self.wait_to_click(self.click_today_date)
self.wait_to_click(self.close_date_picker)
webapp.wait_to_click(self.dob_question)
webapp.wait_to_click(self.click_today_date)
webapp.wait_to_click(self.close_date_picker)
self.wait_to_clear_and_send_keys(self.mobileno_question, fetch_phone_number())
self.wait_to_click(self.home_button)
self.wait_to_click(self.settings_option)
webapp.wait_to_click(self.home_button)
webapp.wait_to_click(self.settings_option)
time.sleep(2)
isChecked = self.is_present(self.turn_off_one_question_toggle_button)
print(isChecked)
Expand All @@ -254,50 +256,50 @@ def one_question_per_screen_positive(self):
self.js_click_direct(self.toggle_button_one_question)
time.sleep(2)
print("Toggled ON")
# self.wait_to_click((By.XPATH, "//th[(text()='Use one question per screen')]/following-sibling::td//input"))
# webapp.wait_to_click((By.XPATH, "//th[(text()='Use one question per screen')]/following-sibling::td//input"))
assert self.is_present(self.turn_on_one_question_toggle_button)
self.wait_to_click(self.done_button)
webapp.wait_to_click(self.done_button)
self.switch_to_default_content()

def clear_user_data(self):
self.switch_to_frame(self.iframe)
self.wait_to_click(self.settings_option)
self.wait_to_click(self.clear_user_data_button)
webapp.wait_to_click(self.settings_option)
webapp.wait_to_click(self.clear_user_data_button)
assert self.is_present_and_displayed(self.clear_data_message)
self.switch_to_default_content()

def change_language(self):
self.switch_to_frame(self.iframe)
self.wait_to_click(self.settings_option, 5)
webapp.wait_to_click(self.settings_option, 5)
self.select_by_text(self.select_language, UserData.language)
self.wait_to_click(self.done_button)
self.wait_to_click(self.start_option)
self.wait_to_click(self.case_list_menu)
self.wait_to_click(self.registration_form)
webapp.wait_to_click(self.done_button)
webapp.wait_to_click(self.start_option)
webapp.wait_to_click(self.case_list_menu)
webapp.wait_to_click(self.registration_form)
assert self.is_present_and_displayed(self.question_display_text)
self.switch_to_default_content()

def add_empty_form(self):
self.js_click(self.add_new_form)
time.sleep(1)
self.wait_to_click(self.add_new_reg_form)
webapp.wait_to_click(self.add_new_reg_form)
time.sleep(3)
if not self.is_present(self.view_app_preview_show):
self.wait_to_click(self.view_app_preview)
webapp.wait_to_click(self.view_app_preview)
else:
print("App preview is already open")
self.wait_to_click(self.refresh_button)
webapp.wait_to_click(self.refresh_button)
self.switch_to_frame(self.iframe)
self.wait_to_click(self.start_option)
webapp.wait_to_click(self.start_option)
time.sleep(2)
assert self.is_displayed(self.empty_form_error_message)
self.switch_to_default_content()
self.driver.refresh()
time.sleep(2)
self.hover_and_click(self.last_form, self.delete_form)
self.wait_to_click(self.delete_confirm_button)
self.wait_to_click(self.refresh_button)
webapp.wait_to_click(self.delete_confirm_button)
webapp.wait_to_click(self.refresh_button)
self.switch_to_frame(self.iframe)
self.wait_to_click(self.start_option)
webapp.wait_to_click(self.start_option)
assert self.is_present_and_displayed(self.case_list_menu)
self.switch_to_default_content()
21 changes: 11 additions & 10 deletions Formplayer/testPages/app_preview/login_as_app_preview_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@

""""Contains test page elements and functions related to the Homepage of Commcare"""


global webapp
class LoginAsAppPreviewPage(BasePage):

def __init__(self, driver, settings):
super().__init__(driver)
webapp = WebAppsBasics(self.driver)

self.dashboard_link = settings['url'] + "/dashboard/project/"
self.form_input_no_login = "app preview test without login" + fetch_random_string()
Expand Down Expand Up @@ -58,23 +59,23 @@ def open_view_app_preview(self, test_app=UserData.basic_tests['tests_app']):
self.driver.get(self.dashboard_link)
self.wait_for_element(self.application_menu_id)
if self.is_present(self.application_menu_id):
self.wait_to_click(self.application_menu_id)
webapp.wait_to_click(self.application_menu_id)
else:
self.wait_to_click(self.full_menu)
self.wait_to_click(self.application_menu_id)
self.wait_to_click((By.XPATH, self.select_test_application.format(test_app)))
webapp.wait_to_click(self.full_menu)
webapp.wait_to_click(self.application_menu_id)
webapp.wait_to_click((By.XPATH, self.select_test_application.format(test_app)))
if not self.is_present(self.view_app_preview_show):
self.wait_to_click(self.view_app_preview)
webapp.wait_to_click(self.view_app_preview)
else:
print("App preview is already open")
self.wait_to_click(self.refresh_button)
webapp.wait_to_click(self.refresh_button)
time.sleep(3)

def login_as_app_preview_presence(self):
self.switch_to_frame(self.iframe)
time.sleep(2)
assert self.is_visible_and_displayed(self.title_bar), "This is not the Webaspps menu page."
self.wait_to_click(self.login_as_button)
webapp.wait_to_click(self.login_as_button)


def login_as_app_preview_content(self):
Expand All @@ -91,7 +92,7 @@ def login_as_app_preview_content(self):

def login_as_app_preview_form_submission(self, text):
self.switch_to_frame(self.iframe)
self.wait_to_click(self.start_option)
webapp.wait_to_click(self.start_option)
self.wait_for_element(self.basic_tests_case)
self.js_click(self.basic_tests_case)
self.wait_for_element(self.basic_tests_form)
Expand All @@ -115,7 +116,7 @@ def submit_history_verification(self, type, username):

def login_as_user(self, username):
self.switch_to_frame(self.iframe)
self.wait_to_click(self.login_as_button)
webapp.wait_to_click(self.login_as_button)
self.wait_to_clear_and_send_keys(self.search_worker, username)
self.js_click(self.search_users_button)
time.sleep(2)
Expand Down
Loading

0 comments on commit ca46c66

Please sign in to comment.