コード例 #1
0
    def basic_cloud_act(self, business, username, password, product_codes):
        basePage.login(self, business, username, password)
        self.driver.wait_activity(".bash.ui.MainActivity", 10)
        while True:
            update_info = self.find_element(basePage.update_text_info)
            time.sleep(2)
            if not update_info: break
        try:

            self.click_element(basePage.menu_btn_layout)

            page_size = basePage.GetPageSize(self)
            sx = 0.1
            sy = 0.75
            ex = 0.1
            ey = 0.25
            basePage.swipe_up(self, page_size, sx, sy, ex, ey)
            self.click_element(coLocation.module_item_name, timeout=1)

            # ===================>>>>>>>我的云单<<<<<<<<===============================
            self.order_list()
            # ===================>>>>>>>门店指标<<<<<<<<===============================

        except Exception as e:
            raise Exception('报表查询操作出现异常')
コード例 #2
0
 def scrap_create(self, business, username, password, product_codes):
     basePage.login(self, business, username, password)
     self.driver.wait_activity(".bash.ui.MainActivity", 10)
     while True:
         update_info = self.find_element(basePage.update_text_info)
         time.sleep(2)
         if not update_info: break
     try:
         # 点击菜单
         self.click_element(basePage.menu_btn_layout)
         # 向上滑到页面
         page_size = basePage.GetPageSize(self)
         sx = 0.1
         sy = 0.75
         ex = 0.1
         ey = 0.25
         basePage.swipe_up(self, page_size, sx, sy, ex, ey)
         # 点击库存损益
         self.click_element(sLocation.scrap)
         time.sleep(5)
         self.click_element(sLocation.stock_loss_add)
         self.click_element(sLocation.product_type_edit)
         self.click_element(sLocation.change_product)
         self.click_element(sLocation.stock_type_edit)
         self.click_element(sLocation.change_reason)
         self.input_element(sLocation.resean_edit, '123')
         self.click_element(sLocation.stock_loss_next)
         time.sleep(6)
         contexts = self.driver.contexts
         self.switch_h5(contexts[1])
         time.sleep(4)
         self.click_element(sLocation.add_handle)
         time.sleep(4)
         for code in product_codes:
             contexts = self.driver.contexts
             self.switch_h5(contexts[0])
             time.sleep(7)
             self.click_element(sLocation.search_product)
             for num in code:
                 self.driver.press_keycode(basePage.keycode[num])
             self.click_element(basePage.keypad_search_btn)
             contexts = self.driver.contexts
             self.switch_h5(contexts[1])
             time.sleep(4)
             self.click_element(sLocation.product_colors)
             self.click_element(sLocation.product_size)
             self.click_element(sLocation.add)
         self.click_element(sLocation.back_btn)
         self.click_element(sLocation.confirm)
         self.click_element(sLocation.back_btn)
         contexts = self.driver.contexts
         self.switch_h5(contexts[0])
         time.sleep(6)
         self.click_element(basePage.menu_btn_layout)
         page_size = basePage.GetPageSize(self)
         basePage.swipe_up(self, page_size, 0.1, 0.80, 0.1, 0.10)
         self.click_element(basePage.logout)
         self.click_element(basePage.text_confirm)
     except Exception as e:
         raise Exception('创建损益单时出现异常:%s' % e)
