Example #1
0
class HostTest(unittest.TestCase):
    @classmethod
    def setUpClass(self):
        """
        测试固件的setUp()的代码,主要是测试的前提准备工作
        :return:
        """
        browse = BrowserEngine(self)
        self.driver = browse.open_browser(self)
        self.logger = BrowserEngine.logger

        self.login = TestLogin(self.driver)
        self.menu = MenuPage(self.driver)
        self.host = TestHost(self.driver)

    @classmethod
    def tearDownClass(self):
        """
        测试结束后的操作
        :return:
        """
        # self.driver.quit()

    # 主机模块测试
    def test_login(self):
        self.logger.info("登录:账号、密码正确匹配")
        self.login.test_login4()
        self.login.sleep(1)
        self.menu.send_click_host()
        self.host.sleep(1)
        self.driver.switch_to.frame("host")

        self.logger.info("测试编辑主机")
        self.host.test_edit_host(editHost["host"], editHost["name"],
                                 editHost["description"], editHost["spm"])
Example #2
0
    def setUpClass(self):
        """
        测试固件的setUp()的代码,主要是测试的前提准备工作
        :return:
        """
        browse = BrowserEngine(self)
        self.driver = browse.open_browser(self)
        self.logger = BrowserEngine.logger

        self.login = TestLogin(self.driver)
        self.menu = MenuPage(self.driver)
        self.vm = TestVm(self.driver)
Example #3
0
    def setUpClass(self):
        """
        测试固件的setUp()的代码,主要是测试的前提准备工作
        :return:
        """
        browse = BrowserEngine(self)
        self.driver = browse.open_browser(self)
        self.logger = BrowserEngine.logger

        self.login = TestLogin(self.driver)
        self.menu = MenuPage(self.driver)
        self.host = TestHost(self.driver)
        self.disk = TestDisk(self.driver)
        self.temp = TestTemp(self.driver)
        self.user = TestUser(self.driver)
        self.vm = TestVm(self.driver)
Example #4
0
class HostTest(unittest.TestCase):

    @classmethod
    def setUpClass(self):
        """
        测试固件的setUp()的代码,主要是测试的前提准备工作
        :return:
        """
        browse = BrowserEngine(self)
        self.driver = browse.open_browser(self)
        self.logger = BrowserEngine.logger

        self.login = TestLogin(self.driver)
        self.menu = MenuPage(self.driver)
        self.disk = TestDisk(self.driver)


    @classmethod
    def tearDownClass(self):
        """
        测试结束后的操作
        :return:
        """
        self.driver.quit()


    # #登录
    # def test_login(self):
    #     self.logger.info("登录:账号、密码正确匹配")
    #     self.login.test_login4()
    #     self.login.sleep(1)

    # 磁盘模块测试
    def test_login(self):
        self.logger.info("登录:账号、密码正确匹配")
        self.login.test_login4()
        self.login.sleep(1)
        self.menu.send_click_disk()
        self.disk.sleep(1)
        self.driver.switch_to.frame("disk")

        self.logger.info("测试编辑主机")
        self.disk.test_new_disk(newDisk["name"], newDisk["description"], newDisk["size"])
        self.disk.sleep(1)
        self.disk.test_edit_disk(editDisk["disk"], editDisk["description"])
        self.disk.sleep(1)
        self.disk.test_delete_disk(deleteDisk["disk"], deleteDisk["cleardisk"])
