コード例 #1
0
ファイル: bzqyj.py プロジェクト: guanzi88/GYL_SJD
 def bzqyj(self):
     logging.info('进入保质期浴巾')
     self.driver.find_elements(*self.kca)[8].click()
     time.sleep(1)
     c = Common(self.driver)
     c.getScreenShot("17保质期预警列表")
     self.driver.find_element(*self.kcc).click()
コード例 #2
0
ファイル: test_aplication_nj.py プロジェクト: grx200/shhfw
    def test_add_application(self, data):
        try:
            l = LoginView(self.driver)
            l.login_action('ht_01', 'qq2883595')
            time.sleep(3)
            logging.info('======test_add_application======')
            a = ApplicationView(self.driver)
            a.add_application_action_nj(data['编号'], data['服务名称'], data['服务类型'],
                                        data['服务单价'], data['服务单位'],
                                        data['服务图片'], data['服务区域'])
            self.assertTrue(a.check_application_action_nj())
        except NoSuchElementException:

            file_name = "no_such_element"
            b = Common(self.driver)
            b.getScreenShot(file_name)
            self.assertTrue(False)
            raise

        except ElementNotVisibleException:

            file_name = "element_not_visible"
            b = Common(self.driver)
            b.getScreenShot(file_name)
            self.assertTrue(False)
            raise
コード例 #3
0
    def testLogin(self, data):
        try:
            logging.info('======test_register=====')
            l = RegisterView(self.driver)
            # data = l.get_csv_data(self.csv_file, 1)
            # print(data['account'],data['password'])
            l.register_action(data['手机号'], data['密码'], data['确认密码'],
                              data['姓名'], data['证件类型'], data['证件号码'],
                              data['所在区域'], data['常用服务地址'])
            self.assertTrue(l.check_registerStatus())
        except NoSuchElementException:

            file_name = "no_such_element"
            b = Common(self.driver)
            b.getScreenShot(file_name)
            self.assertTrue(False)
            raise

        except ElementNotVisibleException:

            file_name = "element_not_visible"
            b = Common(self.driver)
            b.getScreenShot(file_name)
            self.assertTrue(False)
            raise
コード例 #4
0
    def testAddOrder(self,data):
        try:
            logging.info('======test_add_order=====')

            l=LoginView_jg(self.driver)
            # data = l.get_csv_data(self.csv_file, 1)
            l.login_action('admin','123456')
            l.check_loginStatus()
            time.sleep(3)
            b = addOder(self.driver)
            b.addOder(data['订单类型'],data['服务类型'],data['订购人姓名'],data['订购人账号'])
            self.assertTrue(b.check_add_order_action())
            b.get_order_number(data['订单类型'])
            self.driver.quit()
        except NoSuchElementException:

            file_name = "no_such_element"
            b = Common(self.driver)
            b.getScreenShot(file_name)
            self.assertTrue(False)
            raise

        except ElementNotVisibleException:

            file_name = "element_not_visible"
            b = Common(self.driver)
            b.getScreenShot(file_name)
            self.assertTrue(False)
            raise
コード例 #5
0
    def testProcessingDemand(self, data):
        try:
            self.driver.implicitly_wait(20)
            l = LoginView(self.driver)
            l.login_action('17708179512', 'qq2883595')
            time.sleep(3)
            a = demand(self.driver)
            a.xuqiu(data["需求类型"], data['需求标题'], data['编号'])
            self.assertTrue(a.check_xuqiu_action())
            a.get_order_number(data["需求类型"], data['编号'])
            self.driver.quit()
        except NoSuchElementException:

            file_name = "no_such_element"
            b = Common(self.driver)
            b.getScreenShot(file_name)
            self.assertTrue(False)
            raise

        except ElementNotVisibleException:

            file_name = "element_not_visible"
            b = Common(self.driver)
            b.getScreenShot(file_name)
            self.assertTrue(False)
            raise
コード例 #6
0
ファイル: kcyj.py プロジェクト: guanzi88/GYL_SJD
 def kcyj(self):
     logging.info('进入库存预警')
     self.driver.find_elements(*self.kca)[9].click()
     time.sleep(1)
     c = Common(self.driver)
     c.getScreenShot("18库存预警列表")
     self.driver.find_element(*self.kcc).click()