コード例 #3
0
    def transfer_confirm(self, business, username, password):
        '''
        签收待签收的单据
        :param business:
        :param username:
        :param password:
        :return:
        '''
        basePage.login(self, business, username, password)
        self.driver.wait_activity(".bash.ui.MainActivity", 10)
        while True:
            update_info = self.find_element(basePage.update_text_info)
            print update_info
            time.sleep(2)
            if update_info == False: break
        try:
            # 点击菜单
            self.click_element(basePage.menu_btn_layout)
            # 向上滑到页面
            page_size = basePage.GetPageSize(self)
            sx = 0.1
            sy = 0.75
            ex = 0.1
            ey = 0.25
            basePage.swipe_up(self, page_size, sx, sy, ex, ey)

            # 点击门店入库
            self.click_element(tranLocation.stock_in)
            # 点击调拨入库
            self.click_element(tranLocation.transfer_in)
            time.sleep(5)
            self.click_element(tranLocation.details_text)
            contexts = self.driver.contexts
            self.switch_h5(contexts[1])
            time.sleep(4)
            self.click_element(tranLocation.icon_edit)
            self.click_element(tranLocation.icon_delete)
            self.click_element(tranLocation.num_key)
            self.click_element(tranLocation.key_confirm)
            self.click_element(tranLocation.btn_save)
            self.click_element(tranLocation.back_btn)
            time.sleep(4)
            contexts = self.driver.contexts
            self.switch_h5(contexts[0])
            time.sleep(2)
            self.click_element(tranLocation.take_receive)
            el = self.find_element(tranLocation.transfer_diff_wizard)
            if el:
                self.click_element(tranLocation.diff_confirm_button)
                time.sleep(3)
            self.click_element(tranLocation.text_confirm_button)
            time.sleep(1)
        except:
            raise Exception('签收调拨单出现异常')
        self.click_element(basePage.menu_btn_layout)
        page_size = basePage.GetPageSize(self)
        basePage.swipe_up(self, page_size, 0.1, 0.80, 0.1, 0.10)
        self.click_element(basePage.logout)
        self.click_element(basePage.text_confirm)
コード例 #4
0
 def member_query(self, business, username, password, telphone, tag):
     '''
     搜索会员,会员画像,会员资料,历史订单,优惠券
     '''
     basePage.login(self, business, username, password)
     while True:
         update_info = self.find_element(basePage.update_text_info)
         time.sleep(2)
         if not update_info: break
     try:
         # 点击菜单
         self.click_element(basePage.menu_btn_layout)
         time.sleep(2)
         # 进入会员中心
         self.click_element(memLocation.menu_info)
         time.sleep(2)
         if self.find_element(memLocation.iterm):
             self.click_element(memLocation.text_confirm)
         # 输入会员手机号码
         for num in telphone:
             self.driver.press_keycode(basePage.keycode[num])
         # 搜索会员
         self.click_element(memLocation.search_product_btn)
         time.sleep(5)
         if self.find_element(memLocation.iterm):
             self.click_element(memLocation.text_confirm)
         self.click_element(memLocation.radio_history)
         time.sleep(2)
         self.click_element(memLocation.coupon_layout)
         time.sleep(2)
         if self.find_element(memLocation.iterm):
             self.click_element(memLocation.text_confirm)
         self.click_element(memLocation.radio_pic)
         self.click_element(memLocation.addTagBtn)
         self.input_element(memLocation.custom_targs, tag)
         self.click_element(memLocation.add_targs_button)
         time.sleep(2)
         self.click_element(memLocation.confirm_button)
         time.sleep(2)
         # 验证标签是否添加成功
         if self.find_element(memLocation.old_tag):
             print '会员标签添加成功'
         else:
             raise Exception('会员标签添加失败')
         self.click_element(memLocation.member_back)
         self.click_element(basePage.menu_btn_layout)
         sx = 0.1
         sy = 0.25
         ex = 0.1
         ey = 0.75
         basePage.swipe_up(self, basePage.GetPageSize(self), sx, sy, ex, ey)
         self.click_element(basePage.logout)
         self.click_element(basePage.text_confirm)
     except Exception as e:
         raise Exception('会员中心出现异常%s'%e)
