예제 #1
0
class TestCase310SetUpIssuedCommandTaskManagementOperation(unittest.TestCase):
    # 测试 设置 - 指令管理 - 下发工作指令任务的操作

    driver = None
    base_url = None
    base_page = None
    log_in_page = None
    command_management_page = None
    base_paging_function = None

    def setUp(self):
        # 前置条件
        # 实例化对象
        self.driver = AutomateDriver(choose='firefox')
        self.base_url = self.driver.base_url
        self.base_page = BasePage(self.driver, self.base_url)
        self.command_management_page = CommandManagementPage(self.driver, self.base_url)
        self.base_paging_function = BasePagingFunction(self.driver, self.base_url)
        self.log_in_base = LogInBase(self.driver, self.base_url)
        self.assert_text = AssertText()

        # 打开页面,填写用户名、密码、点击登录
        self.base_page.open_page()
        self.driver.set_window_max()
        self.driver.implicitly_wait(5)
        self.driver.clear_cookies()
        self.log_in_base.log_in_jimitest()

        # 登录之后点击控制台,然后点击指令管理
        self.command_management_page.click_control_after_click_command_management()
        sleep(3)

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

    def test_case_set_up_issued_command_task_management_operation(self):
        # 断言url
        expect_url_after_click_command_management = self.base_url + '/custom/toTemplate'
        self.assertEqual(expect_url_after_click_command_management,
                         self.command_management_page.actual_url_click_command_management())
        # 断言左侧列表的title文本
        expect_title_text_after_click_command_management = self.assert_text.command_manager_page_command_type()
        self.assertEqual(expect_title_text_after_click_command_management,
                         self.command_management_page.actual_title_text_after_click_command_management())

        # 点击下发任务指令管理
        self.command_management_page.click_lift_list('issued_command_task_management')
        # 断言
        expect_title_text_after_click_issued_command_task_management = \
            self.assert_text.command_manager_page_issued_command_task()
        self.assertEqual(expect_title_text_after_click_issued_command_task_management,
                         self.command_management_page.actual_text_after_click_issued_command_task())

        # 点击查看设备
        self.command_management_page.click_look_equipment_in_issued_command_task()

        # 断言
        expect_text_after_click_look_equipment = self.assert_text.command_manager_page_issued_command_manager()
        self.assertEqual(expect_text_after_click_look_equipment,
                         self.command_management_page.actual_text_after_click_look_equipment())
class TestCase103DevManageDevFence(unittest.TestCase):
    def setUp(self):
        self.driver = AutomateDriver()
        self.base_url = self.driver.base_url
        self.base_page = BasePage(self.driver, self.base_url)
        self.dev_manage_page = DevManagePages(self.driver, self.base_url)
        self.driver.set_window_max()
        self.log_in_base = LogInBase(self.driver, self.base_url)
        self.dev_manage_page_read_csv = DevManagePageReadCsv()
        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_case_103_dev_manage_dev_fence(self):
        # 打开途强在线首页-登录页
        self.base_page.open_page()
        # 登录
        self.log_in_base.log_in()
        # 点击进入设备管理
        self.dev_manage_page.enter_dev_manage()

        # 搜索设备564123456789567
        self.dev_manage_page.search_dev_in_dev_manage_page('121201234567889')
        self.dev_manage_page.click_look_dev_fence_in_dev_page()

        # 判断进出围栏是否勾选
        in_fence = self.dev_manage_page.get_in_fence_select_in_look_fence_page(
        )
        out_fence = self.dev_manage_page.get_out_fence_select_in_look_fence_page(
        )
        if in_fence == True:
            self.dev_manage_page.click_in_fence_input_checkbox()
            in_fence = self.dev_manage_page.get_in_fence_select_in_look_fence_page(
            )
            self.assertEqual(False, in_fence)
        else:
            self.dev_manage_page.click_in_fence_input_checkbox()
            in_fence = self.dev_manage_page.get_in_fence_select_in_look_fence_page(
            )
            self.assertEqual(True, in_fence)

        if out_fence == True:
            self.dev_manage_page.click_out_fence_input_checkbox()
            out_fence = self.dev_manage_page.get_out_fence_select_in_look_fence_page(
            )
            self.assertEqual(False, out_fence)
        else:
            self.dev_manage_page.click_out_fence_input_checkbox()
            out_fence = self.dev_manage_page.get_out_fence_select_in_look_fence_page(
            )
            self.assertEqual(True, out_fence)

        # 点击保存
        # self.dev_manage_page.click_ensure()
        # 点击取消
        self.dev_manage_page.click_cancels()
class TestCase81DevManageBatchUploadPictures(unittest.TestCase):
    def setUp(self):
        self.driver = AutomateDriver()
        self.base_url = self.driver.base_url
        self.base_page = BasePage(self.driver, self.base_url)
        self.dev_manage_page = DevManagePages(self.driver, self.base_url)
        self.driver.set_window_max()
        self.log_in_base = LogInBase(self.driver, self.base_url)
        self.dev_manage_page_read_csv = DevManagePageReadCsv()
        self.driver.wait(1)
        self.driver.clear_cookies()
        self.driver.wait(1)

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

    def test_case_dev_manage_batch_upload_pictures(self):
        # 打开途强在线首页-登录页
        self.base_page.open_page()
        # 登录
        self.log_in_base.log_in()
        # 点击进入设备管理
        self.dev_manage_page.enter_dev_manage()

        # 点击批量
        self.dev_manage_page.click_batch_upload_pictures_button()
        self.dev_manage_page.click_close_batch_upload_pictures_button()

        self.dev_manage_page.click_batch_upload_pictures_button()
        self.dev_manage_page.click_cancel_batch_upload_pictures_button()

        self.dev_manage_page.click_batch_upload_pictures_button()
        self.dev_manage_page.click_ensure_upload()
class TestCase168OnLineFormOperation(unittest.TestCase):
    def setUp(self):
        # 前置条件
        # 实例化对象
        self.driver = AutomateDriver()
        self.base_url = self.driver.base_url
        self.base_page = BasePage(self.driver, self.base_url)
        self.statistical_form_page = StatisticalFormPage(
            self.driver, self.base_url)
        self.statistical_form_page_read_csv = StatisticalFormPageReadCsv()
        self.log_in_base = LogInBase(self.driver, self.base_url)
        self.connect_sql = ConnectSql()
        self.assert_text = AssertText()
        # 打开页面,填写用户名、密码、点击登录
        self.base_page.open_page()
        self.driver.set_window_max()
        self.driver.implicitly_wait(5)
        self.log_in_base.log_in_jimitest()

        # 登录之后点击控制台,然后点击设置
        self.statistical_form_page.click_control_after_click_statistical_form_page(
        )
        sleep(3)

    def tearDown(self):
        # 退出浏览器
        self.driver.quit_browser()

    def test_case_on_line_form_operation(self):
        # 断言url
        expect_url_after_click_statistical_form = self.base_url + '/deviceReport/statisticalReport'
        self.assertEqual(
            expect_url_after_click_statistical_form,
            self.statistical_form_page.actual_url_after_statistical_form())

        # 点击离线统计
        self.statistical_form_page.click_on_line_form_button()

        # 断言文本
        text = self.statistical_form_page.get_text_after_click_on_line_form_button(
        )
        self.assertEqual(self.assert_text.statistical_form_on_line_form(),
                         text)

        # # 循环客户树
        for n in range(5):
            get_select_account = self.statistical_form_page.get_select_account_in_on_line_form(
                n)
            self.statistical_form_page.click_customer_in_on_line(n)
            get_search_input_account = self.statistical_form_page.get_search_input_account_in_on_line_form(
            )
            self.assertEqual(get_search_input_account, get_select_account)
        # 搜索客户树无数据
        self.statistical_form_page.add_data_to_search_customer_in_on_line(
            '无数据')
        sleep(3)
        text = self.statistical_form_page.get_text_after_click_search_in_on_line(
        )
        self.assertIn(self.assert_text.account_center_page_no_data_text(),
                      text)
class TestCase05UserCenterLogout(unittest.TestCase):
    # 测试用户中心退出登录
    def setUp(self):
        self.driver = AutomateDriver()
        self.base_url = self.driver.base_url
        self.base_page = BasePage(self.driver, self.base_url)
        self.login_page = LoginPage(self.driver, self.base_url)
        self.user_center = UserCenter(self.driver, self.base_url)
        self.log_in_page_read_csv = LogInPageReadCsv()
        self.driver.set_window_max()
        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_user_center_logout(self):
        '''测试用户中心退出登录功能'''
        self.base_page.open_page()
        self.login_page.test_user_login()

        # 取消退出登录
        self.user_center.logout_dismiss()

        # 关闭退出登录
        self.user_center.logout_close()

        # 确认退出登录
        self.user_center.logout()