Example #5
0
class HostUser(unittest.TestCase):
    @classmethod
    def setUpClass(self):
        """
        测试固件的setUp()的代码,主要是测试的前提准备工作
        :return:
        """
        browse = BrowserEngine(self)
        self.driver = browse.open_browser(self)
        self.logger = BrowserEngine.logger

        self.login = TestLogin(self.driver)
        self.menu = MenuPage(self.driver)
        self.user = TestUser(self.driver)

    @classmethod
    def tearDownClass(self):
        """
        测试结束后的操作
        :return:
        """
        self.driver.quit()

    # #登录
    # def test_login(self):
    #     self.logger.info("登录:账号、密码正确匹配")
    #     self.login.test_login4()
    #     self.login.sleep(1)

    # 用户模块测试
    def test_login(self):
        self.logger.info("登录:账号、密码正确匹配")
        self.login.test_login4("admin", "rocky")
        self.login.sleep(1)
        self.menu.send_click_user()
        self.user.sleep(1)
        self.driver.switch_to.frame("user")

        self.user.test_allocate_vm_user(allocateVmUser["user"],
                                        allocateVmUser["vm"])
        self.user.sleep(2)
        self.user.test_remove_vm_user(removeVmUser["user"], removeVmUser["vm"])
Example #6
0
    def test_user(self):
        """
        这里一定要test开头,把测试逻辑代码封装到一个test开头的方法里。
        :return:
        """
        loginpage = LoginPage(self.driver)
        loginpage.send_iput_user('admin')  # 调用页面对象中的方法
        loginpage.sleep(1)
        loginpage.send_iput_passwd('rocky')  # 调用页面对象中的方法
        loginpage.sleep(1)
        loginpage.send_click_submit()  # 调用页面对象类中的点击搜索按钮方法
        loginpage.sleep(1)

        menupage = MenuPage(self.driver)
        menupage.send_click_user()
        menupage.sleep(1)

        # userpage = UserPage(self.driver)
        # self.driver.switch_to.frame("user")
        # userpage.sleep(1)

        # userpage.send_click_user()
        # userpage.sleep(1)
        #
        # userpage.send_click_allocatevm(userpage.table, "lfxtest")
        # userpage.sleep(1)

        userpage.send_click_group()
        userpage.sleep(1)

        userpage.send_click_allocateuser(userpage.table, "lfxtest")
Example #7
0
    def test_temp(self):
        """
        这里一定要test开头,把测试逻辑代码封装到一个test开头的方法里。
        :return:
        """
        loginpage = LoginPage(self.driver)
        loginpage.iput_user('admin')  # 调用页面对象中的方法
        loginpage.sleep(1)
        loginpage.iput_passwd('rocky')  # 调用页面对象中的方法
        loginpage.sleep(1)
        loginpage.send_submit_btn()  # 调用页面对象类中的点击搜索按钮方法
        loginpage.sleep(1)

        menupage = MenuPage(self.driver)
        menupage.send_click_temp()
        menupage.sleep(1)

        temppage = TempPage(self.driver)
        self.driver.switch_to.frame("template")
        temppage.sleep(1)

        temppage.send_select_temp1()
        temppage.sleep(1)
        #temppage.send_click_edit()
        #temppage.send_click_delete()
        temppage.send_click_import()
        temppage.sleep(1)
        self.driver.switch_to.frame(
            self.driver.find_element_by_tag_name("iframe"))
        temppage.sleep(1)

        temppage.send_select_domainIP("FCP2(192G/197G)")
Example #8
0
    def test_disk(self):
        """
        这里一定要test开头,把测试逻辑代码封装到一个test开头的方法里。
        :return:
        """
        loginpage = LoginPage(self.driver)
        loginpage.send_iput_user('admin')  # 调用页面对象中的方法
        loginpage.sleep(1)
        loginpage.send_iput_passwd('123')  # 调用页面对象中的方法
        loginpage.sleep(1)
        loginpage.send_click_submit()  # 调用页面对象类中的点击搜索按钮方法
        loginpage.sleep(1)

        menupage = MenuPage(self.driver)
        menupage.send_click_disk()
        menupage.sleep(1)

        diskpage = DiskPage(self.driver)
        self.driver.switch_to.frame("disk")
        diskpage.sleep(1)

        # table = self.driver.find_element_by_xpath("//*[@id='iDiskTable']/tbody")
        # rows = table.find_elements_by_tag_name("tr")
        #
        # print (table.text)
        # print ("******* len = %d *********" % len(rows))
        #
        flag  = diskpage.select_table_row(diskpage.table, "aa")

        # result = EC.text_to_be_present_in_element(("xpath", "//*[@id='iDiskTable']/tbody"), "hhsi8991")(self.driver)

        print ("************** flag == %d ***************" % flag)
