Exemple #1
0
class TestBuildManage(unittest.TestCase):
    ZHSQ_URL = Config().get('ZHSQ_URL')
    userAcct = Config().get('userAcct')
    userPwd = Config().get('userPwd')
    smsCode = Config().get('smsCode')
    """
    @前置处理器
    description:登陆
    """
    def setUp(self):
        logger.info("----start---")
        self.login_page = LoginPage(browser_type='chrome').get(
            self.ZHSQ_URL, maximize_window=True)
        self.build_add_page = BuildAddPage(self.login_page)
        self.build_find_page = BuildFindPage(self.login_page)
        self.build_edit_page = BuildEditPage(self.login_page)
        self.build_del_page = BuildDelPage(self.login_page)
        try:
            #遗留问题,先录入账号再勾选协议找不到元素
            #原因可能是因为倒计时,导致页面有动态元素
            self.login_page.click_checkbox()
            self.login_page.click_closeAlert()
            self.login_page.input_userAcct(self.userAcct)
            self.login_page.input_userPwd(self.userPwd)
            self.login_page.click_smsCodeButton()
            self.login_page.input_smsCode(self.smsCode)
            self.login_page.click_loginButton()
            self.login_page.wait(3)
            self.build_add_page.click_chooseModTree()
            self.build_add_page.click_chooseBuildManageTree()

        except Exception as msg:
            self.login_page.save_screen_shot("test_login")
            logger.info("异常信息:%s" % msg)
            raise

    def tearDown(self):
        logger.info("----END---")
        self.login_page.quit()

    """
    @添加楼栋
    description:正常添加
    """
    buildingName = "天地社区"

    @unittest.skipUnless(True, "添加楼栋")
    def test_addBuild(self):
        try:
            #1line
            self.build_add_page.click_addButton()
            self.build_add_page.wait()

            self.build_add_page.input_buildingName(self.buildingName)
            self.build_add_page.input_buildingNo(2)
            self.build_add_page.input_unitNo(1)
            self.build_add_page.input_floorCount(8)
            self.build_add_page.input_roomCount(2)
            #2line
            self.build_add_page.click_addLine()
            self.build_add_page.input_unitNo2(2)
            self.build_add_page.input_floorCount2(8)
            self.build_add_page.input_roomCount2(2)
            #操作保存
            self.build_add_page.click_saveButton()
            self.build_add_page.wait()
            #刷新
            self.build_add_page.refresh()
            self.build_add_page.wait()

            buildingNameStr = self.build_add_page.find_element(
                By.XPATH,
                "/html/body/div[1]/div[1]/div[1]/div[2]/div[2]/div/div[3]/div/div/div/div/div/div/table/tbody/tr[1]/td[3]"
            )
            if buildingNameStr is not None:
                self.assertEqual(self.buildingName,
                                 buildingNameStr.text,
                                 msg="楼栋添加失败")
            else:
                self.assertIsNotNone(buildingNameStr, msg="元素定位失败")
        except Exception as msg:
            self.admin_add_page.save_screen_shot("test_addBuild")
            logger.info("异常信息:%s" % msg)
            raise

    #编辑楼栋
    buildingNameEdit = "金城社区"
    floorCountEdit = 10

    def test_editBuild(self):
        TestBuildManage.test_findBuild(self)
        try:
            buildingNameStr = self.build_edit_page.find_element(
                By.XPATH,
                "/html/body/div[1]/div[1]/div[1]/div[2]/div[2]/div/div[3]/div/div/div/div/div/div/table/tbody/tr/td[3]"
            )
            if buildingNameStr is not None:
                self.assertEqual(self.buildingName,
                                 buildingNameStr.text,
                                 msg="查询成功")
                self.build_edit_page.click_editButton()
                self.build_edit_page.input_buildingName(self.buildingNameEdit)
                self.build_edit_page.input_floorCount(self.floorCountEdit)
                self.build_edit_page.click_saveButton()
                self.build_edit_page.wait()
                #get value be used for assert
                self.build_find_page.input_buildingName(self.buildingNameEdit)
                self.build_find_page.click_submitButton()
                buildingNameStr = self.build_edit_page.find_element(
                    By.XPATH,
                    "/html/body/div[1]/div[1]/div[1]/div[2]/div[2]/div/div[3]/div/div/div/div/div/div/table/tbody/tr/td[3]"
                )

                self.build_edit_page.find_element(
                    By.XPATH,
                    "/html/body/div[1]/div[1]/div[1]/div[2]/div[2]/div/div[3]/div/div/div/div/div/div/table/tbody/tr[1]/td[1]/span"
                ).click()
                floorCountStr = self.build_edit_page.find_element(
                    By.XPATH,
                    "/html/body/div[1]/div[1]/div[1]/div[2]/div[2]/div/div[3]/div/div/div/div/div/div/table/tbody/tr[2]/td[2]/div/div/div/div/div/div/table/tbody/tr[1]/td[2]"
                )

                if buildingNameStr is not None:
                    self.assertEqual(str(self.buildingNameEdit),
                                     buildingNameStr.text,
                                     msg="断言失败")
                else:
                    self.assertIsNotNone(buildingNameStr, msg="元素定位失败")
                if floorCountStr is not None:
                    self.assertEqual(str(self.floorCountEdit),
                                     floorCountStr.text,
                                     msg="断言失败")
                else:
                    self.assertIsNotNone(floorCountStr, msg="元素定位失败")
            else:
                self.assertIsNotNone(buildingNameStr, msg="元素定位失败")
        except Exception as msg:
            self.build_edit_page.save_screen_shot("test_findBuild")
            logger.info("异常信息:%s" % msg)
            raise

    #删除楼栋
    def test_delBuild(self):
        try:
            self.build_del_page.click_delButton()
            self.build_del_page.click_isYesButton()
            buildingNameStr = self.build_del_page.find_element(
                By.XPATH,
                "/html/body/div[1]/div[1]/div[1]/div[2]/div[2]/div/div[3]/div/div/div/div/div/div/table/tbody/tr/td[3]"
            )
            if buildingNameStr is not None:
                self.assertNotEqual(self.floorCountEdit,
                                    buildingNameStr.text,
                                    msg="断言失败,删除失败")
            else:
                self.assertIsNotNone(buildingNameStr, msg="元素定位失败,已删除")
        except Exception as msg:
            self.build_edit_page.save_screen_shot("test_findBuild")
            logger.info("异常信息:%s" % msg)
            raise

    #查询
    def test_findBuild(self):
        try:
            self.build_find_page.click_findButton()
            self.build_find_page.input_buildingName(self.buildingName)
            self.build_find_page.click_submitButton()
            self.build_find_page.wait()
        except Exception as msg:
            self.build_edit_page.save_screen_shot("test_findBuild")
            logger.info("异常信息:%s" % msg)
            raise