class TestCase163SportStatisticalPakingNotShutDownOperation(unittest.TestCase):
    def setUp(self):
        # 前置条件
        # 实例化对象
        self.driver = AutomateDriver()
        self.base_url = self.driver.base_url
        self.base_page = BasePage(self.driver, self.base_url)
        self.statistical_form_page = StatisticalFormPage(
            self.driver, self.base_url)
        self.statistical_form_page_read_csv = StatisticalFormPageReadCsv()
        self.log_in_base = LogInBase(self.driver, self.base_url)
        # 打开页面,填写用户名、密码、点击登录
        self.base_page.open_page()
        self.driver.set_window_max()
        self.driver.implicitly_wait(5)
        self.log_in_base.log_in_jimitest()

        # 登录之后点击控制台,然后点击设置
        self.statistical_form_page.click_control_after_click_statistical_form_page(
        )
        sleep(3)

    def tearDown(self):
        # 退出浏览器
        self.driver.quit_browser()

    def test_case_sport_statistical_parking_not_shut_down_operation(self):
        # 断言url
        expect_url_after_click_statistical_form = self.base_url + '/deviceReport/statisticalReport'
        self.assertEqual(
            expect_url_after_click_statistical_form,
            self.statistical_form_page.actual_url_after_statistical_form())
        # 点击停留报表
        self.statistical_form_page.click_paking_not_shut_down_form_button()

        for n in range(5):
            self.statistical_form_page.click_customer_in_stay_not_shut_down_form(
                n)
            # 点击搜索设备按钮
            self.statistical_form_page.click_search_dev_button_in_stay_not_shut_down(
            )
            # 获取有多少组
            number = self.statistical_form_page.get_group_number_in_stay_not_shut_down(
            )
            if number == 0:
                pass
            else:
                for m in range(number):
                    # 收起默认组
                    self.statistical_form_page.click_defalut_group_in_stay_not_shut_down(
                    )
                    # 获取每个组设备的数量
                    dev_number = self.statistical_form_page.get_dev_number_in_stay_not_shut_down(
                        m)
                    # 点开每一个分组
                    self.statistical_form_page.click_per_group_in_stay_not_shut_down(
                        m)
                    dev_number_list = self.statistical_form_page.get_dev_number_list_in_stay_not_shut_down(
                        m)
                    self.assertEqual(str(dev_number_list), dev_number)
class TestCase04LoginWithTester(unittest.TestCase):
    # 测试体验账号登录
    def setUp(self):
        self.driver = AutomateDriver()
        self.base_url = self.driver.base_url
        self.base_page = BasePage(self.driver, self.base_url)
        self.login_page = LoginPage(self.driver, self.base_url)
        self.user_center = UserCenter(self.driver, self.base_url)
        self.log_in_page_read_csv = LogInPageReadCsv()
        self.driver.set_window_max()
        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_user_login_exception(self):
        '''测试体验账号登录'''

        # 打开风控首页-登录页
        self.base_page.open_page()

        # 点击“我要体验”
        self.login_page.taste()

        # 判断登录成功后招呼栏的用户名是否正确
        username = self.user_center.get_username()

        self.assertEqual('小明', username, '登录成功后招呼栏的用户名错误')

        # 成功退出系统
        sleep(2)
        self.user_center.logout()
예제 #8
0
class TestCase122UserSearchTransferUser(unittest.TestCase):
    def setUp(self):
        self.driver = AutomateDriver()
        self.base_url = self.driver.base_url
        self.base_page = BasePage(self.driver, self.base_url)
        self.global_dev_search_page = GlobalDevSearchPage(
            self.driver, self.base_url)
        self.account_center_page_navi_bar = AccountCenterNaviBarPages(
            self.driver, self.base_url)
        self.driver.set_window_max()
        self.global_account_search_page = GlobalAccountSearchPage(
            self.driver, self.base_url)
        self.log_in_base = LogInBase(self.driver, self.base_url)
        self.global_search_page_read_csv = GlobleSearchPageReadCsv()
        self.search_sql = SearchSql()
        self.driver.wait(1)
        self.connect_sql = ConnectSql()
        self.assert_text = AssertText()
        self.driver.clear_cookies()
        self.driver.wait(1)

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

    def test_case_user_search_transfer_user(self):
        # 打开途强在线首页-登录页
        self.base_page.open_page()
        self.log_in_base.log_in()
        # 点击账号中心
        self.log_in_base.click_account_center_button()
        self.global_dev_search_page.click_easy_search()
        # 关闭
        self.global_dev_search_page.close_search()
        sleep(2)

        self.global_dev_search_page.click_easy_search()

        # 选择用户搜索
        self.global_dev_search_page.click_user_search_buttons()

        # 获取列表中第二个用户的账号
        self.global_dev_search_page.swith_to_search_frame()
        get_second_user_account = self.global_account_search_page.get_second_user_account_after_search_user(
        )
        # 点击详情
        self.global_account_search_page.click_user_detail_button()
        # 点击销售设备
        self.global_account_search_page.click_transfer_user_button_in_user_detail_button(
        )
        # 选择的用户是该用户(用户详情所属的用户)或其下级用户,提示“选择的用户不能作为上级用户”
        self.global_account_search_page.search_user_to_transfer_user_in_user_detail(
            get_second_user_account)
        get_text = self.global_account_search_page.get_text_after_click_transfer_user(
        )
        self.assertEqual(
            self.assert_text.the_selected_user_cannot_be_the_superior(),
            get_text)
예제 #9
0
class TestCase152GuideManchineReportSearchUser(unittest.TestCase):
    '''
    导游播报统计搜索用户
    author :zhangAo
    '''
    def setUp(self):
        # 前置条件
        # 实例化对象
        self.driver = AutomateDriver()
        self.base_url = self.driver.base_url
        self.base_page = BasePage(self.driver, self.base_url)
        self.statistical_form_page = StatisticalFormPage(
            self.driver, self.base_url)
        self.statistical_form_page_read_csv = StatisticalFormPageReadCsv()
        self.log_in_base = LogInBase(self.driver, self.base_url)
        self.connect_sql = ConnectSql()
        self.search_sql = SearchSql(self.driver, self.base_url)
        # 打开页面,填写用户名、密码、点击登录
        self.base_page.open_page()
        self.driver.set_window_max()
        self.driver.implicitly_wait(5)
        self.driver.clear_cookies()
        self.log_in_base.log_in_jimitest()

        # 登录之后点击控制台,然后点击设置
        self.statistical_form_page.click_control_after_click_statistical_form_page(
        )
        sleep(3)

    def tearDown(self):
        # 退出浏览器
        self.driver.quit_browser()

    def test_case_guide_manchine_report_search_user(self):
        # 断言url
        expect_url_after_click_statistical_form = self.base_url + '/deviceReport/statisticalReport'
        self.assertEqual(
            expect_url_after_click_statistical_form,
            self.statistical_form_page.actual_url_after_statistical_form())

        # 点击停留报表
        self.statistical_form_page.click_guide_manchine_report_button()

        # 循环点击用户
        self.statistical_form_page.switch_to_guide_manchine_report_frame()
        for n in range(5):
            self.statistical_form_page.click_search_user_button_in_guide_manchine_report(
            )
            get_user_name = self.statistical_form_page.get_user_name_in_guide_manchine_report(
                n + 1)
            self.statistical_form_page.click_per_user_in_guide_manchine_report(
                n + 1)
            user_name = self.statistical_form_page.user_name_in_guide_manchine_report(
            )
            self.assertEqual(get_user_name, user_name)
        self.driver.default_frame()
class TestCase95DevManageBatchSaleByNoDev(unittest.TestCase):
    def setUp(self):
        self.driver = AutomateDriver()
        self.base_url = self.driver.base_url
        self.base_page = BasePage(self.driver, self.base_url)
        self.dev_manage_page = DevManagePages(self.driver, self.base_url)
        self.driver.set_window_max()
        self.log_in_base = LogInBase(self.driver, self.base_url)
        self.dev_manage_page_read_csv = DevManagePageReadCsv()
        self.driver.wait(1)
        self.driver.clear_cookies()
        self.assert_text = AssertText()
        self.driver.wait(1)

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

    def test_case_dev_manage_batch_sale_by_no_dev(self):
        # 打开途强在线首页-登录页
        self.base_page.open_page()
        self.log_in_base.log_in()
        # 点击进入设备管理
        self.dev_manage_page.enter_dev_manage()
        # 点击批量
        self.dev_manage_page.click_batch_sale_button()
        self.dev_manage_page.click_close_batch_sale_button()
        self.dev_manage_page.click_batch_sale_button()
        # 验证界面
        get_sale_title = self.dev_manage_page.get_sale_title_text_in_sale_dev()
        self.assertEqual(self.assert_text.batch_sale_text(), get_sale_title)

        # 搜索框输入多个设备IMEI,点击添加(设备之间用enter键、逗号隔开)
        self.dev_manage_page.add_imei_in_sale_dev_page(
            '121201234567889,867597011453591')
        get_dev_in_list_number = self.dev_manage_page.get_dev_in_list_number()
        self.assertEqual(2, get_dev_in_list_number)

        # 搜索框输入多个设备IMEI,点击添加(设备之间不用enter键、逗号隔开,而用空格隔开)
        self.dev_manage_page.add_imei_in_sale_dev_page(
            '121201234567889867597011453591')
        add_dev_state = self.dev_manage_page.add_dev_after_fail_state()
        self.assertEqual(self.assert_text.dev_page_fail_text(), add_dev_state)
        add_dev_reason = self.dev_manage_page.add_dev_after_fail_reason()
        self.assertEqual(self.assert_text.dev_page_inexistence_text(),
                         add_dev_reason)
        self.dev_manage_page.click_close_fails()

        # 不选择销售对象进行销售
        self.dev_manage_page.click_sale_button()
        # text = self.dev_manage_page.get_error_text_after_ensure()
        # self.assertEqual(self.assert_text.glob_search_please_add_account_text(), text)

        # 点击重置的按钮
        self.dev_manage_page.click_clear_button_in_dev_sale()
        get_dev_in_list_number = self.dev_manage_page.get_dev_in_list_number()
        self.assertEqual(0, get_dev_in_list_number)