Example #9
0
    def test_host(self):
        """
        这里一定要test开头,把测试逻辑代码封装到一个test开头的方法里。
        :return:
        """
        loginpage = LoginPage(self.driver)
        loginpage.send_iput_user('admin')  # 调用页面对象中的方法
        loginpage.sleep(1)
        loginpage.send_iput_passwd('123')  # 调用页面对象中的方法
        loginpage.sleep(1)
        loginpage.send_click_submit()  # 调用页面对象类中的点击搜索按钮方法
        loginpage.sleep(1)

        menupage = MenuPage(self.driver)
        menupage.send_click_network()
        menupage.sleep(1)

        networkpage = NetworkPage(self.driver)
        self.driver.switch_to.frame("network")
        networkpage.sleep(1)
        networkpage.select_table_row(networkpage.table, "Node1")
        networkpage.sleep(1)
        networkpage.send_click_new()
        networkpage.sleep(1)
        self.driver.switch_to.frame(
            self.driver.find_element_by_tag_name("iframe"))
        networkpage.send_select_eth0N()
        networkpage.sleep(1)
        networkpage.send_select_eth1N()
        networkpage.sleep(1)
        networkpage.send_click_closeN()
Example #10
0
class VmTest(unittest.TestCase):
    @classmethod
    def setUpClass(self):
        """
        测试固件的setUp()的代码,主要是测试的前提准备工作
        :return:
        """
        browse = BrowserEngine(self)
        self.driver = browse.open_browser(self)
        self.logger = BrowserEngine.logger

        self.login = TestLogin(self.driver)
        self.menu = MenuPage(self.driver)
        self.vm = TestVm(self.driver)

    @classmethod
    def tearDownClass(self):
        """
        测试结束后的操作
        :return:
        """
        # self.driver.quit()

    #登录
    def test_login(self):
        self.logger.info("登录:账号、密码正确匹配")
        self.login.test_login4(login4[0], login4[1])
        self.login.sleep(1)

    # 虚拟机模块测试
    def new(self):
        self.menu.send_click_vm()
        self.vm.sleep(1)
        self.driver.switch_to.frame("vm")

        self.logger.info("测试新建用户")
Example #11
0
    def test_storage(self):
        """
        这里一定要test开头,把测试逻辑代码封装到一个test开头的方法里。
        :return:
        """
        loginpage = LoginPage(self.driver)
        loginpage.send_iput_user('admin')  # 调用页面对象中的方法
        loginpage.sleep(1)
        loginpage.send_iput_passwd('123')  # 调用页面对象中的方法
        loginpage.sleep(1)
        loginpage.send_click_submit()  # 调用页面对象类中的点击搜索按钮方法
        loginpage.sleep(1)

        menupage = MenuPage(self.driver)
        menupage.send_click_storage()
        menupage.sleep(1)

        storagepage = StoragePage(self.driver)
        self.driver.switch_to.frame("storage")
        storagepage.sleep(1)

        # storagepage.send_click_new()
        # self.driver.switch_to.frame(self.driver.find_element_by_tag_name("iframe"))
        # storagepage.sleep(1)
        # #self.driver.find_element_by_xpath("/html/body/form/div[1]/div[2]/div[2]/div").click()
        # storagepage.sleep(1)
        # js = "var options=document.getElementsByName('domainFunc').children; options[1].selected=false;options[2].selected=true;"
        # self.driver.execute_script(js)
        # storagepage.sleep(1)
        # # sl = Select(self.driver.find_element_by_xpath("/html/body/form/div[1]/div[2]/div[2]/div/select"))
        # # storagepage.sleep(2)
        # #sl.deselect_by_index(0)
        # #storagepage.sleep(2)
        # #self.driver.find_element_by_xpath("/html/body/form/div[1]/div[2]/div[2]/div/div/dl/dd[3]").click()
        # #sl.select_by_index(2)

        storagepage.select_table_row(storagepage.table, "镜像域")
        storagepage.sleep(1)
        storagepage.send_click_loadiso()
        storagepage.sleep(1)
        self.driver.switch_to.frame(self.driver.find_element_by_tag_name("iframe"))
        storagepage.sleep(1)
        path = self.driver.find_element_by_id("fileField")
        storagepage.sleep(1)
        path.send_keys("/home/lfx/iso/mini.iso")
        storagepage.sleep(1)
        # self.driver.switch_to.frame("storage")
        storagepage.sleep(1)
        close = self.driver.find_element_by_("span")
        close.click()