コード例 #7
0
ファイル: test_check.py プロジェクト: grx200/shhfw
    def testCheck(self, data):
        try:
            logging.info('======test_check=====')
            l = LoginView(self.driver)
            # data = l.get_csv_data(self.csv_file, 1)

            l.login_action('17708179510', '123456')
            time.sleep(2)
            a = CheckOrder(self.driver)
            a.checkorder(data['需求类型'])
            self.assertTrue(a.check_check_order_Status())
            self.driver.quit()
        except NoSuchElementException:

            file_name = "no_such_element"
            b = Common(self.driver)
            b.getScreenShot(file_name)
            self.assertTrue(False)
            raise

        except ElementNotVisibleException:

            file_name = "element_not_visible"
            b = Common(self.driver)
            b.getScreenShot(file_name)
            self.assertTrue(False)
            raise
コード例 #8
0
    def testProcessingOder(self,data):
        try:
            data1 = []
            for line in open("../data/cs.txt","r+"):
                data1.append(line)

            l=LoginView(self.driver)
            l.login_action('17708179512','qq2883595')
            time.sleep(3)
            a = processingOder(self.driver)

            a.processing_order(data['订单类型'],data1[int(data['编号'])])
            # a.processing_order(data['订单类型'],data1)
            a.processing_servering_order(data["订单类型"],data['订单编号'])
            self.assertTrue(a.check_processing_servering_order_status())
            self.driver.quit()
        except NoSuchElementException:

            file_name = "no_such_element"
            b = Common(self.driver)
            b.getScreenShot(file_name)
            self.assertTrue(False)
            raise

        except ElementNotVisibleException:

            file_name = "element_not_visible"
            b = Common(self.driver)
            b.getScreenShot(file_name)
            self.assertTrue(False)
            raise
コード例 #9
0
    def test_Xuqiu(self, data):
        try:
            logging.info('======test_submit_demand=====')
            l = LoginView(self.driver)
            # data = l.get_csv_data(self.csv_file, 1)
            l.login_action("17708179510", "123456")
            # self.assertTrue(l.check_loginStatus())
            a = xuqiu(self.driver)
            a.xuqiu(data['需求类型'], data['需求标题'])
            self.assertTrue(a.check_xuqiuStatus())
        except NoSuchElementException:

            file_name = "no_such_element"
            b = Common(self.driver)
            b.getScreenShot(file_name)
            self.assertTrue(False)
            raise

        except ElementNotVisibleException:

            file_name = "element_not_visible"
            b = Common(self.driver)
            b.getScreenShot(file_name)
            self.assertTrue(False)
            raise
コード例 #10
0
ファイル: logout.py プロジェクト: guanzi88/GYL_SJD
 def logout(self):
     C = Common(self.driver)
     C.swipeRight()
     time.sleep(0.5)
     C = Common(self.driver)
     C.getScreenShot("9个人中心")
     logging.info('退出商家端')
     self.driver.find_element(*self.logoutBtn).click()
     self.driver.find_element(*self.qcsjh).click()
コード例 #11
0
 def pd(self):
     logging.info('进入盘点')
     self.driver.find_elements(*self.pda)[6].click()
     self.driver.find_elements(*self.pdb)[0].click()
     time.sleep(1)
     c = Common(self.driver)
     c.getScreenShot("14盘点详情")
     self.driver.find_element(*self.pdc).click()
     self.driver.find_element(*self.pdd).click()
     self.driver.find_element(*self.pde).click()
     self.driver.find_element(*self.pdf).click()
コード例 #12
0
ファイル: dsh.py プロジェクト: guanzi88/GYL_SJD
 def dsh(self):
     logging.info('进入待收货')
     self.driver.find_elements(*self.dsha)[3].click()
     time.sleep(1)
     c = Common(self.driver)
     c.getScreenShot("12待收货按部门详情")
     self.driver.find_element(*self.dshb).click()
     c.getScreenShot("13确认收货弹窗")
     self.driver.find_element(*self.dshc).click()
     self.driver.find_element(*self.dshd).click()
     time.sleep(2)
