Exemplo n.º 1
0
class TestCase18AccountCenterOverviewSetUpLandmark(unittest.TestCase):
    def setUp(self):
        self.driver = AutomateDriverServer(choose='chrome')
        self.base_url = self.driver.base_url
        self.base_page = BasePageServer(self.driver, self.base_url)
        self.login_page = LoginPage(self.driver, self.base_url)
        self.account_center_page_details = AccountCenterDetailsPage(self.driver, self.base_url)
        self.account_center_page_navi_bar = AccountCenterNaviBarPage(self.driver, self.base_url)
        self.log_in_base = LogInBaseServer(self.driver, self.base_url)
        self.driver.set_window_max()
        self.assert_text = AssertText()
        self.driver.wait(1)
        self.driver.clear_cookies()
        self.driver.wait(1)

    def tearDown(self):
        self.driver.quit_browser()

    def test_account_center_overview_set_up_landmark(self):
        # 打开途强在线首页-登录页
        self.base_page.open_page()
        # 登录账号
        self.log_in_base.log_in()
        self.account_center_page_navi_bar.click_account_center_button()
        sleep(2)
        account_center_handle = self.driver.get_current_window_handle()
        # 点击库存
        self.account_center_page_details.account_center_iframe()
        self.account_center_page_details.account_overview('地标设置')
        self.driver.default_frame()

        all_handles = self.driver.get_all_window_handles()
        for handle in all_handles:
            if handle != account_center_handle:
                self.driver.switch_to_window(handle)
                sleep(2)
                expect_url = self.driver.get_current_url()
                actual_url = self.base_url + '/safearea/geozonemap?flag=1'
                self.assertEqual(expect_url, actual_url, '点击地标设置后,实际的url和期望的不一样!')
                sleep(2)

                actual_text = self.account_center_page_details.get_actual_text_after_click_set_up_landmark()
                self.assertEqual(self.assert_text.account_center_page_mark_point_text(), actual_text,
                                 '点击地标设置后,页面没有跳转到地标设置页面上')

                self.assertEqual('active',
                                 self.driver.get_element('x,//*[@id="safemenu"]/li[2]').get_attribute('class'))

                # 查看控制台告警设置能否打开
                self.account_center_page_navi_bar.click_alarm_button_in_console()
                # 断言
                get_text = self.account_center_page_navi_bar.get_text_after_click_alarm_button()
                self.assertEqual(self.assert_text.account_center_page_alarm_manager_text(), get_text)
                self.account_center_page_navi_bar.close_alarm_in_console()

                self.driver.close_current_page()
                # 回到账户中心窗口
                self.driver.switch_to_window(account_center_handle)
                self.driver.wait()
Exemplo n.º 2
0
 def setUp(self):
     self.driver = AutomateDriverServer(choose='chrome')
     self.base_url = self.driver.base_url
     self.base_page = BasePageServer(self.driver, self.base_url)
     self.login_page = LoginPage(self.driver, self.base_url)
     self.account_center_page_details = AccountCenterDetailsPage(self.driver, self.base_url)
     self.account_center_page_navi_bar = AccountCenterNaviBarPage(self.driver, self.base_url)
     self.log_in_base = LogInBaseServer(self.driver, self.base_url)
     self.driver.set_window_max()
     self.assert_text = AssertText()
     self.driver.wait(1)
     self.driver.clear_cookies()
     self.driver.wait(1)
 def setUp(self):
     self.driver = AutomateDriverServer()
     self.base_url = self.driver.base_url
     self.base_page = BasePageServer(self.driver, self.base_url)
     self.login_page = LoginPage(self.driver, self.base_url)
     self.account_center_page_navi_bar = AccountCenterNaviBarPage(self.driver, self.base_url)
     self.account_center_page_details = AccountCenterDetailsPage(self.driver, self.base_url)
     self.log_in_read_csv = LogInPageReadCsv()
     self.connect_sql = ConnectSql()
     self.assert_text = AssertText()
     self.driver.set_window_max()
     self.driver.wait(1)
     self.driver.clear_cookies()
     self.driver.wait(1)
 def setUp(self):
     self.driver = AutomateDriverServer(choose='chrome')
     self.base_url = self.driver.base_url
     self.base_page = BasePageServer(self.driver, self.base_url)
     self.login_page = LoginPage(self.driver, self.base_url)
     self.cust_manage_basic_info_and_add_cust_page = CustManageBasicInfoAndAddCustPage(
         self.driver, self.base_url)
     self.account_center_page_details = AccountCenterDetailsPage(
         self.driver, self.base_url)
     self.cust_manage_cust_list_page = CustManageCustListPage(
         self.driver, self.base_url)
     self.cust_manage_my_dev_page = CustManageMyDevPage(
         self.driver, self.base_url)
     self.cust_manage_lower_account_page = CustManageLowerAccountPage(
         self.driver, self.base_url)
     self.account_center_page_navi_bar = AccountCenterNaviBarPage(
         self.driver, self.base_url)
     self.driver.set_window_max()
     self.log_in_base = LogInBaseServer(self.driver, self.base_url)
     self.cust_manage_page_read_csv = CustManagePageReadCsv()
     self.search_sql = SearchSql()
     self.connect_sql = ConnectSql()
     self.driver.wait(1)
     self.driver.clear_cookies()
     self.driver.wait(1)