コード例 #5
0
    def basic_reload_act(self, business, username, password, product_codes):
        basePage.login(self, business, username, password)
        self.driver.wait_activity(".bash.ui.MainActivity", 10)
        while True:
            update_info = self.find_element(basePage.update_text_info)
            time.sleep(2)
            if not update_info: break
        try:

            self.click_element(basePage.menu_btn_layout)

            page_size = basePage.GetPageSize(self)
            sx = 0.1
            sy = 0.75
            ex = 0.1
            ey = 0.25
            basePage.swipe_up(self, page_size, sx, sy, ex, ey)
            self.click_element(reLocation.module_item_name, timeout=1)

            # ===================>>>>>>>我的云单<<<<<<<<===============================
            self.apply_reload(product_codes)

            self.click_element(reLocation.reload_state_choice, timeout=1)
            self.click_element(reLocation.draft_reload, timeout=1)
            self.click_element(reLocation.commit_reload_button, timeout=1)
            self.click_element(reLocation.conform_commit, timeout=3)
            self.click_element(reLocation.cancel_reload_button, timeout=3)
            self.click_element(reLocation.conform_commit, timeout=3)

            self.click_element(reLocation.reload_state_choice, timeout=1)
            self.click_element(reLocation.approve_reload, timeout=1)

            self.click_element(reLocation.reload_state_choice, timeout=1)
            self.click_element(reLocation.waiting_reload, timeout=1)

            self.click_element(reLocation.reload_state_choice, timeout=1)
            self.click_element(reLocation.done_reload, timeout=1)

            self.click_element(reLocation.reload_state_choice, timeout=1)
            self.click_element(reLocation.reject_reload, timeout=1)
            self.click_element(reLocation.commit_reload_button, timeout=1)
            self.click_element(reLocation.conform_commit, timeout=3)

            self.click_element(reLocation.cancel_reload_button, timeout=3)
            self.click_element(reLocation.conform_commit, timeout=3)

            self.click_element(reLocation.reload_state_choice, timeout=1)
            self.click_element(reLocation.cancel_reload, timeout=1)

        except Exception as e:
            raise Exception('报表查询操作出现异常')
コード例 #6
0
 def scrap_by_orderno(self, business, username, password, transferin_order,
                      sku):
     '''
     调拨入库单高级搜索,根据调拨单号进行模糊搜索
     :return:
     '''
     # 登录
     basePage.login(self, business, username, password)
     self.driver.wait_activity(".bash.ui.MainActivity", 10)
     while True:
         update_info = self.find_element(basePage.update_text_info)
         time.sleep(2)
         if not update_info: break
     try:
         # 点击菜单
         self.click_element(basePage.menu_btn_layout)
         # 向上滑到页面
         page_size = basePage.GetPageSize(self)
         sx = 0.1
         sy = 0.75
         ex = 0.1
         ey = 0.25
         basePage.swipe_up(self, page_size, sx, sy, ex, ey)
         # 点击库存损益
         self.click_element(sLocation.scrap)
         # 点击高级搜索
         self.click_element(sLocation.order_search)
         # 输入退货单号
         self.input_element(sLocation.search_order_no, transferin_order)
         # 输入商品编码
         self.input_element(sLocation.search_order_sku, sku)
         # 点击查询
         self.click_element(sLocation.search_query)
         time.sleep(1)
         self.click_element(basePage.menu_btn_layout)
         time.sleep(2)
         basePage.swipe_up(self, page_size, 0.1, 0.80, 0.1, 0.10)
         self.click_element(basePage.logout)
         self.click_element(basePage.text_confirm)
     except Exception as e:
         raise Exception('损益单高级搜索出现异常:%s' % e)