예제 #11
0
class TestCase127DevSearchIssuedCommand(unittest.TestCase):
    def setUp(self):
        self.driver = AutomateDriver()
        self.base_url = self.driver.base_url
        self.base_page = BasePage(self.driver, self.base_url)
        self.global_dev_search_page = GlobalDevSearchPage(
            self.driver, self.base_url)
        self.account_center_page_navi_bar = AccountCenterNaviBarPages(
            self.driver, self.base_url)
        self.driver.set_window_max()
        self.global_account_search_page = GlobalAccountSearchPage(
            self.driver, self.base_url)
        self.log_in_base = LogInBase(self.driver, self.base_url)
        self.global_search_page_read_csv = GlobleSearchPageReadCsv()
        self.search_sql = SearchSql()
        self.driver.wait(1)
        self.connect_sql = ConnectSql()
        self.assert_text = AssertText()
        self.driver.clear_cookies()
        self.driver.wait(1)

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

    def test_case_dev_search_issued_command(self):
        # 打开途强在线首页-登录页
        self.base_page.open_page()
        self.log_in_base.log_in()
        self.log_in_base.click_account_center_button()
        self.global_dev_search_page.click_easy_search()
        # 关闭
        self.global_dev_search_page.close_search()
        sleep(2)
        self.global_dev_search_page.click_easy_search()
        self.global_dev_search_page.click_dev_searchs()
        # 选择设备搜索
        sleep(5)
        self.global_dev_search_page.swith_to_search_frame()
        sleep(5)
        # 点击详情
        self.global_dev_search_page.click_dev_detail_after_search_dev()

        get_imei = self.global_dev_search_page.get_imei_in_dev_detail()
        get_dev_name = self.global_dev_search_page.get_dev_types_in_dev_detail(
        )

        # 点击设备指令
        self.global_dev_search_page.clcik_dev_command_button()

        get_imei_in_command_page = self.global_dev_search_page.get_dev_imei_in_command_page(
        )
        get_dev_name_in_command_page = self.global_dev_search_page.get_dev_name_in_command_page(
        )

        self.assertEqual(get_imei, get_imei_in_command_page)
        self.assertEqual(get_dev_name, get_dev_name_in_command_page)
class TestCase02LoginException(unittest.TestCase):
    # 测试登录异常情况
    def setUp(self):
        self.driver = AutomateDriver()
        self.base_url = self.driver.base_url
        self.base_page = BasePage(self.driver, self.base_url)
        self.login_page = LoginPage(self.driver, self.base_url)
        self.log_in_page_read_csv = LogInPageReadCsv()
        self.driver.set_window_max()
        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_user_login_exception(self):
        '''测试用户账户登录异常'''

        # 打开风控首页-登录页
        self.base_page.open_page()

        # 第一种,密码和账号都为空
        self.login_page.account_input('')
        self.login_page.password_input('')
        self.login_page.login_button_click()
        self.driver.wait()
        self.assertEqual('登录账号不能为空', self.login_page.get_exception_text())

        # 第二种,密码和账号其中一个不为空
        self.login_page.account_input('syntest')
        self.login_page.password_input('')
        self.login_page.login_button_click()
        self.driver.wait()
        self.assertEqual('登陆密码不能为空', self.login_page.get_exception_text())

        self.login_page.account_input('')
        self.login_page.password_input('jimi123')
        self.login_page.login_button_click()
        self.driver.wait()
        self.assertEqual('登录账号不能为空', self.login_page.get_exception_text())

        # 第三种,账号不存在
        self.login_page.account_input('abdwerewf')
        self.login_page.password_input('123')
        self.login_page.login_button_click()
        self.driver.wait()
        self.assertEqual('账号不存在或者已经停用', self.login_page.get_exception_text())

        # 第四种,密码错误
        self.login_page.account_input('syntest')
        self.login_page.password_input('jimi')
        self.login_page.login_button_click()
        self.driver.wait()
        self.assertEqual('登录密码验证错误', self.login_page.get_exception_text())
class TestCase86DevManageAllSetUpWorkCommand(unittest.TestCase):
    def setUp(self):
        self.driver = AutomateDriver()
        self.base_url = self.driver.base_url
        self.base_page = BasePage(self.driver, self.base_url)
        self.dev_manage_page = DevManagePages(self.driver, self.base_url)
        self.assert_text = AssertText()
        self.driver.set_window_max()
        self.log_in_base = LogInBase(self.driver, self.base_url)
        self.dev_manage_page_read_csv = DevManagePageReadCsv()
        self.driver.wait(1)
        self.driver.clear_cookies()
        self.driver.wait(1)

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

    def test_case_dev_manage_all_set_up_work_command(self):
        # 打开途强在线首页-登录页
        self.base_page.open_page()
        # 登录
        self.log_in_base.log_in()
        # 点击进入设备管理
        self.dev_manage_page.enter_dev_manage()

        # 点击本次查询全部设置工作模式
        # self.dev_manage_page.click_all_set_up_work_command()
        # 点击关闭
        # self.dev_manage_page.click_close_all_set_up_work_command()

        # 点击本次查询全部设置工作模式
        # self.dev_manage_page.click_all_set_up_work_command()
        # 点击取消
        # self.dev_manage_page.click_cancel_all_set_up_work_command()

        # 点击本次查询全部设置工作模式
        self.dev_manage_page.click_all_set_up_work_command()

        try:
            # 检查数量
            get_list_number = self.dev_manage_page.get_list_number()
            get_count_number = self.dev_manage_page.get_count_number()
            self.assertEqual(str(get_list_number), get_count_number)

            # 循环点击删除
            for n in range(get_list_number):
                self.dev_manage_page.delete_dev()

            # 点击发送指令
            self.dev_manage_page.click_issued_command_button()
        except:
            # 获取提示语
            text = self.dev_manage_page.get_text_after_click_all_issued_command(
            )
            self.assertEqual(self.assert_text.dev_type_is_different(), text)
예제 #14
0
class TestCase04UserCenterModifyPassword(unittest.TestCase):
    # 测试个人中心修改密码
    def setUp(self):
        self.driver = AutomateDriver()
        self.base_url = self.driver.base_url
        self.base_page = BasePage(self.driver, self.base_url)
        self.login_page = LoginPage(self.driver, self.base_url)
        self.user_center = UserCenter(self.driver, self.base_url)
        self.log_in_page_read_csv = LogInPageReadCsv()
        self.user_center_read_csv = UserCenterReadCsv()
        self.driver.set_window_max()
        self.connect_sql = ConnectSql()
        self.driver.wait(1)
        self.driver.clear_cookies()
        self.driver.wait(1)

        # 打开途强在线首页-登录页
        self.base_page.open_page()
        sleep(1)
        # 登录账号
        self.login_page.test_user_login()

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

    def test_user_center_modify_password(self):
        # 通过csv测试修改密码功能

        # 点击打开修改密码框
        self.user_center.click_edit_password()

        csv_file = self.user_center_read_csv.read_csv(
            "modify_password_exception.csv")
        csv_data = csv.reader(csv_file)
        for row in csv_data:
            data = {
                "old_password": row[0],
                "new_password": row[1],
                "new_password2": row[2],
                "pwd_prompt": row[3],
            }

            text = self.user_center.get_modify_pwd_exception_prompt(
                data['old_password'], data['new_password'],
                data['new_password2'])

            self.assertIn(data["pwd_prompt"], text, "修改密码,错误提示语显示不一致")

        csv_file.close()

        # 关闭修改密码框
        self.user_center.click_edit_password_close()

        # 退出登录
        self.user_center.logout()
class TestCase102DevManageDevDetailDevMileage(unittest.TestCase):
    def setUp(self):
        self.driver = AutomateDriver()
        self.base_url = self.driver.base_url
        self.base_page = BasePage(self.driver, self.base_url)
        self.dev_manage_page = DevManagePages(self.driver, self.base_url)
        self.driver.set_window_max()
        self.log_in_base = LogInBase(self.driver, self.base_url)
        self.dev_manage_page_read_csv = DevManagePageReadCsv()
        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_case_dev_manage_dev_detail_dev_mileage(self):
        # 打开途强在线首页-登录页
        self.base_page.open_page()
        # 登录
        self.log_in_base.log_in()
        # 点击进入设备管理
        self.dev_manage_page.enter_dev_manage()
        self.dev_manage_page.click_edit_button()
        self.dev_manage_page.click_close_edit_button()
        self.dev_manage_page.click_edit_button()

        # 点击客户信息
        self.dev_manage_page.click_cust_info_button()

        # 获取总里程的最大长度
        dev_total_mileage_max_len = self.dev_manage_page.get_dev_total_mileage_max_len(
        )
        self.assertEqual('10', dev_total_mileage_max_len)

        # 输入非数字
        self.dev_manage_page.input_dev_total_mileage_in_dev_detail('1we23')
        # 获取异常的文字
        text = self.assert_text.dev_total_mileage_text1()
        self.dev_manage_page.click_ensure()
        web_text = self.dev_manage_page.get_text_after_input_dev_total_mileage(
        )
        self.assertEqual(text, web_text)

        # 输入大于999999
        self.dev_manage_page.input_dev_total_mileage_in_dev_detail(
            '1000000000')
        # 获取异常的文字
        text = self.assert_text.dev_total_mileage_text2()
        self.dev_manage_page.click_ensure()
        web_text = self.dev_manage_page.get_text_after_input_dev_total_mileage(
        )
        self.assertEqual(text, web_text)