Exemplo n.º 5
0
class TestCase14AccountCenterOverviewAlarm(unittest.TestCase):
    def setUp(self):
        self.driver = AutomateDriverServer(choose='chrome')
        self.base_url = self.driver.base_url
        self.base_page = BasePageServer(self.driver, self.base_url)
        self.login_page = LoginPage(self.driver, self.base_url)
        self.account_center_page_details = AccountCenterDetailsPage(self.driver, self.base_url)
        self.account_center_page_navi_bar = AccountCenterNaviBarPage(self.driver, self.base_url)
        self.driver.set_window_max()
        self.log_in_base = LogInBaseServer(self.driver, self.base_url)
        self.assert_text = AssertText()
        self.driver.wait(1)
        self.driver.clear_cookies()
        self.driver.wait(1)

    def tearDown(self):
        self.driver.quit_browser()

    def test_account_center_overview_alarm(self):
        # 打开途强在线首页-登录页
        self.base_page.open_page()
        # 登录账号
        self.log_in_base.log_in()
        self.account_center_page_navi_bar.click_account_center_button()
        sleep(2)
        account_center_handle = self.driver.get_current_window_handle()
        # 点击围栏
        self.account_center_page_details.account_center_iframe()
        self.account_center_page_details.account_overview('围栏')
        self.driver.default_frame()

        all_handles = self.driver.get_all_window_handles()
        for handle in all_handles:
            if handle != account_center_handle:
                self.driver.switch_to_window(handle)
                sleep(2)
                expect_url = self.driver.get_current_url()
                actual_url = self.base_url + '/safearea/geozonemap?flag=0'
                self.assertEqual(expect_url, actual_url, '点击围栏后,实际的url和期望的不一样!')
                actual_text = self.account_center_page_details.get_actual_text_after_click_alarm()
                self.assertEqual(self.assert_text.account_center_page_area_alarm_text(), actual_text,
                                 '点击围栏后,页面没有跳转到围栏设置页面')

                # 验证区域预警有没有被选中
                value = self.account_center_page_details.click_safearea_get_vaule()
                self.assertEqual('active', value)

                # 查看控制台告警设置能否打开
                self.account_center_page_navi_bar.click_alarm_button_in_console()
                # 断言
                get_text = self.account_center_page_navi_bar.get_text_after_click_alarm_button()
                self.assertEqual(self.assert_text.account_center_page_alarm_manager_text(), get_text)
                self.account_center_page_navi_bar.close_alarm_in_console()

                self.driver.close_current_page()
                # 回到账户中心窗口
                self.driver.switch_to_window(account_center_handle)
                self.driver.wait()
Exemplo n.º 6
0
 def setUp(self):
     self.driver = AutomateDriverServer()
     self.base_url = self.driver.base_url
     self.base_page = BasePageServer(self.driver, self.base_url)
     self.account_center_page_navi_bar = AccountCenterNaviBarPage(self.driver, self.base_url)
     self.account_center_page_details = AccountCenterDetailsPage(self.driver, self.base_url)
     self.account_center_page_read_csv = AccountCenterPageReadCsv()
     self.log_in_base = LogInBaseServer(self.driver, self.base_url)
     self.assert_text = AssertText()
     self.driver.set_window_max()
     self.driver.clear_cookies()
     # 打开途强在线首页-登录页
     self.base_page.open_page()
     sleep(1)
     # 登录账号
     self.log_in_base.log_in()
 def setUp(self):
     self.driver = AutomateDriverServer(choose='chrome')
     self.base_url = self.driver.base_url
     self.base_page = BasePageServer(self.driver, self.base_url)
     self.login_page = LoginPage(self.driver, self.base_url)
     self.account_center_page_navi_bar = AccountCenterNaviBarPage(
         self.driver, self.base_url)
     self.account_center_page_details = AccountCenterDetailsPage(
         self.driver, self.base_url)
     self.account_center_page_refill_card = AccountCenterRefillCardPage(
         self.driver, self.base_url)
     self.log_in_base = LogInBaseServer(self.driver, self.base_page)
     self.search_sql = SearchSql()
     self.assert_text = AssertText()
     self.assert_text2 = AssertText2()
     self.driver.set_window_max()
     self.account_center_page_read_csv = AccountCenterPageReadCsv()
     self.log_in_base = LogInBaseServer(self.driver, self.base_page)
     self.driver.wait(1)
     self.driver.clear_cookies()
     self.driver.wait(1)
class TestCase124LoginSuccessWithphAppUser(unittest.TestCase):
    def setUp(self):
        self.driver = AutomateDriverServer()
        self.base_url = self.driver.base_url
        self.base_page = BasePageServer(self.driver, self.base_url)
        self.login_page = LoginPage(self.driver, self.base_url)
        self.account_center_page_navi_bar = AccountCenterNaviBarPage(
            self.driver, self.base_url)
        self.account_center_page_details = AccountCenterDetailsPage(
            self.driver, self.base_url)
        self.log_in_read_csv = LogInPageReadCsv()
        self.connect_sql = ConnectSql()
        self.assert_text = AssertText()
        self.driver.set_window_max()
        self.driver.wait(1)
        self.driver.clear_cookies()
        self.driver.wait(1)

    def tearDown(self):
        self.driver.quit_browser()

    def test_app_user_login_by_csv(self):
        '''通过csv测试app账户成功登录和成功退出功能'''
        data = ["首页", "设备管理", "操控台", "统计报表", "安全区域", "设备分布"]

        csv_file = self.log_in_read_csv.read_csv('login_with_app_user.csv')
        csv_data = csv.reader(csv_file)
        for row in csv_data:
            user_to_login = {"account": row[0], "passwd": row[1]}
            # 打开途强在线首页-登录页
            self.base_page.open_page()
            # 输入用户信息进行登录
            self.login_page.user_login(user_to_login["account"],
                                       user_to_login["passwd"])
            # 点首页
            # self.login_page.click_home_page()
            # 判断登录成功后跳转页面是否正确
            actual_url = self.driver.get_current_url()
            expect_url = self.base_url + "/nomalUserCenter"
            self.assertEqual(expect_url, actual_url, "登录成功后页面跳转错误")

            # 判断登录成功后招呼栏的用户名是否正确
            hello_usr = self.account_center_page_navi_bar.hello_user_account()
            expect_usr = user_to_login["account"]
            self.assertEqual(expect_usr, hello_usr, "登录成功后招呼栏账户名显示错误")

            # 验证模块
            module = self.account_center_page_navi_bar.get_page_module()
            for m in range(len(module)):
                self.assertIn(data[m], module[m], "用户账号登录,模块显示错误")

            # 获取当前app账号有几个服务商
            service_number = self.account_center_page_details.get_current_account_service_number(
            )

            # 获取数据库服务商的个数
            connect = self.connect_sql.connect_tuqiang_sql()
            cursor = connect.cursor()
            get_up_account_info_sql = "select userId from user_info where account = '%s';" % user_to_login[
                'account']

            cursor.execute(get_up_account_info_sql)
            get_up_user_info = cursor.fetchall()
            get_current_id = []
            for range1 in get_up_user_info:
                for range2 in range1:
                    get_current_id.append(range2)
            print(get_current_id)

            get_service_sql = "select userId from equipment_mostly where bindUserId = '" + get_current_id[
                0] + "' group by userId ;"
            cursor.execute(get_service_sql)
            get_service = cursor.fetchall()
            service_number_list = []
            for range1 in get_service:
                for range2 in range1:
                    service_number_list.append(range2)
            service_total = len(service_number_list)
            cursor.close()
            connect.close()
            # 断言
            # self.assertEqual(service_number - 1, service_total)
            self.assertEqual(service_number, service_total)

            # 成功退出系统
            sleep(2)
            self.account_center_page_navi_bar.app_usr_logout()
            # 判断是否成功退出到登录页
            self.assertEqual(self.base_url + "/",
                             self.driver.get_current_url(), "退出系统失败")
            break
        csv_file.close()
