Пример #1
0
 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.organize_management = OrganizeManagement(self.driver, self.base_url)
     self.log_in_page_read_csv = LogInPageReadCsv()
     self.user_center_read_csv = UserCenterReadCsv()
     self.organize_management_read_csv = OrganizeManagementReadCsv()
     self.driver.set_window_max()
     self.connect_sql = ConnectSql()
     self.driver.wait(1)
     self.driver.clear_cookies()
     self.driver.wait(1)
class TestCase07OrgManageSearchOrg(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.organize_management = OrganizeManagement(self.driver,
                                                      self.base_url)
        self.log_in_page_read_csv = LogInPageReadCsv()
        self.user_center_read_csv = UserCenterReadCsv()
        self.organize_management_read_csv = OrganizeManagementReadCsv()
        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_search_org(self):
        # 通过csv测试搜索公司部门功能

        csv_file = self.user_center_read_csv.read_csv('search_org.csv')
        csv_data = csv.reader(csv_file)
        for row in csv_data:
            search_org = {
                "account": row[0],
                "password": row[1],
                "key": row[2],
            }

            # 打开风控首页-登录页
            self.base_page.open_page()
            sleep(1)
            # 登录账号
            self.login_page.user_login(search_org['account'],
                                       search_org['password'])

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

            # 从数据库获取登录账号的用户名
            account_info = self.user_center.get_account_info_by_sql(
                search_org['account'])
            print(account_info)
            account_name = account_info[1]

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

            # 点击进入部门管理
            self.organize_management.click_org_manage()

            # 输入搜索关键词进行搜索
            self.organize_management.search_org(search_org['key'])

            # 获取搜索结果
            num = int(self.organize_management.get_search_result_num())
            org_name = self.organize_management.get_search_result_all()

            # 数据库查询搜索结果
            org_name_by_sql = self.organize_management.get_search_result_orgname_by_sql(
                search_org['account'], search_org['key'])
            num_by_sql = self.organize_management.get_search_result_num_by_sql(
                search_org['account'], search_org['key'])

            # 验证搜索结果是否一致
            self.assertEqual(num, num_by_sql)
            self.assertEqual(set(org_name), set(org_name_by_sql))

            # 跳出外层frame
            self.organize_management.switch_to_default_content()

            # 退出登录
            self.user_center.logout()

        csv_file.close()
Пример #3
0
class TestCase03OrgManageAddOrgException2(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.organize_management = OrganizeManagement(self.driver,
                                                      self.base_url)
        self.log_in_page_read_csv = LogInPageReadCsv()
        self.user_center_read_csv = UserCenterReadCsv()
        self.organize_management_read_csv = OrganizeManagementReadCsv()
        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_org_exception2(self):
        # 通过csv测试新增公司部门功能异常情况-部门名称已存在

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

        csv_file = self.user_center_read_csv.read_csv(
            'add_org_info_exception2.csv')
        csv_data = csv.reader(csv_file)
        for row in csv_data:
            add_org_info_exception = {
                "add_org_name": row[0],
                "add_org_tel": row[1],
                "exception_text": row[2],
            }

            # 点击进入部门管理
            self.organize_management.click_org_manage()
            # 点击新增公司部门
            self.organize_management.click_add_org()
            # 验证上级部门是否显示正确
            sup_org_name = self.organize_management.get_sup_org_name()
            # 数据库查询当前登录账户的上级部门
            sup_org_name_by_aql = self.organize_management.get_user_sup_org_by_sql(
                log_in_account)

            self.assertEqual(sup_org_name, sup_org_name_by_aql)

            # 选择上级部门
            self.organize_management.choose_sup_org()
            # 填写新增部门名称
            self.organize_management.input_add_org_name(
                add_org_info_exception['add_org_name'])
            # 填写联系方式
            self.organize_management.input_add_org_tel(
                add_org_info_exception['add_org_tel'])
            # 点击保存按钮
            self.organize_management.click_add_org_save()

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

            # 获取名称重复异常提示
            text = self.organize_management.get_add_org_exception2()

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

            # 切入外层frame
            self.organize_management.switch_to_1_frame()
            # 切入内层frame
            self.organize_management.switch_to_2_frame()
            # 关闭新增公司部门框
            self.organize_management.click_add_org_close()

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

            # 从数据库查询验证新增失败
            new_org_name = self.organize_management.get_add_org_by_sql(
                log_in_account)
            self.assertNotEqual(new_org_name,
                                add_org_info_exception['add_org_name'])
            self.driver.wait(1)

        csv_file.close()

        # 退出登录
        self.user_center.logout()
class TestCase01OrgManageAddOrg(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.organize_management = OrganizeManagement(self.driver,
                                                      self.base_url)
        self.log_in_page_read_csv = LogInPageReadCsv()
        self.user_center_read_csv = UserCenterReadCsv()
        self.organize_management_read_csv = OrganizeManagementReadCsv()
        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_add_org(self):
        # 通过csv测试新增公司部门功能

        csv_file = self.user_center_read_csv.read_csv('add_org_info.csv')
        csv_data = csv.reader(csv_file)
        for row in csv_data:
            add_org_info = {
                "account": row[0],
                "password": row[1],
                "add_org_name": row[2],
                "add_org_tel": row[3],
            }

            # 打开风控首页-登录页
            self.base_page.open_page()
            sleep(1)
            # 登录账号
            self.login_page.user_login(add_org_info['account'],
                                       add_org_info['password'])

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

            # 从数据库获取登录账号的用户名
            account_info = self.user_center.get_account_info_by_sql(
                add_org_info['account'])
            print(account_info)
            account_name = account_info[1]

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

            # 点击进入部门管理
            self.organize_management.click_org_manage()
            # 点击新增公司部门
            self.organize_management.click_add_org()
            # 验证上级部门是否显示正确
            sup_org_name = self.organize_management.get_sup_org_name()
            # 数据库查询当前登录账户的上级部门
            sup_org_name_by_aql = self.organize_management.get_user_sup_org_by_sql(
                add_org_info['account'])

            self.assertEqual(sup_org_name, sup_org_name_by_aql)

            # 选择上级部门
            self.organize_management.choose_sup_org()
            # 填写新增部门名称
            self.organize_management.input_add_org_name(
                add_org_info['add_org_name'])
            # 填写联系方式
            self.organize_management.input_add_org_tel(
                add_org_info['add_org_tel'])
            # 点击取消
            self.organize_management.click_add_org_dismiss()
            # 从数据库查询验证未新增成功
            new_org_name_01 = self.organize_management.get_add_org_by_sql(
                add_org_info['account'])
            self.assertNotEqual(new_org_name_01, add_org_info['add_org_name'])
            self.driver.wait(1)

            # 点击新增公司部门
            self.organize_management.click_add_org()
            # 验证上级部门是否显示正确
            sup_org_name = self.organize_management.get_sup_org_name()
            # 数据库查询当前登录账户的上级部门
            sup_org_name_by_aql = self.organize_management.get_user_sup_org_by_sql(
                add_org_info['account'])

            self.assertEqual(sup_org_name, sup_org_name_by_aql)

            # 选择上级部门
            self.organize_management.choose_sup_org()
            # 填写新增部门名称
            self.organize_management.input_add_org_name(
                add_org_info['add_org_name'])
            # 填写联系方式
            self.organize_management.input_add_org_tel(
                add_org_info['add_org_tel'])
            # 点击关闭按钮
            self.organize_management.click_add_org_close()

            # 从数据库查询验证未新增成功
            new_org_name_02 = self.organize_management.get_add_org_by_sql(
                add_org_info['account'])
            self.assertNotEqual(new_org_name_02, add_org_info['add_org_name'])
            self.driver.wait(1)

            # 点击新增公司部门
            self.organize_management.click_add_org()
            # 验证上级部门是否显示正确
            sup_org_name = self.organize_management.get_sup_org_name()
            # 数据库查询当前登录账户的上级部门
            sup_org_name_by_aql = self.organize_management.get_user_sup_org_by_sql(
                add_org_info['account'])

            self.assertEqual(sup_org_name, sup_org_name_by_aql)

            # 选择上级部门
            self.organize_management.choose_sup_org()
            # 填写新增部门名称
            self.organize_management.input_add_org_name(
                add_org_info['add_org_name'])
            # 填写联系方式
            self.organize_management.input_add_org_tel(
                add_org_info['add_org_tel'])
            # 点击保存按钮
            self.organize_management.click_add_org_save()
            # 跳出最外层frame
            self.organize_management.switch_to_default_content()
            # 从数据库查询验证新增成功
            new_org_name_03 = self.organize_management.get_add_org_by_sql(
                add_org_info['account'])
            self.assertEqual(new_org_name_03, add_org_info['add_org_name'])
            self.driver.wait(1)

            # 退出登录
            self.user_center.logout()

        csv_file.close()
Пример #5
0
class TestCase05OrgManageEditOrgException(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.organize_management = OrganizeManagement(self.driver, self.base_url)
        self.log_in_page_read_csv = LogInPageReadCsv()
        self.user_center_read_csv = UserCenterReadCsv()
        self.organize_management_read_csv = OrganizeManagementReadCsv()
        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_edit_org_exception(self):
        # 通过csv测试修改公司部门功能异常情况


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

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

        # 点击进入部门管理
        self.organize_management.click_org_manage()

        # 查找test00000部门
        search_key = '00000'
        self.organize_management.search_org(search_key)

        # 获取页面查找结果
        search_org_name_01 = self.organize_management.get_search_result_one()
        # 查询数据库获取搜索结果
        org_info_00 = self.organize_management.get_search_result_by_sql(log_in_account,
                                                                        search_key)
        org_name_00 = org_info_00[0]
        sup_org_name_00 = org_info_00[1]
        org_tel_00 = org_info_00[2]
        self.assertEqual(search_org_name_01, org_name_00)

        csv_file = self.user_center_read_csv.read_csv('edit_org_info_exception.csv')
        csv_data = csv.reader(csv_file)
        for row in csv_data:
            edit_org_info_exception = {
                "edit_org_name": row[0],
                "edit_org_tel": row[1],
                "exception_text": row[2],
            }


            # 点击修改
            self.organize_management.click_edit_org()
            # 切入内层frame
            self.organize_management.switch_to_2_frame()
            # 获取当前显示的部门名称是否与未修改前一致
            current_org_name_01 = self.organize_management.get_current_org_name()
            self.assertEqual(search_org_name_01, current_org_name_01)
            # 获取显示的所属上级是否与未修改前一致
            current_sup_org = self.organize_management.get_current_sup_org_name()
            self.assertEqual(sup_org_name_00, current_sup_org)
            # 获取显示的联系方式是否与未修改前一致
            current_org_tel = self.organize_management.get_current_org_tel()
            self.assertEqual(org_tel_00, current_org_tel)

            # 修改部门名称
            self.organize_management.edit_org_name(edit_org_info_exception['edit_org_name'])
            # 修改联系方式
            self.organize_management.edit_org_tel(edit_org_info_exception['edit_org_tel'])
            # 跳出内层frame
            self.organize_management.switch_to_parent_content()

            # 修改(保存)
            self.organize_management.click_org_modify_button()
            # 获取异常提示语
            exception_text = self.organize_management.get_edit_org_exception_text()
            self.assertEqual(edit_org_info_exception['exception_text'],exception_text)

            # 数据库查询是否修改失败
            org_info = self.organize_management.get_search_result_by_sql(log_in_account,
                                                                         search_key)
            org_name = org_info[0]
            org_tel = org_info[2]
            self.assertNotEqual(edit_org_info_exception['edit_org_name'], org_name)
            self.assertNotEqual(edit_org_info_exception['edit_org_tel'], org_tel)

            # 跳出内层frame
            self.organize_management.switch_to_parent_content()

            # 关闭
            self.organize_management.click_org_modify_close()



        csv_file.close()

        # 跳出外层frame
        self.organize_management.switch_to_default_content()

        # 退出登录
        self.user_center.logout()
Пример #6
0
class TestCase06OrgManageViewOrg(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.organize_management = OrganizeManagement(self.driver,
                                                      self.base_url)
        self.log_in_page_read_csv = LogInPageReadCsv()
        self.user_center_read_csv = UserCenterReadCsv()
        self.organize_management_read_csv = OrganizeManagementReadCsv()
        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_view_org(self):
        # 通过csv测试查看公司部门功能

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

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

        # 点击进入部门管理
        self.organize_management.click_org_manage()

        csv_file = self.user_center_read_csv.read_csv('view_org_info.csv')
        csv_data = csv.reader(csv_file)
        for row in csv_data:
            view_org_info = {
                "view_org_name": row[0],
                "view_org_tel": row[1],
            }

            # 点击查看公司部门
            self.organize_management.click_view_org()
            # 切入内层frame
            self.organize_management.switch_to_2_frame()

            # 验证所属上级是否显示正确
            sup_org_name = self.organize_management.get_current_sup_org_name()
            # 数据库查询当前登录账户的上级部门
            sup_org_name_by_aql = self.organize_management.get_belong_to_superior_org_by_sql(
                log_in_account)

            self.assertEqual(sup_org_name, sup_org_name_by_aql)

            # 编辑公司/部门名称
            self.organize_management.edit_org_name(
                view_org_info['view_org_name'])
            # 编辑联系方式
            self.organize_management.edit_org_tel(
                view_org_info['view_org_tel'])
            # 跳出内层frame
            self.organize_management.switch_to_parent_content()
            # 取消
            self.organize_management.click_org_modify_dismiss()
            # 从数据库查询验证未修改成功
            current_org_info_01 = self.organize_management.get_current_org_info_by_sql(
                log_in_account)
            edit_org_name_01 = current_org_info_01[0]
            edit_org_tel_01 = current_org_info_01[1]
            self.assertNotEqual(edit_org_name_01,
                                view_org_info['view_org_name'])
            self.assertNotEqual(edit_org_tel_01, view_org_info['view_org_tel'])
            self.driver.wait(1)

            # 点击查看公司部门
            self.organize_management.click_view_org()
            # 切入内层frame
            self.organize_management.switch_to_2_frame()

            # 验证所属上级是否显示正确
            sup_org_name = self.organize_management.get_current_sup_org_name()
            # 数据库查询当前登录账户的上级部门
            sup_org_name_by_aql = self.organize_management.get_belong_to_superior_org_by_sql(
                log_in_account)

            self.assertEqual(sup_org_name, sup_org_name_by_aql)

            # 编辑公司/部门名称
            self.organize_management.edit_org_name(
                view_org_info['view_org_name'])
            # 编辑联系方式
            self.organize_management.edit_org_tel(
                view_org_info['view_org_tel'])
            # 跳出内层frame
            self.organize_management.switch_to_parent_content()
            # 关闭
            self.organize_management.click_org_modify_close()
            # 从数据库查询验证未修改成功
            current_org_info_02 = self.organize_management.get_current_org_info_by_sql(
                log_in_account)
            edit_org_name_02 = current_org_info_02[0]
            edit_org_tel_02 = current_org_info_02[1]
            self.assertNotEqual(edit_org_name_02,
                                view_org_info['view_org_name'])
            self.assertNotEqual(edit_org_tel_02, view_org_info['view_org_tel'])
            self.driver.wait(1)

            # 点击查看公司部门
            self.organize_management.click_view_org()
            # 切入内层frame
            self.organize_management.switch_to_2_frame()

            # 验证所属上级是否显示正确
            sup_org_name = self.organize_management.get_current_sup_org_name()
            # 数据库查询当前登录账户的上级部门
            sup_org_name_by_aql = self.organize_management.get_belong_to_superior_org_by_sql(
                log_in_account)

            self.assertEqual(sup_org_name, sup_org_name_by_aql)

            # 编辑公司/部门名称
            self.organize_management.edit_org_name(
                view_org_info['view_org_name'])
            # 编辑联系方式
            self.organize_management.edit_org_tel(
                view_org_info['view_org_tel'])
            # 跳出内层frame
            self.organize_management.switch_to_parent_content()
            # 修改(保存)
            self.organize_management.click_org_modify_button()
            # 从数据库查询验证修改成功
            current_org_info_03 = self.organize_management.get_current_org_info_by_sql(
                log_in_account)
            edit_org_name_03 = current_org_info_03[0]
            edit_org_tel_03 = current_org_info_03[1]
            self.assertEqual(edit_org_name_03, view_org_info['view_org_name'])
            self.assertEqual(edit_org_tel_03, view_org_info['view_org_tel'])
            self.driver.wait(1)

        # 跳出外层frame
        self.organize_management.switch_to_default_content()
        csv_file.close()

        # 退出登录
        self.user_center.logout()
class TestCase08OrgManageDeleteOrg(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.organize_management = OrganizeManagement(self.driver,
                                                      self.base_url)
        self.log_in_page_read_csv = LogInPageReadCsv()
        self.user_center_read_csv = UserCenterReadCsv()
        self.organize_management_read_csv = OrganizeManagementReadCsv()
        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_delete_org(self):
        # 通过csv测试删除公司部门功能

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

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

        # 点击进入部门管理
        self.organize_management.click_org_manage()

        csv_file = self.user_center_read_csv.read_csv('delete_org.csv')
        csv_data = csv.reader(csv_file)
        for row in csv_data:
            delete_org = {
                "org_name": row[0],
            }

            # 按名称查找部门
            self.organize_management.search_org(delete_org['org_name'])

            # 点击删除
            self.organize_management.click_delete_org()

            # 跳出frame
            self.organize_management.switch_to_default_content()
            # 取消
            self.organize_management.delete_org_dismiss()

            # 切入frame
            self.organize_management.switch_to_1_frame()
            # 点击删除
            self.organize_management.click_delete_org()
            # 跳出frame
            self.organize_management.switch_to_default_content()
            # 关闭
            self.organize_management.delete_org_close()

            # 切入frame
            self.organize_management.switch_to_1_frame()
            # 点击删除
            self.organize_management.click_delete_org()
            # 跳出frame
            self.organize_management.switch_to_default_content()
            # 确认
            self.organize_management.delete_org_accept()

            # 数据库查找验证部门是否删除成功

            # 数据库查找部门
            org_name_after_delete = self.organize_management.get_search_result_orgname_by_sql(
                log_in_account, '')

            self.assertNotIn(delete_org['org_name'], org_name_after_delete)

            # 切入frame
            self.organize_management.switch_to_1_frame()

        csv_file.close()

        # 跳出frame
        self.organize_management.switch_to_default_content()
        # 退出登录
        self.user_center.logout()
Пример #8
0
class TestCase04OrgManageEditOrg(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.organize_management = OrganizeManagement(self.driver,
                                                      self.base_url)
        self.log_in_page_read_csv = LogInPageReadCsv()
        self.user_center_read_csv = UserCenterReadCsv()
        self.organize_management_read_csv = OrganizeManagementReadCsv()
        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_edit_org(self):
        # 通过csv测试修改公司部门功能

        csv_file = self.user_center_read_csv.read_csv('edit_org_info.csv')
        csv_data = csv.reader(csv_file)
        for row in csv_data:
            edit_org_info = {
                "account": row[0],
                "password": row[1],
                "search_key": row[2],
                "edit_org_name": row[3],
                "choose_sup_org": row[4],
                "edit_org_tel": row[5],
            }

            # 打开风控首页-登录页
            self.base_page.open_page()
            sleep(1)
            # 登录账号
            self.login_page.user_login(edit_org_info['account'],
                                       edit_org_info['password'])

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

            # 从数据库获取登录账号的用户名
            account_info = self.user_center.get_account_info_by_sql(
                edit_org_info['account'])
            print(account_info)
            account_name = account_info[1]

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

            # 点击进入部门管理
            self.organize_management.click_org_manage()

            # 查找test00000部门
            self.organize_management.search_org(edit_org_info['search_key'])
            # 获取页面查找结果
            search_org_name_01 = self.organize_management.get_search_result_one(
            )
            # 查询数据库获取搜索结果
            org_info_00 = self.organize_management.get_search_result_by_sql(
                edit_org_info['account'], edit_org_info['search_key'])
            org_name_00 = org_info_00[0]
            sup_org_name_00 = org_info_00[1]
            org_tel_00 = org_info_00[2]
            self.assertEqual(search_org_name_01, org_name_00)

            # 点击修改
            self.organize_management.click_edit_org()
            # 切入内层frame
            self.organize_management.switch_to_2_frame()
            # 获取当前显示的部门名称是否与未修改前一致
            current_org_name_01 = self.organize_management.get_current_org_name(
            )
            self.assertEqual(search_org_name_01, current_org_name_01)
            # 获取显示的所属上级是否与未修改前一致
            current_sup_org = self.organize_management.get_current_sup_org_name(
            )
            self.assertEqual(sup_org_name_00, current_sup_org)
            # 获取显示的联系方式是否与未修改前一致
            current_org_tel = self.organize_management.get_current_org_tel()
            self.assertEqual(org_tel_00, current_org_tel)

            # 修改部门名称
            self.organize_management.edit_org_name(
                edit_org_info['edit_org_name'])
            # 修改所属上级
            self.organize_management.edit_sup_org(
                edit_org_info['choose_sup_org'])
            # 修改联系方式
            self.organize_management.edit_org_tel(
                edit_org_info['edit_org_tel'])
            # 跳出内层frame
            self.organize_management.switch_to_parent_content()
            # 取消
            self.organize_management.click_org_modify_dismiss()
            # 数据库查询是否修改失败
            org_info_01 = self.organize_management.get_search_result_by_sql(
                edit_org_info['account'], edit_org_info['search_key'])
            org_name_01 = org_info_01[0]
            sup_org_name_01 = org_info_01[1]
            org_tel_01 = org_info_01[2]
            self.assertEqual(org_name_00, org_name_01)
            self.assertEqual(sup_org_name_00, sup_org_name_01)
            self.assertEqual(org_tel_00, org_tel_01)

            # 点击修改
            self.organize_management.click_edit_org()
            # 切入内层frame
            self.organize_management.switch_to_2_frame()

            # 修改部门名称
            self.organize_management.edit_org_name(
                edit_org_info['edit_org_name'])
            # 修改所属上级
            self.organize_management.edit_sup_org(
                edit_org_info['choose_sup_org'])
            # 修改联系方式
            self.organize_management.edit_org_tel(
                edit_org_info['edit_org_tel'])
            # 跳出内层frame
            self.organize_management.switch_to_parent_content()

            # 关闭
            self.organize_management.click_org_modify_close()
            # 数据库查询是否修改失败
            org_info_02 = self.organize_management.get_search_result_by_sql(
                edit_org_info['account'], edit_org_info['search_key'])
            org_name_02 = org_info_02[0]
            sup_org_name_02 = org_info_02[1]
            org_tel_02 = org_info_02[2]
            self.assertEqual(org_name_00, org_name_02)
            self.assertEqual(sup_org_name_00, sup_org_name_02)
            self.assertEqual(org_tel_00, org_tel_02)

            # 点击修改
            self.organize_management.click_edit_org()
            # 切入内层frame
            self.organize_management.switch_to_2_frame()

            # 修改部门名称
            self.organize_management.edit_org_name(
                edit_org_info['edit_org_name'])
            # 修改所属上级
            self.organize_management.edit_sup_org(
                edit_org_info['choose_sup_org'])
            # 修改联系方式
            self.organize_management.edit_org_tel(
                edit_org_info['edit_org_tel'])
            # 跳出内层frame
            self.organize_management.switch_to_parent_content()

            # 修改(保存)
            self.organize_management.click_org_modify_button()
            # 数据库查询是否修改成功
            org_info_03 = self.organize_management.get_search_result_by_sql(
                edit_org_info['account'], edit_org_info['search_key'])
            org_name_03 = org_info_03[0]
            sup_org_name_03 = org_info_03[1]
            org_tel_03 = org_info_03[2]
            self.assertEqual(edit_org_info['edit_org_name'], org_name_03)
            self.assertEqual(edit_org_info['choose_sup_org'], sup_org_name_03)
            self.assertEqual(edit_org_info['edit_org_tel'], org_tel_03)

            # 跳出外层frame
            self.organize_management.switch_to_default_content()

            # 退出登录
            self.user_center.logout()

        csv_file.close()