コード例 #13
0
ファイル: kc.py プロジェクト: guanzi88/GYL_SJD
 def kc(self):
     logging.info('进入库存查询')
     self.driver.find_elements(*self.kca)[7].click()
     time.sleep(1)
     c = Common(self.driver)
     c.getScreenShot("15物品库存列表")
     self.driver.find_elements(*self.kcb)[0].click()
     time.sleep(1)
     c.getScreenShot("16物品库存详情")
     self.driver.find_element(*self.kcc).click()
     self.driver.find_element(*self.kcc).click()
コード例 #14
0
ファイル: sgd.py プロジェクト: guanzi88/GYL_SJD
    def sgd(self):

        logging.info('查看申购单')
        self.driver.find_elements(*self.sga)[1].click()
        c = Common(self.driver)
        c.swipeDown()
        time.sleep(3)
        c.getScreenShot("5申购单列表")
        self.driver.find_elements(*self.sgb)[0].click()
        time.sleep(2)
        c.getScreenShot("6申购单详情")
        self.driver.find_element(*self.fh).click()
コード例 #15
0
ファイル: cgd.py プロジェクト: guanzi88/GYL_SJD
 def cgd(self):
     logging.info('查看采购单')
     self.driver.find_elements(*self.cga)[3].click()
     c = Common(self.driver)
     c.swipeDown()
     time.sleep(3)
     c.getScreenShot("7采购单列表")
     for i in range(2):
         self.driver.find_elements(*self.cgb)[i].click()
         time.sleep(0.5)
         c.getScreenShot("8采购单" + str(i))
         self.driver.find_element(*self.fh).click()
コード例 #16
0
 def shbb(self):
     logging.info('进入收货报表')
     self.driver.find_elements(*self.sha)[10].click()
     time.sleep(1)
     self.driver.find_element(*self.shc).click()
     self.driver.find_elements(*self.shd)[3].click()
     time.sleep(1)
     c = Common(self.driver)
     c.getScreenShot("19收货物品列表")
     self.driver.find_elements(*self.she)[0].click()
     time.sleep(1)
     c.getScreenShot("20物品收货详情")
     self.driver.find_element(*self.shb).click()
     self.driver.find_element(*self.shb).click()
コード例 #17
0
    def dfh(self):
        logging.info('进入待发货')
        self.driver.find_elements(*self.dfha)[2].click()
        logging.info('进入物品维度')
        self.driver.find_element(*self.dfhf).click()
        logging.info('选择明日')
        self.driver.find_element(*self.dfhg).click()
        time.sleep(1)
        self.driver.find_elements(*self.dfhh)[1].click()
        time.sleep(1)
        c = Common(self.driver)
        c.getScreenShot("10待发货物品列表")
        self.driver.find_elements(*self.dfhi)[1].click()
        time.sleep(1)
        c.getScreenShot("10待发货物品详情")
        self.driver.find_element(*self.dfhk).click()
        self.driver.find_element(*self.dfhl).click()
        self.driver.find_element(*self.dfhn).click()
        self.driver.find_element(*self.dfhd).click()

        logging.info('进入订单维度')
        self.driver.find_element(*self.dfhj).click()
        self.driver.find_element(*self.dfhm).click()
        self.driver.find_elements(*self.dfhh)[1].click()
        time.sleep(1)
        c.getScreenShot("10待发货订单列表")
        self.driver.find_elements(*self.dfhb)[0].click()
        time.sleep(1)
        c.getScreenShot("11待发货订单详情")
        self.driver.find_element(*self.dfhc).click()
        self.driver.find_element(*self.dfhd).click()
        self.driver.find_element(*self.dfhe).click()
コード例 #18
0
ファイル: sp_sgd.py プロジェクト: guanzi88/GYL_SJD
 def sp_sgd(self):
     logging.info('进入待审批')
     self.driver.find_elements(*self.dsp)[0].click()
     c = Common(self.driver)
     c.swipeDown()
     time.sleep(1)
     c.getScreenShot("3待审批申购单列表")
     self.driver.find_elements(*self.sgdxq)[0].click()
     self.driver.find_element(*self.quanxuan).click()
     self.driver.find_element(*self.sptg).click()
     self.driver.find_element(*self.qrsp).click()
     time.sleep(1)
     c.getScreenShot("4审批通过详情")
     self.driver.find_element(*self.fh1).click()
     self.driver.find_element(*self.fh2).click()
