def test_navigate_to_the_home_page_from_ui_testing_button(self, browser): self.base_page = BasePage(browser) self.base_page.open(url_ui) self.base_page.is_click_at_the_item("#site") self.home_page = HomePage(browser) home_page = self.home_page.is_text_displayed_at_the_home_page() assert "Welcome to the Docler Holding QA Department" in home_page
def create_driver(request): __config = ConfigSetup() url = __config.get_base_url() if request.param == "chrome": capabilities = { "browserName": "chrome", "version": "61.0", "enableVNC": True, "enableVideo": True } if request.param == "firefox": capabilities = { "browserName": "firefox", "enableVNC": True, "enableVideo": True, "version": "47.0" } if request.param == "chrome_62": capabilities = { "browserName": "chrome", "enableVNC": True, "enableVideo": True, "version": "62.0" } web_driver = webdriver.Remote( command_executor="http://localhost:4444/wd/hub", desired_capabilities=capabilities) request.cls.driver = web_driver request.cls.base_page = BasePage(url, web_driver) yield if web_driver != None: web_driver.quit()
def __init__(self, driver): BasePage.__init__(self, driver)
class TestTaskDocler: @pytest.mark.moderate @pytest.mark.parametrize("locator", ["#home", "#site", "#form", "#error"]) def test_verify_titles_at_pages(self, browser, locator): self.base_page = BasePage(browser) self.base_page.open(url_ui) self.base_page.is_click_at_the_item(locator) self.base_page.is_title_at_page("UI Testing Site") assert "UI Testing Site" @pytest.mark.moderate @pytest.mark.parametrize("locator", ["#home", "#site", "#form", "#error"]) def test_verify_company_logo_at_pages(self, browser, locator): self.base_page = BasePage(browser) self.base_page.open(url_ui) self.base_page.is_click_at_the_item(locator) assert self.base_page.is_company_logo_at_page() @pytest.mark.high def test_navigate_to_the_home_page(self, browser): self.home_page = HomePage(browser) self.home_page.open(url_ui) self.home_page.is_click_at_the_item("#home") home_page = self.home_page.is_text_displayed_at_the_home_page() assert "Welcome to the Docler Holding QA Department" in home_page @pytest.mark.low def test_home_page_button_status(self, browser): self.home_page = HomePage(browser) self.home_page.open(url_ui) self.home_page.is_click_at_the_item("#home") backgound_color = self.home_page.is_get_background_color_at_home_page() assert 'rgba(8, 8, 8, 1)' in backgound_color @pytest.mark.high def test_navigate_to_the_form_page(self, browser): self.form_page = FormPage(browser) self.form_page.open(url_ui) self.form_page.is_click_at_the_item("#form") form_page = self.form_page.is_text_displayed_at_the_form_page() assert "Form" in form_page @pytest.mark.low def test_form_page_button_status(self, browser): self.form_page = FormPage(browser) self.form_page.open(url_ui) self.form_page.is_click_at_the_item("#form") backgound_color = self.form_page.is_get_background_color_at_form_page() assert 'rgba(8, 8, 8, 1)' in backgound_color @pytest.mark.high def test_response_code_at_error_page(self, browser): self.error_page = ErrorPage(browser) self.error_page.open(url_ui) self.error_page.is_click_at_the_item("#error") title = self.error_page.title_at_page() assert "404 Error: File not found :-)" in title r = requests.get('http://uitest.duodecadits.com/error') assert r.status_code == 404 @pytest.mark.high def test_navigate_to_the_home_page_from_ui_testing_button(self, browser): self.base_page = BasePage(browser) self.base_page.open(url_ui) self.base_page.is_click_at_the_item("#site") self.home_page = HomePage(browser) home_page = self.home_page.is_text_displayed_at_the_home_page() assert "Welcome to the Docler Holding QA Department" in home_page @pytest.mark.low def test_verify_the_text_at_home_page_inside_h1_tag(self, browser): self.home_page = HomePage(browser) self.home_page.open(url_ui) self.home_page.is_click_at_the_item("#home") home_page = self.home_page.is_text_displayed_at_the_home_page() assert "Welcome to the Docler Holding QA Department" in home_page @pytest.mark.low def test_verify_the_text_at_home_page_inside_p_tag(self, browser): self.home_page = HomePage(browser) self.home_page.open(url_ui) self.home_page.is_click_at_the_item("#home") text_inside_p_tag = self.home_page.is_text_displayed_at_the_home_page_inside_p_tag( ) assert "This site is dedicated to perform some exercises and demonstrate automated web testing." in text_inside_p_tag @pytest.mark.high def test_form_page_contains_one_input_field_and_one_sumbit_button( self, browser): self.form_page = FormPage(browser) self.form_page.open(url_ui) self.form_page.is_click_at_the_item("#form") self.form_page.is_input_field_at_the_page() submit_button = self.form_page.is_submit_button_at_the_page() assert "Go!" in submit_button.text @pytest.mark.high def test_send_the_form_at_the_form_page_with_filled_input_field( self, browser): self.form_page = FormPage(browser) self.form_page.open(url_ui) self.form_page.is_click_at_the_item("#form") self.form_page.fill_input_field("Vitalii") self.form_page.click_submit_button_at_the_page() assert "Hello Vitalii!" in self.form_page.text_after_submit_form_at_page( ) assert 'hello.html' in self.form_page.is_current_url() @pytest.mark.high def test_send_the_form_at_the_form_page_with_empty_input_field( self, browser): self.form_page = FormPage(browser) self.form_page.open(url_ui) self.form_page.is_click_at_the_item("#form") self.form_page.click_submit_button_at_the_page() assert "Hello !" in self.form_page.text_after_submit_form_at_page() assert 'hello.html' in self.form_page.is_current_url() @pytest.mark.low def test_send_the_form_at_the_form_page_with_double_name(self, browser): self.form_page = FormPage(browser) self.form_page.open(url_ui) self.form_page.is_click_at_the_item("#form") self.form_page.fill_input_field("Luis Alberto") self.form_page.click_submit_button_at_the_page() assert "Hello Luis Alberto!" in self.form_page.text_after_submit_form_at_page( ) assert 'hello.html' in self.form_page.is_current_url() @pytest.mark.high def test_send_the_form_at_the_form_page_with_special_letter_from_other_alphabets( self, browser): self.form_page = FormPage(browser) self.form_page.open(url_ui) self.form_page.is_click_at_the_item("#form") self.form_page.fill_input_field("öäro") self.form_page.click_submit_button_at_the_page() assert "Hello öäro!" in self.form_page.text_after_submit_form_at_page() assert 'hello.html' in self.form_page.is_current_url() @pytest.mark.high def test_send_the_form_at_the_form_page_with_spaces_at_the_name( self, browser): self.form_page = FormPage(browser) self.form_page.open(url_ui) self.form_page.is_click_at_the_item("#form") self.form_page.fill_input_field(" Vitalii") self.form_page.click_submit_button_at_the_page() assert "Hello Vitalii!" in self.form_page.text_after_submit_form_at_page( ) assert 'hello.html' in self.form_page.is_current_url()
def test_verify_company_logo_at_pages(self, browser, locator): self.base_page = BasePage(browser) self.base_page.open(url_ui) self.base_page.is_click_at_the_item(locator) assert self.base_page.is_company_logo_at_page()
def test_verify_titles_at_pages(self, browser, locator): self.base_page = BasePage(browser) self.base_page.open(url_ui) self.base_page.is_click_at_the_item(locator) self.base_page.is_title_at_page("UI Testing Site") assert "UI Testing Site"
class Mobile_testing_helper(): mobile_testing_page = Mobile_testing_page() mailinator_helper = MailinatorHelper() base_page = BasePage() # desired_capabilities = None driver = None # Desired capabilities of the device def device_desired_capabilities(self): print("******") desired_capabilities = { "platformName": "Android", "deviceName": "Xiaomi Redmi Note 7", "appPackage": "com.android.chrome", "appActivity": "com.google.android.apps.chrome.Main" } # global desired_capabilities return desired_capabilities # Web driver set up def driver_setup(self, desired_capabilities): global driver driver = webdriver.Remote("http://localhost:4723/wd/hub", desired_capabilities) # execute script mobile actions {go, search, send, next, done, previous} def execute_action(self, action): self.wait(5) driver.execute_script('mobile: performEditorAction', {'action': action}) # Find element by class def find_element_by_class(self, element, button_element=None): self.wait(5) button = driver.find_element_by_class_name(element) driver.set_value(button, button_element) # Find the element by xpath def find_element_xpath(self, selector): self.wait(5) driver.find_element_by_xpath(selector).click() # Find the element by ID def find_element_id(self, selector): self.wait(5) print(selector) driver.find_element_by_id(selector).click() # Find element by Xpath and send value def find_xpath_enter_value(self, selector, value): self.wait(5) element = driver.find_element_by_xpath(selector).send_keys(value) self.wait(5) # element.send_keys(value) # Find element by ID and send value def find_element_enter_value(self, selector, value): self.wait(5) driver.find_element_by_id(selector).send_keys(value) self.wait(10) # element.send_keys("https://app-dev.builds.qwil.co/platform/signup") # Press Keyevent def keycode(self, code): self.wait(10) print(code) driver.press_keycode(code) # Implicit wait def wait(self, seconds=3): time.sleep(seconds) def navigate_to_google_search(self): self.click_accept_and_continue() self.click_next_button() self.press_no_thanks() driver.get("https://app-dev.builds.qwil.co/platform/signup") # self.wait(10) # self.sign_in_google() def click_accept_and_continue(self): self.wait(10) self.find_element_id( selector=self.mobile_testing_page.accept_and_continue) # driver.find_element_by_id("com.android.chrome:id/terms_accept").click() def click_next_button(self): self.wait(10) self.find_element_id(selector=self.mobile_testing_page.next_button) # driver.find_element_by_id("com.android.chrome:id/next_button").click() def sign_in_google(self): self.wait(10) driver.find_element_id(selector=self.mobile_testing_page.sign_in) # driver.find_element_by_id("com.android.chrome:id/positive_button").click() def press_no_thanks(self): self.wait(10) self.find_element_id(selector=self.mobile_testing_page.no_thanks) # driver.find_element_by_id("com.android.chrome:id/negative_button").click() def visit_page(self): self.wait(10) value = "https://app-dev.builds.qwil.co/platform/signup" self.enter_search_text(value=value) def enter_search_text(self, value): selector = self.mobile_testing_page.google_search self.find_element_enter_value(value=value, selector=selector) # self.base_page.type(text=value, selector=selector) self.click_search() self.wait(40) def click_search(self): self.execute_action(action="go") def signup(self, email, password, confirm_password, url=None, submit=True): #self.mobile_testing_page.type(selector=self.mobile_testing_page.email, text=email) #driver.find_element_by_id("email-input").send_keys(email) self.enter_email(email=email) self.wait(10) self.enter_password(password=password) self.wait(20) self.enter_confirm_password(confirm_password=confirm_password) # if submit: # self.click_signup_button() # token = self.mailinator_helper.get_qwil_token_from_mailinator_email( # email=email, subject="E-mail verification requested" # ) # self.confirm_signup_email(token=token, url=url) # UtilsHelper().wait(seconds=5) # # def confirm_signup_email(self, token, url=None): # self.signup_page.open_url( # uri=self.signup_page.APP_URL # + "/platform/signup/personal-information?token=%s" % token # ) def enter_email(self, email): self.wait(10) print(email) selector = self.mobile_testing_page.email print(selector) self.find_element_enter_value(value=email, selector=selector) def enter_password(self, password): self.wait(10) selector = self.mobile_testing_page.password self.find_element_enter_value(value=password, selector=selector) def enter_confirm_password(self, confirm_password): self.wait(10) selector = self.mobile_testing_page.confirm_password self.find_element_enter_value(value=confirm_password, selector=selector) def find_class_name(self, selector): driver.find_element_by_class_name(selector).click() def click_signup_button(self): self.wait(10) self.find_class_name(selector=self.mobile_testing_page.sign_up)
def test_run_2(self): # create object agent_helper = AgentHelpers() base_page = BasePage() support_helper = SupportCenterHelpers() # Get data from json file data = agent_helper.read_json() # Step1 - visit agent login page agent_helper.open_agent_login_page() logging.info("visit agent login page") # Step2 - Enter user name agent_helper.enter_agent_user_name(agent_user_name=data["agent_user_name"]) logging.info("Enter user name of the agent") # Step3 - Enter agent password agent_helper.enter_agent_password(agent_password=data["agent_password"]) logging.info("Enter password of the agent") # Step4- Click login button agent_helper.click_login_button() base_page.wait(5) logging.info("Logged into the Agent portal") # Step5 - Navigate to options and create new status agent_helper.hover_to_options() agent_helper.select_statuses_option() agent_helper.click_add_status_symbol() agent_helper.enter_status_name(status_name=data["status_Name"]) agent_helper.enter_status_description(status_description=data["status_description"]) agent_helper.click_add_status_button() status_in_page = agent_helper.select_status_by_name__or_check_status_name_in_status_list(status_name=data["status_Name"], check_created_status_name_in_status_page="yes") assert data["status_Name"].upper() == status_in_page logging.info("Created new status successfully") # make status as default agent_helper.make_the_status_as_default(status_name=data["status_Name"]) logging.info("Set created status as default") # #Step6 - Navigate to options and create new priority agent_helper.hover_to_options() agent_helper.select_priorities_option() agent_helper.click_add_priority_symbol() agent_helper.enter_priority_name(priority_name=data["Priority_Name"]) agent_helper.enter_priority_description(priority_description=data["priority_description"]) agent_helper.click_add_priority_button() priority_in_page = agent_helper.select_priority_by_name_or_check_priority_on_priority_page(priority_name=data["Priority_Name"], check_created_status_name_in_priority_page="yes") assert data["Priority_Name"] == priority_in_page logging.info("Created new Priority successfully") #make priority as default agent_helper.make_the_priority_as_default(priority_name=data["Priority_Name"]) logging.info("Set created Priority as default") #open support center page in new tab and Create ticket support_helper.visit_support_center_page() logging.info("visit support center page and create ticket") support_helper.enter_ticket_subject(data["ticket_subject"]) support_helper.enter_ticket_message(data["ticket_message"]) support_helper.attach_screenshot(file_path='C:/Users/HP/PycharmProjects/HappyFox/src/helpers/sample_screenshot.PNG') support_helper.enter_name(data["ticket_full_name"]) support_helper.enter_mail(data["ticket_email"]) support_helper.enter_phone_number(data["ticket_phone_number"]) support_helper.click_create_ticket_button() logging.info("Ticket created successfully") # reply to ticket agent_helper.switch_between_windows(num=0) logging.info("Visit agent portal") #visit tickets page and select the ticket agent_helper.hover_to_options() agent_helper.select_tickets_from_options() agent_helper.select_ticket() # check ticket is in unresponded state before giving any reply agent_helper.check_unresponded_by_agent() logging.info("Ticket is in unresponded state before giving any reply") # check status and priority are same as the default status and priority priority = agent_helper.check_priority() assert priority == data["Priority_Name"] logging.info("Ticket Created with default Priority") status = agent_helper.check_status() assert status == data["status_Name"].upper() logging.info("Ticket Created with default Status") # Give canned reply to the ticket agent_helper.click_reply_button() agent_helper.click_canned_action_button() agent_helper.click_canned_reply_button() agent_helper.click_apply_button() agent_helper.click_add_reply_button() logging.info("Canned reply given successfully") # check ticket changed to responded state after giving any reply agent_helper.check_Responded_by_agent() logging.info("Ticket changed to responded state after giving any reply") # check tag,status,priority after replied to the ticket tag = agent_helper.check_tag_text() assert tag == "customer_query" logging.info("Ticket tag - customer_query") status_change_from, status_change_to = agent_helper.status_change_on_ticket() assert status_change_from == data["status_Name"].upper() assert status_change_to == "CLOSED" logging.info("Ticket status changed from default to CLOSED") priority_change_from, priority_change_to = agent_helper.priority_change_on_ticket() assert priority_change_from == data["Priority_Name"] assert priority_change_to == "Medium" logging.info("Ticket priority changed from default to Medium") # Status on header of the ticket after reply status = agent_helper.status_on_ticket() assert status == "CLOSED" # delete the created status agent_helper.priority_or_status_deleted_success_message_not_present() agent_helper.hover_to_options() agent_helper.select_statuses_option() agent_helper.select_status_by_name__or_check_status_name_in_status_list(status_name=data["status_Name"]) agent_helper.click_delete_status_button() agent_helper.click_delete_button() expected_message = 'Status "%s" is deleted successfully.' % data["status_Name"] actual_message = agent_helper.check_priority_or_status_deleted_success_message() assert expected_message == actual_message logging.info("Deleted the created Status") # delete the created priority agent_helper.priority_or_status_deleted_success_message_not_present() agent_helper.hover_to_options() agent_helper.select_priorities_option() agent_helper.select_priority_by_name_or_check_priority_on_priority_page(priority_name=data["Priority_Name"]) agent_helper.click_delete_status_button() agent_helper.click_delete_button() expected_message = 'Priority "%s" is deleted successfully.' % data["Priority_Name"] actual_message = agent_helper.check_priority_or_status_deleted_success_message() assert expected_message == actual_message logging.info("Deleted the created Priority") # logout from the agent portal agent_helper.staff_menu_drop_down() agent_helper.click_logout() logging.info("Logged out from the Agent portal")
def test_run_1(self): # create object agent_helper = AgentHelpers() base_page = BasePage() # Get data from json file data = agent_helper.read_json() # Step1 - visit agent login page agent_helper.open_agent_login_page() logging.info("visit agent login page") # Step2 - Enter user name agent_helper.enter_agent_user_name(agent_user_name=data["agent_user_name"]) logging.info("Enter user name of the agent") # Step3 - Enter agent password agent_helper.enter_agent_password(agent_password=data["agent_password"]) logging.info("Enter password of the agent") # Step4- Click login button agent_helper.click_login_button() logging.info("Logged into the Agent portal") # Step5 - Navigate to options and create new status agent_helper.hover_to_options() agent_helper.select_statuses_option() agent_helper.click_add_status_symbol() agent_helper.enter_status_name(status_name=data["status_Name"]) agent_helper.enter_status_description(status_description=data["status_description"]) agent_helper.click_add_status_button() status_in_page = agent_helper.select_status_by_name__or_check_status_name_in_status_list(status_name=data["status_Name"], check_created_status_name_in_status_page="yes") assert data["status_Name"].upper() == status_in_page logging.info("Created new status successfully") # #Step6 - Navigate to options and create new priority agent_helper.hover_to_options() agent_helper.select_priorities_option() agent_helper.click_add_priority_symbol() agent_helper.enter_priority_name(priority_name=data["Priority_Name"]) agent_helper.enter_priority_description(priority_description=data["priority_description"]) agent_helper.click_add_priority_button() priority_in_page = agent_helper.select_priority_by_name_or_check_priority_on_priority_page(priority_name=data["Priority_Name"], check_created_status_name_in_priority_page="yes") assert data["Priority_Name"] == priority_in_page logging.info("Created new Priority successfully") # delete the created status agent_helper.hover_to_options() agent_helper.select_statuses_option() agent_helper.select_status_by_name__or_check_status_name_in_status_list(status_name=data["status_Name"]) agent_helper.click_delete_status_button() agent_helper.click_delete_button() expected_message = 'Status "%s" is deleted successfully.' % data["status_Name"] actual_message = agent_helper.check_priority_or_status_deleted_success_message() assert expected_message == actual_message logging.info("Deleted the created Status") # delete the created priority agent_helper.priority_or_status_deleted_success_message_not_present() agent_helper.hover_to_options() agent_helper.select_priorities_option() agent_helper.select_priority_by_name_or_check_priority_on_priority_page(priority_name=data["Priority_Name"]) agent_helper.click_delete_status_button() agent_helper.click_delete_button() expected_message = 'Priority "%s" is deleted successfully.'% data["Priority_Name"] actual_message = agent_helper.check_priority_or_status_deleted_success_message() assert expected_message == actual_message logging.info("Deleted the created Priority") #logout from the agent portal agent_helper.staff_menu_drop_down() agent_helper.click_logout() logging.info("Logged out from the Agent portal")
class Mobile_testing_helper(): mobile_testing_page = Mobile_testing_page() mailinator_helper = MailinatorHelper() base_page = BasePage() # desired_capabilities = None driver = None touch = None # Desired capabilities of the device def device_desired_capabilities(self): print("******") desired_capabilities = { "platformName": "Android", "deviceName": "Xiaomi Redmi Note 7", "appPackage": "com.android.chrome", "appActivity": "com.google.android.apps.chrome.Main", "newCommandTimeout": 120 } # global desired_capabilities return desired_capabilities def leaforg_desired_capabilities(self): desired_capabilities = { "platformName": "Android", "deviceName": "Xiaomi Redmi Note 7", "appPackage": "com.testleaf.leaforg", "appActivity": "com.testleaf.leaforg.MainActivity", "newCommandTimeout": 120 } # global desired_capabilities self.wait(5) return desired_capabilities def launch_chrome_device_desired_capabilities(self): print("******") desired_capabilities = { "platformName": "Android", "deviceName": "Xiaomi Redmi Note 7", "browserName": "Chrome", "chromedriverExecutable": "/Users/Sapthagiri/Downloads/chromedriver 4", "udid": "1570ca03", "newCommandTimeout": 120 } # global desired_capabilities return desired_capabilities # Web driver set up def driver_setup(self, desired_capabilities): global driver driver = webdriver.Remote("http://*****:*****@bounds='[145,602][935,709]']").click() driver.find_element_by_xpath("//android.widget.EditText[@bounds='[145,602][935,709]']").send_keys(email) self.enter_email(email=email) self.wait(10) self.enter_password(password=password) self.wait(20) self.enter_confirm_password(confirm_password=confirm_password) # if submit: # self.click_signup_button() # token = self.mailinator_helper.get_qwil_token_from_mailinator_email( # email=email, subject="E-mail verification requested" # ) # self.confirm_signup_email(token=token, url=url) # UtilsHelper().wait(seconds=5) # # def confirm_signup_email(self, token, url=None): # self.signup_page.open_url( # uri=self.signup_page.APP_URL # + "/platform/signup/personal-information?token=%s" % token # ) def enter_email(self, email): self.wait(10) print(email) selector = self.mobile_testing_page.email print(selector) self.find_element_enter_value(value=email, selector=selector) def enter_password(self, password): self.wait(10) selector = self.mobile_testing_page.password self.find_element_enter_value(value=password, selector=selector) def enter_confirm_password(self, confirm_password): self.wait(10) selector = self.mobile_testing_page.confirm_password self.find_element_enter_value(value=confirm_password, selector=selector) def find_class_name(self, selector): driver.find_element_by_class_name(selector).click() def click_signup_button(self): self.wait(10) self.find_class_name(selector=self.mobile_testing_page.sign_up) """ TouchAction(driver) .press(x=540, y=739) .move_to(x=518, y=1607) .release() .perform() """ def create_an_account_in_leafOrg(self, email, first_name, last_name, phone_number, ): self.wait(5) self.click_create_account() self.wait(6) self.enter_first_name(first_name=first_name) self.enter_last_name(last_name=last_name) self.enter_leaforg_email(email=email) self.enter_phone_number(phone_number=phone_number) self.click_arrow() self.pass_state_name() self.wait() def select_date_of_birth(self): self.click_date_of_birth_dropdown() self.wait() self.click_year_in_calender() self.wait() self.swipe_year() self.click_selected_year() self.select_date() self.navigate_month() self.desired_day() self.click_set() self.click_continue_button() self.wait(7) def swipe_year(self): global touch touch = TouchAction(driver) #touch.long_press(x=230, y=347) self.wait() for i in range(3): self.wait() touch.press(x=540, y=739).move_to(x=518, y=1607).release().perform() """ Long press and slide a bar (vertical scroll) """ #touch.long_press(x=540, y=739).move_to(x=518, y=1607).release().perform() def click_create_account(self): self.wait(10) #self.find_element_xpath(selector=self.mobile_testing_page.leafOrg_create_account) self.mobile_testing_page.click(self.mobile_testing_page.leafOrg_create_account) """ x=230, y=347 """ """ Multiple actions action0 = TouchAction().tap(element) action1 = TouchAction().tap(element) MultiAction().add(action0).add(action1).perform() """ def enter_first_name(self, first_name): touch = TouchAction(driver) selector = self.mobile_testing_page.enter_first_name self.wait() value = first_name # name_selector = driver.find_element_by_xpath("//android.widget.EditText[@bounds='[110,313][995,371]']") #self.wait(3) driver.find_element_by_xpath("//android.widget.EditText[@bounds='[110,313][995,371]']").send_keys(first_name) #self.find_xpath_enter_value(selector, value) #touch.long_press(x=169, y=347, duration=10000) # self.wait(3) # touch.long_press(name_selector, duration=10000).perform() # self.wait(10) # touch.tap(x=333, y=239).perform() # self.wait(3) # touch.tap(x=254, y=239).perform() # self.wait(15) def enter_last_name(self, last_name): self.wait(5) # touch = TouchAction(driver) # name_selector = driver.find_element_by_xpath("//android.widget.EditText[@bounds='[110,440][995,495]']") # touch.long_press(name_selector, duration=10000).perform() # self.wait(10) # touch.tap(x=150, y=362).perform() selector = self.mobile_testing_page.enter_last_name value = last_name self.find_xpath_enter_value(selector, value) def enter_leaforg_email(self, email): self.wait(5) selector = self.mobile_testing_page.enter_email value = email self.find_xpath_enter_value(selector, value) def enter_phone_number(self, phone_number): #self.wait() selector = self.mobile_testing_page.enter_phone_number value = phone_number self.find_xpath_enter_value(selector, value) def click_arrow(self): self.wait() self.find_element_xpath(selector=self.mobile_testing_page.state_arrow) def pass_state_name(self): self.wait(5) self.find_element_xpath(selector=self.mobile_testing_page.state_name) def click_date_of_birth_dropdown(self): self.wait(10) self.find_element_xpath(selector=self.mobile_testing_page.dob_dropdown) def click_year_in_calender(self): self.wait(10) self.find_element_id(selector=self.mobile_testing_page.year_in_calender) """ TouchAction(driver) .press() .move_to() .release() .perform() """ def touch_driver(self): global touch touch = TouchAction(driver) return touch def click_selected_year(self): self.wait(10) self.find_element_xpath(selector=self.mobile_testing_page.selected_year) def select_date(self): self.wait(10) self.find_element_id(selector=self.mobile_testing_page.date) def click_set(self): self.wait(10) self.find_element_id(selector=self.mobile_testing_page.set_button) def click_continue_button(self): self.wait(5) self.find_element_xpath(selector=self.mobile_testing_page.continue_button) def enter_continue_button(self): self.wait(5) self.find_element_xpath(selector=self.mobile_testing_page.press_continue_button) def license_information(self, license): self.wait(5) self.add_license(license=license) self.click_license_exp_date() self.click_set() self.enter_continue_button() def add_license(self, license): selector = self.mobile_testing_page.license_number print(license) value1 = "125125124" value2 = license self.find_xpath_enter_value(selector, value1) touch.long_press(x=164, y=470, duration=10000).perform() #self.wait(5) touch.tap(x=470, y=343).perform() self.wait() driver.find_element_by_xpath(selector).clear() self.find_xpath_enter_value(selector, value2) def click_license_exp_date(self): self.wait(10) self.find_element_xpath(selector=self.mobile_testing_page.license_exp_date) def participants_information(self, participant_id, mentor_name, group_name): self.wait(5) self.add_particpant_id(participant_id=participant_id) self.select_join_date() self.click_set() self.type_mentors_name(mentor_name=mentor_name) self.group_name(group_name=group_name) self.click_submit_registration() self.click_ok_button() self.click_submit_registration() def add_particpant_id(self, participant_id): self.wait() print("*****CHECKPOINT******") #driver.find_element_by_xpath("//android.widget.EditText[@bounds='[110,432][995,487]']").click().send_keys(1241241) # print("*****ELEMENT*****", element) # element.clear() # element.send_keys("12512513") #driver.find_element_by_xpath("//android.widget.EditText[@bounds='[110,432][995,487]']").send_keys(participant_id) # selector = self.mobile_testing_page.enter_participant_id # value = participant_id # self.find_xpath_enter_value(selector, value) touch.long_press(x=174, y=451, duration=10000).perform() self.wait(10) touch.tap(x=117, y=347).perform() self.wait(3) def select_join_date(self): self.wait(10) self.find_element_xpath(selector=self.mobile_testing_page.enter_join_date) def type_mentors_name(self, mentor_name): self.wait(5) selector = self.mobile_testing_page.enter_mentor_name value = mentor_name self.find_xpath_enter_value(selector, value) def group_name(self, group_name): self.wait(5) selector = self.mobile_testing_page.enter_group_name value = group_name self.find_xpath_enter_value(selector, value) def click_submit_registration(self): self.wait() self.find_element_xpath(selector=self.mobile_testing_page.submit_registration) def click_ok_button(self): self.wait(5) self.find_element_xpath(selector=self.mobile_testing_page.ok_button) def validate_login_page(self): self.validate_title() def validate_title(self): self.visibility_of_element_located(selector=self.mobile_testing_page.leafOrg_create_account) #driver.find_element_by_id(selector) #self.base_page.wait_for_presence(selector) def navigate_month(self): self.wait(5) for i in range(2): self.wait(5) self.find_element_id(selector=self.mobile_testing_page.next) def desired_day(self): self.wait(10) self.find_element_xpath(selector=self.mobile_testing_page.desired_date) def visit_qwil_webapp(self): self.enter_qwil_url() def enter_qwil_url(self): url = "https://app-dev.builds.qwil.co/platform/signup" self.url_navigation(url=url) def url_navigation(self, url): driver.get(url) self.wait(10) print("*******") #driver.find_element_by_xpath("//android.widget.EditText[@bounds='[145,602][935,709]']").click() #driver.find_element_by_id("email-input").send_keys("Sapthagiri") driver.find_element_by_id("email-input").click()
def test_user_can_search(self): (BasePage.at(SearchPage()).open().search( "Autoline").get_search_results().should(have.size_at_least(1)))