class TestCase11AccountCenterOverviewTotal(unittest.TestCase):
    def setUp(self):
        self.driver = AutomateDriverServer(choose='chrome')
        self.base_url = self.driver.base_url
        self.base_page = BasePageServer(self.driver, self.base_url)
        self.login_page = LoginPage(self.driver, self.base_url)
        self.account_center_page_details = AccountCenterDetailsPage(self.driver, self.base_url)
        self.account_center_page_navi_bar = AccountCenterNaviBarPage(self.driver, self.base_url)
        self.assert_text = AssertText()
        self.driver.set_window_max()
        self.connect_sql = ConnectSql()
        self.log_in_base = LogInBaseServer(self.driver, self.base_url)
        self.driver.wait(1)
        self.driver.clear_cookies()
        self.driver.wait(1)

    def tearDown(self):
        self.driver.quit_browser()

    def test_account_center_overview_total(self):
        self.base_page.open_page()
        self.log_in_base.log_in()
        # self.log_in_base.log_in_with_csv("kankan111","jimi123")
        self.account_center_page_navi_bar.click_account_center_button()
        self.account_center_page_details.account_center_iframe()
        # 获取登录账号的用户名
        # current_account = self.log_in_base.get_log_in_account()
        sleep(2)
        account_center_handle = self.driver.get_current_window_handle()
        expect_total = self.account_center_page_details.get_current_account_total_equipment()

        # 点击库存
        self.account_center_page_details.account_overview('总进货数')
        self.driver.default_frame()

        all_handles = self.driver.get_all_window_handles()
        for handle in all_handles:
            if handle != account_center_handle:
                self.driver.switch_to_window(handle)
                sleep(2)
                expect_url = self.driver.get_current_url()
                # 执行sql脚本查询当前登录账号的userId,fullParent
                actual_url = self.base_url + '/device/toDeviceManage?lowerDevFlag=1'
                self.assertEqual(expect_url, actual_url, '点击总进货数后,实际的url和期望的不一样!')

                # 断言包涵下级是否被勾选上
                self.assertEqual(True, self.driver.get_element('x,//*[@id="lowerFlag"]/div/input').is_selected())

                sleep(3)
                dev_count = self.account_center_page_details.get_total_dev_number_after_ckick_all_dev_number()
                self.assertEqual(expect_total, str(dev_count), '当前总进货数和实际数据库不一致!')

                # 验证清空按钮
                self.account_center_page_details.click_clear_all_button()
                lower_user_input_value = self.account_center_page_details.get_lower_input_value()
                self.assertEqual(False, lower_user_input_value)
                # 点搜索
                self.account_center_page_details.click_search_button()
                lower_user_input_value_again = self.account_center_page_details.get_lower_input_value()
                self.assertEqual(False, lower_user_input_value_again)

                # 查看控制台告警设置能否打开
                self.account_center_page_navi_bar.click_alarm_button_in_console()
                # 断言
                get_text = self.account_center_page_navi_bar.get_text_after_click_alarm_button()
                self.assertEqual(self.assert_text.account_center_page_alarm_manager_text(), get_text)
                self.account_center_page_navi_bar.close_alarm_in_console()

                self.driver.close_current_page()
                # 回到账户中心窗口
                self.driver.switch_to_window(account_center_handle)
                self.driver.wait()
class TestCase16AccountCenterOverviewEquipmentManager(unittest.TestCase):
    def setUp(self):
        self.driver = AutomateDriverServer(choose='chrome')
        self.base_url = self.driver.base_url
        self.base_page = BasePageServer(self.driver, self.base_url)
        self.login_page = LoginPage(self.driver, self.base_url)
        self.account_center_page_details = AccountCenterDetailsPage(
            self.driver, self.base_url)
        self.account_center_page_navi_bar = AccountCenterNaviBarPage(
            self.driver, self.base_url)
        self.driver.set_window_max()
        self.log_in_base = LogInBaseServer(self.driver, self.base_url)
        self.connect_sql = ConnectSql()
        self.assert_text = AssertText()
        self.assert_text2 = AssertText2()
        self.driver.wait(1)
        self.driver.clear_cookies()
        self.driver.wait(1)

    def tearDown(self):
        self.driver.quit_browser()

    def test_account_center_overview_equipment_manager(self):
        # 打开途强在线首页-登录页
        self.base_page.open_page()
        # 登录账号
        self.log_in_base.log_in()
        self.account_center_page_navi_bar.click_account_center_button()
        # self.account_center_page_details.account_center_iframe()
        current_account = self.log_in_base.get_log_in_account()
        sleep(2)
        account_center_handle = self.driver.get_current_window_handle()
        # 点击库存
        self.account_center_page_details.account_center_iframe()
        self.account_center_page_details.account_overview('设备管理')
        self.driver.default_frame()

        all_handles = self.driver.get_all_window_handles()
        for handle in all_handles:
            if handle != account_center_handle:
                self.driver.switch_to_window(handle)
                sleep(2)
                expect_url = self.driver.get_current_url()
                actual_url = self.base_url + '/device/toDeviceManage'
                self.assertEqual(expect_url, actual_url,
                                 '点击设备管理后,实际的url和期望的不一样!')

                # 验证文本
                # text = self.account_center_page_details.click_dev_manage_get_text()
                text = self.account_center_page_details.click_dev_manage_get_text(
                )
                print(text)
                self.assertEqual(
                    " " + self.assert_text2.
                    account_center_page_contains_lower_dev_text(), text)

                # 查看控制台告警设置能否打开
                self.account_center_page_navi_bar.click_alarm_button_in_console(
                )
                # 断言
                get_text = self.account_center_page_navi_bar.get_text_after_click_alarm_button(
                )
                self.assertEqual(
                    self.assert_text.account_center_page_alarm_manager_text(),
                    get_text)
                self.account_center_page_navi_bar.close_alarm_in_console()

                self.driver.close_current_page()
                # 回到账户中心窗口
                self.driver.switch_to_window(account_center_handle)
                self.driver.wait()