예제 #16
0
class TestCase165StatisticalFormAlarmOverview(unittest.TestCase):
    def setUp(self):
        # 前置条件
        # 实例化对象
        self.driver = AutomateDriver()
        self.base_url = self.driver.base_url
        self.base_page = BasePage(self.driver, self.base_url)
        self.alarm_info_page = AlarmInfoPage(self.driver, self.base_url)
        self.statistical_form_page_read_csv = StatisticalFormPageReadCsv()
        self.log_in_base = LogInBase(self.driver, self.base_url)
        self.statistical_form_page = StatisticalFormPage(self.driver, self.base_url)
        self.connect_sql = ConnectSql()

        # 打开页面,填写用户名、密码、点击登录
        self.base_page.open_page()
        self.driver.set_window_max()
        self.driver.implicitly_wait(5)
        self.log_in_base.log_in_jimitest()

        # 登录之后点击控制台,然后点击指令管理
        self.statistical_form_page.click_control_after_click_statistical_form_page()
        time.sleep(3)

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

    def test_case_statistical_form_alarm_overview(self):
        # 断言url
        expect_url = self.base_url + '/deviceReport/statisticalReport'
        self.assertEqual(expect_url, self.alarm_info_page.actual_url_click_alarm())

        # 点击告警总览
        self.alarm_info_page.click_alarm_overview_list()

        for n in range(5):
            self.statistical_form_page.click_customer_in_alarm_overview(n)
            # 点击搜索设备按钮
            self.statistical_form_page.click_search_dev_button_alarm_form()
            # 获取有多少组
            number = self.statistical_form_page.get_group_number_in_alarm_overview_form()
            if number == 0:
                pass
            else:
                for m in range(number):
                    # 收起默认组
                    self.statistical_form_page.click_defalut_group_in_alarm_overview_form()
                    # 获取每个组设备的数量
                    dev_number = self.statistical_form_page.get_dev_number_in_alarm_overview_form(m)
                    # 点开每一个分组
                    self.statistical_form_page.click_per_group_in_alarm_overview_form(m)
                    dev_number_list = self.statistical_form_page.get_dev_number_list_in_alarm_overview_form(m)
                    self.assertEqual(str(dev_number_list), dev_number)
예제 #17
0
class TestCase97DevManageEditAccount(unittest.TestCase):
    def setUp(self):
        self.driver = AutomateDriver()
        self.base_url = self.driver.base_url
        self.base_page = BasePage(self.driver, self.base_url)
        self.dev_manage_page = DevManagePages(self.driver, self.base_url)
        self.driver.set_window_max()
        self.log_in_base = LogInBase(self.driver, self.base_url)
        self.dev_manage_page_read_csv = DevManagePageReadCsv()
        self.connect_sql = ConnectSql()
        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_case_dev_manage_edit_account(self):
        # 打开途强在线首页-登录页
        self.base_page.open_page()
        # 登录
        self.log_in_base.log_in()
        # 点击进入设备管理
        self.dev_manage_page.enter_dev_manage()

        # 点击下级用户
        self.dev_manage_page.click_next_user_in_dev_page()

        # 点击编辑用户
        self.dev_manage_page.click_edit_account_button()
        self.dev_manage_page.click_close_edit_button()
        self.dev_manage_page.click_edit_account_button()

        self.dev_manage_page.switch_to_dev_edit_frame()
        # 搜索用户
        self.dev_manage_page.search_account_in_edit_user()
        get_user_name_after_search = self.dev_manage_page.get_user_name_after_search_in_edit_user(
        )
        up_user = self.dev_manage_page.get_up_user_edit_user_in_dev_page()
        self.assertIn(up_user, get_user_name_after_search)

        # 循环点击
        for n in range(5):
            self.dev_manage_page.click_user_to_search_up_user_in_edit_user(n)
            up_user = self.dev_manage_page.get_up_user_edit_user_in_dev_page()
            get_user_name_after_search = self.dev_manage_page.get_user_name_after_search_in_edit_user(
            )
            self.assertIn(up_user, get_user_name_after_search)

        self.driver.default_frame()
예제 #18
0
class TestCase98DevManagePagingFunction(unittest.TestCase):
    def setUp(self):
        self.driver = AutomateDriver()
        self.base_url = self.driver.base_url
        self.base_page = BasePage(self.driver, self.base_url)
        self.dev_manage_page = DevManagePages(self.driver, self.base_url)
        self.driver.set_window_max()
        self.log_in_base = LogInBase(self.driver, self.base_url)
        self.dev_manage_page_read_csv = DevManagePageReadCsv()
        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_dev_manager_paging_function(self):
        '''测试设备管理-设备搜索-by imei'''

        # 打开途强在线首页-登录页
        self.base_page.open_page()
        # 登录
        self.log_in_base.log_in_jimitest()
        # 点击进入设备管理
        self.dev_manage_page.enter_dev_manage()

        # 全部设备_分页默认显示每页20条
        # get_paging_text = self.dev_manage_page.get_paging_text()
        # self.assertEqual(self.assert_text.per_20_page(), get_paging_text)

        # 获取总共有多少页
        total_page_number = self.dev_manage_page.get_total_page_number_in_dev_manager()

        if total_page_number == 1:
            get_up_page_state = self.dev_manage_page.get_up_page_state()
            self.assertEqual('active', get_up_page_state)

            get_next_page_state = self.dev_manage_page.get_next_page_state()
            self.assertEqual('active', get_next_page_state)

        elif total_page_number == 0:
            text = self.dev_manage_page.get_search_no_dev_name_text()
            self.assertIn(self.assert_text.account_center_page_no_data_text(), text)

        else:
            for n in range(total_page_number):
                self.dev_manage_page.click_per_page(n + 1)

        if total_page_number != 0:
            self.dev_manage_page.click_per_number()
class TestCase172StatusStatistical(unittest.TestCase):
    def setUp(self):
        # 前置条件
        # 实例化对象
        self.driver = AutomateDriver()
        self.base_url = self.driver.base_url
        self.base_page = BasePage(self.driver, self.base_url)
        self.statistical_form_page = StatisticalFormPage(
            self.driver, self.base_url)
        self.statistical_form_page_read_csv = StatisticalFormPageReadCsv()
        self.log_in_base = LogInBase(self.driver, self.base_url)
        self.connect_sql = ConnectSql()
        self.assert_text = AssertText()
        # 打开页面,填写用户名、密码、点击登录
        self.base_page.open_page()
        self.driver.set_window_max()
        self.driver.implicitly_wait(5)
        self.log_in_base.log_in_jimitest()

        # 登录之后点击控制台,然后点击设置
        self.statistical_form_page.click_control_after_click_statistical_form_page(
        )
        sleep(3)

    def tearDown(self):
        # 退出浏览器
        self.driver.quit_browser()

    def test_case_172_status_statistical(self):
        # 断言url
        expect_url_after_click_statistical_form = self.base_url + '/deviceReport/statisticalReport'
        self.assertEqual(
            expect_url_after_click_statistical_form,
            self.statistical_form_page.actual_url_after_statistical_form())

        # 点击离线统计
        self.statistical_form_page.click_status_statistical_form_button()
        # 切换到状态统计的frame里面
        self.statistical_form_page.switch_to_status_statistical_frame()
        # 点击选择所有状态
        self.statistical_form_page.select_all_status_in_status_statistical_form(
        )
        # 点击搜索
        self.statistical_form_page.click_search_button_in_status_statistical_form(
        )
        self.driver.default_frame()
class TestCase80DevManageSearchCustomer(unittest.TestCase):
    def setUp(self):
        self.driver = AutomateDriver()
        self.base_url = self.driver.base_url
        self.base_page = BasePage(self.driver, self.base_url)
        self.dev_manage_page = DevManagePages(self.driver, self.base_url)
        self.driver.set_window_max()
        self.log_in_base = LogInBase(self.driver, self.base_url)
        self.dev_manage_page_read_csv = DevManagePageReadCsv()
        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_case_dev_manage_search_customer(self):
        # 打开途强在线首页-登录页
        self.base_page.open_page()
        # 登录
        self.log_in_base.log_in()
        # 点击进入设备管理
        self.dev_manage_page.enter_dev_manage()

        # 循环点击5次
        for n in range(5):
            self.driver.click_element(
                'x,//*[@id="treeDemo_deviceManage_%s_span"]' % str(n + 2))
            sleep(2)
            # 判断数量
            get_account_dev_number = self.driver.get_text(
                'x,//*[@id="treeDemo_deviceManage_%s_span"]' % str(n + 2))
            number = get_account_dev_number.split('(')[1].split('/')[0]

            dev_number = self.dev_manage_page.get_dev_number()
            self.assertEqual(number, str(dev_number))

        # 搜索无数据
        self.dev_manage_page.search_customer('无数据')
        get_text = self.dev_manage_page.get_search_customer_no_data_text()
        self.assertIn(self.assert_text.account_center_page_no_data_text(),
                      get_text)
