def test_02_logout(driver): """ === Description: # Push the button Sign out # Verify logout === Expected result: * Sign in should be in the title """ main_page = MainPage(driver) main_page.verify_sign_out() main_page.get_screen_shot("test_02_logout")
def test_04_checking_work_logo_button(driver): """ === Description: # Go to any tab in the menu bar # Return with the logo === Expected result: * Pressing the logo button will return to the main page """ main_page = MainPage(driver) main_page.rand_transition_between_header_menu() main_page.get_screen_shot("test_04_checking_work_logo_button") main_page.verify_working_logo_button() main_page.get_screen_shot("test_04_checking_work_logo_button")
def test_06_verify_subscribe_to_us_positive(driver): """ === Description: # In the form "Subscribe to us" incert correct email # Click button for subscriber === Expected result: * Subscription will be successful """ main_page = MainPage(driver) main_page.input_data_in_subscriber_to_us_field() main_page.send_email_for_subscribe() main_page.get_screen_shot("test_06_verify_subscribe_to_us_positive") main_page.verify_subscriber_operation() main_page.get_screen_shot("test_06_verify_subscribe_to_us_positive") main_page.close_information_window_with_subscriber()
def test_01_login(driver): """ === Description: # Open site "http://example.com" # Enter username # Enter password # Submit login # Verify login === Expected result: * Username should be in the title """ main_page = MainPage(driver) main_page.sign_in_account() main_page.get_screen_shot("test_01_login") main_page.verify_sign_in_account() main_page.get_screen_shot("test_01_login")
class TestYiYao: def setup(self): # self.main = MainPage(types='debug') # self.main.write_cookie_for_json('../datas/cookie.json') useinghandless = 'true' if useinghandless == 'true': moudle = '无界面' else: moudle = '有界面' loc1 = ("xpath", "//*[contains(text(),'登 录')]") loc2 = ("xpath", "//span[contains(text(),'处方中心')]") self.main = MainPage( url='http://partner.zhyf.sfrog.cn/#/workbench/index', userhadless=useinghandless) print('植入cookie前') print(f'检测未登录页面元素:{self.main.is_visibility_of_element_located(loc1)}') print(f'检测已登录页面元素:{self.main.is_visibility_of_element_located(loc2)}') time.sleep(1) self.main.get_screen_shot(f'{moudle}cookie前截图', '') self.main.add_cookie('../datas/cookie.json') self.main.refresh() # self.main.max_size() self.main.set_window_size(1920, 1080) print('植入cookie后') time.sleep(1) self.main.get_screen_shot(f'{moudle}cookie后截图', '') print(f'检测未登录页面元素:{self.main.is_visibility_of_element_located(loc1)}') print(f'检测已登录页面元素:{self.main.is_visibility_of_element_located(loc2)}') def teardown(self): self.main.quit() @allure.story('测试用例:创建处方成功') def test_add_prescription_success(self): pass
def test_05_negative_send_message_to_support_with_incorrect_email(driver): """ === Description: # Open support window in the right down corner # Input in the field incorrect data === Expected result: * Button 'Send' is disabled * The message will not be sent """ main_page = MainPage(driver) main_page.open_support_window() main_page.get_screen_shot( "test_05_negative_send_message_to_support_with_incorrect_email") main_page.write_message_to_support(negative=True) main_page.get_screen_shot( "test_05_negative_send_message_to_support_with_incorrect_email") main_page.verify_button_send_message_to_supp_is_disabled() main_page.get_screen_shot( "test_05_negative_send_message_to_support_with_incorrect_email")