コード例 #19
0
    def loginview(self, username, password):

        self.driver.find_element(*self.username_type).send_keys(username)
        self.driver.find_element(*self.password_type).send_keys(password)
        time.sleep(0.5)
        c = Common(self.driver)
        c.getScreenShot("0登录页")
        self.driver.find_element(*self.loginBtn).click()
        logging.info('登录商家端')
        time.sleep(5)
        c.getScreenShot("1首页")
        # 检查是否更新,如检测到更新那么就取消更新
        try:
            cancelBtn = self.driver.find_element(*self.qxgx)  # 取消更新
        except NoSuchElementException:
            logging.info("未检测到更新")
        else:
            cancelBtn.click()
            logging.info("取消更新")
コード例 #20
0
    def testProcessingOder(self, data):
        try:
            self.yuqi = data['预期结果']
            da = ExcelUtil('../data/booking.xls', 'Sheet1').next()
            self.shiji = da[int(data['编号'])]['app新增订单结果']
            phone = da[int(data['编号']) - 1]['随机电话(不要填写)']
            li1 = []
            if self.yuqi == 'ok' and self.shiji == 'ok':
                l = LoginView(self.driver)
                l.login_action('17708179512', 'qq2883595')
                l.check_loginStatus()
                time.sleep(3)
                a = processingOder(self.driver)
                a.processing_order_dfw(data['服务类型'], phone)
                a.processing_order(data['服务类型'], phone)
                # a.processing_order(data['订单类型'],data1)
                a.processing_servering_order(data["服务类型"], phone)
                result = a.check_processing_servering_order_status()
                if result == 'ok':
                    result = True
                else:
                    result = False
                self.assertTrue(result)
                self.driver.quit()
            else:
                self.assertTrue('False')
                logging.error('app新增订单,用例失败')

        except NoSuchElementException:

            file_name = "no_such_element"
            b = Common(self.driver)
            b.getScreenShot(file_name)
            self.assertTrue(False)
            raise

        except ElementNotVisibleException:

            file_name = "element_not_visible"
            b = Common(self.driver)
            b.getScreenShot(file_name)
            self.assertTrue(False)
            raise
コード例 #21
0
    def testLogin(self):
        try:
            logging.info('======test_login=====')
            l=LoginView(self.driver)
            # data = l.get_csv_data(self.csv_file, 1)
            l.login_action('admin','123456')
            self.assertTrue(l.check_loginStatus())
        except NoSuchElementException:

            file_name = "no_such_element"
            b = Common(self.driver)
            b.getScreenShot(file_name)
            self.assertTrue(False)
            raise

        except ElementNotVisibleException:

            file_name = "element_not_visible"
            b = Common(self.driver)
            b.getScreenShot(file_name)
            self.assertTrue(False)
            raise
コード例 #22
0
    def testProcessingOderXq(self, data):
        try:
            data1 = xlrd.open_workbook('../data/demand.xls')
            sheet = data1.sheet_by_index(0)
            nrows = sheet.nrows
            ncols = sheet.ncols
            li1 = []
            for i in range(1, nrows):  #第0行为表头
                alldata = sheet.row_values(i)  #循环输出excel表中每一行,即所有数据
                li1.append(alldata[4])  #每次重新取数据,写在test外面会有问题
            if len(li1[int(data['编号']) - 1]) == 20:
                l = LoginView(self.driver)
                l.login_action('17708179512', 'qq2883595')
                time.sleep(3)
                a = processingOder(self.driver)
                a.processing_order_dfw(data['需求类型'], li1[int(data['编号']) - 1])
                a.processing_order(data['需求类型'], li1[int(data['编号']) - 1])
                # a.processing_order(data['订单类型'],data1)
                a.processing_servering_order(data["需求类型"],
                                             li1[int(data['编号']) - 1])
                self.assertTrue(a.check_processing_servering_order_status())
                self.driver.quit()
            else:
                self.assertTrue(False)
        except NoSuchElementException:

            file_name = "no_such_element"
            b = Common(self.driver)
            b.getScreenShot(file_name)
            self.assertTrue(False)
            raise

        except ElementNotVisibleException:

            file_name = "element_not_visible"
            b = Common(self.driver)
            b.getScreenShot(file_name)
            self.assertTrue(False)
            raise