class TestCase84DevManageBatchIssuedCommand(unittest.TestCase):
    def setUp(self):
        self.driver = AutomateDriver()
        self.base_url = self.driver.base_url
        self.base_page = BasePage(self.driver, self.base_url)
        self.dev_manage_page = DevManagePages(self.driver, self.base_url)
        self.assert_text = AssertText()
        self.driver.set_window_max()
        self.log_in_base = LogInBase(self.driver, self.base_url)
        self.dev_manage_page_read_csv = DevManagePageReadCsv()
        self.driver.wait(1)
        self.driver.clear_cookies()
        self.driver.wait(1)

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

    def test_case_dev_manage_batch_issued_command(self):
        # 打开途强在线首页-登录页
        self.base_page.open_page()
        # 登录
        self.log_in_base.log_in()
        # 点击进入设备管理
        self.dev_manage_page.enter_dev_manage()

        # 点击批量
        self.dev_manage_page.click_batch_issued_command_button()

        self.dev_manage_page.click_close_batch_batch_issued_command_button()

        self.dev_manage_page.click_batch_issued_command_button()

        # 获取选中的设备数量
        '''dev_number = self.dev_manage_page.get_dev_number_after_click_issued_command()
        dev_number_count = self.dev_manage_page.get_count_number_after_click_issued_command()
        self.assertEqual(str(dev_number), dev_number_count)'''
        # 获取提示语
        text = self.dev_manage_page.get_text_after_click_all_issued_command()
        self.assertEqual(self.assert_text.dev_type_is_different(), text)
class TestCase93DevManageUnbundleDev(unittest.TestCase):
    def setUp(self):
        self.driver = AutomateDriver()
        self.base_url = self.driver.base_url
        self.base_page = BasePage(self.driver, self.base_url)
        self.dev_manage_page = DevManagePages(self.driver, self.base_url)
        self.driver.set_window_max()
        self.log_in_base = LogInBase(self.driver, self.base_url)
        self.dev_manage_page_read_csv = DevManagePageReadCsv()
        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_case_dev_manage_unbundle_dev(self):
        # 打开途强在线首页-登录页
        self.base_page.open_page()
        # 登录
        self.log_in_base.log_in_jimitest()
        # 点击进入设备管理
        self.dev_manage_page.enter_dev_manage()

        # 搜索绑定的设备
        self.dev_manage_page.search_bundle_dev()
        #  获取第一个设备的imei
        imei_in_list = self.dev_manage_page.get_imei_in_list()

        # 点击解绑
        self.dev_manage_page.click_unbundle_dev()

        imei_in_list_again = self.dev_manage_page.get_imei_in_list()

        self.assertNotEqual(imei_in_list, imei_in_list_again, '解绑失败')
class TestCase182AlarmDetailSearch(unittest.TestCase):
    # 告警详情页面搜索
    def setUp(self):
        # 前置条件
        # 实例化对象
        self.driver = AutomateDriver()
        self.base_url = self.driver.base_url
        self.base_page = BasePage(self.driver, self.base_url)

        self.alarm_info_page = AlarmInfoPage(self.driver, self.base_url)
        self.statistical_form_page_read_csv = StatisticalFormPageReadCsv()
        self.log_in_base = LogInBase(self.driver, self.base_url)
        self.statistical_form_page = StatisticalFormPage(self.driver, self.base_url)
        self.connect_sql = ConnectSql()
        self.statistical_form_page3 = StatisticFormPage3(self.driver, self.base_url)
        self.seasrch_sql = SearchSql(self.driver, self.base_url)

        # 打开页面,填写用户名、密码、点击登录
        self.base_page.open_page()
        self.driver.set_window_max()
        self.driver.implicitly_wait(5)
        self.driver.clear_cookies()
        self.assert_text = AssertText()
        self.log_in_base.log_in_jimitest()
        # 登录之后点击控制台,然后点击指令管理
        self.statistical_form_page.click_control_after_click_statistical_form_page()
        sleep(3)

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

    def test_case_alarm_detail_search(self):
        # 断言url
        expect_url = self.base_url + '/deviceReport/statisticalReport'
        self.assertEqual(expect_url, self.alarm_info_page.actual_url_click_alarm())
        # 点击告警详情
        self.alarm_info_page.click_alarm_detail_list()
        # 选择全部的告警类型查询
        self.statistical_form_page3.select_all_alarm_type_in_alarm_detail_search()
        # 读数据
        csv_file = self.statistical_form_page_read_csv.read_csv('alarm_detail_search_data.csv')
        csv_data = csv.reader(csv_file)

        is_header = True
        for row in csv_data:
            if is_header:
                is_header = False
                continue
            data = {
                'user_name': row[0],
                'type': row[1],
                'status': row[2],
                'alarm_begin_time': row[3],
                'alarm_end_time': row[4],
                'push_begin_time': row[5],
                'push_end_time': row[6],
                'is_input_dev': row[7]
            }
            self.statistical_form_page3.add_data_to_search_alarm_detail(data)

            get_alarm_begin_time = self.statistical_form_page3.get_alarm_begin_time_in_alarm_detail_page()
            get_alarm_end_time = self.statistical_form_page3.get_alarm_end_time_in_alarm_detail_page()
            get_push_begin_time = self.statistical_form_page3.get_push_begin_time_in_alarm_detail_page()
            get_push_end_time = self.statistical_form_page3.get_push_end_time_in_alarm_detail_page()
            all_dev = self.seasrch_sql.search_current_account_equipment(data['user_name'])
            imeis = self.statistical_form_page3.change_dev_imei_format(all_dev)
            get_current_userid = self.seasrch_sql.search_current_account_user_id(data['user_name'])
            request_url = request_base_url()

            if data['is_input_dev'] == '0':
                request_params = {
                    '_method_': 'getAlarmDetailNoPaging',
                    'startTime': get_alarm_begin_time,
                    'endTime': get_alarm_end_time,
                    'userIds': get_current_userid,
                }
                res = requests.post(request_url, data=request_params)
                sleep(20)
                response = res.json()
                res_data = response['data']
                for data_1 in res_data:
                    del data_1['alarmType'], data_1['id'], data_1['lat'], data_1['lng'], data_1['speed'], data_1[
                        'status'], data_1['userId']
                print(res_data)

                web_total_number = self.statistical_form_page3.get_web_total_number_in_alarm_detail_page()
                web_data = []
                for n in range(web_total_number):
                    web_data.append({
                        'imei': self.statistical_form_page3.get_imei_in_alarm_detail(n),
                        'createTime': self.statistical_form_page3.get_creat_time_in_alarm_detail(n),
                        'pushTime': self.statistical_form_page3.get_push_time_in_alarm_detail(n),
                        'addr': self.statistical_form_page3.get_addr_in_alarm_detail(n),
                        'readStatus': self.statistical_form_page3.get_read_status_in_alarm_detail(n)
                    })
                print(web_data)
                self.assertEqual(web_data, res_data)

            elif data['is_input_dev'] == '1':
                request_params = {
                    '_method_': 'getAlarmDetailNoPaging',
                    'startCreateTime': get_push_begin_time,
                    'endCreateTime': get_push_end_time,
                    'userIds': get_current_userid,
                    'imeis': imeis
                }
                res = requests.post(request_url, data=request_params)
                sleep(20)
                response = res.json()
                res_data = response['data']
                for data_1 in res_data:
                    del data_1['alarmType'], data_1['id'], data_1['lat'], data_1['lng'], data_1['speed'], data_1[
                        'status'], data_1['userId']
                print(res_data)

                web_total_number = self.statistical_form_page3.get_web_total_number_in_alarm_detail_page()
                web_data = []
                for n in range(web_total_number):
                    web_data.append({
                        'imei': self.statistical_form_page3.get_imei_in_alarm_detail(n),
                        'createTime': self.statistical_form_page3.get_creat_time_in_alarm_detail(n),
                        'pushTime': self.statistical_form_page3.get_push_time_in_alarm_detail(n),
                        'addr': self.statistical_form_page3.get_addr_in_alarm_detail(n),
                        'readStatus': self.statistical_form_page3.get_read_status_in_alarm_detail(n)
                    })
                print(web_data)
                self.assertEqual(web_data, res_data)
            self.driver.default_frame()
        csv_file.close()
