def check_order_addressee(_addressee_view): try: #addressee_info = locate_by_anchor(_addressee_view, child_lv='v0l1') addressee_info_text= poco(text = '顾超').get_text() addressee_info_pos = poco(text = '顾超').get_position()[0] addressee_pos = poco(text = '收件人').get_position()[0] #addressee_info_text = get_text_of_view(addressee_info) #mobile_info = locate_by_anchor(_addressee_view, child_lv='v0l1l1') mobile_info = poco(text = '186-2172-9133') mobile_info_text = mobile_info.get_text() mobile_info_pos = poco(text = '186-2172-9133').get_position()[0] address_info = locate_by_anchor(_addressee_view, child_lv='v1l1') address_info_text = get_text_of_view(address_info) # address = poco(text = '收货地址') # address_pos = address.get_position()[0] # address_info_text = poco(text = '上海,上海市,宝山区,高境镇新二路55号皇冠,201900').get_text() if addressee_info_text != ORDER_INFO.get('收件人姓名') and addressee_info_pos != addressee_pos: return False, '订单的收件人姓名信息显示不正确' if mobile_info_text != ORDER_INFO.get('收件人手机f') and addressee_info_pos != mobile_info_pos: return False, '订单的收件人手机号信息显示不正确' if address_info_text != ORDER_INFO.get('收货地址'): return False, '订单的收货地址信息显示不正确' return True, '' except PocoNoSuchNodeException: return False, '订单收货信息部分界面异常或者数据异常,请重新检查用例设计'
def go_pending_bad_evalution_page(self): # pending_bad_evalution_button = UIObjectProxy(poco) # pending_bad_evalution_button.query = self.pending_bad_evalution_button_locator pending_bad_evalution_button = init_element(self.pending_bad_evalution_button_locator) pending_bad_evalution_button.wait() pending_bad_evalution_button.click() poco(text="阻止差评买家拍单").wait_for_appearance(3) return poco(text="阻止差评买家拍单").exists()
def go_violation_words_check_page(self): violation_words_check_button = init_element(self.violation_words_check_button_locator) violation_words_check_button.click() if poco(text='立即授权').exists(): confirm_auth_button = init_element(self.confirm_auth_button_locator) confirm_auth_button.click() BasePage().refresh() return poco(text='违规词检测').exists()
def default_evaluation(self): a = poco(text='谢谢,很好的买家!').exists() b = poco(text='谢谢,欢迎下次惠顾小店!').exists() c = poco(text='谢谢亲的支持!欢迎下次惠顾!').exists() d = poco(text='期待您的下次光临,我们会做得更好!').exists() e = poco(text='谢谢您的光临,新款随时上请继续关注小店!').exists() if a and b and c and d and e: return True else: return False
def check_address(): news = get_seller_address() results = {'name': True, 'address': True, 'phone': True} for i in news[0]: results['name'] = poco(text=i) and results['name'] for i in news[1]: results['address'] = poco(text=i) and results['name'] for i in news[2]: results['phone'] = poco(text=i) and results['name'] return results
def white_ww_operation(self): poco(text='添加旺旺白名单').click() buyer_nick = poco(text='买家旺旺') buyer_nick.parent().offspring("android.widget.EditText").set_text( '自动白名单用户') reason_white = poco(text='放行原因') reason_white.parent().offspring("android.widget.EditText").set_text( '自动白名单用户添加原因') poco(text='添加').click() # 有问题,得这么处理一下 buyer_nick.parent().offspring("android.widget.EditText").set_text('') reason_white.parent().offspring("android.widget.EditText").set_text('') operation_name_status = {} if poco(text='自动白名单用户'): operation_name_status['add'] = True auto_white_reason = poco(text='放行原因:自动白名单用户添加原因') auto_white_reason.parent().parent().offspring( "android.widget.Button")[0].click() else: operation_name_status['add'] = False if poco(text='自动白名单用户'): operation_name_status['move'] = False else: operation_name_status['move'] = True return operation_name_status
def default_remarks(self): a = poco(text='缺货').exists() b = poco(text='周末不收货').exists() c = poco(text='发EMS').exists() d = poco(text='老客户').exists() e = poco(text='送赠品').exists() default_remarks = {'缺货': a, '周末不收货': b, '发EMS': c, '老客户': d, '送赠品': e} if a and b and c and d and e: return True, default_remarks else: return False, default_remarks
def change_default_logistic(self): ay_click(self.default_logistic_locator) poco(text="安能物流").parent().child()[0].click() poco(text='在线下单').click() poco(text="安能物流").parent().child()[0].click() poco(text='保存').click() self.back()
def close_order(self): close_order = init_element(self.close_order_locator) close_order.click() # 关闭订单按钮点击后可能没有反应 try: poco(text='确认关闭').wait_for_appearance(3) self.back() return True except Exception: if ay_exists(self.copy_mobile_number_locator): # 可能会误点到收货地址 ay_click(self.copy_mobile_number_locator) close_order.invalidate() close_order.click() res = poco(text='确认关闭').exists() self.back() return res
def set_less_than_actual_payment(self): less_than_actual_payment = init_element( self.less_than_actual_payment_locator) locate_by_anchor(less_than_actual_payment, 2, 'l1l0').click() less_payment = poco(text='小于该金额') locate_by_anchor(less_payment, 2, 'v1l0l0').set_text('10') locate_by_anchor(less_payment, 2, 'v2v1l1').click()
def go_bad_evalution_page(self): # bad_evalution_button = UIObjectProxy(poco) # bad_evalution_button.query = self.bad_evalution_button_locator bad_evalution_button = init_element(self.bad_evalution_button_locator) bad_evalution_button.wait() bad_evalution_button.click() return poco(text="阻止Ta拍单").exists()
def go_missing_evalution_page(self): # missing_evalution_button = UIObjectProxy(poco) # missing_evalution_button.query = self.missing_evalution_button_locator missing_evalution_button = init_element(self.missing_evalution_button_locator) missing_evalution_button.wait() missing_evalution_button.click() return poco(text="近90天漏评").exists()
def go_to_be_evaluated_page(self): # to_be_evaluated_button = UIObjectProxy(poco) # to_be_evaluated_button.query = self.to_be_evaluated_button_locator to_be_evaluated_button = init_element(self.to_be_evaluated_button_locator) to_be_evaluated_button.wait() to_be_evaluated_button.click() return poco(text="批量评价").exists()
def go_pending_interim_evalution_page(self): # pending_interim_evalution_button = UIObjectProxy(poco) # pending_interim_evalution_button.query = self.pending_interim_evalution_button_locator pending_interim_evalution_button = init_element(self.pending_interim_evalution_button_locator) pending_interim_evalution_button.wait() pending_interim_evalution_button.click() return poco(text="阻止中评买家拍单").exists()
def less_set_than_order_common_num(self): than_order_common_num = init_element( self.than_order_common_num_locator) locate_by_anchor(than_order_common_num, 2, 'l1l0').click() less_than_order = poco(text='小于该件数') locate_by_anchor(less_than_order, 2, 'v1l0l0').set_text('50') locate_by_anchor(less_than_order, 2, 'v2v1l1').click()
def go_release_taobao_page(self): release_taobao_button = init_element(self.release_taobao_button_locator) release_taobao_button.wait_for_appearance() release_taobao_button.click() taobao_workbench_title = init_element(self.taobao_workbench_title_locator) taobao_workbench_title.wait_for_appearance() return poco(text='微淘工作台').exists()
def go_taobao_broadcast_page(self): taobao_broadcast_button = init_element(self.taobao_broadcast_button_locator) taobao_broadcast_button.wait_for_appearance() taobao_broadcast_button.click() watch_broadcast_text = init_element(self.watch_broadcast_text_locator) watch_broadcast_text.wait_for_appearance() return poco(text='立即观看直播>').exists()
def go_interim_evalution_page(self): # interim_evalution_button = UIObjectProxy(poco) # interim_evalution_button.query = self.interim_evalution_button_locator interim_evalution_button = init_element(self.interim_evalution_button_locator) interim_evalution_button.wait() interim_evalution_button.click() return poco(text="阻止Ta拍单").exists()
def recover_default_logistic(self): poco(text='常用物流').click() try: loop_find(Template(r"pic_data/tpl1581424887698.png", record_pos=(-0.001, -0.757), resolution=(1080, 2340), threshold=0.95)) poco(text="安能物流").parent().child()[0].click() except: pass poco(text='在线下单').click() try: loop_find(Template(r"pic_data/tpl1581424887698.png", record_pos=(-0.001, -0.757), resolution=(1080, 2340), threshold=0.95)) poco(text="安能物流").parent().child()[0].click() except: pass poco(text='保存').click()
def go_good_evalution_page(self): # good_evalution_button = UIObjectProxy(poco) # good_evalution_button.query = self.good_evalution_button_locator good_evalution_button = init_element(self.good_evalution_button_locator) good_evalution_button.wait() good_evalution_button.click() result = print(poco(text="阻止Ta拍单").exists()) return str(result)
def go_to_others_evalution_page(self): # to_others_evalution_button = UIObjectProxy(poco) # to_others_evalution_button.query = self.to_others_evalution_button_locator to_others_evalution_button = init_element(self.to_others_evalution_button_locator) to_others_evalution_button.wait() to_others_evalution_button.click() result = print(poco(text="阻止Ta拍单").exists()) return str(result)
def check_order_remark(_remark_view): try: #remark_info = locate_by_anchor(_remark_view, child_lv='v0l1l0l1') remark_info = poco(text = '自动化测试备注') #message_info = locate_by_anchor(_remark_view, child_lv='v1l1') message_info = poco(text = '自动化测试留言') remark_info_text = remark_info.get_text() message_info_text = message_info.get_text() if remark_info_text != ORDER_INFO.get('备注'): return False, '订单的备注信息显示不正确' if message_info_text != ORDER_INFO.get('留言'): return False, '订单的留言信息显示不正确' return True, '' except PocoNoSuchNodeException: return False, '订单备注部分界面异常或者数据异常,请重新检查用例设计' except IndexError: return False, '订单备注部分界面异常或者数据异常,请重新检查用例设计'
def check_white_baby(self): white_baby = init_element(self.white_baby_locator) locate_by_anchor(white_baby, 1, 'l0').click() button = poco(text='黑名单中买家依旧拦截') locate_by_anchor(button, 1, 'l0').click() if get_text_of_view(locate_by_anchor( button, 1, 'l0')).encode('utf-8') == b'\xee\x9a\x9d': return True else: return False
def set_close_reason(self): close_reason = init_element(self.close_reason_locator) close_reason.click() poco(text='未及时付款').click() reason = poco(text='请选择关闭理由') reason_click = locate_by_anchor(reason, parent_lv=2, child_lv='v2v1l1') reason_click.click() if poco(text='请选择关闭理由'): poco(text='买家不想买了').click() reason_click.click() return poco(text='买家不想买了').exists(), '买家不想买了' else: return poco(text='未及时付款').exists(), '未及时付款'
def extended_receiving_time(self): """ 延时3天收货 :return: """ ay_click(self.delayed_receipt_locator) poco(text='3').click() poco(text='请选择延迟收货的天数').wait_for_disappearance(10) if poco('android:id/alertTitle').exists(): poco('确认').click()
def white_ww_operation(self): # poco(text='添加旺旺白名单').click() poco(text='买家旺旺').parent().offspring("android.widget.EditText")[0].set_text('自动白名单用户') poco(text='放行原因').parent().offspring("android.widget.EditText")[0].set_text('自动白名单用户添加原因') operation_name_status = {} if poco(text='自动白名单用户'): operation_name_status['add'] = True else: operation_name_status['add'] = False poco(text='自动白名单用户').parent().parent().offspring("android.widget.Button")[0].click() if poco(text='自动白名单用户'): operation_name_status['move'] = False else: operation_name_status['move'] = True return operation_name_status
def white_baby_operation(): baby_status = {} poco(text='添加宝贝白名单').click() poco(text='添加宝贝白名单').wait_for_appearance(3) poco(text='添加宝贝白名单').click() first_baby = poco(text='添加')[0] baby_name_demo = locate_by_anchor(first_baby, parent_lv=2, child_lv='l0l1') baby_name = get_text_of_view(baby_name_demo) first_baby.click() if poco(text=baby_name).exists(): baby_status['add'] = True locate_by_anchor( poco(text=baby_name), parent_lv=3, child_lv='l1').offspring('android.widget.Button').click() else: baby_status['add'] = False if poco(text=baby_name).exists(): baby_status['move'] = False else: baby_status['move'] = True return baby_status
def set_interception_status(self): poco(text='快速设置拦截方式').wait_for_appearance(5) #status = init_element(self.quick_setting_of_interception_mode_locator) #print(status.attr('pos')) # 初始化所有开关状态为关闭状态 #status.click() #poco(text='自定义拦截模式').wait_for_appearance(5) poco(text=self.get_interception_status()).click() poco(text='自定义拦截模式').click()
def black_block_operation(): poco(text='旺旺黑名单').click() ww_name = poco(text='买家旺旺') locate_by_anchor(ww_name, 1, 'l1l1').set_text('自动黑名单用户') black_reason = poco(text='拉黑原因') locate_by_anchor(black_reason, 1, 'l1l1').set_text('自动黑名单用户添加原因') poco(text='添加').click() locate_by_anchor(ww_name, 1, 'l1l0').set_text('') locate_by_anchor(black_reason, 1, 'l1l0').set_text('') name_status = {} if poco(text='自动黑名单用户'): name_status['add'] = True else: name_status['add'] = False # poco(text='自动黑名单用户').parent().parent().offspring("android.widget.Button")[0].click() auto_black_name = poco(text='自动黑名单用户') locate_by_anchor(auto_black_name, 2, 'l1').click() if poco(text='自动黑名单用户'): name_status['move'] = False else: name_status['move'] = True return name_status
def change_phrase(self, index=0): check_address_element = locate_by_anchor(init_element(self.check_address_anchor), 2, 'l1') check_address_element.click() poco(text='设为默认短语')[1].click() self.refresh()