def check_order_info_cart(self):
     """
     购物车订单应显示多个商品
     :param
     :return:
     """
     msg = []
     remark = init_element(self.remark_locator)
     remark_view = remark.parent().parent()
     item_name1 = init_element(self.item_name_cart1_locator)
     item_name2 = init_element(self.item_name_cart2_locator)
     if not item_name1.exists() or not item_name2.exists():
         return False, '购物车订单商品名称显示不正确'
     item_view1 = locate_by_anchor(item_name1, parent_lv=4)
     item_view2 = locate_by_anchor(item_name2, parent_lv=4)
     addressee = init_element(self.addressee_locator)
     addressee_view = locate_by_anchor(addressee, parent_lv=2)
     res1_1 = self.check_order_first_item(item_view1)
     res1_2 = self.check_order_second_item(item_view2)
     res2 = self.check_order_remark(remark_view)
     res3 = self.check_order_addressee(addressee_view)
     if not res1_1[0]:
         msg.append(res1_1[1])
     if not res1_2[0]:
         msg.append(res1_2[1])
     if not res2[0]:
         msg.append(res2[1])
     if not res3[0]:
         msg.append(res3[1])
     return res1_1[0] and res1_2[0] and res2[0] and res3[0], ';'.join(msg)
 def check_order_first_item(_item_view):
     """
     检查普通订单的商品信息,如果是购物车订单,该方法检查第一件商品的信息
     :return:
     """
     try:
         item_name_info = locate_by_anchor(_item_view, child_lv='v0l1l0v0')
         item_name_info_text = get_text_of_view(item_name_info)
         sku_id = locate_by_anchor(_item_view, child_lv='v0l1l0v1')
         sku_id_text = get_text_of_view(sku_id)
         sku_properties_name1 = locate_by_anchor(_item_view, child_lv='v0l1l0v2v0')
         sku_properties_name2 = locate_by_anchor(_item_view, child_lv='v0l1l0v2v1')
         sku_properties_name3 = locate_by_anchor(_item_view, child_lv='v0l1l0v2v2')
         sku_properties_name1_text = get_text_of_view(sku_properties_name1)
         sku_properties_name2_text = get_text_of_view(sku_properties_name2)
         sku_properties_name3_text = get_text_of_view(sku_properties_name3)
         res1 = sku_properties_name1_text == ITEM_INFO.get('属性')[0]
         res2 = sku_properties_name2_text == ITEM_INFO.get('属性')[1]
         res3 = sku_properties_name3_text == ITEM_INFO.get('属性')[2]
         res = res1 and res2 and res3
         if item_name_info_text != ITEM_INFO.get('商品标题'):
             return False, '订单商品标题显示不正确'
         if sku_id_text != ITEM_INFO.get('商家编码'):
             return False, '订单的商家编码信息显示不正确'
         if not res:
             return False, '订单的sku属性信息显示不正确'
         return True, ''
     except PocoNoSuchNodeException:
         return False, '订单商品部分界面异常或者数据异常,请重新检查用例设计'
Ejemplo n.º 3
0
 def choice_first_default_reminder(self):
     new = init_element(self.recommended_phrase_locator)
     # 第一条短语的选择按钮
     change_one = locate_by_anchor(new, parent_lv=2, child_lv='v1v2v0v0l0')
     change_one.click()
     chang_one_text = locate_by_anchor(change_one, parent_lv=4, child_lv='v0')
     chang_one_text = get_text_of_view(chang_one_text)
     return chang_one_text
Ejemplo n.º 4
0
 def choice_second_default_reminder(self):
     new = init_element(self.recommended_phrase_locator)
     # 第二条短语的选择按钮
     chang_two = locate_by_anchor(new, parent_lv=2, child_lv='v2v2v0v0l0')
     chang_two.click()
     chang_two_text = locate_by_anchor(chang_two, parent_lv=4, child_lv='v0')
     chang_two_text = get_text_of_view(chang_two_text)
     return chang_two_text
Ejemplo n.º 5
0
 def check_black_block(self):
     black_block = init_element(self.black_block_locator)
     locate_by_anchor(black_block, 2, 'l0l0').click()
     if get_text_of_view(locate_by_anchor(
             black_block, 2, 'l0l0')).encode('utf-8') == b'\xee\x9a\x9d':
         return True
     else:
         return False
 def get_order_status(self):
     block_buyer = init_element(self.block_buyer_locator)
     temp = locate_by_anchor(block_buyer, parent_lv=3, child_lv='v0')
     if len(temp.child()) < 4:
         status = locate_by_anchor(temp, child_lv='l0')
     else:
         status = locate_by_anchor(temp, child_lv='l1')
     return get_text_of_view(status)
Ejemplo n.º 7
0
 def check_white_ww(self):
     white_ww = init_element(self.white_ww_locator)
     locate_by_anchor(white_ww, 1, 'l0').click()
     if get_text_of_view(locate_by_anchor(
             white_ww, 1, 'l0')).encode('utf-8') == b'\xee\x9a\x9d':
         return True
     else:
         return False