class TestCase154ObdMileageForm(unittest.TestCase):
    def setUp(self):
        # 前置条件
        # 实例化对象
        self.driver = AutomateDriver()
        self.base_url = self.driver.base_url
        self.base_page = BasePage(self.driver, self.base_url)
        self.statistical_form_page = StatisticalFormPage(
            self.driver, self.base_url)
        self.statistical_form_page_read_csv = StatisticalFormPageReadCsv()
        self.log_in_base = LogInBase(self.driver, self.base_url)
        self.connect_sql = ConnectSql()
        self.search_sql = SearchSql(self.driver, self.base_url)
        self.obd_form_page = ObdFormPage(self.driver, self.base_url)
        # 打开页面,填写用户名、密码、点击登录
        self.base_page.open_page()
        self.driver.set_window_max()
        self.driver.implicitly_wait(5)
        self.driver.clear_cookies()
        self.log_in_base.log_in_jimitest()
        self.assert_text = AssertText()

        # 登录之后点击控制台,然后点击设置
        self.statistical_form_page.click_control_after_click_statistical_form_page(
        )
        sleep(3)

    def tearDown(self):
        # 退出浏览器
        self.driver.quit_browser()

    def test_case_obd_mileage_form(self):
        # 断言url
        expect_url_after_click_statistical_form = self.base_url + '/deviceReport/statisticalReport'
        self.assertEqual(
            expect_url_after_click_statistical_form,
            self.statistical_form_page.actual_url_after_statistical_form())

        # 点击obd统计的里程报表
        self.obd_form_page.click_obd_form_mileage_statistical_button()
        # 切换到odb里程统计的frame里面
        self.obd_form_page.switch_to_obd_mileage_statistical_frame()

        csv_file = self.statistical_form_page_read_csv.read_csv(
            'obd_milage_report_search_data.csv')
        csv_data = csv.reader(csv_file)
        is_header = True
        for row in csv_data:
            if is_header:
                is_header = False
                continue
            search_data = {
                'user_name': row[0],
                'choose_date': row[2],
                'begin_time': row[3],
                'end_time': row[4]
            }
            self.obd_form_page.add_data_to_search_obd_mileage_statistical_form(
                search_data)

            # 获取页面上设备的信息
            dev_name = self.obd_form_page.get_dev_name_in_obd_mileage_statistical_form(
            )
            dev_total_mile = self.obd_form_page.get_dev_total_mile_obd_mileage_statistical_form(
            )
            dev_avg_oil = self.obd_form_page.get_dev_avg_oil_obd_mileage_statistical_form(
            )
            dev_avg_speed = self.obd_form_page.get_avg_oil_obd_mileage_statistical_form(
            )
            dev_total_oil = self.obd_form_page.get_dev_total_oil_obd_mileage_statistical_form(
            )

            # 查询设备的名称
            sql_check_dev_name = self.obd_form_page.get_dev_name_in_sql(
                self.obd_form_page.search_imei())

            # 查询数据库的条数
            get_sql_total_number = self.obd_form_page.get_sql_total_number()
            get_web_total_number = self.obd_form_page.get_web_total_number()
            self.assertEqual(len(get_sql_total_number),
                             get_web_total_number[1])

            # 获取查询出来的 页数
            if get_web_total_number[0] != 0 and get_web_total_number[0] != 1:
                self.obd_form_page.click_first_page()
            total_page = self.obd_form_page.get_obd_list_total_page_number()
            if total_page == 0:
                self.assertEqual('0', dev_total_mile)
                self.assertEqual('0', dev_avg_oil)
                self.assertEqual('0', dev_avg_speed)
                self.assertEqual('0', dev_total_oil)

            elif total_page == 1:
                # 断言平均油耗
                # 查询设备的名称
                self.assertEqual(dev_name, sql_check_dev_name)
                count_avg_oil = '%.2f' % (
                    (float(dev_total_oil) / float(dev_total_mile)) * 100)
                self.assertEqual(count_avg_oil, dev_avg_oil)
                # 获取页面上的里程和耗油
                mile_and_oil_list = []
                per_page_total_number = self.obd_form_page.get_per_page_total_number(
                )
                for n in range(per_page_total_number):
                    mile_and_oil_list.append({
                        'mile':
                        float(
                            self.obd_form_page.
                            get_per_mile_in_obd_mileage_form(n)),
                        'oil':
                        float(
                            self.obd_form_page.get_per_oil_in_obd_mileage_form(
                                n)),
                    })
                print(mile_and_oil_list)
                total_mile = 0
                total_oil = 0
                for data in mile_and_oil_list:
                    total_mile += data['mile']
                    total_oil += data['oil']
                self.assertAlmostEqual(float(dev_total_mile), total_mile)
                self.assertAlmostEqual(float(dev_total_oil), total_oil)

                # 计算总时间 然后断言平均速度
                total_time = sum(get_sql_total_number)
                print(total_time)
                avg_speed = '%.2f' % ((float(dev_total_mile)) / float(
                    (float(total_time) / 3600)))
                self.assertEqual(avg_speed, dev_avg_speed)

            else:
                # 断言平均油耗
                self.assertEqual(dev_name, sql_check_dev_name)
                count_avg_oil = '%.2f' % (
                    (float(dev_total_oil) / float(dev_total_mile)) * 100)
                self.assertEqual(count_avg_oil, dev_avg_oil)
                mile_and_oil_list = []
                for i in range(total_page):
                    # 循环点击每一页
                    self.obd_form_page.click_per_page(i)
                    # 获取页面上的里程和耗油
                    per_page_total_number = self.obd_form_page.get_per_page_total_number(
                    )
                    for n in range(per_page_total_number):
                        mile_and_oil_list.append({
                            'mile':
                            float(
                                self.obd_form_page.
                                get_per_mile_in_obd_mileage_form(n)),
                            'oil':
                            float(
                                self.obd_form_page.
                                get_per_oil_in_obd_mileage_form(n)),
                        })
                total_mile = 0
                total_oil = 0
                for data in mile_and_oil_list:
                    total_mile += data['mile']
                    total_oil += data['oil']

                self.assertAlmostEqual(float(dev_total_mile), total_mile)
                self.assertAlmostEqual(float(dev_total_oil), total_oil)

                # 计算总时间 然后断言平均速度
                total_time = sum(get_sql_total_number)
                avg_speed = '%.2f' % ((float(dev_total_mile)) / float(
                    (float(total_time) / 3600)))
                self.assertEqual(avg_speed, dev_avg_speed)
        csv_file.close()
        self.driver.default_frame()
class TestCase137SearchUserByTypeCreatNewUser(unittest.TestCase):
    def setUp(self):
        self.driver = AutomateDriver()
        self.base_url = self.driver.base_url
        self.base_page = BasePage(self.driver, self.base_url)
        self.global_dev_search_page = GlobalDevSearchPage(self.driver, self.base_url)
        self.account_center_page_navi_bar = AccountCenterNaviBarPages(self.driver, self.base_url)
        self.driver.set_window_max()
        self.global_account_search_page = GlobalAccountSearchPage(self.driver, self.base_url)
        self.log_in_base = LogInBase(self.driver, self.base_url)
        self.global_search_page_read_csv = GlobleSearchPageReadCsv()
        self.search_sql = SearchSql()
        self.driver.wait(1)
        self.connect_sql = ConnectSql()
        self.assert_text = AssertText()
        self.driver.clear_cookies()
        self.driver.wait(1)

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

    def test_case_137_search_user_by_type_creat_new_user(self):
        # 打开途强在线首页-登录页
        self.base_page.open_page()
        self.log_in_base.log_in()
        # 点击账号中心
        self.log_in_base.click_account_center_button()
        self.global_dev_search_page.click_easy_search()
        # 关闭
        self.global_dev_search_page.close_search()
        sleep(2)
        self.global_dev_search_page.click_easy_search()
        # 选择用户搜索
        self.global_dev_search_page.click_user_search_buttons()
        self.global_dev_search_page.swith_to_search_frame()

        # 获取用户列表有多少页
        user_account = ''
        total_page = self.global_dev_search_page.get_total_page_after_search_user()
        for n in range(total_page):
            self.global_dev_search_page.click_per_page(n)
            # 获取每页有多少条
            number = self.global_dev_search_page.get_per_page_total_number_in_search_user()
            for i in range(number):
                # 获取各个用户的用户类型
                user_type = self.global_dev_search_page.get_user_type_in_search_user(i)
                user_account = self.global_dev_search_page.get_user_account_in_search_user(i)
                if user_type == '销售':
                    break
        # 搜索获取到的销售类型的用户,搜索
        self.global_dev_search_page.search_user(user_account)
        # 点击新增下级用户
        self.global_dev_search_page.click_add_next_user_in_search_user()
        # 获取新增下级用户时,下级的客户类型有几种
        user_type_number = self.global_dev_search_page.get_user_type_number_in_search_user()
        self.assertEqual(3, user_type_number)

        self.global_dev_search_page.search_user('')
        user_account = ''
        total_page = self.global_dev_search_page.get_total_page_after_search_user()
        for n in range(total_page):
            self.global_dev_search_page.click_per_page(n)
            # 获取每页有多少条
            number = self.global_dev_search_page.get_per_page_total_number_in_search_user()
            for i in range(number):
                # 获取各个用户的用户类型
                user_type = self.global_dev_search_page.get_user_type_in_search_user(i)
                user_account = self.global_dev_search_page.get_user_account_in_search_user(i)
                if user_type == '代理商':
                    break
        # 搜索获取到的销售类型的用户,搜索
        self.global_dev_search_page.search_user(user_account)
        # 点击新增下级用户
        self.global_dev_search_page.click_add_next_user_in_search_user()
        # 获取新增下级用户时,下级的客户类型有几种
        user_type_number = self.global_dev_search_page.get_user_type_number_in_search_user()
        self.assertEqual(2, user_type_number)

        self.global_dev_search_page.search_user('')
        user_account = ''
        total_page = self.global_dev_search_page.get_total_page_after_search_user()
        for n in range(total_page):
            self.global_dev_search_page.click_per_page(n)
            # 获取每页有多少条
            number = self.global_dev_search_page.get_per_page_total_number_in_search_user()
            for i in range(number):
                # 获取各个用户的用户类型
                user_type = self.global_dev_search_page.get_user_type_in_search_user(i)
                user_account = self.global_dev_search_page.get_user_account_in_search_user(i)
                if user_type == '用户':
                    break
        # 搜索获取到的销售类型的用户,搜索
        self.global_dev_search_page.search_user(user_account)
        # 获取新增下级用户的display值
        get_new_next_display = self.global_dev_search_page.get_new_next_display_in_search_user()
        self.assertEqual('display: none;', get_new_next_display)

        self.driver.default_frame()