class TestCase24AccountCenterOverviewAttention(unittest.TestCase):
    def setUp(self):
        self.driver = AutomateDriverServer(choose='chrome')
        self.base_url = self.driver.base_url
        self.base_page = BasePageServer(self.driver, self.base_url)
        self.login_page = LoginPage(self.driver, self.base_url)
        self.account_center_page_details = AccountCenterDetailsPage(
            self.driver, self.base_url)
        self.account_center_page_navi_bar = AccountCenterNaviBarPage(
            self.driver, self.base_url)
        self.driver.set_window_max()
        self.log_in_base = LogInBaseServer(self.driver, self.base_url)
        self.assert_text = AssertText()
        self.connect_sql = ConnectSql()
        self.driver.wait(1)
        self.driver.clear_cookies()
        self.driver.wait(1)

    def tearDown(self):
        self.driver.quit_browser()

    def test_account_center_overview_attention(self):
        # 打开途强在线首页-登录页
        self.base_page.open_page()
        # 登录账号
        self.log_in_base.log_in()
        self.account_center_page_navi_bar.click_account_center_button()
        current_account = self.log_in_base.get_log_in_account()
        sleep(2)
        account_center_handle = self.driver.get_current_window_handle()

        self.account_center_page_details.account_center_iframe()
        actual_total_attention = self.account_center_page_details.get_actual_total_attention(
        )
        # 点击库存
        self.account_center_page_details.account_overview('重点关注车辆')
        self.driver.default_frame()

        all_handles = self.driver.get_all_window_handles()
        for handle in all_handles:
            if handle != account_center_handle:
                self.driver.switch_to_window(handle)
                sleep(2)
                expect_url = self.driver.get_current_url()
                connect = self.connect_sql.connect_tuqiang_sql()
                # 创建数据库游标
                cur = connect.cursor()
                # 执行sql脚本查询当前登录账号的userId,fullParent
                get_id_sql = "select userId from user_info where account = '" + current_account + "' ;"
                cur.execute(get_id_sql)
                # 读取数据
                user_relation = cur.fetchall()
                print(user_relation)
                user_id = user_relation[0][0]
                # actual_url = self.base_url + '/console?userId=%s&viewFlag=4' % user_id
                actual_url = self.base_url + '/console?viewFlag=4'
                cur.close()
                connect.close()
                self.assertEqual(expect_url, actual_url,
                                 '点击重点关注车辆后,实际的url和期望的不一样!')
                sleep(2)

                # 断言已关注被选中
                self.assertEqual(
                    'active',
                    self.driver.get_element(
                        'x,//*[@id="FOLLOW"]').get_attribute('class'))

                expect_total_inactive = self.account_center_page_details.get_total_all_attention_equipment(
                )
                self.assertEqual(actual_total_attention, expect_total_inactive,
                                 '账号重点关注车辆数量错误')

                # 查看控制台告警设置能否打开
                self.account_center_page_navi_bar.click_alarm_button_in_console(
                )
                # 断言
                get_text = self.account_center_page_navi_bar.get_text_after_click_alarm_button(
                )
                self.assertEqual(
                    self.assert_text.account_center_page_alarm_manager_text(),
                    get_text)
                self.account_center_page_navi_bar.close_alarm_in_console()

                self.driver.close_current_page()
                # 回到账户中心窗口
                self.driver.switch_to_window(account_center_handle)
                self.driver.wait()
Exemplo n.º 12
0
class TestCase12AccountCenterOverviewControl(unittest.TestCase):
    def setUp(self):
        self.driver = AutomateDriverServer(choose='chrome')
        self.base_url = self.driver.base_url
        self.base_page = BasePageServer(self.driver, self.base_url)
        self.login_page = LoginPage(self.driver, self.base_url)
        self.account_center_page_details = AccountCenterDetailsPage(
            self.driver, self.base_url)
        self.account_center_page_navi_bar = AccountCenterNaviBarPage(
            self.driver, self.base_url)
        self.driver.set_window_max()
        self.log_in_base = LogInBaseServer(self.driver, self.base_url)
        self.assert_text = AssertText()
        self.driver.wait(1)
        self.driver.clear_cookies()
        self.driver.wait(1)

    def tearDown(self):
        self.driver.quit_browser()

    def test_account_center_overview_control(self):
        # 打开途强在线首页-登录页
        self.base_page.open_page()
        # 登录账号
        self.log_in_base.log_in()
        self.account_center_page_navi_bar.click_account_center_button()
        sleep(2)
        account_center_handle = self.driver.get_current_window_handle()

        # 点击控制台
        self.account_center_page_details.account_center_iframe()
        self.account_center_page_details.account_overview('控制台')
        self.driver.default_frame()

        all_handles = self.driver.get_all_window_handles()
        for handle in all_handles:
            if handle != account_center_handle:
                self.driver.switch_to_window(handle)
                sleep(2)
                expect_url = self.driver.get_current_url()
                actual_url = self.base_url + '/console'
                self.assertEqual(expect_url, actual_url,
                                 '点击控制台后,实际的url和期望的不一样!')

                # 获取菜单栏中控制台的class属性
                get_console_class = self.account_center_page_navi_bar.get_console_class_value(
                )
                # self.assertEqual('active', get_console_class)
                self.assertIn('active', get_console_class)

                # 获取全部的li里面的class属性
                all_dev_class_value = self.account_center_page_navi_bar.get_all_dev_button_value(
                )
                self.assertEqual('active', all_dev_class_value)
                #self.assertIn('active', all_dev_class_value)

                # 查看控制台告警设置能否打开
                self.account_center_page_navi_bar.click_alarm_button_in_console(
                )
                # 断言
                get_text = self.account_center_page_navi_bar.get_text_after_click_alarm_button(
                )
                self.assertEqual(
                    self.assert_text.account_center_page_alarm_manager_text(),
                    get_text)
                self.account_center_page_navi_bar.close_alarm_in_console()

                self.driver.close_current_page()
                # 回到账户中心窗口
                self.driver.switch_to_window(account_center_handle)
                self.driver.wait()