コード例 #23
0
ファイル: test_addPeople.py プロジェクト: grx200/shhfw
    def testAddPerson(self, data):
        try:
            l = LoginView(self.driver)
            l.login_action('17708179512', 'qq2883595')
            time.sleep(3)
            a = resource_management(self.driver)
            a.addPerson()
            self.assertTrue(True)
        except NoSuchElementException:

            file_name = "no_such_element"
            b = Common(self.driver)
            b.getScreenShot(file_name)
            self.assertTrue(False)
            raise

        except ElementNotVisibleException:

            file_name = "element_not_visible"
            b = Common(self.driver)
            b.getScreenShot(file_name)
            self.assertTrue(False)
            raise
コード例 #24
0
    def test_login_001(self):
        logging.info('======test_login_001=====')
        try:
            l = LoginView(self.driver)
            data = l.get_csv_data(self.csv_file, 1)
            # l.login_action(data[0],data[1])

            l.login_action(18888888888, "qq123456")
            self.assertTrue(l.check_loginStatus())
        except NoSuchElementException:

            file_name = "no_such_element"
            b = Common(self.driver)
            b.getScreenShot(file_name)
            self.assertTrue(False)
            raise

        except ElementNotVisibleException:

            file_name = "element_not_visible"
            b = Common(self.driver)
            b.getScreenShot(file_name)
            self.assertTrue(False)
            raise
コード例 #25
0
ファイル: test_oder.py プロジェクト: grx200/shhfw
    def testAddOrder(self, data):
        try:
            logging.info('======test_add_order=====')
            l = LoginView_zf(self.driver)
            # data = l.get_csv_data(self.csv_file, 1)
            l.login_action('admin', '123456')
            l.check_loginStatus()
            time.sleep(3)
            b = addOder(self.driver)
            b.addOder(data['订单类型'], data['服务类型'], data['订购人姓名'], number)
            self.assertTrue(b.check_add_order_action())
            self.driver.quit()
            c = LoginView_fw(self.driver)
            c.login_action('17708179512', 'qq2883595')
            c.check_loginStatus()
            time.sleep(3)
            d = processingOder(self.driver)
            d.processing_order(data['订单类型'], data['订单编号'])
            d.processing_servering_order(data['订单编号'])
            self.assertTrue(d.check_processing_servering_order_status())
            self.driver.quit()
        except NoSuchElementException:

            file_name = "no_such_element"
            b = Common(self.driver)
            b.getScreenShot(file_name)
            self.assertTrue(False)
            raise

        except ElementNotVisibleException:

            file_name = "element_not_visible"
            b = Common(self.driver)
            b.getScreenShot(file_name)
            self.assertTrue(False)
            raise
コード例 #26
0
 def dzhz(self):
     logging.info('进入对账汇总')
     self.driver.find_elements(*self.dzhza)[12].click()
     time.sleep(1)
     c = Common(self.driver)
     c.getScreenShot("21对账汇总列表")
     self.driver.find_element(*self.dzhzb).click()
     time.sleep(1)
     c.getScreenShot("22对账汇总明细")
     self.driver.find_element(*self.dzhzc).click()
     time.sleep(1)
     c.getScreenShot("23对账汇总明细的明细")
     self.driver.find_element(*self.dzhzd).click()
     self.driver.find_element(*self.dzhzd).click()
     self.driver.find_element(*self.dzhzd).click()