Exemple #2
0
class TestGuardManage(unittest.TestCase):
    ZHSQ_URL = Config().get('ZHSQ_URL')
    userAcct = Config().get('userAcct')
    userPwd = Config().get('userPwd')
    smsCode = Config().get('smsCode')
    """
    @前置处理器
    description:登陆
    """
    def setUp(self):
        logger.info("----start---")
        self.login_page = LoginPage(browser_type='chrome').get(
            self.ZHSQ_URL, maximize_window=True)
        self.menu_page = MenuPage(self.login_page)
        self.guard_add_page = GuardAddPage(self.login_page)
        self.guard_find_page = GuardFindPage(self.login_page)
        self.guard_edit_page = GuardEditPage(self.login_page)
        self.guard_del_page = GuardDelPage(self.login_page)
        self.guard_restart_page = GuardRestartPage(self.login_page)
        try:
            #遗留问题,先录入账号再勾选协议找不到元素
            #原因可能是因为倒计时,导致页面有动态元素
            self.login_page.click_checkbox()
            self.login_page.click_closeAlert()
            self.login_page.input_userAcct(self.userAcct)
            self.login_page.input_userPwd(self.userPwd)
            self.login_page.click_smsCodeButton()
            self.login_page.input_smsCode(self.smsCode)
            self.login_page.click_loginButton()
            self.login_page.wait(3)
            self.menu_page.click_deviceManage()
            self.menu_page.click_accessContro()
            self.menu_page.wait()

        except Exception as msg:
            self.login_page.save_screen_shot("test_login")
            logger.info("异常信息:%s" % msg)
            raise

    def tearDown(self):
        logger.info("----END---")
        self.login_page.quit()

    #新增门禁
    deviceName = time.strftime("%Y%m%d") + "测试门禁"
    sn = RandomString.gen_random_string(8)

    def test_addGuard(self):
        try:
            self.guard_add_page.click_addButton()
            self.guard_add_page.click_buildList()
            self.guard_add_page.click_chooseBuild()
            self.guard_add_page.click_unitList()
            self.guard_add_page.click_chooseUnit()
            self.guard_add_page.click_landMark()
            self.guard_add_page.click_submitLand()
            self.guard_add_page.input_deviceNames(self.deviceName)
            self.guard_add_page.input_sn(self.sn)
            self.guard_add_page.click_saveButton()
            msgStr = self.guard_add_page.find_element(
                By.XPATH, "/html/body/div[2]/span/div/div/div/span")
            if msgStr is not None:
                self.assertEqual(msgStr.text, "添加成功", msg="添加设备失败")
            else:
                self.assertIsNotNone(msgStr, msg="设备添加元素定位失败")
        except Exception as msg:
            self.login_page.save_screen_shot("test_addGuard")
            logger.info("异常信息:%s" % msg)
            raise

    ## 查询租户byname
    def test_findGuard(self, guardName):
        try:
            self.guard_find_page.click_findButton()
            self.guard_find_page.input_guardName(guardName)
            self.guard_find_page.click_submitButton()
        except Exception as msg:
            self.login_page.save_screen_shot("test_findGuard")
            logger.info("异常信息:%s" % msg)
            raise

    ##编辑门禁
    editDeviceName = time.strftime("%Y%m%d") + "测试门禁编辑"

    def test_editGuard(self):
        TestGuardManage.test_findGuard(self, self.deviceName)
        try:
            self.guard_edit_page.click_editButton()
            self.guard_edit_page.input_deviceName(self.editDeviceName)
            self.guard_edit_page.click_saveButton()
            nameStr = self.guard_edit_page.find_element(
                By.XPATH,
                "/html/body/div[1]/div[1]/div[1]/div[2]/div[2]/div/div[3]/div[1]/div/div/div/div/div[1]/div/table/tbody/tr/td[2]"
            )
            if nameStr is not None:
                self.assertEqual(nameStr.text,
                                 self.editDeviceName,
                                 msg="编辑失败!")
            else:
                self.assertIsNotNone(nameStr, msg="元素获取失败,编辑error!")
        except Exception as msg:
            self.login_page.save_screen_shot("test_findGuard")
            logger.info("异常信息:%s" % msg)
            raise

    ## 删除门禁
    def test_delGuard(self):
        TestGuardManage.test_findGuard(self, self.editDeviceName)
        try:
            self.guard_del_page.click_delButton()
            self.guard_del_page.click_isYesButton()
            msgStr = self.guard_del_page.find_element(
                By.XPATH, "/html/body/div[2]/span/div/div/div/span")
            if msgStr is not None:
                self.assertEqual(msgStr.text, "删除设备成功", msg="删除失败")
            else:
                self.assertIsNotNone(msgStr.text, msg="元素获取失败,删除失败了吧")
        except Exception as msg:
            self.login_page.save_screen_shot("test_delGuard")
            logger.info("异常信息:%s" % msg)
            raise

    ## 重启app
    def test_restartApp(self):
        TestGuardManage.test_findGuard(self, self.editDeviceName)
        try:
            self.guard_restart_page.click_appRestart()
            self.guard_restart_page.click_isYesButton()
            msgStr = self.guard_restart_page.find_element(
                By.XPATH, "/html/body/div[2]/span/div/div/div/span")
            logger.info(msgStr.text)
            if msgStr is not None:
                self.assertEqual(msgStr.text, "操作成功", msg="app重启失败")
            else:
                self.assertIsNotNone(msgStr.text, msg="元素获取失败,app重启失败")
        except Exception as msg:
            self.login_page.save_screen_shot("test_restartApp")
            logger.info("异常信息:%s" % msg)
            raise

    ## 重启guard
    def test_restartGuard(self):
        TestGuardManage.test_findGuard(self, self.editDeviceName)
        try:
            self.guard_restart_page.click_guardRestart()
            self.guard_restart_page.click_isYesButton()
            msgStr = self.guard_restart_page.find_element(
                By.XPATH, "/html/body/div[2]/span/div/div/div/span")
            if msgStr is not None:
                self.assertEqual(msgStr.text, "操作成功", msg="门禁重启失败")
            else:
                self.assertIsNotNone(msgStr.text, msg="元素获取失败,门禁重启失败")
        except Exception as msg:
            self.login_page.save_screen_shot("test_restartGuard")
            logger.info("异常信息:%s" % msg)
            raise