コード例 #7
0
    def best_info(self, business, username, password, product_code):
        basePage.login(self, business, username, password)
        self.driver.wait_activity(".bash.ui.MainActivity", 10)
        while True:
            update_info = self.find_element(basePage.update_text_info)
            print update_info
            time.sleep(2)
            if not update_info: break

        try:
            self.click_element(basePage.menu_btn_layout)
            self.click_element(bsLocation.module_item_name)
            time.sleep(5)
            contexts = self.driver.contexts
            self.switch_h5(contexts[1])
            time.sleep(4)
            self.click_element(bsLocation.search_product_btn)
            self.input_element(bsLocation.input_product, product_code)
            self.click_element(bsLocation.search)
            time.sleep(2)
            self.click_element(bsLocation.clear)
            self.click_element(bsLocation.cancel)
            el = self.find_element(bsLocation.favourite_product)
            if el:
                self.click_element(bsLocation.favourite_product)
                time.sleep(5)
                self.click_element(bsLocation.inventory)
                time.sleep(2)
                self.click_element(bsLocation.back_btn)
            contexts = self.driver.contexts
            self.switch_h5(contexts[0])
            time.sleep(5)
            self.click_element(basePage.menu_btn_layout)
            page_size = basePage.GetPageSize(self)
            basePage.swipe_up(self, page_size, 0.1, 0.80, 0.1, 0.10)
            self.click_element(basePage.logout)
            self.click_element(basePage.text_confirm)
        except:
            raise Exception('畅销排行操作出现异常')
コード例 #8
0
    def transfer_by_orderno(self, business, username, password,
                            transferin_order, sku):
        '''
        调拨入库单高级搜索,根据调拨单号进行模糊搜索
        :return:
        '''
        # 登录
        basePage.login(self, business, username, password)
        self.driver.wait_activity(".bash.ui.MainActivity", 10)
        while True:
            update_info = self.find_element(basePage.update_text_info)
            print update_info
            time.sleep(2)
            if update_info == False: break
        try:
            # 点击菜单
            self.click_element(basePage.menu_btn_layout)
            # 向上滑到页面
            page_size = basePage.GetPageSize(self)
            sx = 0.1
            sy = 0.75
            ex = 0.1
            ey = 0.25
            basePage.swipe_up(self, page_size, sx, sy, ex, ey)
            # 点击门店入库
            self.click_element(tranLocation.stock_in)
            # 点击调拨入库
            self.click_element(tranLocation.transfer_in)
            # 点击高级搜索
            self.click_element(tranLocation.order_search)
            # 输入调拨单号
            self.input_element(tranLocation.search_order_no, transferin_order)
            # 输入商品编码
            self.input_element(tranLocation.search_order_sku, sku)
            # 点击调拨类型
            self.click_element(tranLocation.type_edit)
            page_size = basePage.GetPageSize(self)
            sx = 0.5
            sy = 0.75
            ex = 0.5
            ey = 0.80
            basePage.swipe_up(self, page_size, sx, sy, ex, ey)
            self.click_element(tranLocation.transfer_options_submit)
            # 点击查询
            self.click_element(tranLocation.search_query)
            self.click_element(basePage.menu_btn_layout)

            basePage.swipe_up(self, page_size, 0.1, 0.80, 0.1, 0.10)
            self.click_element(basePage.logout)
            self.click_element(basePage.text_confirm)
        except Exception as e:
            raise Exception('调拨入库单高级搜索出现异常:%s' % e)