コード例 #27
0
ファイル: test_booking.py プロジェクト: grx200/shhfw
    def testBooking(self,data):
        try:
            #每次用例执行前重启APP(APP不能像web端一样,用例执行前通过地址栏跳转至固定页面,只能通过重启的方式来实现固定流程)
            self.driver.launch_app()
            #登录

            l=LoginView(self.driver)
            l.login_action('17708179510',123456)
            logger.info('======test_booking=====')
            time.sleep(2)
            #订单业务
            a = BookingView(self.driver)
            self.bh = data['编号']
            # 最后一个参数电话号码,是用来找到这个输入域的,因为元素定位不到,且输入域中有默认值,所有根据默认值来定位电话号码输入域,然后再把他清除掉,传入生成的随机电话
            # 里面的服务名称都是乱编的,二天跑的时候,需要按照具体情况去修改新增订单选择的农机或农资的名称
            #123是电话号码输入域的默认值
            a.booking_action(data['编号'],data['服务类型'],data["服务名称"],data["服务数量"],'123')
            # 看看新增订单的实际情况,如果新增成功,就在excel中记录"T",失败的话记录“F”
            self.re = a.check_bookingStatus()
            if self.re == True:
                workbook = xlrd.open_workbook('../data/booking.xls')
                excel =copy(workbook)
                # excel.get_sheet()中的参数0表示第一个sheet表,改为参数1的话就表示在第二个sheet表中添加数据
                table = excel.get_sheet(0)
                table.write(int(self.bh),5,'ok')
                excel.save('../data/booking.xls')
            else:
                workbook = xlrd.open_workbook('../data/booking.xls')
                excel =copy(workbook)
                table = excel.get_sheet(0)
                table.write(int(self.bh),5,'ko')
                excel.save('../data/booking.xls')

            # 再从excel中读取实际结果和预期结果,判断是否一致
            self.yuqi = data['预期结果']
            self.assertEqual(self.yuqi,self.re)
            #每次用例结束后,关闭APP
            self.driver.close_app()


        except NoSuchElementException:
            file_name = "no_such_element"
            b = Common(self.driver)
            b.getScreenShot(file_name)
            workbook = xlrd.open_workbook('../data/booking.xls')
            excel =copy(workbook)
            table = excel.get_sheet(0)
            table.write(int(self.bh),5,'ko')
            excel.save('../data/booking.xls')

            self.assertEqual(self.yuqi,False)
            self.driver.close_app()
            raise

        except ElementNotVisibleException:
            file_name = "element_not_visible"
            b = Common(self.driver)
            b.getScreenShot(file_name)
            workbook = xlrd.open_workbook('../data/booking.xls')
            excel =copy(workbook)
            table = excel.get_sheet(0)
            table.write(int(self.bh),5,'ko')
            excel.save('../data/booking.xls')

            self.assertEqual(self.yuqi,False)
            self.driver.close_app()
            raise
コード例 #28
0
    def login_action(self, username):
        time.sleep(10)
        logging.info('=======login action====')
        time.sleep(1)


        # 点击登录按钮
        self.driver.find_element(*self.btn_login_phone).click()
        self.driver.implicitly_wait(2)

        logging.info('=======login finshed====')

        try:
            element = self.driver.find_element(*self.home_btn)
        except NoSuchElementException:
            logging.info("fail")
        else:
            element.click()
            logging.info("sucess")


if __name__ == '__main__':

    driver = appium_desird()
    l = LoginView(driver)
    l.login_action('17600629988')
    time.sleep(5)
    # module = 'phone_login'
    common = Common(driver)
    common.getScreenShot('login')
コード例 #29
0
        self.code = self.ret['content']['code']
        print(self.code)
        # 填写验证码
        self.driver.find_element(*self.phonevery).click()
        self.driver.find_element(*self.phonevery).send_keys(self.code)

        # 点击登录按钮
        self.driver.find_element(*self.btn_login_phone).click()
        self.driver.implicitly_wait(2)

        logging.info('=======login finshed====')

        try:
            element = self.driver.find_element(*self.home_btn)
        except NoSuchElementException:
            logging.info("fail")
        else:
            element.click()
            logging.info("sucess")


if __name__ == '__main__':

    driver = appium_desird()
    l = LoginView(driver)
    l.login_action('17600629988')
    time.sleep(5)
    # module = 'phone_login'
    common = Common(driver)
    common.getScreenShot('phone_login')