class TestNoticeManage(unittest.TestCase):
    ZHSQ_URL = Config().get('ZHSQ_URL')
    userAcct = Config().get('userAcct')
    userPwd = Config().get('userPwd')
    smsCode = Config().get('smsCode')
    """
    @前置处理器
    description:登陆
    """
    def setUp(self):
        logger.info("----start---")
        self.login_page = LoginPage(browser_type='chrome').get(
            self.ZHSQ_URL, maximize_window=True)
        self.menu_page = MenuPage(self.login_page)
        self.notice_add_page = NoticeAddPage(self.login_page)
        self.notice_find_page = NoticeFindPage(self.login_page)
        self.notice_del_page = NoticeDelPage(self.login_page)
        self.notice_edit_page = NoticeEditPage(self.login_page)
        try:
            #遗留问题,先录入账号再勾选协议找不到元素
            #原因可能是因为倒计时,导致页面有动态元素
            self.login_page.click_checkbox()
            self.login_page.click_closeAlert()
            self.login_page.input_userAcct(self.userAcct)
            self.login_page.input_userPwd(self.userPwd)
            self.login_page.click_smsCodeButton()
            self.login_page.input_smsCode(self.smsCode)
            self.login_page.click_loginButton()
            self.login_page.wait(3)
            self.menu_page.click_estateManage()
            self.menu_page.click_noticeManage()
            self.menu_page.wait()

        except Exception as msg:
            self.login_page.save_screen_shot("test_login")
            logger.info("异常信息:%s" % msg)
            raise

    def tearDown(self):
        logger.info("----END---")
        self.login_page.quit()

    #新增门禁公告
    title = "测试门禁公告"
    apptitle = "测试手机公告"
    content = "南园春半踏青时,风和闻马嘶。青梅如豆柳如眉,日长蝴蝶飞"
    editTitle = "编辑门禁公告"
    appeditTitle = "编辑手机公告"
    editContent = "花露重,草烟低,人家帘幕垂。秋千慵困解罗衣,画堂双燕归"
    dateTime = "2021-08-08 09:20:30"

    def test_addGuardNotice(self):
        try:
            self.notice_add_page.click_addGuardNoticeButton()
            self.notice_add_page.click_guardList()
            self.notice_add_page.click_chooseGuard()
            self.notice_add_page.input_title(self.title)
            self.notice_add_page.input_content(self.content)
            self.notice_add_page.click_expiring_date()
            self.notice_add_page.input_date_time(self.dateTime)
            self.notice_add_page.click_saveButton()
            msgStr = self.notice_add_page.find_element(
                By.XPATH, "/html/body/div[2]/span/div/div/div/span")
            if msgStr is not None:
                self.assertEqual(msgStr.text, "操作成功,新增门禁公告成功", msg="新增门禁公告失败")
            else:
                self.assertIsNotNone(msgStr, msg="新增门禁公告元素定位失败")
        except Exception as msg:
            self.login_page.save_screen_shot("test_addGuardNotice")
            logger.info("异常信息:%s" % msg)
            raise

    ##新增app公告
    def test_addAppNotice(self):
        try:
            self.notice_add_page.click_addAppNoticeButton()
            self.notice_add_page.input_title(self.apptitle)
            self.notice_add_page.input_content(self.content)
            self.notice_add_page.click_saveButton()
            msgStr = self.notice_add_page.find_element(
                By.XPATH, "/html/body/div[2]/span/div/div/div/span")
            if msgStr is not None:
                self.assertEqual(msgStr.text, "操作成功,新增手机公告成功", msg="新增手机公告失败")
            else:
                self.assertIsNotNone(msgStr, msg="新增手机公告元素定位失败")
        except Exception as msg:
            self.login_page.save_screen_shot("test_addAppNotice")
            logger.info("异常信息:%s" % msg)
            raise

    ##根据标题查询公告
    def test_findNotice(self, title):
        try:
            self.notice_find_page.click_findButton()
            self.notice_find_page.input_title(title)
            self.notice_find_page.click_submitButton()
        except Exception as msg:
            self.login_page.save_screen_shot("test_findNotice")
            logger.info("异常信息:%s" % msg)
            raise

    ##门禁公告失效并删除
    def test_delNotice(self):
        TestNoticeManage.test_findNotice(self, self.title)
        try:
            self.notice_del_page.click_delButton()
            self.notice_del_page.click_isYesButton()
            msgStr = self.notice_del_page.find_element(
                By.XPATH, "/html/body/div[2]/span/div/div/div/span")
            if msgStr is not None:
                self.assertEqual(msgStr.text, "操作成功,当前公告已失效", msg="门禁公告失效操作失败")
                state = self.notice_del_page.find_element(
                    By.XPATH,
                    "/html/body/div[1]/div[1]/div[1]/div[2]/div[2]/div/div[3]/div/div/div/div/div/div/table/tbody/tr/td[5]/span/span"
                )
                if state.text == "失效":
                    self.notice_del_page.click_delButton()
                    self.notice_del_page.click_isYesButton()
                    msgStr = self.notice_del_page.find_element(
                        By.XPATH, "/html/body/div[2]/span/div/div/div/span")
                    if msgStr is not None:
                        self.assertEqual(msgStr.text,
                                         "操作成功,当前公告已删除",
                                         msg="删除门禁公告失败")
                    else:
                        self.assertIsNotNone(msgStr, msg="删除门禁公告元素定位失败")
                else:
                    return
            else:
                self.assertIsNotNone(msgStr, msg="门禁公告失效操作元素定位失败")
        except Exception as msg:
            self.login_page.save_screen_shot("test_delNotice")
            logger.info("异常信息:%s" % msg)
            raise

    ##app公告删除
    def test_delAppNotice(self):
        TestNoticeManage.test_findNotice(self, self.apptitle)
        try:
            self.notice_del_page.click_delButton()
            self.notice_del_page.click_isYesButton()
            msgStr = self.notice_del_page.find_element(
                By.XPATH, "/html/body/div[2]/span/div/div/div/span")
            if msgStr is not None:
                self.assertEqual(msgStr.text, "操作成功,当前公告已删除", msg="删除手机公告失败")
            else:
                self.assertIsNotNone(msgStr, msg="删除手机公告操作元素定位失败")
        except Exception as msg:
            self.login_page.save_screen_shot("test_delNotice")
            logger.info("异常信息:%s" % msg)
            raise

    ##失效后编辑门禁公告使生效
    def test_editNotice(self):
        TestNoticeManage.test_findNotice(self, self.title)
        try:
            #失效
            self.notice_del_page.click_delButton()
            self.notice_del_page.click_isYesButton()
            msgStr = self.notice_del_page.find_element(
                By.XPATH, "/html/body/div[2]/span/div/div/div/span")
            if msgStr is not None:
                self.assertEqual(msgStr.text, "操作成功,当前公告已失效", msg="门禁公告失效操作失败")
                state = self.notice_del_page.find_element(
                    By.XPATH,
                    "/html/body/div[1]/div[1]/div[1]/div[2]/div[2]/div/div[3]/div/div/div/div/div/div/table/tbody/tr/td[5]/span/span"
                )
                if state.text == "失效":
                    self.notice_edit_page.click_editButton()
                    self.notice_edit_page.input_title(self.editTitle)
                    self.notice_edit_page.input_content(self.editContent)
                    self.notice_edit_page.click_dateTimeList()
                    self.notice_edit_page.input_time(self.dateTime)
                    self.notice_edit_page.click_saveButton()
                    msgStr = self.notice_del_page.find_element(
                        By.XPATH, "/html/body/div[2]/span/div/div/div/span")
                    if msgStr is not None:
                        self.assertEqual(msgStr.text,
                                         "操作成功,操作成功",
                                         msg="编辑门禁公告失败")
                        state = self.notice_del_page.find_element(
                            By.XPATH,
                            "/html/body/div[1]/div[1]/div[1]/div[2]/div[2]/div/div[3]/div/div/div/div/div/div/table/tbody/tr/td[5]/span/span"
                        )
                        self.assertEqual(state.text, "生效", msg="编辑后未生效")
                    else:
                        self.assertIsNotNone(msgStr, msg="编辑门禁公告元素定位失败")
                else:
                    return
            else:
                self.assertIsNotNone(msgStr, msg="门禁公告失效操作元素定位失败")
        except Exception as msg:
            self.login_page.save_screen_shot("test_delNotice")
            logger.info("异常信息:%s" % msg)
            raise