Exemplo n.º 13
0
class TestCase17AccountCenterOverviewCommand(unittest.TestCase):
    def setUp(self):
        self.driver = AutomateDriverServer(choose='chrome')
        self.base_url = self.driver.base_url
        self.base_page = BasePageServer(self.driver, self.base_url)
        self.login_page = LoginPage(self.driver, self.base_url)
        self.account_center_page_details = AccountCenterDetailsPage(
            self.driver, self.base_url)
        self.account_center_page_navi_bar = AccountCenterNaviBarPage(
            self.driver, self.base_url)
        self.assert_text = AssertText()
        self.driver.set_window_max()
        self.log_in_base = LogInBaseServer(self.driver, self.base_url)
        self.driver.wait(1)
        self.driver.clear_cookies()
        self.driver.wait(1)

    def tearDown(self):
        self.driver.quit_browser()

    def test_account_center_overview_command(self):
        # 打开途强在线首页-登录页
        self.base_page.open_page()
        # 登录账号
        self.log_in_base.log_in()
        self.account_center_page_navi_bar.click_account_center_button()
        sleep(2)
        account_center_handle = self.driver.get_current_window_handle()
        # 点击库存
        self.account_center_page_details.account_center_iframe()
        self.account_center_page_details.account_overview('指令管理')
        self.driver.default_frame()

        all_handles = self.driver.get_all_window_handles()
        for handle in all_handles:
            if handle != account_center_handle:
                self.driver.switch_to_window(handle)
                sleep(2)
                expect_url = self.driver.get_current_url()
                actual_url = self.base_url + '/custom/toTemplate?viewFlag=2'
                self.assertEqual(expect_url, actual_url,
                                 '点击指令管理后,实际的url和期望的不一样!')
                sleep(3)

                actual_text = self.account_center_page_details.get_actual_text_after_click_command(
                )
                self.assertEqual(
                    self.assert_text.
                    account_center_page_issued_command_manager(), actual_text,
                    '点击指令管理后,页面没有跳转到下发指令管理上')

                # 查看控制台告警设置能否打开
                self.account_center_page_navi_bar.click_alarm_button_in_console(
                )
                # 断言
                get_text = self.account_center_page_navi_bar.get_text_after_click_alarm_button(
                )
                self.assertEqual(
                    self.assert_text.account_center_page_alarm_manager_text(),
                    get_text)
                self.account_center_page_navi_bar.close_alarm_in_console()

                self.driver.close_current_page()
                # 回到账户中心窗口
                self.driver.switch_to_window(account_center_handle)
                self.driver.wait()
class TestCase15AccountCenterOverviewNextGuest(unittest.TestCase):
    def setUp(self):
        self.driver = AutomateDriverServer(choose='chrome')
        self.base_url = self.driver.base_url
        self.base_page = BasePageServer(self.driver, self.base_url)
        self.login_page = LoginPage(self.driver, self.base_url)
        self.account_center_page_details = AccountCenterDetailsPage(
            self.driver, self.base_url)
        self.account_center_page_navi_bar = AccountCenterNaviBarPage(
            self.driver, self.base_url)
        self.driver.set_window_max()
        self.log_in_base = LogInBaseServer(self.driver, self.base_url)
        self.assert_text = AssertText()
        self.connect_sql = ConnectSql()
        self.driver.wait(1)
        self.driver.clear_cookies()
        self.driver.wait(1)

    def tearDown(self):
        self.driver.quit_browser()

    def test_account_center_overview_next_guest(self):
        # 打开途强在线首页-登录页
        self.base_page.open_page()
        # 登录账号
        self.log_in_base.log_in()
        self.account_center_page_navi_bar.click_account_center_button()
        # self.account_center_page_details.account_center_iframe()
        current_account = self.log_in_base.get_log_in_account()
        sleep(2)
        account_center_handle = self.driver.get_current_window_handle()

        # 点击下级客户管理
        self.account_center_page_details.account_center_iframe()
        self.account_center_page_details.account_overview('下级客户管理')
        self.driver.default_frame()

        all_handles = self.driver.get_all_window_handles()
        for handle in all_handles:
            if handle != account_center_handle:
                self.driver.switch_to_window(handle)
                sleep(2)
                expect_url = self.driver.get_current_url()
                # 创建数据库游标
                connect = self.connect_sql.connect_tuqiang_sql()
                cur = connect.cursor()
                # 执行sql脚本查询当前登录账号的userId,fullParent
                get_id_sql = "select userId from user_info where account = '" + current_account + "';"
                cur.execute(get_id_sql)
                # 读取数据
                user_relation = cur.fetchall()
                user_id = user_relation[0][0]
                cur.close()
                connect.close()
                # actual_url = self.base_url + '/customer/toSearch?userId=%s&viewFlag=4' % user_id
                actual_url = self.base_url + '/customer/toSearch?viewFlag=4'
                self.assertEqual(expect_url, actual_url,
                                 '点击下级客户管理后,实际的url和期望的不一样!')
                sleep(3)
                expect_next = self.account_center_page_details.get_current_account_next(
                )
                actual_next = self.account_center_page_details.get_actual_current_account_next(
                )
                self.assertEqual(expect_next, actual_next, '左侧列表的下级总数和右侧不一致!')

                # 查看控制台告警设置能否打开
                self.account_center_page_navi_bar.click_alarm_button_in_console(
                )
                # 断言
                get_text = self.account_center_page_navi_bar.get_text_after_click_alarm_button(
                )
                self.assertEqual(
                    self.assert_text.account_center_page_alarm_manager_text(),
                    get_text)
                self.account_center_page_navi_bar.close_alarm_in_console()

                self.driver.close_current_page()
                # 回到账户中心窗口
                self.driver.switch_to_window(account_center_handle)
                self.driver.wait()