Example #12
0
    def test_vm(self):
        """
        这里一定要test开头,把测试逻辑代码封装到一个test开头的方法里。
        :return:
        """
        loginpage = LoginPage(self.driver)
        loginpage.send_iput_user('admin')  # 调用页面对象中的方法
        loginpage.sleep(1)
        loginpage.send_iput_passwd('123')  # 调用页面对象中的方法
        loginpage.sleep(1)
        loginpage.send_click_submit()  # 调用页面对象类中的点击搜索按钮方法
        loginpage.sleep(1)

        menupage = MenuPage(self.driver)
        menupage.send_click_vm()
        menupage.sleep(1)

        vmpage = VmPage(self.driver)
        self.driver.switch_to.frame("vm")
        vmpage.sleep(1)

        vmpage.select_table_row(vmpage.table, "ttt-1")
        vmpage.sleep(1)
Example #13
0
class LinxEngine(unittest.TestCase):
    @classmethod
    def setUpClass(self):
        """
        测试固件的setUp()的代码,主要是测试的前提准备工作
        :return:
        """
        browse = BrowserEngine(self)
        self.driver = browse.open_browser(self)
        self.logger = BrowserEngine.logger

        self.login = TestLogin(self.driver)
        self.menu = MenuPage(self.driver)
        self.host = TestHost(self.driver)
        self.disk = TestDisk(self.driver)
        self.temp = TestTemp(self.driver)
        self.user = TestUser(self.driver)
        self.vm = TestVm(self.driver)

    @classmethod
    def tearDownClass(self):
        """
        测试结束后的操作
        :return:
        """
        # self.driver.quit()

    #登录测试
    def test_login(self):
        # self.logger.info("登录测试1:账号、密码均为空")
        # self.login.test_login1()
        # self.login.sleep(1)
        # self.logger.info("登录测试2:账号或密码为空")
        # self.login.test_login2()
        # self.login.sleep(1)
        # self.logger.info("登录测试3:账号或密码错误")
        # self.login.test_login3()
        # self.login.sleep(1)
        self.logger.info("登录测试4:账号、密码正确匹配")
        self.login.test_login4("admin", "rocky")
        self.login.sleep(1)

    #主机模块测试
    def test_host(self):
        self.menu.send_click_host()
        self.host.sleep(2)
        self.driver.switch_to.frame("host")

        # self.logger.info("测试部署主机")
        # self.host.sleep(1)
        # self.host.test_deploy_host()
        # self.host.sleep(2)
        #
        # self.host.sleep(15)
        #
        self.logger.info("测试新建主机")
        self.host.sleep(1)
        self.host.test_new_host()
        self.host.sleep(2)

        self.logger.info("***************测试编辑主机***************")
        self.host.test_edit_host()
        self.host.sleep(2)

        self.logger.info("********** 测试维护主机 **********")
        self.host.test_maintenance_host()
        self.host.sleep(2)

        self.logger.info("测试激活主机")
        self.host.active_host()
        self.host.sleep(2)

        self.logger.info("测试删除主机")
        self.host.test_delete_host()
        self.host.sleep(2)

    # 磁盘模块测试
    def test_disk(self):
        self.menu.send_click_disk()
        self.host.sleep(2)
        self.driver.switch_to.frame("disk")

        self.logger.info("测试新建磁盘")
        self.disk.sleep(1)
        self.disk.test_new_disk()
        self.disk.sleep(2)

        self.logger.info("测试编辑磁盘")
        self.disk.sleep(1)
        self.disk.test_edit_disk()
        self.disk.sleep(2)

        self.logger.info("测试删除磁盘")
        self.disk.sleep(1)
        self.disk.test_delete_disk()
        self.disk.sleep(2)

    # 模板模块测试
    def test_temp(self):
        self.menu.send_click_temp()
        self.host.sleep(2)
        self.driver.switch_to.frame("template")

        self.logger.info("测试编辑模板")
        self.temp.sleep(1)
        self.temp.test_edit_temp()
        self.temp.sleep(2)

        self.logger.info("测试删除模板")
        self.temp.sleep(1)
        self.temp.test_delete_temp()
        self.temp.sleep(2)

    # 用户模块测试
    def test_user(self):
        self.menu.send_click_user()
        self.host.sleep(1)
        self.driver.switch_to.frame("user")

        # self.logger.info("测试新建用户")
        # self.user.test_new_user()
        # self.host.sleep(2)
        #
        # self.logger.info("测试删除用户")
        # self.user.test_delete_user()
        # self.host.sleep(2)
        #
        # self.logger.info("测试修改用户密码")
        # self.user.test_update_user_passwd()
        # self.host.sleep(2)
        #
        # self.logger.info("测试新建用户组")
        # self.user.test_new_group()
        # self.host.sleep(2)
        #
        # self.logger.info("测试删除用户组")
        # self.user.test_delete_group()
        # self.host.sleep(2)

        # self.user.test_allocate_vm_user()
        # self.user.sleep(2)
        self.user.test_remove_vm_user()

        # self.user.test_allocate_vm_group()
        # self.user.sleep(2)
        # self.user.test_remove_vm_group()
        #
        # self.user.test_allocate_user_group()
        # self.user.sleep(2)
        # self.user.test_remove_user_group()

    # 虚拟机模块测试
    def test_vm(self):
        self.menu.send_click_vm()
        self.vm.sleep(1)
        self.driver.switch_to.frame("vm")

        self.logger.info("测试新建用户")
        # self.vm.test_new_vm_attach_disk()
        # self.vm.sleep(1)
        # self.vm.test_new_vm_new_disk()
        # self.vm.sleep(1)
        # self.vm.test_new_vm_with_temp()
        # self.vm.test_import_vm()
        # self.vm.test_delete_vm()
        # self.vm.test_runonce_vm()
        # self.vm.test_new_snap()
        self.vm.test_restore_snap()
Example #14
0
    def test_host(self):
        """
        这里一定要test开头,把测试逻辑代码封装到一个test开头的方法里。
        :return:
        """
        loginpage = LoginPage(self.driver)
        loginpage.send_iput_user('admin')  # 调用页面对象中的方法
        loginpage.sleep(1)
        loginpage.send_iput_passwd('123')  # 调用页面对象中的方法
        loginpage.sleep(1)
        loginpage.send_click_submit()  # 调用页面对象类中的点击搜索按钮方法
        loginpage.sleep(2)

        menupage = MenuPage(self.driver)
        menupage.send_click_host()
        menupage.sleep(1)
        self.driver.switch_to.frame("host")
        menupage.sleep(1)
        host = TestHost(self.driver)
        menupage.sleep(1)
        host.select_table_row(host.table, "node1")
        menupage.sleep(1)
        host.send_click_edit()
        menupage.sleep(1)
        self.driver.switch_to.frame(
            self.driver.find_element_by_tag_name("iframe"))
        menupage.sleep(1)

        menupage.click_select_option("/html/body/form/div[1]/div[4]/div/div",
                                     "低")