Exemple #4
0
class TestDoorCardManage(unittest.TestCase):
    ZHSQ_URL = Config().get('ZHSQ_URL')
    userAcct = Config().get('userAcct')
    userPwd = Config().get('userPwd')
    smsCode = Config().get('smsCode')
    """
    @前置处理器
    description:登陆
    """
    def setUp(self):
        logger.info("----start---")
        self.login_page = LoginPage(browser_type='chrome').get(self.ZHSQ_URL, maximize_window=True)
        self.menu_page = MenuPage(self.login_page)
        self.card_add_page = CardAddPage(self.login_page)
        self.card_edit_page = CardEditPage(self.login_page)
        self.card_find_page = CardFindPage(self.login_page)
        self.card_del_page = CardDelPage(self.login_page)
        try:
            #遗留问题,先录入账号再勾选协议找不到元素
            #原因可能是因为倒计时,导致页面有动态元素
            self.login_page.click_checkbox()
            self.login_page.click_closeAlert()
            self.login_page.input_userAcct(self.userAcct)
            self.login_page.input_userPwd(self.userPwd)
            self.login_page.click_smsCodeButton()
            self.login_page.input_smsCode(self.smsCode)
            self.login_page.click_loginButton()
            self.login_page.wait(3)
            self.menu_page.click_householdManage()
            self.menu_page.click_doorcardManage()
            self.menu_page.wait()

        except Exception as msg:
            self.login_page.save_screen_shot("test_login")
            logger.info("异常信息:%s" %msg)
            raise

    def tearDown(self):
        logger.info("----END---")
        self.login_page.quit()

    #新增普通门卡
    ownerCardNo = "12345678"
    memberCardNo = "23456789"
    def test_addCard(self):
        try:
            self.card_add_page.click_addButton()
            self.card_add_page.click_buildList()
            self.card_add_page.click_chooseBuild()
            self.card_add_page.click_unitList()
            self.card_add_page.click_chooseUnit()
            self.card_add_page.click_floorList()
            self.card_add_page.click_chooseFloor()
            self.card_add_page.click_houseList()
            self.card_add_page.click_chooseHouse()
            ##业主
            self.card_add_page.input_ownerCardNo(self.ownerCardNo)
            self.card_add_page.click_ownerCardType()
            self.card_add_page.click_chooseOwnerCardType()
            ##租户
            self.card_add_page.click_chooseMember()
            self.card_add_page.input_memberCardNo(self.memberCardNo)
            self.card_add_page.click_memberCardType()
            self.card_add_page.click_chooseMemberCardType()
            ##保存
            self.card_add_page.click_saveButton()
            msgStr = self.card_add_page.find_element(By.XPATH,"/html/body/div[2]/span/div/div/div/span")
            if msgStr is not None:
                self.assertEqual(msgStr.text,"添加成功",msg="普通门卡添加失败")
            else:
                self.assertIsNotNone(msgStr,msg="普通门卡添加元素定位失败")
        except Exception as msg:
            self.login_page.save_screen_shot("test_addCard")
            logger.info("异常信息:%s" %msg)
            raise

    ##根据门卡号码查询信息
    def test_findCard(self,cardNum):
        try:
            self.card_find_page.refresh()
            self.card_find_page.click_findButton()
            self.card_find_page.input_cardNum(cardNum)
            self.card_find_page.click_submitButton()
        except Exception as msg:
            self.login_page.save_screen_shot("test_findCard")
            logger.info("异常信息:%s" %msg)
            raise

    ##门卡编辑
    def test_editCard(self):
        TestDoorCardManage.test_editOwnerCard(self)
        TestDoorCardManage.test_editMemberCard(self)

    ##编辑业主门卡
    def test_editOwnerCard(self):
        TestDoorCardManage.test_findCard(self,self.ownerCardNo)
        try:
            self.card_edit_page.click_editButton()
            self.card_edit_page.click_cardTypeList()
            self.card_edit_page.click_chooseCardType()
            self.card_edit_page.click_saveButton()
            msgStr = self.card_edit_page.find_element(By.XPATH,"/html/body/div[2]/span/div/div/div/span")
            if msgStr is not None:
                self.assertEqual(msgStr.text,"编辑完成",msg="业主编辑失败")
            else:
                self.assertIsNotNone(msgStr,msg="业主编辑元素定位失败")
        except Exception as msg:
            self.login_page.save_screen_shot("test_editOwnerCard")
            logger.info("异常信息:%s" %msg)
            raise

    ##编辑业主成员门卡
    def test_editMemberCard(self):
        TestDoorCardManage.test_findCard(self,self.memberCardNo)
        try:
            self.card_edit_page.click_editButton()
            self.card_edit_page.click_cardTypeList()
            self.card_edit_page.click_chooseCardType()
            self.card_edit_page.click_saveButton()
            msgStr = self.card_edit_page.find_element(By.XPATH,"/html/body/div[2]/span/div/div/div/span")
            if msgStr is not None:
                self.assertEqual(msgStr.text,"编辑完成",msg="业主成员编辑失败")
            else:
                self.assertIsNotNone(msgStr,msg="业主成员编辑元素定位失败")
        except Exception as msg:
            self.login_page.save_screen_shot("test_editMemberCard")
            logger.info("异常信息:%s" %msg)
            raise

    ##普通门卡删除
    def test_delCard(self):
        TestDoorCardManage.test_delOwnerCard(self)
        TestDoorCardManage.test_delMemberCard(self)


    ##删除业主
    def test_delOwnerCard(self):
        TestDoorCardManage.test_findCard(self,self.ownerCardNo)
        try:
            self.card_del_page.click_delButton()
            self.card_del_page.click_isYesButton()
            msgStr = self.card_del_page.find_element(By.XPATH,"/html/body/div[3]/span/div/div/div/span")
            if msgStr is not None:
                self.assertEqual(msgStr.text,"注销门卡成功",msg="业主普通门卡删除失败")
            else:
                self.assertIsNotNone(msgStr,msg="删除业主普通门卡元素定位失败")
        except Exception as msg:
            self.login_page.save_screen_shot("test_delOwnerCard")
            logger.info("异常信息:%s" %msg)
            raise

    ##删除业主成员
    def test_delMemberCard(self):
        TestDoorCardManage.test_findCard(self,self.memberCardNo)
        try:
            self.card_del_page.click_delButton()
            self.card_del_page.click_isYesButton()
            msgStr = self.card_del_page.find_element(By.XPATH,"/html/body/div[3]/span/div/div/div/span")
            if msgStr is not None:
                self.assertEqual(msgStr.text,"注销门卡成功",msg="业主成员普通门卡删除失败")
            else:
                self.assertIsNotNone(msgStr,msg="删除业主成员普通门卡元素定位失败")
        except Exception as msg:
            self.login_page.save_screen_shot("test_delMemberCard")
            logger.info("异常信息:%s" %msg)
            raise


    """
    管理门卡新增
    """
    manageCardNo = "34567890"
    def test_addManageCard(self):
        try:

            #####################
            self.login_page.find_element(By.XPATH,"/html/body/div[1]/div[1]/div[1]/div[2]/div[2]/div/div[1]/div[1]/div/button[2]").click()
            self.login_page.find_element(By.XPATH,"/html/body/div[3]/div/div[2]/div/div[2]/div[2]/div[2]/div/div[1]/div/div[2]/div/span/span/div/div/div").click()
            self.login_page.find_elements(By.XPATH,"/html/body/div[4]/div/div/div/ul/li")[0].click()
            self.login_page.find_element(By.ID,"cardArr.0.cardId").send_keys(self.manageCardNo)
            self.login_page.find_element(By.XPATH,"/html/body/div[3]/div/div[2]/div/div[2]/div[2]/div[2]/div/div[4]/div/div[2]/div/span/div/div/div").click()
            self.login_page.find_elements(By.XPATH,"/html/body/div[5]/div/div/div/ul/li")[0].click()
            self.login_page.find_element(By.XPATH,"/html/body/div[3]/div/div[2]/div/div[2]/div[2]/div[2]/div/div[7]/div/div[2]/div/span/span/span/span").click()
            self.login_page.find_elements(By.XPATH,"/html/body/div[6]/div/div/div/ul/li")[-1].click()
            self.login_page.find_element(By.XPATH,"/html/body/div[3]/div/div[2]/div/div[2]/div[3]/button[2]").click()
            ####################

            msgStr = self.login_page.find_element(By.XPATH,"/html/body/div[2]/span/div/div/div/span")
            if msgStr is not None:
                self.assertEqual(msgStr.text,"添加成功",msg="管理卡添加失败")
            else:
                self.assertIsNotNone(msgStr,msg="管理卡添加元素定位失败")
        except Exception as msg:
            self.login_page.save_screen_shot("test_editOwnerCard")
            logger.info("异常信息:%s" %msg)
            raise

    ###管理卡删除
    def test_delManageCard(self):
        TestDoorCardManage.test_findManageCard(self,self.manageCardNo)
        try:
            self.card_del_page.click_delButton()
            self.card_del_page.click_manageIsYesButton()
            msgStr = self.card_del_page.find_element(By.XPATH,"/html/body/div[4]/span/div/div/div/span")
            if msgStr is not None:
                self.assertEqual(msgStr.text,"注销门卡成功",msg="管理门卡删除失败")
            else:
                self.assertIsNotNone(msgStr,msg="删除管理门卡元素定位失败")
        except Exception as msg:
            self.login_page.save_screen_shot("test_delManageCard")
            logger.info("异常信息:%s" %msg)
            raise

    ###编辑管理卡
    def test_editManageCard(self):
        TestDoorCardManage.test_findManageCard(self,self.manageCardNo)
        try:

            self.card_edit_page.click_editButton()
            self.card_edit_page.find_element(By.XPATH,"/html/body/div[3]/div/div[2]/div/div[2]/div[2]/div[2]/div[2]/div[4]/div/div[2]/div/span/div/div/div").click()
            self.card_edit_page.find_element(By.XPATH,"/html/body/div[3]/div/div[2]/div/div[2]/div[3]/button[2]").click()
            msgStr = self.card_edit_page.find_element(By.XPATH,"/html/body/div[3]/span/div/div/div/span")
            if msgStr is not None:
                self.assertEqual(msgStr.text,"编辑完成",msg="管理卡编辑失败")
            else:
                self.assertIsNotNone(msgStr,msg="管理卡编辑元素定位失败")
        except Exception as msg:
            self.login_page.save_screen_shot("test_editOwnerCard")
            logger.info("异常信息:%s" %msg)
            raise

    ###管理卡查询
    def test_findManageCard(self,manageCardNo):
        try:
            self.card_find_page.refresh()
            self.card_find_page.click_findButton()
            self.card_find_page.click_cardTypeList()
            self.card_find_page.click_chooseCardType()
            self.card_find_page.input_cardNum(manageCardNo)
            self.card_find_page.click_submitButton()
        except Exception as msg:
            self.login_page.save_screen_shot("test_findCard")
            logger.info("异常信息:%s" %msg)
            raise
