class OMS(AbTemplate): # sometimes run the file name is file.py sometimes is file.pyc so we need replace by this way # file_name = os.path.basename(__file__).replace(".pyc", "_case").replace(".py", "_case") # case_info = file_name.split("_", 1) # case_id = case_info[0] # case_name = case_info[1] # testcaseinfo = testcaseinfo.TestCaseInfo(case_id, case_name, "功能测试") # logger = noteLog.Loggger(case_name) # testcaseinfo.setLogPath(logger.rel_file) # case info phone = "13811095741" # page util load user_manage_page = usermanage.UserManagePage() user_detail_page = userdetail.UserDetailPage() @retrying.retry(retry_on_exception=retry_if_timeout_exception, stop_max_attempt_number=2) def test_case(self): self.util_init(__file__) self.testcaseinfo.starttime = time.strftime("%Y-%m-%d %H:%M:%S") if self.flag > 1: self.setUp() try: self.step = "convert to user manage page" self.logger.info(self.step) self.convert_URL = urldata.URLData().get_user_manage_page_url() self.convert_to_url(self.convert_URL) self.wait_url_to_be(self.convert_URL) self.step = "fill phone" self.logger.info(self.step) self.wait_visable(self.user_manage_page.phone_text_box) self.fill(self.user_manage_page.phone_text_box, self.phone) self.step = "click query" self.logger.info(self.step) self.click(self.user_manage_page.query_user_button) self.step = "click user id" self.logger.info(self.step) self.wait_visable(self.user_manage_page.user_id) self.click(self.user_manage_page.user_id) self.switch_handel() self.step = "ban user" self.logger.info(self.step) self.wait_clickable(self.user_detail_page.ban_user_link) self.click(self.user_detail_page.ban_user_link) self.wait_a_certain_time(5) self.step = "match ban statu" self.logger.info(self.step) ban_statu = self.get_text_Infor(self.user_detail_page.ban_statu) self.assertEquals("锁定", ban_statu, "锁定状态不匹配") self.testcaseinfo.result = "Pass" pass except TimeoutException: self.timeout_method() except Exception as err: self.exception_method(err) finally: self.finally_method()
def test_case(self): self.util_init(__file__) self.testcaseinfo.starttime = time.strftime("%Y-%m-%d %H:%M:%S") if self.flag > 1: self.setUp() try: self.step = "convert to overdue remind page" self.logger.info(self.step) self.convert_to_url( urldata.URLData().get_overdue_remind_page_url()) self.wait_url_to_be( urldata.URLData().get_overdue_remind_page_url()) self.step = "select company" self.logger.info(self.step) self.wait_visable(self.due_remind_page.cityList_select) self.Select(self.due_remind_page.company_select, self.company_value) self.step = "select city " self.logger.info(self.step) self.Select(self.due_remind_page.cityList_select, self.city_value) self.step = "select type " self.logger.info(self.step) self.Select(self.due_remind_page.typeList_select, self.type_value) self.step = "select station" self.logger.info(self.step) self.Select(self.due_remind_page.stationList_select, self.station_value) self.step = "select is use" self.logger.info(self.step) self.Select(self.due_remind_page.is_use_select, self.is_use_value) self.step = "click query button" self.logger.info(self.step) self.click(self.due_remind_page.query_button) self.step = "validate result" self.logger.info(self.step) self.wait_visable(self.due_remind_page.unit_link) after_station = self.get_text_Infor(self.due_remind_page.unit_link) after_is_use = self.get_text_Infor( self.due_remind_page.overdue_statu) self.assertEquals(self.is_use_value, after_is_use, "逾期状态结果不匹配") if self.station_value not in after_station: raise Exception("分店不匹配") self.step = "click and validate contract link" self.logger.info(self.step) self.click(self.due_remind_page.contract_link) self.switch_handel() self.wait_visable( contractdetail.ContactDetailPage().contact_detail_theme) after_theme = self.get_text_Infor( contractdetail.ContactDetailPage().contact_detail_theme) self.assertEquals("合同详情", after_theme, "合同详情链接不匹配") self.driver.close() self.switch_handel() self.step = "click and validate user link" self.logger.info(self.step) self.click(self.due_remind_page.user_link) self.switch_handel() self.wait_visable(userdetail.UserDetailPage().user_detail_theme) after_theme = self.get_text_Infor( userdetail.UserDetailPage().user_detail_theme) self.assertEquals("用户详情", after_theme, "用户详情链接不匹配") self.driver.close() self.switch_handel() self.step = "click and validate stationunit link" self.logger.info(self.step) self.click(self.due_remind_page.unit_link) self.switch_handel() self.wait_visable( stationunitdetail.StationunitDetailPage().unit_detail_theme) after_theme = self.get_text_Infor( stationunitdetail.StationunitDetailPage().unit_detail_theme) self.assertEquals("仓位详情", after_theme, "仓位详情链接不匹配") self.testcaseinfo.result = "Pass" pass except TimeoutException: self.timeout_method() except Exception as err: self.exception_method(err) finally: self.finally_method()
class OMS(AbTemplate): # sometimes run the file name is file.py sometimes is file.pyc so we need replace by this way # file_name = os.path.basename(__file__).replace(".pyc", "_case").replace(".py", "_case") # case_info = file_name.split("_", 1) # case_id = case_info[0] # case_name = case_info[1] # testcaseinfo = testcaseinfo.TestCaseInfo(case_id, case_name, "功能测试") # logger = noteLog.Loggger(case_name) # testcaseinfo.setLogPath(logger.rel_file) # case info phone = "13810345799" name = "烟雨" card_type = "护照" card_no = "110001001001100010" province = "北京" city = "北京" area = "东四十条" street = "古道" zip = "836700" # page util load user_manage_page = usermanage.UserManagePage() user_detail_page = userdetail.UserDetailPage() user_card_detail = carddetail.CardInfoDetail() @retrying.retry(retry_on_exception=retry_if_timeout_exception, stop_max_attempt_number=2) def test_case(self): self.util_init(__file__) self.testcaseinfo.starttime = time.strftime("%Y-%m-%d %H:%M:%S") if self.flag > 1: self.setUp() try: self.step = "convert to user manage page" self.logger.info(self.step) self.convert_URL = urldata.URLData().get_user_manage_page_url() self.convert_to_url(self.convert_URL) self.wait_url_to_be(self.convert_URL) self.step = "fill phone" self.logger.info(self.step) self.wait_visable(self.user_manage_page.phone_text_box) self.fill(self.user_manage_page.phone_text_box, self.phone) self.step = "click query" self.logger.info(self.step) self.click(self.user_manage_page.query_user_button) self.step = "click user id" self.logger.info(self.step) self.wait_visable(self.user_manage_page.user_id) self.click(self.user_manage_page.user_id) self.switch_handel() self.step = "find new authentication" self.logger.info(self.step) js = "document.getElementsByClassName('userbalance table table-bordered table-striped')[0].scrollIntoView(false);" self.driver.execute_script(js) self.wait_visable(self.user_detail_page.address_info) self.step = "save number of info" self.logger.info(self.step) old_row_no = len( self.find_elements(self.user_detail_page.cardinfo_number)) self.step = "click add" self.logger.info(self.step) self.wait_clickable(self.user_detail_page.add_cardinfo_button) self.click(self.user_detail_page.add_cardinfo_button) self.step = "fill name" self.logger.info(self.step) self.fill(self.user_detail_page.name_box, self.name) self.step = "fill phone" self.logger.info(self.step) self.fill(self.user_detail_page.phone_box, self.phone) self.step = "select type" self.logger.info(self.step) self.Select(self.user_detail_page.identity_type_select, self.card_type) self.step = "fill card no" self.logger.info(self.step) self.fill(self.user_detail_page.identity_no_box, self.card_no) self.step = "fill province" self.logger.info(self.step) self.fill(self.user_detail_page.province_box, self.province) self.step = "fill city" self.logger.info(self.step) self.fill(self.user_detail_page.city_box, self.city) self.step = "fill area" self.logger.info(self.step) self.fill(self.user_detail_page.area_box, self.area) self.step = "fill street" self.logger.info(self.step) self.fill(self.user_detail_page.street_box, self.street) self.step = "fill zip" self.logger.info(self.step) self.fill(self.user_detail_page.zip_box, self.zip) self.step = "click confirm" self.logger.info(self.step) self.click(self.user_detail_page.confirm_button) self.wait_a_certain_time(5) self.step = "get now number of info" self.logger.info(self.step) self.driver.execute_script(js) self.wait_visable(self.user_detail_page.cardinfo_number) new_row_no = len( self.find_elements(self.user_detail_page.cardinfo_number)) self.step = "match number" self.assertEquals(old_row_no + 1, new_row_no, "认证信息添加失败") self.testcaseinfo.result = "Pass" pass except TimeoutException: self.timeout_method() except Exception as err: self.exception_method(err) finally: self.finally_method()
class OMS(AbTemplate): # sometimes run the file name is file.py sometimes is file.pyc so we need replace by this way # file_name = os.path.basename(__file__).replace(".pyc", "_case").replace(".py", "_case") # case_info = file_name.split("_", 1) # case_id = case_info[0] # case_name = case_info[1] # testcaseinfo = testcaseinfo.TestCaseInfo(case_id, case_name, "功能测试") # logger = noteLog.Loggger(case_name) # testcaseinfo.setLogPath(logger.rel_file) # case info phone = "15611805853" balance_prz_value = "10" balance_prz_comment = "自动化测试" # page util load user_manage_page = usermanage.UserManagePage() user_detail_page = userdetail.UserDetailPage() @retrying.retry(retry_on_exception=retry_if_timeout_exception, stop_max_attempt_number=2) def test_case(self): self.util_init(__file__) self.testcaseinfo.starttime = time.strftime("%Y-%m-%d %H:%M:%S") if self.flag > 1: self.setUp() try: self.step = "convert to user manage page" self.logger.info(self.step) self.convert_URL = urldata.URLData().get_user_manage_page_url() self.convert_to_url(self.convert_URL) self.wait_url_to_be(self.convert_URL) self.step = "fill phone" self.logger.info(self.step) self.wait_visable(self.user_manage_page.phone_text_box) self.fill(self.user_manage_page.phone_text_box, self.phone) self.step = "click query" self.logger.info(self.step) self.click(self.user_manage_page.query_user_button) self.step = "click user id" self.logger.info(self.step) self.wait_visable(self.user_manage_page.user_id) self.click(self.user_manage_page.user_id) self.switch_handel() self.step = "screen scroll" self.logger.info(self.step) js = "document.getElementsByClassName('usercommission table table-bordered table-striped')[0].scrollIntoView(false)" self.driver.execute_script(js) self.step = "record gift balance value" self.logger.info(self.step) self.wait_visable(self.user_detail_page.gift_balance) old_gift_balance = self.get_text_Infor( self.user_detail_page.gift_balance) old_gift_total_balance = self.get_text_Infor( self.user_detail_page.gift_total_balance) self.step = "click gift link" self.logger.info(self.step) self.click(self.user_detail_page.gift_balance_link) self.step = "clear old value" self.logger.info(self.step) self.wait_visable(self.user_detail_page.balance_prz_value_box) self.find_element( self.user_detail_page.balance_prz_value_box).clear() self.find_element( self.user_detail_page.balance_prz_comment_box).clear() self.step = "fill value" self.logger.info(self.step) self.fill(self.user_detail_page.balance_prz_value_box, self.balance_prz_value) self.step = "fill comment" self.logger.info(self.step) self.fill(self.user_detail_page.balance_prz_comment_box, self.balance_prz_comment) self.step = "click gift button" self.logger.info(self.step) self.click(self.user_detail_page.gift_button) self.step = "match alert" self.logger.info(self.step, 0) self.wait_alert() self.accept_alert() self.wait_a_certain_time(5) self.step = "match balance" self.logger.info(self.step) self.wait_visable(self.user_detail_page.gift_balance) new_gift_balance = self.get_text_Infor( self.user_detail_page.gift_balance) new_gift_total_balance = self.get_text_Infor( self.user_detail_page.gift_total_balance) self.assertEquals( float(old_gift_balance) + float(self.balance_prz_value), float(new_gift_balance), "赠送余额不匹配") self.assertEquals( float(old_gift_total_balance) + float(self.balance_prz_value), float(new_gift_total_balance), "总赠送余额不匹配") self.testcaseinfo.result = "Pass" pass except TimeoutException: self.timeout_method() except Exception as err: self.exception_method(err) finally: self.finally_method()
class OMS(AbTemplate): # sometimes run the file name is file.py sometimes is file.pyc so we need replace by this way # file_name = os.path.basename(__file__).replace(".pyc", "_case").replace(".py", "_case") # case_info = file_name.split("_", 1) # case_id = case_info[0] # case_name = case_info[1] # testcaseinfo = testcaseinfo.TestCaseInfo(case_id, case_name, "功能测试") # logger = noteLog.Loggger(case_name) # testcaseinfo.setLogPath(logger.rel_file) # case info phone = "13810345799" file1_path = "F:\\upload1.txt" file2_path = "F:\\upload2.txt" # page util load user_manage_page = usermanage.UserManagePage() user_detail_page = userdetail.UserDetailPage() user_card_detail = carddetail.CardInfoDetail() @skip("too many numbers not suit auto test") @retrying.retry(retry_on_exception=retry_if_timeout_exception, stop_max_attempt_number=2) def test_case(self): self.util_init(__file__) self.testcaseinfo.starttime = time.strftime("%Y-%m-%d %H:%M:%S") if self.flag > 1: self.setUp() try: self.step = "convert to user manage page" self.logger.info(self.step) self.convert_URL = urldata.URLData().get_user_manage_page_url() self.convert_to_url(self.convert_URL) self.wait_url_to_be(self.convert_URL) self.step = "fill phone" self.logger.info(self.step) self.wait_visable(self.user_manage_page.phone_text_box) self.fill(self.user_manage_page.phone_text_box, self.phone) self.step = "click query" self.logger.info(self.step) self.click(self.user_manage_page.query_user_button) self.step = "click user id" self.logger.info(self.step) self.wait_visable(self.user_manage_page.user_id) self.click(self.user_manage_page.user_id) self.switch_handel() self.step = "find new authentication" self.logger.info(self.step,3) js = "document.getElementsByClassName('userbalance table table-bordered table-striped')[0].scrollIntoView(false)" self.driver.execute_script(js) self.wait_visable(self.user_detail_page.address_info) elements = self.find_elements(self.user_detail_page.address_info) ls = [] for element in elements: ls.append(element.text) elements = self.find_elements(self.user_detail_page.showdetail_links) self.step = "click show detail link" self.logger.info(self.step) elements[ls.index(max(ls))].click() self.step = "click upload" self.logger.info(self.step) self.wait_clickable(self.user_card_detail.upload_page_button) self.click(self.user_card_detail.upload_page_button) self.step = "upload file1" self.logger.info(self.step) self.wait_visable(self.user_card_detail.file1_button) self.fill(self.user_card_detail.file1_button, self.file1_path) self.step = "upload file2" self.logger.info(self.step) self.fill(self.user_card_detail.file2_button, self.file2_path) self.step = "click upload" self.logger.info(self.step) self.click(self.user_card_detail.upload_button) self.step = "click view link" self.logger.info(self.step) self.wait_clickable(self.user_card_detail.view_link) self.click(self.user_card_detail.view_link) self.step = "click pass" self.logger.info(self.step) self.wait_clickable(self.user_card_detail.pass_button) self.click(self.user_card_detail.pass_button) self.wait_a_certain_time(5) self.step = "match flag link" if self.get_text_Infor(self.user_card_detail.check_flag_link) == "已审核": self.testcaseinfo.result = "Pass" pass except TimeoutException: self.timeout_method() except Exception as err: self.exception_method(err) finally: self.finally_method()
class OMS(AbTemplate): # sometimes run the file name is file.py sometimes is file.pyc so we need replace by this way # file_name = os.path.basename(__file__).replace(".pyc", "_case").replace(".py", "_case") # case_info = file_name.split("_", 1) # case_id = case_info[0] # case_name = case_info[1] # testcaseinfo = testcaseinfo.TestCaseInfo(case_id, case_name, "功能测试") # logger = noteLog.Loggger(case_name) # testcaseinfo.setLogPath(logger.rel_file) # case info phone = "13811095741" developer = "lily" # page util load user_manage_page = usermanage.UserManagePage() user_detail_page = userdetail.UserDetailPage() @retrying.retry(retry_on_exception=retry_if_timeout_exception, stop_max_attempt_number=2) def test_case(self): self.util_init(__file__) self.testcaseinfo.starttime = time.strftime("%Y-%m-%d %H:%M:%S") if self.flag > 1: self.setUp() try: self.step = "convert to user manage page" self.logger.info(self.step) self.convert_URL = urldata.URLData().get_user_manage_page_url() self.convert_to_url(self.convert_URL) self.wait_url_to_be(self.convert_URL) self.step = "fill phone" self.logger.info(self.step) self.wait_visable(self.user_manage_page.phone_text_box) self.fill(self.user_manage_page.phone_text_box, self.phone) self.step = "click query" self.logger.info(self.step) self.click(self.user_manage_page.query_user_button) self.step = "click user id" self.logger.info(self.step) self.wait_visable(self.user_manage_page.user_id) self.click(self.user_manage_page.user_id) self.switch_handel() self.step = "screen scroll" self.logger.info(self.step) js = "document.getElementsByClassName('usercommission table table-bordered table-striped')[0].scrollIntoView(true)" self.driver.execute_script(js) self.step = "click change developer link" self.logger.info(self.step) self.wait_clickable(self.user_detail_page.change_developer_link) self.click(self.user_detail_page.change_developer_link) self.step = "select developer" self.logger.info(self.step) self.wait_visable(self.user_detail_page.developer_select) self.Select(self.user_detail_page.developer_select, self.developer) self.step = "click change button" self.logger.info(self.step) self.click(self.user_detail_page.change_developer_button) self.wait_a_certain_time(5) self.step = "check is change" self.logger.info(self.step) new_developer = self.get_text_Infor( self.user_detail_page.developer) self.assertEquals(self.developer, new_developer, "发展人更改不匹配") self.testcaseinfo.result = "Pass" pass except TimeoutException: self.timeout_method() except Exception as err: self.exception_method(err) finally: self.finally_method()
class OMS(AbTemplate): # file_name = os.path.basename(__file__).replace(".pyc", "_case").replace(".py", "_case") # case_info = file_name.split("_", 1) # case_id = case_info[0] # case_name = case_info[1] # testcaseinfo = testcaseinfo.TestCaseInfo(case_id, case_name, "功能测试") # logger = noteLog.Loggger(case_name) # testcaseinfo.setLogPath(logger.rel_file) # case info phone_value = "13810345799" # page info user_manage_page = usermanage.UserManagePage() user_detail_page = userdetail.UserDetailPage() order_detail_page = orderdetail.OrderDetail() contract_detail_page = contractdetail.ContactDetailPage() stationunit_detail_page = stationunitdetail.StationunitDetailPage() pay_detail_page = paydetail.PayDetailPage() promote_detail_page = promotedetail.PromoteDetailPage() @skip("js scroll screen always error pause this case for now") @retrying.retry(retry_on_exception=retry_if_timeout_exception, stop_max_attempt_number=2) def test_case(self): self.util_init(__file__) self.testcaseinfo.starttime = time.strftime("%Y-%m-%d %H:%M:%S") if self.flag > 1: self.setUp() try: # print self.case_name self.step = "convert to user manage page" self.logger.info(self.step) self.convert_URL = urldata.URLData().get_user_manage_page_url() self.convert_to_url(self.convert_URL) self.wait_url_to_be(self.convert_URL) self.step = "input phone" self.logger.info(self.step) self.wait_visable(self.user_manage_page.phone_text_box) self.fill(self.user_manage_page.phone_text_box, self.phone_value) self.step = "click query" self.logger.info(self.step) self.click(self.user_manage_page.query_user_button) self.step = "click username" self.logger.info(self.step) self.wait_clickable(self.user_manage_page.user_username) self.click(self.user_manage_page.user_username) self.switch_handel() self.step = "screen scroll" self.logger.info(self.step) js = "document.getElementsByClassName('list_details historyOrderBox')[0].scrollIntoView(true)" self.driver.execute_script(js) self.step = "click history order's order link" self.logger.info(self.step) self.wait_clickable(self.user_detail_page.history_order_order) self.click(self.user_detail_page.history_order_order) self.step = "match order page theme" self.logger.info(self.step) self.wait_visable(self.order_detail_page.order_detail_theme) self.assertEqual("订单详情", self.get_text_Infor(self.order_detail_page.order_detail_theme), "订单链接不匹配") self.back() self.step = "screen scroll" self.logger.info(self.step) js = "document.getElementsByClassName('list_details historyOrderBox')[0].scrollIntoView(true)" self.driver.execute_script(js) self.step = "click history order's unit link" self.logger.info(self.step) self.wait_clickable(self.user_detail_page.history_order_unit) self.click(self.user_detail_page.history_order_unit) self.switch_handel() self.step = "match unit page theme" self.logger.info(self.step) self.wait_visable(self.stationunit_detail_page.unit_detail_theme) self.assertEqual("仓位详情", self.get_text_Infor(self.stationunit_detail_page.unit_detail_theme), "仓位链接不匹配") self.driver.back() self.step = "screen scroll" self.logger.info(self.step) js = "document.getElementsByClassName('list_details historyOrderBox')[0].scrollIntoView(true)" self.driver.execute_script(js) self.step = "click history order's contract link" self.logger.info(self.step) self.wait_clickable(self.user_detail_page.history_order_contract) self.click(self.user_detail_page.history_order_contract) self.switch_handel() self.step = "match contract page theme" self.logger.info(self.step) self.wait_visable(self.contract_detail_page.contact_detail_theme) self.assertEqual("合同详情", self.get_text_Infor(self.contract_detail_page.contact_detail_theme), "合同链接") self.driver.back() self.step = "screen scroll" self.logger.info(self.step) js = "document.getElementsByClassName('list_details historyOrderBox')[0].scrollIntoView(true)" self.driver.execute_script(js) self.step = "click history order's payid link" self.logger.info(self.step) self.wait_clickable(self.user_detail_page.history_order_payid) self.click(self.user_detail_page.history_order_payid) self.switch_handel() self.step = "match payid page theme" self.logger.info(self.step) self.wait_visable(self.pay_detail_page.pay_detail_theme) self.assertEqual("支付信息", self.get_text_Infor(self.pay_detail_page.pay_detail_theme), "支付链接不匹配") self.driver.back() self.step = "screen scroll" self.logger.info(self.step) js = "document.getElementsByClassName('list_details historyOrderBox')[0].scrollIntoView(true)" self.driver.execute_script(js) self.step = "click history order's promote link" self.logger.info(self.step) self.wait_clickable(self.user_detail_page.history_order_promote) self.click(self.user_detail_page.history_order_promote) self.switch_handel() self.step = "match promote page theme" self.logger.info(self.step) self.wait_visable(self.promote_detail_page.promote_detail_theme) self.assertEqual("优惠券详情", self.get_text_Infor(self.promote_detail_page.promote_detail_theme), "优惠券链接不匹配") self.driver.back() self.testcaseinfo.result = "Pass" pass except TimeoutException: self.timeout_method() except Exception as err: self.exception_method(err) finally: self.finally_method()
class OMS(AbTemplate): # sometimes run the file name is file.py sometimes is file.pyc so we need replace by this way # file_name = os.path.basename(__file__).replace(".pyc", "").replace(".py", "_case") # case_info = file_name.split("_", 1) # case_id = case_info[0] # case_name = case_info[1] # testcaseinfo = testcaseinfo.TestCaseInfo(case_id, case_name, "功能测试") # logger = noteLog.Loggger(case_name) # testcaseinfo.setLogPath(logger.rel_file) # case info company_value = "新海汇" area_value = "北京市" unit_type_value = "迷你仓" station_value = "双井国贸" unit_value = "双井 A1" order_type_value = "续仓" order_statu_value = "完成" pay_method_value = "微信" order_id_value = "1007082102089340" start_date_value = "2019-07-20" end_date_value = "2019-08-23" # page info order_manage_page = ordermanage.orderManagePage() order_detail_page = orderdetail.OrderDetail() unit_detail_page = stationunitdetail.StationunitDetailPage() pay_detail_page = paydetail.PayDetailPage() contact_detail_page = contractdetail.ContactDetailPage() user_detail_page = userdetail.UserDetailPage() @retrying.retry(retry_on_exception=retry_if_timeout_exception, stop_max_attempt_number=2) def test_case_by(self): self.util_init(__file__) self.testcaseinfo.name = self.case_name + "_by" self.testcaseinfo.starttime = time.strftime("%Y-%m-%d %H:%M:%S") if self.flag > 1: self.setUp() try: self.step = "convert to order manage page" self.logger.info(self.step) self.convert_URL = urldata.URLData().get_order_manage_page_url() self.convert_to_url(self.convert_URL) self.wait_url_to_be(self.convert_URL) self.step = "select company" self.logger.info(self.step) self.wait_visable(self.order_manage_page.company_select) self.Select(self.order_manage_page.company_select, self.company_value) self.step = "select area" self.logger.info(self.step) self.Select(self.order_manage_page.area_select, self.area_value) self.step = "select unit type" self.logger.info(self.step) self.Select(self.order_manage_page.unit_type_select, self.unit_type_value) self.step = "select station" self.logger.info(self.step) self.Select(self.order_manage_page.manage_station_select, self.station_value) self.step = "fill unit" self.logger.info(self.step) self.fill(self.order_manage_page.unit_box, self.unit_value) self.step = "select order type" self.logger.info(self.step) self.Select(self.order_manage_page.order_type_select, self.order_type_value) self.step = "select order statu" self.logger.info(self.step) self.Select(self.order_manage_page.order_statu_select, self.order_statu_value) self.step = "select pay method" self.logger.info(self.step) self.Select(self.order_manage_page.pay_method_select, self.pay_method_value) self.step = "fill start date time" self.logger.info(self.step) self.clear(self.order_manage_page.manage_start_time) self.fill(self.order_manage_page.manage_start_time, self.start_date_value) self.step = "fill end date time" self.logger.info(self.step) self.clear(self.order_manage_page.manage_end_time) self.fill(self.order_manage_page.manage_end_time, self.end_date_value) self.step = "fill order value" self.logger.info(self.step) self.fill(self.order_manage_page.order_id_box, self.order_id_value) self.step = "click query" self.logger.info(self.step) self.click(self.order_manage_page.query_button) self.step = "match order id" self.logger.info(self.step, 10) self.assertEqual( self.get_text_Infor(self.order_manage_page.orider_link), self.order_id_value, "查询结果订单号不匹配") self.step = "match unit type" self.logger.info(self.step) self.assertEqual( self.get_text_Infor(self.order_manage_page.unit_type_info), self.order_type_value, "订单类型不匹配") self.step = "click order link" self.logger.info(self.step) self.wait_clickable(self.order_manage_page.orider_link) self.click(self.order_manage_page.orider_link) self.switch_handel() self.step = "match order link" self.logger.info(self.step) self.wait_visable(self.order_detail_page.order_detail_theme) now_theme = self.get_text_Infor( self.order_detail_page.order_detail_theme) self.assertEquals(now_theme, "订单详情", "订单链接跳转不匹配") self.driver.close() self.switch_handel() self.step = "click unit link" self.logger.info(self.step) self.wait_clickable(self.order_manage_page.unit_link) self.click(self.order_manage_page.unit_link) self.switch_handel() self.step = "match unit link" self.logger.info(self.step) self.wait_visable(self.unit_detail_page.unit_detail_theme) now_theme = self.get_text_Infor( self.unit_detail_page.unit_detail_theme) self.assertEquals(now_theme, "仓位详情", "仓位链接跳转不匹配") self.driver.close() self.switch_handel() self.step = "click user link" self.logger.info(self.step) self.wait_clickable(self.order_manage_page.user_link) self.click(self.order_manage_page.user_link) self.switch_handel() self.step = "match user link" self.logger.info(self.step) self.wait_visable(self.user_detail_page.user_detail_theme) now_theme = self.get_text_Infor( self.user_detail_page.user_detail_theme) self.assertEquals(now_theme, "用户详情", "用户链接跳转不匹配") self.driver.close() self.switch_handel() self.step = "click contract link" self.logger.info(self.step) self.wait_clickable(self.order_manage_page.contract_link) self.click(self.order_manage_page.contract_link) self.switch_handel() self.step = "match contract link" self.logger.info(self.step) self.wait_visable(self.contact_detail_page.contact_detail_theme) now_theme = self.get_text_Infor( self.contact_detail_page.contact_detail_theme) self.assertEquals("合同详情", now_theme, "合同链接跳转不匹配") self.driver.close() self.switch_handel() self.step = "click pay link" self.logger.info(self.step) self.wait_clickable(self.order_manage_page.payment_link) self.click(self.order_manage_page.payment_link) self.switch_handel() self.step = "match pay link" self.logger.info(self.step) self.wait_visable(self.pay_detail_page.pay_detail_theme) now_theme = self.get_text_Infor( self.pay_detail_page.pay_detail_theme) self.assertEquals("支付信息", now_theme, "支付链接跳转不匹配") self.driver.close() self.switch_handel() self.testcaseinfo.result = "Pass" pass except TimeoutException: self.timeout_method() except Exception as err: self.exception_method(err) finally: self.finally_method() @retrying.retry(retry_on_exception=retry_if_timeout_exception, stop_max_attempt_number=2) def test_case_all(self): self.util_init(__file__) self.testcaseinfo.name = self.case_name + "_all" self.testcaseinfo.starttime = time.strftime("%Y-%m-%d %H:%M:%S") if self.flag > 1: self.setUp() try: self.step = "convert to order manage page" self.logger.info(self.step) self.convert_URL = urldata.URLData().get_order_manage_page_url() self.convert_to_url(self.convert_URL) self.wait_url_to_be(self.convert_URL) self.step = "select company" self.logger.info(self.step) self.wait_clickable(self.order_manage_page.query_button) self.Select(self.order_manage_page.company_select, self.company_value) self.step = "click query" self.logger.info(self.step) self.click(self.order_manage_page.query_button) self.step = "match result" self.logger.info(self.step, 10) if not self.find_element(self.order_manage_page.user_phone_info): raise Exception("not find result") self.testcaseinfo.result = "Pass" except TimeoutException: self.timeout_method() except Exception as err: self.exception_method(err) finally: self.finally_method()
class OMS(AbTemplate): # file_name = os.path.basename(__file__).replace(".pyc", "_case").replace(".py", "_case") # case_info = file_name.split("_", 1) # case_id = case_info[0] # case_name = case_info[1] # testcaseinfo = testcaseinfo.TestCaseInfo(case_id, case_name, "功能测试") # logger = noteLog.Loggger(case_name) # testcaseinfo.setLogPath(logger.rel_file) # case info phone_value = "13311331331" order_id_value = "110001001001100010" create_start_date = "2018-01-01" create_end_date = time.strftime("%Y-%m-%d") return_start_date = create_start_date return_end_date = create_end_date execute_value = "未执行" cancel_value = "未取消" size_value = "50" # page info user_manage_page = usermanage.UserManagePage() user_detail_page = userdetail.UserDetailPage() commission_list_page = commissionlist.CommissionList() @retrying.retry(retry_on_exception=retry_if_timeout_exception, stop_max_attempt_number=2) def test_case(self): self.util_init(__file__) self.testcaseinfo.starttime = time.strftime("%Y-%m-%d %H:%M:%S") if self.flag > 1: self.setUp() try: # print self.case_name self.step = "convert to user manage page" self.logger.info(self.step) self.convert_URL = urldata.URLData().get_user_manage_page_url() self.convert_to_url(self.convert_URL) self.wait_url_to_be(self.convert_URL) self.step = "input phone" self.logger.info(self.step) self.wait_visable(self.user_manage_page.phone_text_box) self.fill(self.user_manage_page.phone_text_box, self.phone_value) self.step = "click query" self.logger.info(self.step) self.click(self.user_manage_page.query_user_button) self.step = "click username" self.logger.info(self.step) self.wait_clickable(self.user_manage_page.user_username) self.click(self.user_manage_page.user_username) self.switch_handel() self.step = "screen scroll" self.logger.info(self.step) js = "document.getElementsByClassName('userbalance table table-bordered table-striped')[0].scrollIntoView(true)" self.driver.execute_script(js) self.step = "click return manage's showdetail" self.logger.info(self.step) self.wait_clickable(self.user_detail_page.return_manage_showdetail) self.click(self.user_detail_page.return_manage_showdetail) self.step = "fill order id" self.logger.info(self.step) self.wait_visable(self.commission_list_page.order_id_box) self.fill(self.commission_list_page.order_id_box, self.order_id_value) self.step = "fill create start date" self.logger.info(self.step) self.fill(self.commission_list_page.create_start_date, self.create_start_date) self.step = "fill create end date" self.logger.info(self.step) self.fill(self.commission_list_page.create_end_date, self.create_end_date) self.step = "fill return start date" self.logger.info(self.step) self.fill(self.commission_list_page.return_start_date, self.return_start_date) self.step = "fill return end date" self.logger.info(self.step) self.fill(self.commission_list_page.return_end_date, self.return_end_date) self.step = "select execute" self.logger.info(self.step) self.Select(self.commission_list_page.execute_select, self.execute_value) self.step = "select cancel" self.logger.info(self.step) self.Select(self.commission_list_page.cancel_select, self.cancel_value) self.step = "select size" self.logger.info(self.step) self.Select(self.commission_list_page.size_select, self.size_value) self.step = "click query" self.logger.info(self.step) self.click(self.commission_list_page.query_button) self.step = "match tabel info" self.logger.info(self.step) self.wait_visable(self.commission_list_page.return_result_statu) self.assertEqual("No Data", self.get_text_Infor(self.commission_list_page.return_result_statu), "result not equals") self.testcaseinfo.result = "Pass" pass except TimeoutException: self.timeout_method() except Exception as err: self.exception_method(err) finally: self.finally_method()
class OMS(AbTemplate): # file_name = os.path.basename(__file__).replace(".pyc", "_case").replace(".py", "_case") # case_info = file_name.split("_", 1) # case_id = case_info[0] # case_name = case_info[1] # testcaseinfo = testcaseinfo.TestCaseInfo(case_id, case_name, "功能测试") # logger = noteLog.Loggger(case_name) # testcaseinfo.setLogPath(logger.rel_file) # case info phone_value = "15611805853" # page info user_manage_page = usermanage.UserManagePage() user_detail_page = userdetail.UserDetailPage() order_detail_page = orderdetail.OrderDetail() contract_detail_page = contractdetail.ContactDetailPage() stationunit_detail_page = stationunitdetail.StationunitDetailPage() @retrying.retry(retry_on_exception=retry_if_timeout_exception, stop_max_attempt_number=2) def test_case(self): self.util_init(__file__) self.testcaseinfo.starttime = time.strftime("%Y-%m-%d %H:%M:%S") if self.flag > 1: self.setUp() try: # print self.case_name self.step = "convert to user manage page" self.logger.info(self.step) self.convert_URL = urldata.URLData().get_user_manage_page_url() self.convert_to_url(self.convert_URL) self.wait_url_to_be(self.convert_URL) self.step = "input phone" self.logger.info(self.step) self.wait_visable(self.user_manage_page.phone_text_box) self.fill(self.user_manage_page.phone_text_box, self.phone_value) self.step = "click query" self.logger.info(self.step) self.click(self.user_manage_page.query_user_button) self.step = "click username" self.logger.info(self.step) self.wait_clickable(self.user_manage_page.user_username) self.click(self.user_manage_page.user_username) self.switch_handel() self.step = "click contract history's contract link" self.logger.info(self.step) self.wait_clickable( self.user_detail_page.contract_history_contract) self.click(self.user_detail_page.contract_history_contract) self.step = "match contract page theme" self.logger.info(self.step) self.wait_visable(self.contract_detail_page.contact_detail_theme) self.assertEqual( "合同详情", self.get_text_Infor( self.contract_detail_page.contact_detail_theme), "合同链接不匹配") self.driver.back() self.step = "click contract history's order link" self.logger.info(self.step) # target=self.find_element(self.user_detail_page.contract_history_order) # self.driver.execute_script("arguments[0].scrollIntoView();",target) self.wait_clickable(self.user_detail_page.contract_history_order) self.click(self.user_detail_page.contract_history_order) self.step = "match order page theme" self.logger.info(self.step) self.wait_visable(self.order_detail_page.order_detail_theme) self.assertEqual( "订单详情", self.get_text_Infor(self.order_detail_page.order_detail_theme), "订单链接不匹配") self.back() self.step = "click contract history's unit link" self.logger.info(self.step) self.wait_clickable(self.user_detail_page.contract_history_unit) self.click(self.user_detail_page.contract_history_unit) self.switch_handel() self.step = "match unit page theme" self.logger.info(self.step) self.wait_visable(self.stationunit_detail_page.unit_detail_theme) self.assertEqual( "仓位详情", self.get_text_Infor( self.stationunit_detail_page.unit_detail_theme), "仓位链接不匹配") self.testcaseinfo.result = "Pass" pass except TimeoutException: self.timeout_method() except Exception as err: self.exception_method(err) finally: self.finally_method()