コード例 #9
0
    def member_register(self, business, username, password, tag):
        '''
        注册会员,添加新会员标签
        '''

        basePage.login(self,business, username, password)
        while True:
            update_info = self.find_element(basePage.update_text_info)
            time.sleep(2)
            if not update_info: break
        try:
            # 点击菜单
            self.click_element(basePage.menu_btn_layout)
            time.sleep(2)
            # 进入会员中心
            self.click_element(memLocation.menu_info)
            time.sleep(2)
            if self.find_element(memLocation.iterm):
                self.click_element(memLocation.text_confirm)
            new_member = self.createPhone()
            for new_num in new_member:
                self.driver.press_keycode(basePage.keycode[new_num])
            self.click_element(memLocation.add_member_txt)
            time.sleep(2)
            if self.find_element(memLocation.hint_text):
                self.click_element(memLocation.text_confirm)
            time.sleep(5)
            new_name = self.memberName().decode('utf-8')
            self.input_element(memLocation.register_name, new_name)
            self.click_element(random.choice(memLocation.sex))
            self.click_element(memLocation.register_save)
            time.sleep(2)
            self.tag_info = self.tag_info % new_member
            if self.find_element(self.tag_info):
                self.click_element(memLocation.text_confirm)
            time.sleep(5)
            if self.find_element(memLocation.iterm):
                self.click_element(memLocation.text_confirm)
            self.click_element(memLocation.radio_pic)
            self.click_element(memLocation.addTagBtn)
            self.input_element(memLocation.custom_targs, tag)
            self.click_element(memLocation.add_targs_button)
            time.sleep(2)
            self.click_element(memLocation.confirm_button)
            time.sleep(2)
            # 验证标签是否添加成功
            if self.find_element(memLocation.old_tag):
                print '会员标签添加成功'
            else:
                raise Exception('会员标签添加失败')
            time.sleep(2)
            # 使用新注册的会员进行下单
            self.click_element(memLocation.sale_btn)
            try:
                self.find_element(memLocation.member_name.text == new_name)
                print '跳转到购物车页面成功带上会员'
            except:
                raise Exception('异常')
            self.click_element(basePage.menu_btn_layout)
            sx = 0.1
            sy = 0.25
            ex = 0.1
            ey = 0.75
            basePage.swipe_up(self, basePage.GetPageSize(self), sx, sy, ex, ey)
            self.click_element(basePage.logout)
            self.click_element(basePage.text_confirm)
        except Exception as e:
            raise Exception('会员中心添加标签出现异常%s'%e)
コード例 #10
0
    def sale_test(self, business, username, password, product_code, telphone):

        basePage.login(self, business, username, password)
        self.driver.wait_activity(".bash.ui.MainActivity", 10)
        while True:
            update_info = self.find_element(basePage.update_text_info)
            print update_info
            time.sleep(2)
            if update_info == False: break
        try:
            # 输入商品编码
            for i in product_code:
                self.driver.press_keycode(basePage.keycode[i])
            self.click_element(basePage.keypad_search_btn)
            self.click_element(scLocation.product_sizes[0])
            self.click_element(scLocation.product_colors[0])
            self.click_element(scLocation.confirm_txt)
            # 清空购物车
            self.click_element(scLocation.shopcar_clear_btn)
            # 确认清空操作
            self.click_element(scLocation.text_confirm)
            # 商品的颜色和尺码生成唯一的组合
            datagroup = [scLocation.product_colors, scLocation.product_sizes]
            cartesian = basePage.Cartesian(datagroup)
            attrlist = cartesian.assemble()
            for info in attrlist:
                # 输入商品编码
                for i in product_code:
                    self.driver.press_keycode(basePage.keycode[i])
                self.click_element(basePage.keypad_search_btn)
                color_info = info[0]
                size_info = info[1]
                self.click_element(size_info)
                self.click_element(color_info)
                self.click_element(scLocation.confirm_txt)
            # 输入会员手机号码
            for num in telphone:
                self.driver.press_keycode(basePage.keycode[num])
            self.click_element(basePage.keypad_search_btn)
            # 选择销售员
            self.click_element(scLocation.saleman_text)
            self.click_element(scLocation.tv_sale_name)
            self.click_element(scLocation.tv_confirm)
            # 点击下一步
            self.click_element(scLocation.settle_btn)
            # 确认提示信息
            if self.find_element(scLocation.text_confirm):
                self.click_element(scLocation.text_confirm)
            try:
                # 检查是否进入选择促销的页面
                self.find_element(scLocation.member_promotion_name)
                # 点击去支付
                self.click_element(scLocation.settle_btn)
            except:
                raise Exception('上传销售订单出现异常')
            # 选择现金支付
            self.click_element(scLocation.pay_cash)
            # 确认支付
            self.click_element(scLocation.confirm_pay)
            try:
                # 检查是否支付成功
                self.find_element(scLocation.img_gou)
                # 开始新订单
                self.click_element(scLocation.text_restart)
                print '支付成功'
            except:
                raise Exception('支付出现异常')
            self.click_element(basePage.menu_btn_layout)
            page_size = basePage.GetPageSize(self)
            basePage.swipe_up(self, page_size, 0.1, 0.80, 0.1, 0.10)
            self.click_element(basePage.logout)
            self.click_element(basePage.text_confirm)
        except Exception as e:
            raise Exception('创建销售订单出现异常:%s' % e)