class TestHouseManage(unittest.TestCase):
    ZHSQ_URL = Config().get('ZHSQ_URL')
    userAcct = Config().get('userAcct')
    userPwd = Config().get('userPwd')
    smsCode = Config().get('smsCode')
    """
    @前置
    description:登陆
    """
    def setUp(self):
        logger.info("----start---")
        self.login_page = LoginPage(browser_type='chrome').get(
            self.ZHSQ_URL, maximize_window=True)
        self.house_add_page = HouseAddPage(self.login_page)
        self.house_find_page = HouseFindPage(self.login_page)
        self.house_del_page = HouseDelPage(self.login_page)
        self.house_edit_page = HouseEditPage(self.login_page)

        try:

            self.login_page.click_checkbox()
            self.login_page.click_closeAlert()
            self.login_page.input_userAcct(self.userAcct)
            self.login_page.input_userPwd(self.userPwd)
            self.login_page.click_smsCodeButton()
            self.login_page.input_smsCode(self.smsCode)
            self.login_page.click_loginButton()
            self.login_page.wait()
            self.house_add_page.click_chooseModTree()
            self.house_add_page.click_chooseHouseManageTree()
            self.house_add_page.wait()
        except Exception as msg:
            self.login_page.save_screen_shot("test_login")
            logger.info("异常信息:%s" % msg)
            raise

    roomName = "101"

    def test_addHouse(self):
        try:
            self.house_add_page.click_addButton()
            self.house_add_page.wait()
            self.house_add_page.click_belongToBuilding()
            self.house_add_page.click_buildListBox()

            self.house_add_page.click_belongTounit()
            self.house_add_page.click_unitListBox()

            self.house_add_page.click_belongToFloor()
            self.house_add_page.click_floorListBox()

            self.house_add_page.input_roomName(self.roomName)

            self.house_add_page.click_roomId()
            self.house_add_page.click_chooseRoomId()

            self.house_add_page.click_saveButton()

            tipsStr = self.house_add_page.find_element(
                By.XPATH, "/html/body/div[2]/span/div[1]/div/div/span")
            if tipsStr is not None:
                self.assertEqual("新增房屋,成功", tipsStr.text, msg="新增房屋失败")
            else:
                self.assertIsNotNone(tipsStr, msg="元素定位失败")

            roomNameStr = self.house_add_page.find_element(
                By.XPATH,
                "/html/body/div[1]/div[1]/div[1]/div[2]/div[2]/div/div[3]/div/div/div/div/div/div[1]/div/table/tbody/tr/td[5]"
            )
            if roomNameStr is not None:
                self.assertEqual(self.roomName, roomNameStr.text, msg="断言失败")
            else:
                self.assertIsNotNone(roomNameStr, msg="元素定位失败")
        except Exception as msg:
            self.login_page.save_screen_shot("test_addHouse")
            logger.info("异常信息:%s" % msg)
            raise

    def test_delHouse(self):
        self.test_serchHouse(self.editRoomName)
        try:
            buildStr = self.house_del_page.find_element(
                By.XPATH,
                "/html/body/div[1]/div[1]/div[1]/div[2]/div[2]/div/div[3]/div/div/div/div/div/div[1]/div/table/tbody/tr/td[3]"
            )
            if buildStr is not None:
                self.house_del_page.click_delButton()
                self.house_del_page.click_isYesButton()
                tipsStr = self.house_del_page.find_element(
                    By.XPATH, "/div/div/div/span")
                if tipsStr is not None:
                    self.assertEqual("删除房屋成功", tipsStr.text, msg="删除失败")
                else:
                    self.assertIsNotNone(tipsStr, msg="元素定位失败")
            else:
                self.assertIsNotNone(buildStr, msg="元素定位失败")

        except Exception as msg:
            self.login_page.save_screen_shot("test_addHouse")
            logger.info("异常信息:%s" % msg)
            raise

    editRoomName = "102"

    def test_editHouse(self):
        self.test_serchHouse(self.roomName)
        self.house_edit_page.click_editButton()
        try:
            self.house_edit_page.input_roomName(self.editRoomName)
            self.house_edit_page.click_roomId()
            self.house_edit_page.click_chooseRoomId()
            self.house_edit_page.click_saveButton()
            self.test_serchHouse(self.editRoomName)
            roomNameStr = self.house_edit_page.find_element(
                By.XPATH,
                "/html/body/div[1]/div[1]/div[1]/div[2]/div[2]/div/div[3]/div/div/div/div/div/div[1]/div/table/tbody/tr/td[5]"
            )
            if roomNameStr is not None:
                self.assertEqual(roomNameStr.text,
                                 self.editRoomName,
                                 msg="断言失败")
            else:
                self.assertIsNotNone(roomNameStr, msg="元素定位失败")
        except Exception as msg:
            self.login_page.save_screen_shot("test_editHouse")
            logger.info("异常信息:%s" % msg)
            raise

    def test_serchHouse(self, roomName):
        self.house_find_page.refresh()
        self.house_find_page.click_screenButton()
        self.house_find_page.input_roomName(roomName)
        self.house_find_page.click_findButton()

    def tearDown(self):
        logger.info("----END---")
        self.login_page.quit()