class TestCase016AccountCenterFastSaleReset(unittest.TestCase):
    def setUp(self):
        self.driver = AutomateDriverServer(choose='chrome')
        self.base_url = self.driver.base_url
        self.base_page = BasePageServer(self.driver, self.base_url)
        self.login_page = LoginPage(self.driver, self.base_url)
        self.account_center_page_navi_bar = AccountCenterNaviBarPage(
            self.driver, self.base_url)
        self.account_center_page_details = AccountCenterDetailsPage(
            self.driver, self.base_url)
        self.assert_text2 = AssertText2()
        self.driver.set_window_max()
        self.account_center_page_read_csv = AccountCenterPageReadCsv()
        self.log_in_base = LogInBaseServer(self.driver, self.base_page)
        self.account_center_change_page = AccountCenterChangePage(
            self.driver, self.base_page)
        self.driver.wait(1)
        self.driver.clear_cookies()
        self.driver.wait(1)

    def tearDown(self):
        self.driver.quit_browser()

    def test_account_center_fast_sale_reset(self):
        '''通过csv测试账户详情-快捷销售-删除设备、重置功能'''
        csv_file = self.account_center_page_read_csv.read_csv(
            'fast_sale_exact_find_and_sale.csv')
        csv_data = csv.reader(csv_file)

        # 打开途强在线首页-登录页
        self.base_page.open_page()
        # 登录账号
        # self.log_in_base.log_in()
        self.log_in_base.log_in_with_csv("dzltest", "jimi123")
        self.driver.wait(1)
        self.account_center_page_navi_bar.click_account_center_button()

        for row in csv_data:
            search_account = {
                "account": row[0],
                "device_imei": row[1],
                "imei_count": row[2],
                "selected_dev": row[2]
            }
            # 进入快捷销售页面
            sleep(1)
            # self.account_center_page_details.account_center_iframe()
            # self.account_center_page_details.fast_sales()

            self.account_center_change_page.switch_fast_sale_enable()
            self.account_center_change_page.switch_to_fast_sale_frame()
            # 查找账户
            self.account_center_page_details.fast_sales_find_account(
                search_account["account"])
            #点取消
            self.account_center_page_details.fast_sales_find_and_dis_add_device(
                "123123123")

            # 输入设备imei精确查找设备并添加
            self.account_center_page_details.fast_sales_find_and_add_device(
                search_account["device_imei"])
            self.driver.default_frame()
            self.driver.wait()

            #验证消息中的失败个数
            failure_count = self.account_center_page_details.get_device_prompt_failure_count(
            )
            list_failure_count = self.account_center_page_details.get_device_list_failure_count(
            )
            self.assertEqual(failure_count, list_failure_count,
                             "显示的失败个数与列表中的失败数不一致")

            #验证消息中的成功个数
            all_data = self.account_center_page_details.get_prompt_list_data()
            succeed_count = self.account_center_page_details.get_device_prompt_succeed_count(
            )
            self.account_center_page_details.click_prompt_close()
            self.account_center_change_page.switch_to_fast_sale_frame()
            list_count = self.account_center_page_details.get_list_succeed_count(
            )
            self.assertEqual(succeed_count, list_count, "成功添加的设备数不一致")

            #断言失败提示中的信息
            for s in range(list_failure_count):
                self.assertIsNotNone(all_data["imei"][s], "sim卡号为空")
                self.assertEqual("失败", all_data["state"][s], "存在不是失败的数据")
                self.assertIsNotNone(all_data["cause"][s], "失败原因中存在空数据")

            # 验证已选设备计数是否准确
            dev_num = self.account_center_page_details.get_selected_device_num(
            )
            self.assertEqual(list_count, dev_num, "已选设备个数不准确")
            # 删除列表中的设备
            self.account_center_page_details.delete_list_device()

            self.assertEqual(
                0, self.account_center_page_details.get_selected_device_num(),
                "删除设备后,已选设备数不是0")

            # 重置验证
            self.account_center_page_details.fast_sales_find_and_add_device(
                search_account["device_imei"])
            self.driver.default_frame()
            self.account_center_page_details.click_prompt_close()
            self.account_center_change_page.switch_to_fast_sale_frame()
            self.account_center_page_details.choose_account_expired_time("三个月")
            self.driver.wait(1)
            self.account_center_page_details.reset_device()

            self.assertEqual(
                0, self.account_center_page_details.get_list_succeed_count(),
                "重置后,列表中已添加的设备的数不是0")
            self.assertEqual(
                0, self.account_center_page_details.get_selected_device_num(),
                "重置后,已选设备数不是0")
            self.assertEqual(
                self.assert_text2.account_center_please_select(),
                self.account_center_page_details.get_account_expired_time_text(
                ), "重置后,用户到期时间不是请选择")

            self.driver.default_frame()
        csv_file.close()
Exemplo n.º 16
0
class TestCase23AccountCenterOverviewInactive(unittest.TestCase):
    def setUp(self):
        self.driver = AutomateDriverServer(choose='chrome')
        self.base_url = self.driver.base_url
        self.base_page = BasePageServer(self.driver, self.base_url)
        self.login_page = LoginPage(self.driver, self.base_url)
        self.account_center_page_details = AccountCenterDetailsPage(
            self.driver, self.base_url)
        self.account_center_page_navi_bar = AccountCenterNaviBarPage(
            self.driver, self.base_url)
        self.driver.set_window_max()
        self.log_in_base = LogInBaseServer(self.driver, self.base_url)
        self.assert_text = AssertText()
        self.driver.wait(1)
        self.driver.clear_cookies()
        self.driver.wait(1)

    def tearDown(self):
        self.driver.quit_browser()

    def test_account_center_overview_inactive(self):
        # 打开途强在线首页-登录页
        self.base_page.open_page()
        # 登录账号
        self.log_in_base.log_in()
        self.account_center_page_navi_bar.click_account_center_button()
        sleep(2)
        account_center_handle = self.driver.get_current_window_handle()

        self.account_center_page_details.account_center_iframe()
        actual_total_inctive = self.account_center_page_details.get_actual_total_inactve(
        )
        # 点击未激活
        self.account_center_page_details.account_overview('未激活')
        self.driver.default_frame()

        all_handles = self.driver.get_all_window_handles()
        for handle in all_handles:
            if handle != account_center_handle:
                self.driver.switch_to_window(handle)
                sleep(2)
                expect_url = self.driver.get_current_url()
                actual_url = self.base_url + '/device/toDeviceManage?statusFlag=inactive&lowerDevFlag=1'
                self.assertEqual(expect_url, actual_url,
                                 '点击未激活后,实际的url和期望的不一样!')
                sleep(3)
                self.account_center_page_details.click_more_in_dev_manage()
                self.assertEqual(
                    self.assert_text.account_center_page_activing_text(),
                    self.driver.get_text(
                        'x,//*[@id="allDev"]/div[2]/div[1]/div/div[6]/div[6]/div[2]/div/div/span[2]'
                    ))
                self.assertEqual(
                    True,
                    self.driver.get_element(
                        'x,//*[@id="lowerFlag"]/div/input').is_selected())

                expect_total_inactive = self.account_center_page_details.get_total_dev_number_after_ckick_all_dev_number(
                )
                self.assertEqual(actual_total_inctive,
                                 str(expect_total_inactive), '账号总览统计未激活数量错误')

                # 验证清空按钮
                self.account_center_page_details.click_clear_all_button()
                lower_user_input_value = self.account_center_page_details.get_lower_input_value(
                )
                self.assertEqual(False, lower_user_input_value)
                get_text = self.account_center_page_details.click_active_get_text(
                )
                self.assertEqual(
                    self.assert_text.account_center_page_active_status_text(),
                    get_text)
                # 点搜索
                self.account_center_page_details.click_search_button()
                lower_user_input_value_again = self.account_center_page_details.get_lower_input_value(
                )
                self.assertEqual(False, lower_user_input_value_again)
                get_text = self.account_center_page_details.click_active_get_text(
                )
                self.assertEqual(
                    self.assert_text.account_center_page_active_status_text(),
                    get_text)

                # 查看控制台告警设置能否打开
                self.account_center_page_navi_bar.click_alarm_button_in_console(
                )
                # 断言
                get_text = self.account_center_page_navi_bar.get_text_after_click_alarm_button(
                )
                self.assertEqual(
                    self.assert_text.account_center_page_alarm_manager_text(),
                    get_text)
                self.account_center_page_navi_bar.close_alarm_in_console()

                self.driver.close_current_page()
                # 回到账户中心窗口
                self.driver.switch_to_window(account_center_handle)
                self.driver.wait()