예제 #26
0
class TestCase02UserManageAddUserException1(unittest.TestCase):
    # 测试用户管理新增用户功能异常情况
    def setUp(self):
        self.driver = AutomateDriver()
        self.base_url = self.driver.base_url
        self.base_page = BasePage(self.driver, self.base_url)
        self.login_page = LoginPage(self.driver, self.base_url)
        self.user_center = UserCenter(self.driver, self.base_url)
        self.user_management = UserManagement(self.driver, self.base_url)
        self.log_in_page_read_csv = LogInPageReadCsv()
        self.user_center_read_csv = UserCenterReadCsv()
        self.user_management_read_csv = UserManagementReadCsv()
        self.driver.set_window_max()
        self.connect_sql = ConnectSql()
        self.driver.wait(1)
        self.driver.clear_cookies()
        self.driver.wait(1)

        # 打开风控首页-登录页
        self.base_page.open_page()
        sleep(1)
        # 登录账号
        self.login_page.test_user_login()



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

    def test_add_user_exception1(self):
        # 通过csv测试新增用户功能异常情况


        # 获取当前登录账户
        log_in_account = self.user_center.get_login_account()
        print(log_in_account)

        csv_file = self.user_management_read_csv.read_csv('add_user_exception1.csv')
        csv_data = csv.reader(csv_file)
        for row in csv_data:
            add_user_exception = {
                "add_user_name": row[0],
                "add_login_user": row[1],
                "add_login_passwd": row[2],
                "add_user_phone": row[3],
                "add_user_role":row[4],
                "exception_text": row[5],
            }

            # 点击进入用户管理
            self.user_management.click_user_manage()
            # 点击新增用户
            self.user_management.click_add_user()
            # 切入内层frame
            self.user_management.switch_to_2_frame()
            # 输入新增用户名
            self.user_management.input_add_user_name(add_user_exception['add_user_name'])
            # 输入登陆账号
            self.user_management.input_add_login_user(add_user_exception['add_login_user'])
            # 输入登录密码
            self.user_management.input_add_login_passwd(add_user_exception['add_login_passwd'])
            # 输入手机号码
            self.user_management.input_add_user_phone(add_user_exception['add_user_phone'])
            # 判断分配用户角色
            if add_user_exception['add_user_role'] == '1':
                self.user_management.input_add_user_role()
            # 选择所属公司部门
            self.user_management.choose_add_user_org()
            # 点击保存按钮
            self.user_management.click_add_user_save()

            # 获取异常提示
            text = self.user_management.get_add_user_exception1()

            self.assertEqual(add_user_exception['exception_text'], text)

            # 关闭新增用户框
            self.user_management.click_add_user_close()

            # 跳出最外层frame
            self.user_management.switch_to_default_content()

            # 从数据库查询验证新增失败
            new_user_name = self.user_management.get_add_user_by_sql(log_in_account)
            self.assertNotEqual(new_user_name, add_user_exception['add_user_name'])
            self.driver.wait(1)

        csv_file.close()

        # 退出登录
        self.user_center.logout()
class TestCase155SportStatisticalParkingFormExceptionSearch(unittest.TestCase):
    def setUp(self):
        self.driver = AutomateDriver()
        self.base_url = self.driver.base_url
        self.base_page = BasePage(self.driver, self.base_url)
        self.statistical_form_page = StatisticalFormPage(self.driver, self.base_url)
        self.statistical_form_page2 = StatisticalFormPage2(self.driver, self.base_url)
        self.statistical_form_page_read_csv = StatisticalFormPageReadCsv()
        self.log_in_base = LogInBase(self.driver, self.base_url)
        self.assert_text = AssertText()
        # 打开页面,填写用户名、密码、点击登录
        self.base_page.open_page()
        self.driver.set_window_max()
        self.driver.implicitly_wait(5)

    def test_parking_form_exception_search(self):
        """
         停车未熄火报表页面,异常搜索数据验证
        """
        # 登录
        self.log_in_base.log_in_jimitest()
        # 点击进入统计报表、停车未熄火报表
        self.statistical_form_page.click_control_after_click_statistical_form_page()
        self.statistical_form_page.click_paking_not_shut_down_form_button()

        # 取开始、结束时间
        type = ["今天", "本周", "昨天", "上周", "本月", "上月", "自定义"]
        data = ["暂无数据"]

        for time in type:
            time = self.statistical_form_page2.parking_not_shut_down_form_validation_time(time)
            self.assertEqual(time["page_time"]["page_start_time"], time["sql_time"]["sql_start_time"], "实际与显示的开始时间不相符")
            self.assertEqual(time["page_time"]["page_end_time"], time["sql_time"]["sql_end_time"], "实际与显示的结束时间不相符")

        # 验证提示
        for user in data:
            text = self.statistical_form_page2.search_inexistence_user(user)
            print(text)
            self.assertIn(user, text, "搜索后的数据不存在实际搜索出的数据中")

        # 验证搜索下级的imei可以搜索到
        # 填写下级的imei搜索
        sleep(2)
        self.statistical_form_page2.input_imei_to_search_in_paking_form(self.statistical_form_page2.get_imei())
        # 断言
        # 获取查询设备的imei
        search_imei = self.statistical_form_page2.get_search_imei_in_paking_form()
        self.assertEqual(search_imei, self.statistical_form_page2.get_imei())

        # 验证停机的设备无法搜索到
        self.statistical_form_page2.input_imei_to_search_in_paking_form(
            self.statistical_form_page2.get_shut_down_imei())
        # 获取搜索的数量
        get_number_after_search = self.statistical_form_page.get_number_after_search_in_paking_form()
        self.assertEqual(0, get_number_after_search)

        get_text_after_search = self.statistical_form_page.get_text_after_search_in_paking_form()
        self.assertIn(self.assert_text.account_center_page_no_data_text(), get_text_after_search)

        # 验证未激活的设备无法搜索到
        self.statistical_form_page2.input_imei_to_search_in_paking_form(
            self.statistical_form_page2.get_no_active_imei())
        # 获取搜索的数量
        get_number_after_search = self.statistical_form_page.get_number_after_search_in_paking_form()
        self.assertEqual(0, get_number_after_search)

        get_text_after_search = self.statistical_form_page.get_text_after_search_in_paking_form()
        self.assertIn(self.assert_text.account_center_page_no_data_text(), get_text_after_search)

    def tearDown(self):
        # 退出浏览器
        self.driver.quit_browser()