Exemple #6
0
class TestOwnerManage(unittest.TestCase):
    ZHSQ_URL = Config().get('ZHSQ_URL')
    userAcct = Config().get('userAcct')
    userPwd = Config().get('userPwd')
    smsCode = Config().get('smsCode')
    """
    @前置处理器
    description:登陆
    """
    def setUp(self):
        logger.info("----start---")
        self.login_page = LoginPage(browser_type='chrome').get(
            self.ZHSQ_URL, maximize_window=True)
        self.menu_page = MenuPage(self.login_page)
        self.owner_add_page = OwnerAddPage(self.login_page)
        self.owner_find_page = OwnerFindPage(self.login_page)
        self.owner_edit_page = OwnerEditPage(self.login_page)
        self.owner_del_page = OwnerDelPage(self.login_page)
        try:
            #遗留问题,先录入账号再勾选协议找不到元素
            #原因可能是因为倒计时,导致页面有动态元素
            self.login_page.click_checkbox()
            self.login_page.click_closeAlert()
            self.login_page.input_userAcct(self.userAcct)
            self.login_page.input_userPwd(self.userPwd)
            self.login_page.click_smsCodeButton()
            self.login_page.input_smsCode(self.smsCode)
            self.login_page.click_loginButton()
            self.login_page.wait(3)
            self.menu_page.click_householdManage()
            self.menu_page.click_ownerManage()
            self.menu_page.wait()

        except Exception as msg:
            self.login_page.save_screen_shot("test_login")
            logger.info("异常信息:%s" % msg)
            raise

    def tearDown(self):
        logger.info("----END---")
        self.login_page.quit()

    customName = "卢志恒"

    @unittest.skipUnless(True, "新增业主")
    def test_addOwner(self):
        try:
            self.owner_add_page.click_addButton()
            self.owner_add_page.click_belongToBuilding()
            self.owner_add_page.click_buildListBox()
            self.owner_add_page.click_belongTounit()
            self.owner_add_page.click_unitListBox()
            self.owner_add_page.click_belongToFloor()
            self.owner_add_page.click_floorListBox()
            self.owner_add_page.click_roomId()
            self.owner_add_page.click_chooseRoomId()
            # ##业主
            self.owner_add_page.input_customName(self.customName)
            self.owner_add_page.click_customType()
            self.owner_add_page.click_chooseCustomType()
            self.owner_add_page.input_customTel("15038330928")

            #滚动条滚动到某元素
            # target = self.owner_add_page.find_element(By.XPATH,"/html/body/div[3]/div/div[2]/div/div[2]/div[3]/button[2]")
            # self.owner_add_page.execute("arguments[0].scrollIntoView();", target)

            js = "document.getElementById(\"customs.0.prsnImgUrl\").style.display='block';"
            # 调用js脚本
            self.owner_add_page.execute(js)
            self.owner_add_page.input_imgFile(SOURCEIMG_PATH +
                                              "/13213156600.jpg")

            # # ##业主成员
            # self.owner_add_page.click_addMemberButton()
            # self.owner_add_page.input_memberName("李杨")
            # self.owner_add_page.click_memberType()
            # self.owner_add_page.click_chooseMemberType()
            # self.owner_add_page.input_memberTel("15137161725")
            #
            # js1 = "document.getElementById(\"customs.1.prsnImgUrl\").style.display='block';"
            # self.owner_add_page.execute(js1)
            # self.owner_add_page.find_element(By.XPATH,"/html/body/div[3]/div/div[2]/div/div[2]/div[2]/div[3]/div[2]/div[2]/div[7]/div/div[2]/div/span/span/div/span/input").send_keys(SOURCEIMG_PATH + "/13213156601.jpeg")
            # ##操作
            self.owner_add_page.click_saveButton()
            msgStr = self.owner_add_page.find_element(
                By.XPATH, "/html/body/div[2]/span/div/div/div/span")
            if msgStr is not None:
                self.assertEqual(msgStr.text, "添加成功", msg="添加失败")
            else:
                self.assertIsNotNone(msgStr, msg="元素定位失败")
            self.owner_add_page.wait()
            self.owner_add_page.refresh()
        except Exception as msg:
            self.owner_add_page.save_screen_shot("test_addOwner")
            logger.info("异常信息:%s" % msg)
            raise

    ## 业主成员
    memberName = "李杨"

    def test_addMember(self):
        try:
            self.owner_add_page.click_addButton()
            self.owner_add_page.click_belongToBuilding()
            self.owner_add_page.click_buildListBox()
            self.owner_add_page.click_belongTounit()
            self.owner_add_page.click_unitListBox()
            self.owner_add_page.click_belongToFloor()
            self.owner_add_page.click_floorListBox()
            self.owner_add_page.click_roomId()
            self.owner_add_page.click_chooseRoomId()

            # ##业主成员
            self.owner_add_page.click_addMemberButton()
            self.owner_add_page.input_memberName(self.memberName)
            self.owner_add_page.click_memberType()
            self.owner_add_page.click_chooseMemberType()
            self.owner_add_page.input_memberTel("15137161725")

            js1 = "document.getElementById(\"customs.0.prsnImgUrl\").style.display='block';"
            self.owner_add_page.execute(js1)
            self.owner_add_page.find_element(
                By.ID, "customs.0.prsnImgUrl").send_keys(SOURCEIMG_PATH +
                                                         "/13213156601.jpeg")
            ##操作
            self.owner_add_page.click_saveButton()
            msgStr = self.owner_add_page.find_element(
                By.XPATH, "/html/body/div[2]/span/div/div/div/span")
            if msgStr is not None:
                self.assertEqual(msgStr.text, "添加成功", msg="添加失败")
            else:
                self.assertIsNotNone(msgStr, msg="元素定位失败")
            self.owner_add_page.wait()
            self.owner_add_page.refresh()
        except Exception as msg:
            self.owner_add_page.save_screen_shot("test_addMember")
            logger.info("异常信息:%s" % msg)
            raise

    editCustomName = customName + "edit"
    editMemberName = memberName + "edit"

    ##编辑 查询并编辑
    def test_edit(self, oldName, newName):
        self.owner_edit_page.refresh()
        TestOwnerManage.test_findOwner(self, oldName)
        try:
            self.owner_edit_page.click_editButton()
            self.owner_edit_page.input_ownerName(newName)
            self.owner_edit_page.click_saveButton()
            msgStr = self.owner_edit_page.find_element(
                By.XPATH, "/html/body/div[2]/span/div/div/div/span")
            if msgStr is not None:
                self.assertEqual(msgStr.text, "操作成功", msg="添加失败")
            else:
                self.assertIsNotNone(msgStr, msg="元素定位失败")
            self.owner_edit_page.wait()
            self.owner_edit_page.refresh()
            TestOwnerManage.test_findOwner(self, newName)
            nameStr = self.owner_edit_page.find_element(
                By.XPATH,
                "/html/body/div/div[1]/div[1]/div[2]/div[2]/div/div/div/div[3]/div/div/div/div/div/div[1]/div/table/tbody/tr/td[5]"
            )
            if nameStr is not None:
                self.assertEqual(nameStr.text, newName, msg="数据错误")
            else:
                self.assertIsNotNone(nameStr.text, msg="查询数据列表为空")
            self.owner_edit_page.refresh()
        except Exception as msg:
            self.owner_add_page.save_screen_shot("test_edit")
            logger.info("异常信息:%s" % msg)
            raise

    def test_editOwner(self):
        TestOwnerManage.test_edit(self, self.customName, self.editCustomName)
        TestOwnerManage.test_edit(self, self.memberName, self.editMemberName)

    # ##删除-根据name查找并删除
    def test_del(self, name):
        self.owner_del_page.refresh()
        TestOwnerManage.test_findOwner(self, name)
        try:
            self.owner_del_page.click_delButton()
            self.owner_del_page.click_isYesButton()
            msgStr = self.owner_del_page.find_element(
                By.XPATH, "/html/body/div[2]/span/div/div/div/span")
            if msgStr is not None:
                self.assertEqual(msgStr.text, "注销业主成功", msg="注销业主失败")
            else:
                self.assertIsNotNone(msgStr.text, msg="元素定位失败")
        except Exception as msg:
            self.owner_add_page.save_screen_shot("test_del")
            logger.info("异常信息:%s" % msg)
            raise

    def test_delOwner(self):
        TestOwnerManage.test_del(self, self.editCustomName)
        TestOwnerManage.test_del(self, self.editMemberName)

    def test_findOwner(self, prsnName):
        try:
            self.owner_find_page.click_searchButton()
            self.owner_find_page.input_prsnName(prsnName)
            self.owner_find_page.click_submitButton()
        except Exception as msg:
            self.owner_add_page.save_screen_shot("test_findOwner")
            logger.info("异常信息:%s" % msg)
            raise
