def test_assert_phonenumber_href(self): try: homepage = HomePage(Browser._driver) self.assertTrue(homepage.verify_phonenumber_href()) except: raise Exception ("Phone number href is not correct")
def test_assert_servicemail_href(self): try: homepage = HomePage(Browser._driver) self.assertTrue(homepage.verify_serviceamil_href()) except: raise Exception ("Service email href is not correct")
def test_footer_codeofconduct_navigtion(self): try: homepage = HomePage(Browser._driver) self.assertEqual(self.Homeresult[1][10], homepage.get_codeofconduct_url()) except: raise Exception("Privacy Terms Navigation Failed")
def setUp(cls): # create a new Browser session and maximize the window Browser.initialize_driver() # default FireFox BasicActions.maximize_window() # Go to Olyve Home Page URL BasicActions.navigate(ConfigReader.readconfig('ConfigurationSettings', 'OlyveHomeURL')) # Wait till the Home page is loaded homepage = HomePage(Browser._driver) homepage.wait_for_header_olyve_logo()
def test_go_to_product(self): homepage = HomePage(Browser._driver) # Get the number of products for Index in range(0, homepage.get_product_count()): homepage.findproductandclick(Index) BasicActions.implicit_wait(20) # Wait for Product Page to load if homepage.wait_for_product_page(): url_name = BasicActions.get_current_url() url_name_from_excel = self.Productresult[1][Index] self.assertEqual(url_name, url_name_from_excel) BasicActions.go_back() BasicActions.refresh_page() BasicActions.implicit_wait(5)
def test_header_items(self): try: homepage = HomePage(Browser._driver) self.assertTrue(homepage.is_logo_displayed(), "Olyve Header Logo is not displayed") self.assertTrue(homepage.is_header_shop_button_enabled(), "Header Shop Button is not enabled") self.assertTrue(homepage.is_header_fromourcustomers_button_enabled(), "Header From Our Customers Button is not enabled") self.assertTrue(homepage.is_header_theolyveexperience_button_enabled(), "Header The Olyve Experience Button is not enabled") self.assertTrue(homepage.is_header_track_button_enabled(), "Header Track Button is not enabled") self.assertTrue(homepage.is_header_service_button_enabled(), "Header Service Button is not enabled") self.assertTrue(homepage.is_header_workshops_button_enabled(), "Header Workshops Button is not enabled") self.assertTrue(homepage.is_header_social_button_enabled(), "Header Social Button is not enabled") # Fetch the expected header from the excel sheet expected_header_message_ribbon = self.Homeresult[1][0] self.assertEqual(expected_header_message_ribbon, homepage.get_header_ribbon_message(), "Header Ribbon Message is not correct") except: raise Exception("Header Assertions Failed")
def test_twitter_social_info(self): try: # Instance from homepage class homepage = HomePage(Browser._driver) # Wait till home page is loaded before clicking on Twitter link if homepage.wait_for_product_image_load(): # Call the twitter_social_info function homepage.twitter_social_info() # Wait till home page is loaded after clicking on Twitter link BasicActions.implicit_wait(20) # Switch to the newly opened window Browser._driver.switch_to.window(Browser._driver.window_handles[1]) # Make sure the newly opened window is loaded in order to get the URL if homepage.wait_for_twitter_page_load: url_name = Browser._driver.current_url # Verify that the URL of the newly opened page is the URL of Olyve Twitter Social Link self.assertEqual(self.Homeresult[1][9], Browser._driver.current_url, "Error in asserting the Twitter link") except: raise Exception("Twitter link not correct")
def test_shop_button_second_slide_click(self): homepage = HomePage(Browser._driver) selected_slide = homepage.click_on_second_slide() if homepage.verify_slide_is_active(selected_slide)== True: homepage.shop_button_second_slide_click() BasicActions.implicit_wait(40) # Switch to the newly opened window Browser._driver.switch_to.window(Browser._driver.window_handles[1]) # Make sure the newly opened window is loaded in order to get the URL if homepage.wait_for_instgram_page_load(): url_name = Browser._driver.current_url # Verify that the URL of the newly opened page is the URL of Olyve Instgram Social Link self.assertEqual(self.Homeresult[1][7], Browser._driver.current_url, "Error in asserting the Instgram link")
def test_footer_items_text(self): try: homepage = HomePage(Browser._driver) # Footer text assertions self.assertEqual(self.Homeresult[1][1], homepage.get_footer_copyright_text()) self.assertEqual(self.Homeresult[1][2], homepage.get_footer_privacyterms_text()) self.assertEqual(self.Homeresult[1][3], homepage.get_footer_codeofconduct_text()) self.assertEqual(self.Homeresult[1][4], homepage.get_footer_phonenumber_text()) self.assertEqual(self.Homeresult[1][5], homepage.get_footer_serviceemail_text()) except: raise Exception("Footer Text Assertions Failed")
def test_navigating_between_products_slide(self): try: homepage = HomePage(Browser._driver) selected_slide = homepage.click_on_second_slide() self.assertTrue(homepage.verify_slide_is_active(selected_slide), "Second Slide is not active") BasicActions.implicit_wait(20) selected_slide = homepage.click_on_third_slide() self.assertTrue(homepage.verify_slide_is_active(selected_slide), "Third Slide is not active") BasicActions.implicit_wait(30) selected_slide = homepage.click_on_first_slide() BasicActions.implicit_wait(5) self.assertTrue(homepage.verify_slide_is_active(selected_slide), "First Slide is not active") except: raise Exception("There is an issue in navigating between the slides")
def test_from_our_customer_button_click(self): homepage = HomePage(Browser._driver) self.assertEqual(self.Homeresult[1][13], homepage.from_our_customer_button_click(), "Error in asserting the From Our Customer Page")
def test_olyve_exprience_button_click(self): homepage = HomePage(Browser._driver) self.assertEqual(self.Homeresult[1][12], homepage.olyve_experience_button_click(), "Error in asserting the From Our Customer Page")
def test_shop_button_click(self): homepage = HomePage(Browser._driver) self.assertTrue(homepage.shop_button_click(), "By clicking on the Header Shop button, the user was not navigated to Products")
def test_registration_GetSpendingLimitSuccess(self): driver = self.driver driver.get(self.base_url) url_1 = self.base_url + '/Account/Signup' url_2 = self.base_url + '/Account/ApplyNow' url_3 = self.base_url + '/Account/ApplyNow#' x = random.randint(100, 10000) text3 = 'Employment Information' text4 = 'Personal Information' text5 = 'Payment Information' text6 = 'Congratulations!' PORTAL = 'mainstreet' time.sleep(3) driver.get(self.base_url + '/Account/Signup') # self.assertEqual(url_1, HelperTestBase.getURL(self)) ##### Page 1: START Let’s Create Your Account ########### RegistrationPage1.fillForm1(self, email='*****@*****.**', username='******' + str(x), password="******", passwordConfirm="Ss123456", answer='valya') # self.assertEqual(url_2, HelperTestBase.getURL(self)) HelperTestBase.waitNextButton(self) ################## Page2 : Contact Information ######################### RegistrationPage2.fillForm2(self, firstName='sveta', lastName='step' + str(x), phone='7777777777', portal=PORTAL) time.sleep(20) self.assertEqual(url_3, HelperTestBase.getURL(self)) self.assertIn(text3, self.driver.page_source) ################## Page3: Employment Information ######################### RegistrationPage3.fillForm3(self, employerName='Private Firm Niagara', empPhone='5986547899', income='9999', ohterIncome='') time.sleep(5) # self.assertIn(text4, self.driver.page_source) ################## Page4: Personal Information ######################### RegistrationPage4.fillForm4(self, ssn='121512230', driverLic='555555555', state="AL") time.sleep(10) self.assertIn(text5, self.driver.page_source) ######## Page5: Payment Information ########################### RegistrationPage5.fillForm5(self, accountType='DebitCard', cardNumber='5454-5454-5454-5454', cvv="1234", month='12', year='2021') time.sleep(35) self.assertIn(text6, self.driver.page_source) RegistrationPage5.clickContinueButton(self) time.sleep(15) self.assertIs(True, HomePage.checkINFOBannerPresent(self)) HomePage.logOut(self) #####Test scope - new user can Log In with credentials: driver.get(self.base_url + '/Account/Login') LoginPage.logIn(self, "svetast" + str(x), "Ss123456") self.assertIs(True, HomePage.checkLogOutLink(self))
def test_changePassword(self): driver = self.driver driver.get(self.base_url + '/Account/Dashboard') text0 = 'Password is required.' text1 = 'New password is required.' text2 = 'Re-type new password is required.' text4 = 'Cannot use any of the four previous passwords.' text5 = 'Password must be at least 8 alphanumeric characters and contain at least one number' text6 = 'Password and Re-Type password do not match' text7 = 'Update Successful' LoginPage.logIn(self, "svetast999", "Ss123456") time.sleep(5) ManageAccountPage.clickAccountSettings(self) time.sleep(2) ManageAccountPage.changePassword(self, currentPW='', newPW='', reTypePW='') time.sleep(3) self.assertIn(text0, self.driver.page_source) self.assertIn(text1, self.driver.page_source) self.assertIn(text2, self.driver.page_source) self.driver.refresh() # Check validation ####### ManageAccountPage.changePassword(self, currentPW='Ss123456', newPW='Ss1!@#$%^&*()_+<>[]{}?', reTypePW='Ss1!@#$%^&*()_+<>?[]{}') time.sleep(4) self.assertIn(text5, self.driver.page_source) # Check that password shoul be consist minimum of 8 symbols ####### ManageAccountPage.changePassword(self, currentPW='Ss123456', newPW='Ss12345', reTypePW='Ss12345') time.sleep(4) self.assertIn(text5, self.driver.page_source) # Check that User Can't use any of the four previous passwords: ManageAccountPage.changePassword(self, currentPW='Ss123456', newPW='Ss123456', reTypePW='Ss123456') time.sleep(3) self.assertIn(text4, self.driver.page_source) # Check that Password must be at least 8 alphanumeric characters and contain at least one number': ManageAccountPage.changePassword(self, currentPW='Ss123456', newPW='12345678', reTypePW='12345678') time.sleep(3) self.assertIn(text5, self.driver.page_source) # Check that Password must be at least 8 alphanumeric characters and contain at least one number': ManageAccountPage.changePassword(self, currentPW='Ss123456', newPW='Asdfghjk', reTypePW='Asdfghjk') time.sleep(3) self.assertIn(text5, self.driver.page_source) # Check that Password and Re-Type password should be match: ManageAccountPage.changePassword(self, currentPW='Ss123456', newPW='Ss123456', reTypePW='Ff123456') time.sleep(3) self.assertIn(text6, self.driver.page_source) # Check that Password and Re-Type password should be match: ManageAccountPage.changePassword(self, currentPW='Ss123456', newPW='Ff123456', reTypePW='Ss123456') time.sleep(3) self.assertIn(text6, self.driver.page_source) ###### Check that Password has been changed successfully after entered valid data: ########### ManageAccountPage.changePassword(self, currentPW='Ss123456', newPW='Ff123456', reTypePW='Ff123456') time.sleep(3) self.assertIn(text7, self.driver.page_source) self.driver.refresh() ######## Return Test Data ################ ManageAccountPage.changePassword(self, currentPW='Ff123456', newPW='Rr123456', reTypePW='Rr123456') time.sleep(3) self.assertIn(text7, self.driver.page_source) self.driver.refresh() ManageAccountPage.changePassword(self, currentPW='Rr123456', newPW='Nn123456', reTypePW='Nn123456') time.sleep(3) self.assertIn(text7, self.driver.page_source) self.driver.refresh() ManageAccountPage.changePassword(self, currentPW='Nn123456', newPW='Mm123456', reTypePW='Mm123456') time.sleep(3) self.assertIn(text7, self.driver.page_source) self.driver.refresh() ManageAccountPage.changePassword(self, currentPW='Mm123456', newPW='Kk123456', reTypePW='Kk123456') time.sleep(3) self.assertIn(text7, self.driver.page_source) self.driver.refresh() ManageAccountPage.changePassword(self, currentPW='Kk123456', newPW='Ss123456', reTypePW='Ss123456') time.sleep(3) self.assertIn(text7, self.driver.page_source) self.driver.refresh() HomePage.logOut(self) time.sleep(3) LoginPage.logIn(self, "svetast999", "Ss123456") HelperTestBase.waitLogOutLink(self) self.assertIs(True, HomePage.checkLogOutLink(self))
def test_checkNavigation(self): driver = self.driver driver.get(self.base_url + '/Account/Dashboard') text1 = self.base_url + '/account/orderhistory' text2 = self.base_url + '/account/ordershipping' text3 = self.base_url + '/account/Settings' text4 = self.base_url + '/account/addressbook' text5 = self.base_url + '/LTO/EditEmploymentInformation' text6 = self.base_url + '/LTO/EditPersonalInformation' text7 = 'Change Payment Method' text9 = self.base_url + '/account/dashboard' text10 = "Register to Make Payments" LoginPage.logIn(self, "svetast555", "Ss123456") ManageAccountPage.clickOrderHistory(self) time.sleep(2) self.assertEqual(text1, HelperTestBase.getURL(self)) self.driver.back() ManageAccountPage.clickTrackShipping(self) time.sleep(2) self.assertEqual(text2, HelperTestBase.getURL(self)) self.driver.back() ManageAccountPage.clickAccountSettings(self) time.sleep(2) self.assertEqual(text3, HelperTestBase.getURL(self)) self.assertIs(True, ManageAccountPage.checkNewPasswordFieldPresent(self)) self.assertIs(True, ManageAccountPage.checkNewEmailAddressFielfPresent(self)) self.driver.back() time.sleep(5) ManageAccountPage.clickAddressAndPhone(self) time.sleep(2) self.assertEqual(text4, HelperTestBase.getURL(self)) self.assertIs(True, ManageAccountPage.checkAddressFieldPresent(self)) self.assertIs(True, ManageAccountPage.checkZipCodeFielfPresent(self)) self.assertIs(True, ManageAccountPage.checkMobilePhoneFielfPresent(self)) self.driver.back() time.sleep(2) ManageAccountPage.clickEmploymentInformation(self) time.sleep(2) self.assertEqual(text5, HelperTestBase.getURL(self)) self.driver.back() time.sleep(2) ManageAccountPage.clickPersonalInformation(self) time.sleep(2) self.assertEqual(text6, HelperTestBase.getURL(self)) self.assertIs(True, ManageAccountPage.checkSaveButton_Present(self)) self.assertIs(True, ManageAccountPage.checkCancelButton_Present(self)) self.assertIs(True, ManageAccountPage.checkSSNPresent(self)) self.assertIs(True, ManageAccountPage.checkDriverLisensePresent(self)) self.assertIs(True, ManageAccountPage.checkDriverLisenseStatePresent(self)) self.driver.back() time.sleep(2) ManageAccountPage.clickChangePaymentMethod(self) time.sleep(2) self.assertIn(text7, self.driver.page_source) self.driver.back() time.sleep(2) ManageAccountPage.clickAccountSummary(self) time.sleep(2) self.assertEqual(text9, HelperTestBase.getURL(self)) self.driver.back() time.sleep(2) ManageAccountPage.clickShopNow(self) time.sleep(2) self.assertIs(True, HomePage.checkINFOBannerPresent(self)) self.driver.back() time.sleep(2) #### add checking if self.driver.find_element_by_partial_link_text( "Click Here to go to").is_displayed(): ManageAccountPage.clickToGoTo(self) time.sleep(10) windows = driver.window_handles driver.switch_to.window(windows[1]) self.assertIn(text10, self.driver.page_source) self.driver.back() time.sleep(2)
def test_homePage(self, getData): log = self.getLogger() self.driver.implicitly_wait(2) homepage = HomePage(self.driver) log.info("first name is " + getData["FirstName"]) homepage.getName().send_keys(getData["FirstName"]) homepage.getEmail().send_keys(getData["LastName"]) homepage.getPassword().send_keys("Test@123") homepage.getCheckbox().click() self.SelectGender(homepage.getGender(), getData["Gender"]) homepage.getSubmitButton().click() self.driver.refresh()
def test_case_smoke1(self): """smoke1-BS全流程测试-通过场景""" # Chrome驱动 driver = webdriver.Chrome() # 浏览器最大化 driver.maximize_window() # 打开网址 driver.get(URL.url) # 等待 driver.implicitly_wait(20) # loginPage实例化 loginPage1 = LoginPage() loginPage1.test_user_login(driver=driver, username='******', password=123456) sleep(3) # homePage实例化 homePage1 = HomePage() # workOrder实例化 workOrder1 = WorkOrderPage() """test登陆新建工单""" homePage1.click_work_order(driver=driver) """新增工单""" workOrder1.click_add_order(driver=driver) """抢修类型""" workOrder1.click_qiangxiu_button(driver=driver) sleep(1) driver.implicitly_wait(20) """请选择派发流程_第2个抢修流程""" workOrder1.click_dispatch_flow_select(driver=driver) sleep(1) driver.implicitly_wait(20) sleep(1) driver.implicitly_wait(20) """选择第一个派发""" workOrder1.click_dispatch_flow_selected_one(driver=driver) sleep(1) driver.implicitly_wait(20) """填写项目名称""" workOrder1.input_project_name(driver=driver, project_name=u'test项目名称') sleep(1) driver.implicitly_wait(20) """填写项目地点""" workOrder1.input_project_place(driver=driver, project_place=u'test项目地点') sleep(1) driver.implicitly_wait(20) """选择负责人""" workOrder1.click_principal_select(driver=driver) sleep(1) driver.implicitly_wait(20) """选择第1个负责人""" workOrder1.click_principal_selected_one(driver=driver) sleep(1) driver.implicitly_wait(20) """选择验证人""" workOrder1.click_identifier_select(driver=driver) sleep(1) driver.implicitly_wait(20) """选择第1个验证人""" workOrder1.click_identifier_selected_one(driver=driver) sleep(1) driver.implicitly_wait(20) """选择客户""" workOrder1.click_customer_select(driver=driver) sleep(1) driver.implicitly_wait(20) """选择第2个客户""" workOrder1.click_customer_selected_one(driver=driver) sleep(1) driver.implicitly_wait(20) """输入客户联系人""" workOrder1.input_customer_linkman(driver=driver, customer_linkman=u'许臻') sleep(1) driver.implicitly_wait(20) """输入联系电话""" workOrder1.input_linkman_tel(driver=driver, linkman_tel='15609100803') sleep(1) driver.implicitly_wait(20) """输入工单内容描述""" workOrder1.input_work_order_content_description( driver=driver, work_order_content_description=u'工单内容描述') sleep(1) driver.implicitly_wait(20) """输入计划开始时间""" workOrder1.select_plan_start_time(driver=driver, plan_start_time='2018-04-20 00:00') sleep(1) driver.implicitly_wait(20) """输入计划结束时间""" workOrder1.select_plan_end_time(driver=driver, plan_end_time='2018-04-20 22:00') """输入班组""" workOrder1.input_group(driver=driver, group=u'巡检一班') """点击派单按钮""" workOrder1.click_dispatch_button(driver=driver) sleep(1) driver.implicitly_wait(20) """******************""" """点击我的待办按钮""" workOrder1.click_my_to_do_button(driver=driver) sleep(1) driver.implicitly_wait(20) """点击第一个处理按钮""" workOrder1.click_first_deal_button(driver=driver) sleep(10) # 浏览器退出 driver.quit()
def test_workshop_button_click(self): homepage = HomePage(Browser._driver) self.assertEqual(self.Homeresult[1][18], homepage.workshop_button_click(), "Error in asserting the Workshop Page")
def test_track_button_click(self): homepage = HomePage(Browser._driver) self.assertEqual(self.Homeresult[1][14], homepage.track_button_click(self.Homeresult[1][15]), "Error in asserting the Track Page")
def test_shop_button_third_slide_click(self): homepage = HomePage(Browser._driver) selected_slide = homepage.click_on_third_slide() if homepage.verify_slide_is_active(selected_slide) == True: self.assertTrue(homepage.shop_button_third_slide_click(), "By clicking on the Shop button of the third slide, the user was not navigated to Products")
def test_01_search_product(self): driver = self.driver login = LoginPage(driver) login.skip_sign_in() home_page = HomePage(driver) home_page.search_item(TestData.search_item_text) home_page.select_item(Locators.item_xpath) home_page.use_pin_code() home_page.enter_pin_code(TestData.pin_code) home_page.apply_pin_code()
def test_service_button_click(self): homepage = HomePage(Browser._driver) self.assertEqual(self.Homeresult[1][16], homepage.service_button_click(self.Homeresult[1][15], self.Homeresult[1][17]), "Error in asserting the Service Page")
def click_login(self): HomePage.click_login(self)
def test_social_button_click(self): homepage = HomePage(Browser._driver) self.assertTrue(homepage.social_button_click(), "By clicking on the Social button, the user was not navigated to Social links")
def test_case_smoke1(self): """smoke1-BS全流程测试-不通过-取消场景""" # Chrome驱动 driver = webdriver.Chrome() # 浏览器最大化 driver.maximize_window() # 打开网址 driver.get(URL.url) # 等待 driver.implicitly_wait(20) # loginPage实例化 loginPage1 = LoginPage() """test登陆通知调度""" # 调用对象loginPage1的login方法 loginPage1.test_user_login(driver=driver, username='******', password='******') # homePage实例化 homePage1 = HomePage() # 等待 driver.implicitly_wait(20) # 点击实时监控button homePage1.click_real_time_monitoring(driver=driver) # 实时监控页面实例化 realTimeMonitoringPage1 = RealTimeMonitoringPage() # 等待 driver.implicitly_wait(20) # 点击实时监控的左侧第一个卡片 realTimeMonitoringPage1.click_first_warn_notice_card(driver=driver) driver.implicitly_wait(20) # 点击实时监控的右侧通知调度button realTimeMonitoringPage1.click_notice_dispatcher_button(driver=driver) driver.implicitly_wait(20) # 输入通知调度dialog realTimeMonitoringPage1.input_notice_dispatcher_dialog(driver=driver, notice_dispatcher_content=u'通知调度') # 点击通知调度dialog的确定button driver.implicitly_wait(20) realTimeMonitoringPage1.click_notice_dispatcher_input_confirm_button(driver=driver) sleep(1) # 点击调度管理button homePage1.click_dispatching_management(driver=driver) # 调度管理页面实例化 dispatchingManagementPage1 = DispatchingManagementPage() # 等待 sleep(3) driver.implicitly_wait(20) # 第一个调度单派单 dispatchingManagementPage1.click_first_dispatch_button(driver=driver) driver.implicitly_wait(20) # 点击工单类型---3.维修单 dispatchingManagementPage1.click_slow_repair_button(driver=driver) driver.implicitly_wait(20) # 点击派发流程按钮 dispatchingManagementPage1.click_dispatch_flow_button(driver=driver) driver.implicitly_wait(20) # 选择第一个派发流程 dispatchingManagementPage1.select_first_dispatch_flow(driver=driver) driver.implicitly_wait(20) # 点击自动匹配 sleep(1) dispatchingManagementPage1.click_auto_match_button(driver=driver) driver.implicitly_wait(20) # 自动匹配点击第一个人员 sleep(1) dispatchingManagementPage1.click_auto_match_first_user_list(driver=driver) driver.implicitly_wait(20) # 点击自动匹配对话框的确定按钮 dispatchingManagementPage1.click_auto_match_confirm_button(driver=driver) driver.implicitly_wait(20) # 输入工单内容描述 dispatchingManagementPage1.input_work_order_content(driver=driver, work_order_content_input=u'工单内容描述') driver.implicitly_wait(20) # 选择计划开始时间 dispatchingManagementPage1.select_plan_start_time(driver=driver, plan_start_time='2018-03-22 00:00') driver.implicitly_wait(20) # 选择计划结束时间 dispatchingManagementPage1.select_plan_end_time(driver=driver, plan_end_time='2018-12-29 00:00') driver.implicitly_wait(20) # 输入班组 dispatchingManagementPage1.input_team_group(driver=driver, team_group=u'巡检一班') driver.implicitly_wait(20) # 调度管理派单界面的派单按钮 sleep(1) dispatchingManagementPage1.click_dispatch_button(driver=driver) sleep(1) # 退出登陆实例化 logoutPage1 = LogoutPage() # 退出登陆 logoutPage1.test_user_logout(driver=driver) """电工1登陆,走流程,审核和处理""" # 电工1登陆 loginPage1.test_user_login(driver=driver, username='******', password='******') # 等待 driver.implicitly_wait(20) # 点击首页工单按钮 homePage1.click_work_order(driver=driver) sleep(1) # 工单实例化 workOrderPage1 = WorkOrderPage() # 等待 driver.implicitly_wait(20) # 点击工单中的我的待办 workOrderPage1.click_my_to_do_button(driver=driver) sleep(1) driver.implicitly_wait(20) # 点击第一个工单的处理按钮 workOrderPage1.click_first_deal_button(driver=driver) driver.implicitly_wait(20) # 填写审核表单 workOrderPage1.input_audit_form(driver=driver, required_equipment=u'所需设备', required_materials=u'所需材料', repaired_plan=u'所需计划') driver.implicitly_wait(20) sleep(1) # 点击第一个工单的处理按钮 workOrderPage1.click_first_deal_button(driver=driver) # 填写处理表单 driver.implicitly_wait(20) workOrderPage1.input_deal_form(driver=driver, deal_result=u'处理结果') sleep(1) driver.implicitly_wait(20) # 退出登陆 logoutPage1.test_user_logout(driver=driver) sleep(1) driver.implicitly_wait(20) """test登陆,走流程,验证--通过""" # test登陆 loginPage1.test_user_login(driver=driver, username='******', password='******') sleep(1) driver.implicitly_wait(20) # 点击导航的工单按钮 homePage1.click_work_order(driver=driver) # 点击工单中的我的待办 workOrderPage1.click_my_to_do_button(driver=driver) sleep(1) driver.implicitly_wait(20) # 点击第一个工单的处理按钮 workOrderPage1.click_first_deal_button(driver=driver) driver.implicitly_wait(20) # 填写验证表单 workOrderPage1.input_verify_form(driver=driver, result_description=u'结果描述') # 验证表单中的通过按钮 workOrderPage1.click_vertify_form_no_pass_button(driver=driver) sleep(1) # 弹窗提示点击取消按钮 driver.implicitly_wait(20) workOrderPage1.click_hint_cancel_button(driver=driver) sleep(1) # 浏览器退出 driver.quit()
def test_LeaseSuccess_NewUser(self): driver = self.driver driver.get(self.base_url) url_1 = self.base_url + '/Account/Signup' url_2 = self.base_url + '/Account/ApplyNow' url_3 = self.base_url + '/Account/ApplyNow#' x = random.randint(100, 10000) text3 = 'Employment Information' text4 = 'Personal Information' text5 = 'Payment Information' text6 = 'Congratulations!' time.sleep(3) driver.get(self.base_url + '/Account/Signup') self.driver.refresh() ##### Page 1: START Let’s Create Your Account ########### RegistrationPage1.fillForm1(self, email='*****@*****.**', username='******' + str(x), password="******", passwordConfirm="Ss123456", answer='valya') ################## Page2 : Contact Information ######################### RegistrationPage2.fillForm2(self, firstName='sveta', lastName='step' + str(x), phone='121212121212', portal='mainstreet') ################## Page3: Employment Information ######################### RegistrationPage3.fillForm3(self, employerName='Private Firm Niagara', empPhone='5986547899', income='9999', ohterIncome='') ################## Page4: Personal Information ######################### RegistrationPage4.fillForm4(self, ssn='121512230', driverLic='555555555', state="AL") time.sleep(5) self.assertIn(text5, self.driver.page_source) ######## Page5: Payment Information ########################### RegistrationPage5.fillForm5(self, accountType='DebitCard', cardNumber='5454-5454-5454-5454', cvv="1234", month='12', year='2021') time.sleep(35) self.assertIn(text6, self.driver.page_source) RegistrationPage5.clickContinueButton(self) time.sleep(15) self.assertIs(True, HomePage.checkINFOBannerPresent(self)) text1 = 'Thank you.' text2 = 'No items found in your cart.' url_2 = self.base_url + '/cart' ### Precondition : check that Cart is empty: driver.get(url_2) self.assertIn(text2, self.driver.page_source) ### test scope : add the item to Cart: HomePage.submitSearch(self, 'canon') SearchResultsPage.clickAddToCart(self) self.driver.get(url_2) time.sleep(5) ### test scope : click on Checkout button : CartPage.clickCheckoutButton(self) time.sleep(5) ### test scope : click on Price Reviewed Opt In , ReviewYourLease buttons: CartPage.selectPriceReviewedOptIn(self) CartPage.clickReviewYourLease(self) ### test scope : check that user accepted the Lease: LeasePage.signAgreement(self, firstName='sveta', lastName=' step' + str(x)) time.sleep(100) self.assertIn(text1, self.driver.page_source) driver.get(url_2) time.sleep(8) self.assertIn(text2, self.driver.page_source)