コード例 #1
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
コード例 #2
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
コード例 #3
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
コード例 #4
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
コード例 #5
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
コード例 #6
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
コード例 #7
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
コード例 #8
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
コード例 #9
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
コード例 #10
0
ファイル: resourceManagement.py プロジェクト: grx200/shhfw
        self.driver.find_element(*self.njglBtn).click()
        time.sleep(0.8)
        self.driver.find_element(*self.xznjBtn).click()
        time.sleep(0.8)
        self.driver.find_element(*self.njmc).send_keys("测试农机设备")
        self.driver.find_element(*self.xhgg).send_keys("asasasa")

        self.driver.find_element(*self.zylx1).click()
        time.sleep(0.5)
        self.driver.find_element(*self.zylx2).click()
        self.driver.find_element(*self.zylx2).click()
        time.sleep(0.3)
        file = os.path.abspath(os.path.join(os.getcwd(), "../.."))
        picture_file = file + "\shhfw\data\%s" % "update_test.png"
        self.driver.find_element(*self.njzp).send_keys(picture_file)

        self.driver.find_element(*self.xzsbBtn).click()
        self.driver.find_element(*self.sbbh).send_keys(
            random.randint(100, 99999))
        self.driver.find_element(*self.addBtn).click()
        time.sleep(2)
        self.driver.find_element(*self.qrBtn).click()


if __name__ == "__main__":
    driver = open_browser()
    b = LoginView(driver)
    b.login_action("17708179512", "qq2883595")
    c = resource_management(driver)
    # c.addPerson()
    c.addEquipment()
コード例 #11
0
ファイル: myunit_business.py プロジェクト: grx200/shhfw
 def setUpClass(cls):
     cls.driver = open_browser()
     l = LoginView(cls.driver)
     l.login_action("18888888888", 'qq123456')
コード例 #12
0
ファイル: applicationView.py プロジェクト: grx200/shhfw
        else:
            logging.info('add application success!')
            return True

    def check_application_action_nz(self):
        logging.info('====check_add_application_action======')
        try:
            time.sleep(3)
            element = self.driver.find_element(*self.yz)
        except NoSuchElementException:
            logging.error('add application Fail!')
            self.getScreenShot('add application fail')
            return False

        else:
            logging.info('add application success!')
            return True


if __name__ == '__main__':
    driver = open_browser()
    l = LoginView(driver)
    l.login_action('ht_01', 'qq2883595')
    l.check_loginStatus()
    time.sleep(4)
    a = ApplicationView(driver)
    a.add_application_action_nz("肥料", "肥料", 999, "个", "update_test.png", '',
                                '', '', '', '', '')
    a.check_application_action_nz()
    driver.close()
コード例 #13
0
ファイル: demand.py プロジェクト: grx200/shhfw
            logging.info('-----write excel finished------')
        logging.info('-----order phone number is %s------' % str(OrderNumber))

    def check_xuqiu_action(self):
        logging.info('====check_demand_action======')
        try:
            time.sleep(4.5)
            element = self.driver.find_element(*self.nav)
        except NoSuchElementException:
            logging.info('processing demand success!')
            return True
        else:
            logging.error('processing demand Fail!')
            self.getScreenShot('processing demand fail')
            return False


if __name__ == '__main__':
    driver = open_browser()
    l = LoginView(driver)
    l.login_action('17708179512', 'qq2883595')
    l.check_loginStatus()
    time.sleep(4)
    a = demand(driver)
    # a.signing(111,513701199510265833,'2019-05-11',"update_test.png")
    # a.xuqiu("找农资","来个化肥")
    # a.check_application_action()
    # a.check_xuqiu_action()
    a.get_order_number("找农资")
    driver.close()