Exemplo n.º 17
0
class TestCase19AccountCenterOverviewAlarm(unittest.TestCase):
    def setUp(self):
        self.driver = AutomateDriverServer(choose='chrome')
        self.base_url = self.driver.base_url
        self.base_page = BasePageServer(self.driver, self.base_url)
        self.login_page = LoginPage(self.driver, self.base_url)
        self.account_center_page_details = AccountCenterDetailsPage(
            self.driver, self.base_url)
        self.account_center_page_navi_bar = AccountCenterNaviBarPage(
            self.driver, self.base_url)
        self.driver.set_window_max()
        self.log_in_base = LogInBaseServer(self.driver, self.base_url)
        self.assert_text = AssertText()
        self.driver.wait(1)
        self.driver.clear_cookies()
        self.driver.wait(1)

    def tearDown(self):
        self.driver.quit_browser()

    def test_account_center_overview_set_up_landmark(self):
        # 打开途强在线首页-登录页
        self.base_page.open_page()
        # 登录账号
        self.log_in_base.log_in()
        self.account_center_page_navi_bar.click_account_center_button()
        sleep(2)
        account_center_handle = self.driver.get_current_window_handle()
        # 点击告警
        self.account_center_page_details.account_center_iframe()
        self.account_center_page_details.account_overview('告警')
        self.driver.default_frame()

        all_handles = self.driver.get_all_window_handles()
        for handle in all_handles:
            if handle != account_center_handle:
                self.driver.switch_to_window(handle)
                sleep(2)
                expect_url = self.driver.get_current_url()
                actual_url = self.base_url + '/deviceReport/statisticalReport?modularId=alarmDdetails'
                self.assertEqual(expect_url, actual_url,
                                 '点击告警后,实际的url和期望的不一样!')
                sleep(2)

                actual_text = self.account_center_page_details.get_actual_text_after_click_alarms(
                )
                self.assertEqual(
                    self.assert_text.account_center_page_alarm_details_text(),
                    actual_text, '点击告警后,页面没有跳转到告警总览页面上')

                # 查看控制台告警设置能否打开
                self.account_center_page_navi_bar.click_alarm_button_in_console(
                )
                # 断言
                get_text = self.account_center_page_navi_bar.get_text_after_click_alarm_button(
                )
                self.assertEqual(
                    self.assert_text.account_center_page_alarm_manager_text(),
                    get_text)
                self.account_center_page_navi_bar.close_alarm_in_console()

                self.driver.close_current_page()
                # 回到账户中心窗口
                self.driver.switch_to_window(account_center_handle)
                self.driver.wait()
class TestCase13AccountCenterOverviewForm(unittest.TestCase):
    def setUp(self):
        self.driver = AutomateDriverServer(choose='chrome')
        self.base_url = self.driver.base_url
        self.base_page = BasePageServer(self.driver, self.base_url)
        self.login_page = LoginPage(self.driver, self.base_url)
        self.account_center_page_details = AccountCenterDetailsPage(
            self.driver, self.base_url)
        self.account_center_page_navi_bar = AccountCenterNaviBarPage(
            self.driver, self.base_url)
        self.driver.set_window_max()
        self.log_in_base = LogInBaseServer(self.driver, self.base_url)
        self.assert_text = AssertText()
        self.driver.wait(1)
        self.driver.clear_cookies()
        self.driver.wait(1)

    def tearDown(self):
        self.driver.quit_browser()

    def test_account_center_overview_form(self):
        # 打开途强在线首页-登录页
        self.base_page.open_page()
        # 登录账号
        self.log_in_base.log_in()
        self.account_center_page_navi_bar.click_account_center_button()
        sleep(2)
        account_center_handle = self.driver.get_current_window_handle()
        # 点击统计报表
        self.account_center_page_details.account_center_iframe()
        self.account_center_page_details.account_overview('统计报表')
        self.driver.default_frame()

        all_handles = self.driver.get_all_window_handles()
        for handle in all_handles:
            if handle != account_center_handle:
                self.driver.switch_to_window(handle)
                sleep(2)
                expect_url = self.driver.get_current_url()
                actual_url = self.base_url + '/deviceReport/statisticalReport'
                self.assertEqual(expect_url, actual_url,
                                 '点击统计报表后,实际的url和期望的不一样!')

                # 验证文本
                actual_text = self.account_center_page_details.click_report_after_text(
                )
                self.assertEqual(
                    self.assert_text.account_center_page_statistical_form_text(
                    ), actual_text)

                # 验证运动统计是否被选中
                # get_value_sport_statistion = self.account_center_page_navi_bar.get_value_sport_statistiacl_value()
                # self.assertEqual('active', get_value_sport_statistion)

                # 验证运动总览
                get_value_sport_overview = self.account_center_page_navi_bar.get_value_sport_overview_value(
                )
                self.assertEqual('active', get_value_sport_overview)

                # 验证右侧区域是否为运动总览
                get_text = self.account_center_page_navi_bar.get_text_after_report(
                )
                self.assertEqual(
                    self.assert_text.account_center_page_sport_overview_text(),
                    get_text)

                # 查看控制台告警设置能否打开
                self.account_center_page_navi_bar.click_alarm_button_in_console(
                )
                # 断言
                get_text = self.account_center_page_navi_bar.get_text_after_click_alarm_button(
                )
                self.assertEqual(
                    self.assert_text.account_center_page_alarm_manager_text(),
                    get_text)
                self.account_center_page_navi_bar.close_alarm_in_console()

                self.driver.close_current_page()
                # 回到账户中心窗口
                self.driver.switch_to_window(account_center_handle)
                self.driver.wait()