Ejemplo n.º 8
0
 def check_cloud_bad(self):
     cloud_bad = init_element(self.cloud_bad_locator)
     locate_by_anchor(cloud_bad, 1, 'l0').click()
     if get_text_of_view(locate_by_anchor(
             cloud_bad, 1, 'l0')).encode('utf-8') == b'\xee\x9a\x9d':
         return True
     else:
         return False
Ejemplo n.º 9
0
 def check_buyer_no_alipay(self):
     buyer_no_alipay = init_element(self.buyer_no_alipay_locator)
     locate_by_anchor(buyer_no_alipay, 1, 'l0').click()
     if get_text_of_view(locate_by_anchor(
             buyer_no_alipay, 1, 'l0')).encode('utf-8') == b'\xee\x9a\x9d':
         return True
     else:
         return False
 def get_logistics(self):
     anchor = init_element(self.logistics_company_locator)
     a = locate_by_anchor(anchor, parent_lv=2, child_lv='v0l1l0')
     b = locate_by_anchor(anchor, parent_lv=2, child_lv='v0l1l1')
     c = locate_by_anchor(anchor, parent_lv=2, child_lv='v1l1l2')
     news = {'company': a.get_text().strip(), 'company_id': b.get_text().strip(),
             'company_info': c.get_text().strip()}
     return news
Ejemplo n.º 11
0
 def check_give_me_bad_seller(self):
     bad_seller = init_element(self.give_me_bad_seller_locator)
     locate_by_anchor(bad_seller, 1, 'l0').click()
     if get_text_of_view(locate_by_anchor(
             bad_seller, 1, 'l0')).encode('utf-8') == b'\xee\x9a\x9d':
         return True
     else:
         return False
Ejemplo n.º 12
0
 def check_area_interception(self):
     area_interception = init_element(self.area_interception_locator)
     locate_by_anchor(area_interception, 1, 'l0').click()
     if get_text_of_view(
             locate_by_anchor(area_interception, 1,
                              'l0')).encode('utf-8') == b'\xee\x9a\x9d':
         return True
     else:
         return False
Ejemplo n.º 13
0
 def check_than_order_num(self):
     than_order_num = init_element(self.than_order_num_locator)
     locate_by_anchor(than_order_num, 1, 'l0').click()
     close_Elastic_frame('大于该件数').click()
     if get_text_of_view(locate_by_anchor(
             than_order_num, 1, 'l0')).encode('utf-8') == b'\xee\x9a\x9d':
         return True
     else:
         return False
Ejemplo n.º 14
0
 def check_than_actual_payment(self):
     than_actual_payment = init_element(self.than_actual_payment_locator)
     locate_by_anchor(than_actual_payment, 1, 'l0').click()
     close_Elastic_frame('大于该金额').click()
     if get_text_of_view(
             locate_by_anchor(than_actual_payment, 1,
                              'l0')).encode('utf-8') == b'\xee\x9a\x9d':
         return True
     else:
         return False
Ejemplo n.º 15
0
 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
Ejemplo n.º 16
0
 def check_following_keywords(self):
     following_keywords = init_element(self.following_keywords_locator)
     locate_by_anchor(following_keywords, 1, 'l0').click()
     close_Elastic_frame('以下关键字拦截').click()
     if get_text_of_view(
             locate_by_anchor(following_keywords, 1,
                              'l0')).encode('utf-8') == b'\xee\x9a\x9d':
         return True
     else:
         return False
 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, '订单收货信息部分界面异常或者数据异常,请重新检查用例设计'
Ejemplo n.º 18
0
    def add_del_refresh_remarks(self):
        sure_button = init_element(self.preservation_locator)
        poco(text='新建').click()
        text_edit = init_element(self.preservation_locator)
        text_edit = locate_by_anchor(text_edit, parent_lv=2, child_lv='l0').offspring("android.widget.EditText")[0]
        text_edit.set_text('新增的备注短语')
        sure_button.click()
        time.sleep(1)
        results = {}
        results['添加备注短语'] = poco(text='新增的备注短语').exists()
        poco(text='新增的备注短语').click()
        text_edit.invalidate()
        text_edit.set_text(str(text_edit.get_text()) + '修改内容')
        sure_button.click()
        results['修改结果'] = poco(text='新增的备注短语修改内容').exists()
        poco(text='新增的备注短语修改内容').click()
        text_edit.invalidate()
        if text_edit.get_text() == '新增的备注短语修改内容':
            results['信息校验'] = True
        else:
            results['信息校验'] = False
        poco(text='删除').click()
        poco(text='确认').click()
        if poco(text='新增的备注短语修改内容').exists():
            results['删除结果'] = False
        else:
            results['删除结果'] = True

        return results