class TestTenantManage(unittest.TestCase):
    ZHSQ_URL = Config().get('ZHSQ_URL')
    userAcct = Config().get('userAcct')
    userPwd = Config().get('userPwd')
    smsCode = Config().get('smsCode')
    """
    @前置处理器
    description:登陆
    """
    def setUp(self):
        logger.info("----start---")
        self.login_page = LoginPage(browser_type='chrome').get(
            self.ZHSQ_URL, maximize_window=True)
        self.menu_page = MenuPage(self.login_page)
        self.tenant_find_page = TenantFindPage(self.login_page)
        self.tenant_add_page = TenantAddPage(self.login_page)
        self.tenant_edit_page = TenantEditPage(self.login_page)
        self.tenant_xuyue_page = TenantXuyuePage(self.login_page)
        self.tenant_del_page = TenantDelPage(self.login_page)
        try:
            #遗留问题,先录入账号再勾选协议找不到元素
            #原因可能是因为倒计时,导致页面有动态元素
            self.login_page.click_checkbox()
            self.login_page.click_closeAlert()
            self.login_page.input_userAcct(self.userAcct)
            self.login_page.input_userPwd(self.userPwd)
            self.login_page.click_smsCodeButton()
            self.login_page.input_smsCode(self.smsCode)
            self.login_page.click_loginButton()
            self.login_page.wait(3)
            self.menu_page.click_householdManage()
            self.menu_page.click_tenantManage()
            self.menu_page.wait()

        except Exception as msg:
            self.login_page.save_screen_shot("test_login")
            logger.info("异常信息:%s" % msg)
            raise

    def tearDown(self):
        logger.info("----END---")
        self.login_page.quit()

    #新增租户
    customName = "杨志豪"
    customTel = "15237104251"

    def test_addTenant(self):
        try:

            self.tenant_add_page.click_addButton()
            #楼栋信息
            self.tenant_add_page.click_belongToBuilding()
            self.tenant_add_page.click_buildListBox()
            self.tenant_add_page.click_belongTounit()
            self.tenant_add_page.click_unitListBox()
            self.tenant_add_page.click_belongToFloor()
            self.tenant_add_page.click_floorListBox()
            self.tenant_add_page.click_roomId()
            self.tenant_add_page.click_chooseRoomId()
            #租户信息
            self.tenant_add_page.input_customName(self.customName)
            self.tenant_add_page.input_customTel(self.customTel)
            self.tenant_add_page.click_clickTime()
            self.tenant_add_page.input_startTime("2021-03-20")
            self.tenant_add_page.input_endTime("2021-06-11")

            js2 = "document.getElementById(\"customs.0.prsnImgUrl\").style.display='block';"
            self.tenant_add_page.execute(js2)
            self.tenant_add_page.input_imgFile(SOURCEIMG_PATH +
                                               "/13213156605.jpeg")
            self.tenant_add_page.click_saveButton()

            msgStr = self.tenant_add_page.find_element(
                By.XPATH, "/html/body/div[2]/span/div/div/div/span")
            if msgStr is not None:
                self.assertEqual(msgStr.text, "添加成功", msg="添加租户失败")
            else:
                self.assertIsNotNone(msgStr, msg="元素定位失败")
            self.tenant_add_page.wait()
        except Exception as msg:
            self.login_page.save_screen_shot("test_addTenant")
            logger.info("异常信息:%s" % msg)
            raise

    ## 查询租户byname
    def test_findTenant(self, customName):
        try:
            self.tenant_find_page.click_findButton()
            self.tenant_find_page.input_prsnName(customName)
            self.tenant_find_page.click_submitButton()
        except Exception as msg:
            self.login_page.save_screen_shot("test_findTenant")
            logger.info("异常信息:%s" % msg)
            raise

    ## 编辑租户
    editName = "曲灵儿"

    def test_editTenant(self):
        TestTenantManage.test_findTenant(self, self.customName)
        try:
            self.tenant_edit_page.click_editButton()
            self.tenant_edit_page.input_name(self.editName)
            self.tenant_edit_page.click_saveButton()
            msgStr = self.tenant_edit_page.find_element(
                By.XPATH, "/html/body/div[2]/span/div/div/div/span")
            if msgStr is not None:
                self.assertEqual(msgStr.text, "操作成功", msg="编辑失败")
            else:
                self.assertIsNotNone(msgStr.text, msg="定位元素失败,编辑未成功")
        except Exception as msg:
            self.login_page.save_screen_shot("test_editTenant")
            logger.info("异常信息:%s" % msg)
            raise

    ##  删除租户by name
    def test_delTenant(self):
        TestTenantManage.test_findTenant(self, self.editName)
        try:
            self.tenant_del_page.click_delButton()
            self.tenant_del_page.click_isYesButton()
            msgStr = self.tenant_del_page.find_element(
                By.XPATH, "/html/body/div[2]/span/div/div/div/span")
            if msgStr is not None:
                self.assertEqual(msgStr.text, "解约租户成功", msg="解约租户失败")
            else:
                self.assertIsNotNone(msgStr.text, msg="元素定位失败,解约租户失败")
        except Exception as msg:
            self.login_page.save_screen_shot("test_delTenant")
            logger.info("异常信息:%s" % msg)
            raise

        ##  续约租户by name
    def test_xuyueTenant(self):
        TestTenantManage.test_findTenant(self, self.editName)
        try:
            self.tenant_xuyue_page.click_xuyueButton()
            self.tenant_xuyue_page.click_clickTime()
            self.tenant_xuyue_page.input_chooseTime("2022-03-01")
            self.tenant_xuyue_page.click_saveButton()
            msgStr = self.tenant_xuyue_page.find_element(
                By.XPATH, "/html/body/div[2]/span/div/div/div/span")
            if msgStr is not None:
                self.assertEqual(msgStr.text, "续期成功", msg="续期失败")
            else:
                self.assertIsNotNone(msgStr.text, msg="元素定位失败,续期失败")
        except Exception as msg:
            self.login_page.save_screen_shot("test_delTenant")
            logger.info("异常信息:%s" % msg)
            raise