class TestCase37AccountCenterSearchLowerClientVerify(unittest.TestCase):
    def setUp(self):
        self.driver = AutomateDriverServer(choose='chrome')
        self.base_url = self.driver.base_url
        self.base_page = BasePageServer(self.driver, self.base_url)
        self.login_page = LoginPage(self.driver, self.base_url)
        self.account_center_page_navi_bar = AccountCenterNaviBarPage(
            self.driver, self.base_url)
        self.account_center_page_details = AccountCenterDetailsPage(
            self.driver, self.base_url)
        self.assert_text = AssertText()
        self.driver.set_window_max()
        self.account_center_page_read_csv = AccountCenterPageReadCsv()
        self.log_in_base = LogInBaseServer(self.driver, self.base_page)
        self.account_center_change_page = AccountCenterChangePage(
            self.driver, self.base_page)
        self.driver.wait(1)
        self.driver.clear_cookies()
        self.driver.wait(1)

    def tearDown(self):
        self.driver.quit_browser()

    def test_search_lower_client(self):
        '''通过csv测试账户详情--下级客户--查找不同账号功能'''

        # 打开途强在线首页-登录页
        self.base_page.open_page()
        # 登录账号
        self.log_in_base.log_in()
        self.driver.wait(1)
        self.account_center_page_navi_bar.click_account_center_button()
        self.account_center_change_page.switch_fast_sale_enable()
        self.account_center_change_page.switch_to_fast_sale_frame()

        csv_file = self.account_center_page_read_csv.read_csv(
            'search_different_account.csv')
        csv_data = csv.reader(csv_file)
        for row in csv_data:
            search_account = {"account": row[0]}

            # 查找账户
            search_result = self.account_center_page_details.subordinate_account_search(
                search_account["account"])
            if type(search_result) is str:
                self.assertIn(
                    self.assert_text.account_center_page_no_data_text(),
                    search_result, "搜索结果为暂无数据时,提示不一致")

            else:
                for subscript in range(len(search_result)):
                    text = search_result[subscript].split("(")[0]
                    self.assertIn(search_account["account"], text, "搜索结果不一致")

            self.driver.wait()

        # 直接选择用户
        for user in range(8):
            self.account_center_page_details.fast_sales()
            self.account_center_page_details.click_list_subordinate_client(
                user + 1)

        # 验证enter键输入
        self.account_center_page_details.fast_sales()
        self.account_center_page_details.search_subordinate_client_click_enter(
            "1234")

        self.driver.wait()
        self.driver.default_frame()
        csv_file.close()
class TestCase400830AccountCenterFastSaleEditAddFaility(unittest.TestCase):
    def setUp(self):
        self.driver = AutomateDriverServer(choose='chrome')
        self.base_url = self.driver.base_url
        self.base_page = BasePageServer(self.driver, self.base_url)
        self.login_page = LoginPage(self.driver, self.base_url)
        self.account_center_page_navi_bar = AccountCenterNaviBarPage(
            self.driver, self.base_url)
        self.account_center_page_details = AccountCenterDetailsPage(
            self.driver, self.base_url)
        self.assert_text = AssertText()
        self.driver.set_window_max()
        self.account_center_page_read_csv = AccountCenterPageReadCsv()
        self.log_in_base = LogInBaseServer(self.driver, self.base_page)
        self.driver.wait(1)
        self.driver.clear_cookies()
        self.driver.wait(1)

    def tearDown(self):
        self.driver.quit_browser()

    def test_fast_sale_edit_add_faility_succeed(self):
        '''通过csv测试账户详情-快捷销售-编辑设备名称和设备sim卡号'''
        csv_file = self.account_center_page_read_csv.read_csv(
            'fast_sale_edit_dev_data.csv')
        csv_data = csv.reader(csv_file)

        # 打开途强在线首页-登录页
        self.base_page.open_page()
        # 登录账号
        self.log_in_base.log_in_with_csv("dzltest", "jimi123")
        self.driver.wait(1)
        self.account_center_page_navi_bar.click_account_center_button()

        for row in csv_data:
            data = {
                "account": row[0],
                "device_imei": row[1],
                "selected_dev": row[2],
                "dev_name": row[3],
                "sim": row[4],
                "old_dev_name": row[5],
                "old_sim": row[6]
            }
            # 进入快捷销售页面
            self.account_center_page_details.account_center_iframe()
            self.account_center_page_details.fast_sales()

            # 查找账户
            self.account_center_page_details.fast_sales_find_account(
                data["account"])

            # 输入设备imei精确查找设备并添加
            self.account_center_page_details.fast_sales_find_and_add_device(
                data["device_imei"])
            self.driver.default_frame()
            self.driver.wait()
            # 关闭消息提示框
            try:
                self.account_center_page_details.click_prompt_close()
            except:
                print("没有消息弹框提示")

            # self.account_center_page_details.account_center_iframe()
            # 获取列表设备imei,名称和sim卡号
            info = self.account_center_page_details.get_list_add_equipment_user_and_sim(
            )

            # 验证设备名称和sim卡的元素长度
            self.assertEqual(
                50,
                self.account_center_page_details.get_fast_sale_dev_name_len(),
                "设备名称长度不一致")
            self.assertEqual(
                20,
                self.account_center_page_details.get_fast_sale_dev_sim_len(),
                "设备sim卡长度不一致")

            # 编辑设备名称和sim卡号
            self.account_center_page_details.edit_list_add_equipment(
                info["imei"], data["dev_name"], data["sim"])

            # 点击用户到期时间
            self.account_center_page_details.account_center_iframe()
            self.account_center_page_details.choose_account_expired_time(
                data["selected_dev"])
            sleep(1)
            # 销售
            self.account_center_page_details.sale_button()
            # 通过弹出框状态验证是否销售成功
            sale_status_text = self.account_center_page_details.get_sale_status(
            )
            self.assertIn(
                self.assert_text.account_center_page_operation_done(),
                sale_status_text, "销售失败")
            self.driver.default_frame()
            sleep(2)

            # 点击设备管理
            dev_data = self.account_center_page_details.get_dev_manage_equipment_user_and_sim(
                info["imei"])
            for i in range(len(dev_data["dev_imei"])):
                if data["dev_name"] != "":
                    self.assertEqual(info["imei"][i] + data["dev_name"],
                                     dev_data["dev_name"][i], "设备名称与期望不一致")
                else:
                    self.assertIn(info["imei"][i][10:],
                                  dev_data["dev_name"][i],
                                  "为空时,设备名称不存在后五位imei")

                self.assertEqual(data["sim"], dev_data["dev_sim"][i],
                                 "sim卡与期望不一致")

            # 改设备数据
            self.account_center_page_details.dev_manage_edit_equipment_user_and_sim(
                data["old_dev_name"], data["old_sim"])

            break