Ejemplo n.º 19
0
 def choose_bad_batch(self):
     insert = init_element(self.insert_phrase_button_locator)
     good = locate_by_anchor(insert, parent_lv=5, child_lv='v0l2l0')
     good.click()
     if get_text_of_view(good) == '\ue69d':
         return True
     else:
         return False
 def check_order_addressee_detail_page(self, _addressee_view):
     try:
         addressee_info = locate_by_anchor(_addressee_view, child_lv='v0l1')
         addressee_info_text = get_text_of_view(addressee_info)
         mobile_info = locate_by_anchor(_addressee_view, child_lv='v0l1l1l0')
         mobile_info_text = get_text_of_view(mobile_info)
         address_info = locate_by_anchor(_addressee_view, child_lv='v1l1')
         address_info_text = get_text_of_view(address_info)
         if addressee_info_text != ORDER_INFO.get('收件人姓名'):
             return False, '订单的收件人姓名信息显示不正确'
         if mobile_info_text != ORDER_INFO.get('收件人手机f'):
             return False, '订单的收件人手机号信息显示不正确'
         if address_info_text != ORDER_INFO.get('收货地址'):
             return False, '订单的收货地址信息显示不正确'
         return True, ''
     except PocoNoSuchNodeException:
         return False, '订单收货信息部分界面异常或者数据异常,请重新检查用例设计'
 def check_order_no(self, _order_no):
     order_no_lab = init_element(self.order_no_lab_locator)
     order_no_info = locate_by_anchor(order_no_lab, parent_lv=1, child_lv='l1l0')
     order_no_text = order_no_info.get_text()
     if order_no_text != _order_no:
         return False
     else:
         return True
 def choose_bad(self):
     insert = init_element(self.insert_locator)
     bad = locate_by_anchor(insert, parent_lv=5, child_lv='v1l2l0')
     bad.click()
     if get_text_of_view(bad) == b'\\ue69d':
         return True
     else:
         return False
 def choose_medium(self):
     insert = init_element(self.insert_locator)
     medium = locate_by_anchor(insert, parent_lv=5, child_lv='v1l1l0')
     medium.click()
     if get_text_of_view(medium) == b'\\ue69d':
         return True
     else:
         return False
 def check_order_second_item(_item_view):
     try:
         item_name_info = locate_by_anchor(_item_view, child_lv='v1l1l0v0')
         item_name_info_text = get_text_of_view(item_name_info)
         sku_id = locate_by_anchor(_item_view, child_lv='v1l1l0v1')
         sku_id_text = get_text_of_view(sku_id)
         sku_properties_name1 = locate_by_anchor(_item_view, child_lv='v1l1l0v2v0')
         sku_properties_name1_text = get_text_of_view(sku_properties_name1)
         res = sku_properties_name1_text == ITEM_INFO_CART[1].get('属性')
         if item_name_info_text != ITEM_INFO_CART[1].get('商品标题'):
             return False, '购物车订单第二件商品标题显示不正确{},{}'.format(item_name_info_text, ITEM_INFO_CART[1].get('商品标题'))
         if sku_id_text != ITEM_INFO_CART[1].get('商家编码'):
             return False, '购物车订单第二件商品的商家编码信息显示不正确{}'.format(sku_id_text)
         if not res:
             return False, '购物车订单第二件商品的sku属性信息显示不正确'
         return True, ''
     except PocoNoSuchNodeException:
         return False, '购物车订单商品部分界面异常或者数据异常,请重新检查用例设计'
 def get_price(self):
     """
     通过相对定位找到价格元素
     获取并返回文本内容,即订单总价
     :return:
     """
     anchor = init_element(self.total_price_locator)
     total_price = locate_by_anchor(anchor, parent_lv=1, child_lv='l3l1')
     total_price_text = get_text_of_view(total_price)
     return total_price_text
Ejemplo n.º 26
0
 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()
Ejemplo n.º 27
0
 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()
Ejemplo n.º 28
0
 def recipient_block_operation(self):
     recipient_block = init_element(self.recipient_block_locator)
     locate_by_anchor(recipient_block, 2, 'l1v0').click()
     name = poco(text='收件人姓名')
     name.parent().offspring("android.widget.EditText").set_text('测试人员')
     mobile_phone = poco(text='收件人手机号码')
     mobile_phone.parent().offspring("android.widget.EditText").set_text(
         '13911112222')
     phone = poco(text='收件人电话号码')
     phone.parent().offspring("android.widget.EditText").set_text('8510100')
     recive_add = poco(text='收件地址')[1]
     recive_add.parent().offspring("android.widget.EditText")[0].set_text(
         '上海市')
     reason = poco(text='拦截原因(选填)')
     locate_by_anchor(reason, 1, 'l1').set_text('测试拦截')
     poco(text='添加').wait_for_appearance(3)
     poco(text='添加').click()
     sleep(3)
     operation_status = {}
     reason_added = poco(text='拦截原因:测试拦截')
     if reason_added.exists():
         operation_status['add'] = True
         locate_by_anchor(reason_added, 2, 'l1').click()
         poco(text='确认').click()
         if poco(text='拦截原因:测试拦截').exists():
             operation_status['move'] = False
         else:
             operation_status['move'] = True
         return operation_status
     else:
         operation_status['add'] = False
Ejemplo n.º 29
0
 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
Ejemplo n.º 30
0
 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(), '未及时付款'