class TestCase100GlobAccountSearch(unittest.TestCase):
    def setUp(self):
        self.driver = AutomateDriver()
        self.base_url = self.driver.base_url
        self.base_page = BasePage(self.driver, self.base_url)
        self.global_dev_search_page = GlobalDevSearchPage(self.driver, self.base_url)
        self.account_center_page_navi_bar = AccountCenterNaviBarPages(self.driver, self.base_url)
        self.driver.set_window_max()
        self.global_account_search_page = GlobalAccountSearchPage(self.driver, self.base_url)
        self.log_in_base = LogInBase(self.driver, self.base_url)
        self.global_search_page_read_csv = GlobleSearchPageReadCsv()
        self.search_sql = SearchSql()
        self.driver.wait(1)
        self.connect_sql = ConnectSql()
        self.driver.clear_cookies()
        self.driver.wait(1)

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

    def test_global_account_search(self):
        # 打开途强在线首页-登录页
        self.base_page.open_page()
        self.log_in_base.log_in()
        self.log_in_base.click_account_center_button()
        current_account = self.log_in_base.get_log_in_account()
        self.global_dev_search_page.click_easy_search()
        # 关闭
        self.global_dev_search_page.close_search()
        sleep(2)

        self.global_dev_search_page.click_easy_search()
        # self.global_dev_search_page.click_account_search()

        # 度数据
        csv_file = self.global_search_page_read_csv.read_csv('global_search_account_data.csv')
        csv_data = csv.reader(csv_file)

        is_header = True
        for row in csv_data:
            if is_header:
                is_header = False
                continue
            search_data = {
                'account_info': row[0]
            }
            self.global_dev_search_page.swith_to_search_frame()
            self.global_dev_search_page.account_easy_search(search_data)

            connect = self.connect_sql.connect_tuqiang_sql()
            # 创建数据库游标
            cur = connect.cursor()

            # 执行sql脚本查询当前登录账号的userId,fullParent
            get_id_sql = "select o.account,o.userId,o.fullParentId from user_info o where o.account = '" + current_account + "' ;"
            cur.execute(get_id_sql)
            # 读取数据
            user_relation = cur.fetchall()
            # 遍历数据
            for row in user_relation:
                user_relation_id = {
                    "account": row[0],
                    "userId": row[1],
                    "fullParent": row[2]
                }

                # 执行sql脚本,根据当前登录账号的userId,fullParent查询出当前账户的所有下级账户
                get_lower_account_sql = "select userId from user_info where fullParentId like" + \
                                        "'" + user_relation_id["fullParent"] + user_relation_id["userId"] + "%'" + ";"
                cur.execute(get_lower_account_sql)
                # 读取数据
                lower_account = cur.fetchall()
                lower_account_list = [user_relation_id["userId"]]
                for range1 in lower_account:
                    for range2 in range1:
                        lower_account_list.append(range2)
                lower_account_tuple = tuple(lower_account_list)

                get_total_sql = self.search_sql.search_account_sqls(lower_account_tuple, search_data)
                print(get_total_sql)
                cur.execute(get_total_sql)
                # 读取数据
                total_data = cur.fetchall()
                # 从数据tuple中获取最终查询记录统计条数
                total_list = []
                for range1 in total_data:
                    for range2 in range1:
                        total_list.append(range2)
                total = len(total_list)
                print('本次查询数据库的条数为:%s' % total)
                web_total = self.global_account_search_page.easy_search_results()
                print('本次查询页面的条数是:%s' % web_total)
                self.assertEqual(total, web_total)
                self.driver.default_frame()
            cur.close()
            connect.close()

        csv_file.close()
        self.global_dev_search_page.close_search()
예제 #29
0
class TestCase04AccountLog(unittest.TestCase):
    # 账号管理记录
    def setUp(self):
        self.driver = AutomateDriver()
        self.base_url = self.driver.base_url
        self.base_page = BasePage(self.driver, self.base_url)
        self.login_page = LoginPage(self.driver, self.base_url)
        self.user_center = UserCenter(self.driver, self.base_url)
        self.operation_log = OperationLog(self.driver, self.base_url)
        self.log_in_page_read_csv = LogInPageReadCsv()
        self.user_center_read_csv = UserCenterReadCsv()
        self.operation_log_read_csv = OperationLogReadCsv()
        self.driver.set_window_max()
        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_log(self):
        # 测试账号管理记录

        # 打开风控首页-登录页
        self.base_page.open_page()
        sleep(1)
        # 登录账号
        self.login_page.test_log_login_user_normal()
        # 获取当前登录账号
        log_in_account = self.user_center.get_login_account()
        print(log_in_account)

        # 从数据库获取登录账号的客户名称、电话
        account_info = self.user_center.get_account_info_by_sql(log_in_account)
        print(account_info)

        # 获取修改资料里面的信息
        user_info = self.user_center.get_user_info()

        # 断言
        self.assertEqual(log_in_account, user_info['login_account'])
        self.assertEqual(account_info[1], user_info['name'])
        self.assertEqual(account_info[2], user_info['tel'])

        # 点击设置
        self.operation_log.click_setup()

        # 点击进入操作日志
        self.operation_log.click_operation_log()

        # 切入frame
        self.operation_log.switch_to_myframe()

        # 点击账号管理记录
        self.operation_log.click_account_log()

        csv_file = self.operation_log_read_csv.read_csv('account_log.csv')
        csv_data = csv.reader(csv_file)
        for row in csv_data:
            account_log = {
                "start_time": row[0],
                "end_time": row[1],
                "type": row[2],
            }

            # 输入时间段
            self.operation_log.account_input_time(account_log['start_time'],
                                                  account_log['end_time'])

            # 选择类型
            self.operation_log.account_choose_type(account_log['type'])

            # 点击搜索
            self.operation_log.account_click_search()
            '''# 获取搜索结果
            result_info = self.operation_log.get_account_log_search_result()
            print(result_info)


            # 获取数据库查询结果
            info = self.operation_log.get_account_log_search_result_by_sql(log_in_account,account_log['start_time'],account_log['end_time'])


            # 验证搜索结果是否一致
            self.assertEqual(result_info,info)'''

            # 点击重置
            self.operation_log.account_click_reset()

        # 跳出frame
        self.operation_log.switch_default()

        # 退出登录
        self.user_center.logout()
예제 #30
0
class TestCase713FormExportOBDTroubleFormExport(unittest.TestCase):
    # 测试 obd报表 故障报表 - 导出
    def setUp(self):
        # 前置条件
        # 实例化对象
        self.driver = AutomateDriver()
        self.base_url = self.driver.base_url
        self.base_page = BasePage(self.driver, self.base_url)
        self.statistical_form_page = StatisticalFormPage(
            self.driver, self.base_url)
        self.statistical_form_page_read_csv = StatisticalFormPageReadCsv()
        self.log_in_base = LogInBase(self.driver, self.base_url)
        self.connect_sql = ConnectSql()
        self.search_sql = SearchSql(self.driver, self.base_url)
        self.statistical_form_page3 = StatisticFormPage3(
            self.driver, self.base_url)
        self.assert_text = AssertText()
        self.form_page = FormPage(self.driver, self.base_url)
        self.page = Page(self.driver, self.base_url)
        self.form_export_page = FormExportPage(self.driver, self.base_url)
        self.statistical_form_page4 = StatisticFormPage4(
            self.driver, self.base_url)
        # 打开页面,填写用户名、密码、点击登录
        self.base_page.open_page()
        self.driver.set_window_max()
        self.driver.implicitly_wait(5)
        self.driver.clear_cookies()
        self.log_in_base.log_in_jimitest()

        current_handle = self.driver.get_current_window_handle()
        self.statistical_form_page.click_control_after_click_statistical_form_page(
        )
        sleep(3)
        self.base_page.change_windows_handle(current_handle)

    def tearDown(self):
        self.driver.close_window()
        # 退出浏览器
        self.driver.quit_browser()

    def test_case_obd_trouble_form_export(self):
        # 断言url
        expect_url_after_click_statistical_form = self.base_url + '/deviceReport/statisticalReport'
        self.assertEqual(
            expect_url_after_click_statistical_form,
            self.statistical_form_page.actual_url_after_statistical_form())
        # 断言
        self.assertEqual(
            self.assert_text.statistical_form_sport_overview_form(),
            self.statistical_form_page.actual_text_after_click_sport_overview(
            ))

        # 切换到里程报表的frame
        self.statistical_form_page.click_obd_trouble_form()
        self.statistical_form_page.switch_to_obd_trouble_frame()
        # 搜索数据
        self.form_export_page.search_obd_trouble_data()

        # 让其展示所有列
        # 点击展示列
        self.form_page.click_display_line_button_obd_failure()
        # 获取有多少个展示列
        display_line_number = self.form_page.get_display_line_name_number_obd_failure(
        )
        print(display_line_number)
        for n in range(display_line_number):
            # 获取每一个展示列是否被勾选
            display_style = self.form_page.get_per_display_style_obd_failure(n)
            if display_style == False:
                self.form_page.click_per_display_input_button_obd_failure(n)
        self.form_page.click_display_line_button_obd_failure()
        # 获取页面中的数据
        web_data = []
        total_page = self.statistical_form_page4.get_total_page_in_obd_car_condition(
        )
        if total_page == 0:
            pass
        else:
            if total_page == 1:
                total_number_per_page = self.statistical_form_page4.get_total_number_per_page_in_obd_car_condition(
                )
                for a in range(total_number_per_page):
                    web_data.append(
                        self.form_export_page.get_per_line_data_obd_trouble(a))

            else:
                for x in range(total_page):
                    self.statistical_form_page3.click_per_page_in_mile_report_form(
                        x)
                    total_number_per_page = self.statistical_form_page4.get_total_number_per_page_in_obd_car_condition(
                    )
                    for a in range(total_number_per_page):
                        web_data.append(
                            self.form_export_page.
                            get_per_line_data_obd_trouble(a))

            # 点击导出所有列
            self.form_export_page.click_export_button_in_mileage()
            # 切换到导出的frame中
            self.form_export_page.switch_export_frame()
            # 判断有多少个div的标签
            export_div_number = self.form_export_page.get_sport_overview_export_div_number(
            )
            for m in range(export_div_number - 2):
                # 获取基本信息和客户信息是否被勾选
                input_style = self.form_export_page.get_input_style_select_in_sport_overview_export(
                    m)
                if input_style == False:
                    self.form_export_page.click_per_in_sport_overview_export(m)
            # 点击生成任务按钮
            self.form_export_page.click_create_task_button_in_sport_overview_export_stay(
            )
            # 查找刚刚导出的文件
            file = self.form_export_page.find_expect_file()
            print(file)
            # 读excel文件
            excel_data = self.form_export_page.read_excel_file_by_index(file,
                                                                        n=0)
            del excel_data[0]
            print('excel', excel_data)
            print('web', web_data)

            self.assertEqual(web_data, excel_data)

        self.driver.default_frame()