コード例 #11
0
    def transfer_out_upload(self, business, username, password, product_codes):
        basePage.login(self, business, username, password)
        self.driver.wait_activity(".bash.ui.MainActivity", 10)
        while True:
            update_info = self.find_element(basePage.update_text_info)
            time.sleep(2)
            if not update_info: break
        try:
            # 点击菜单
            self.click_element(basePage.menu_btn_layout)
            # 向上滑到页面
            page_size = basePage.GetPageSize(self)
            sx = 0.1
            sy = 0.75
            ex = 0.1
            ey = 0.25
            basePage.swipe_up(self, page_size, sx, sy, ex, ey)

            # 点击门店出库
            self.click_element(tranLocation.stock_out)
            # 点击调拨出库
            self.click_element(tranLocation.transfer_out)
            time.sleep(5)
            self.click_element(tranLocation.title)
            self.click_element(tranLocation.draft_order)
            self.click_element(tranLocation.confirm_allocate_txt)
            el = self.find_element(tranLocation.confirm_tip)
            if el:
                self.click_element(tranLocation.text_confirm)
                self.click_element(tranLocation.details_text)
                contexts = self.driver.contexts
                self.switch_h5(contexts[1])
                time.sleep(7)
                self.click_element(tranLocation.add_handle)
                time.sleep(4)
                for code in product_codes:
                    contexts = self.driver.contexts
                    self.switch_h5(contexts[0])
                    time.sleep(7)
                    self.click_element(tranLocation.search_product)
                    for num in code:
                        self.driver.press_keycode(basePage.keycode[num])
                    self.click_element(basePage.keypad_search_btn)
                    contexts = self.driver.contexts
                    self.switch_h5(contexts[1])
                    time.sleep(4)
                    self.click_element(tranLocation.product_colors)
                    self.click_element(tranLocation.product_size)
                    self.click_element(tranLocation.add)
                self.click_element(tranLocation.back_btn)
                self.click_element(tranLocation.confirm)
                self.click_element(tranLocation.back_btn)
                time.sleep(1)
                contexts = self.driver.contexts
                self.switch_h5(contexts[0])
                time.sleep(6)
                self.click_element(tranLocation.confirm_allocate_txt)
                self.click_element(tranLocation.allocate_next)
                time.sleep(1)
                self.click_element(tranLocation.allocate_next)
                time.sleep(2)
                self.click_element(basePage.menu_btn_layout)
                page_size = basePage.GetPageSize(self)
                basePage.swipe_up(self, page_size, 0.1, 0.80, 0.1, 0.10)
                self.click_element(basePage.logout)
                self.click_element(basePage.text_confirm)

            else:
                self.click_element(tranLocation.text_confirm)
                self.click_element(tranLocation.allocate_next)
                time.sleep(1)
                self.click_element(tranLocation.allocate_next)
                time.sleep(2)
                self.click_element(basePage.menu_btn_layout)
                page_size = basePage.GetPageSize(self)
                basePage.swipe_up(self, page_size, 0.1, 0.80, 0.1, 0.10)
                self.click_element(basePage.logout)
                self.click_element(basePage.text_confirm)
        except Exception as e:
            raise Exception('提交调拨出库出现异常%s' % e)