Example #1
0
    def __init__(self, parent=None):
        self.logo = Link(
            xpath=".//div[@class='navigation-bar']//li[@class='product-logo']",
            element_name="Logo")
        self.nodesTotal = HtmlElement(
            xpath=".//div[@class='navigation-bar']//div[@class='statistic']"
            "/div[@class='stat-count'][1]",
            element_name="Nodes total")
        self.nodesUnallocated = HtmlElement(
            xpath=".//div[@class='navigation-bar']//div[@class='statistic']"
            "/div[@class='stat-count'][1]",
            element_name="Nodes unallocated")
        self.notificationsLink = Link(
            xpath=".//div[@class='navigation-bar']"
            "//li[contains(@class, 'notifications')]",
            element_name="Notifications")
        self.openStackEnvironmentsLink = Link(
            xpath=".//div[@class='navigation-bar']"
            "//li[contains(.,'OpenStack Environments')]",
            element_name="OpenStack Environments")
        self.releases = Link(xpath=".//div[@class='navigation-bar']"
                             "//li[contains(.,'Releases')]/a",
                             element_name="Releases")
        self.supportLink = Link(xpath=".//div[@class='navigation-bar']"
                                "//li[contains(.,'OpenStack Support')]",
                                element_name="OpenStack Support")

        AbstractView.__init__(self, parent)
Example #2
0
    def __init__(self, parent=None):
        self.addNodes = Link(
            xpath="//div//a[@class='btn btn-success btn-add-nodes']",
            element_name="Add nodes"
        )
        self.deleteNodes = Button(
            xpath="//button[contains(@class,'btn-delete-nodes')]",
            element_name="Delete nodes"
        )
        self.reassignRoles = Button(
            xpath="//button[contains(@class, 'btn-assign-roles')]"
                  "and contains(text(),'Reassign Roles')]",
            element_name="Reassign roles"
        )
        self.assignRoles = Button(
            xpath="//button[contains("
                  "@class, 'btn btn-success btn-assign-roles') "
                  "and contains(text(),'Assign Roles')]",
            element_name="Assign roles"
        )
        self.environment_status = HtmlElement(
            xpath="//div[@class='environment-status']",
            element_name="Environment status"
        )
        self.groupBy = Select(
            xpath="//div[@class='cluster-toolbar-item nodes-filter']"
                  "//select[@name='grouping']",
            element_name="Select group by"
        )
        self.backToEnvironmentNodeList = Button(
            xpath="//div[@class='btn btn-go-to-cluster']",
            element_name="Back to Environment Node List"
        )

        self.nodelist = HtmlElement(
            xpath="//div[@class='node-groups' and "
                  "contains(div[@class='row-fluid node-group-header']"
                  "//h4/text(),'{role}')]",
            element_name="'{role}' block"
        )
        self.deploymentMode = Button(
            xpath="//button[contains(@class,'btn btn-cluster-actions')]",
            element_name="Deployment mode"
        )
        self.alertError = HtmlElement(
            xpath="//div[contains(@class, 'alert-block') "
                  "and contains(@class, 'global-error')]/p",
            element_name="Alert Error"
        )

        AbstractView.__init__(self, parent)
Example #3
0
    def __init__(self, parent=None):
        self.environment = HtmlElement(
            xpath="//div[@id='content']//div[@class='cluster-list']"
                  "//a[contains(@class, 'clusterbox') "
                  "and div[contains(@class, 'cluster-name') "
                  "and text()='{name}']]",
            element_name="Environment {name}"
        )

        self.newEnvironment = Link(
            xpath="//div[@id='content']//div[@class='cluster-list']"
                  "//div[contains(@class, 'clusterbox create-cluster')]",
            element_name="New environment")

        AbstractView.__init__(self, parent)
        self.url = "#clusters"
Example #4
0
    def __init__(self, parent=None):
        self.addCompute = Link(
            xpath="//div[@id='tab-nodes']"
                  "//div[contains(@class, 'node-list-compute')]"
                  "//a[contains(@class, 'btn-add-nodes')]",
            element_name="Add compute"
        )
        self.addController = Link(
            xpath="//div[@id='tab-nodes']"
                  "//div[contains(@class, 'node-list-controller')]"
                  "//a[contains(@class, 'btn-add-nodes')]",
            element_name="Add controller"
        )
        self.addCinder = Link(
            xpath="//div[@id='tab-nodes']"
                  "//div[contains(@class, 'node-list-cinder')]"
                  "//a[contains(@class, 'btn-add-nodes')]",
            element_name="Add controller"
        )
        self.computes = Button(
            xpath="//div[@id='tab-nodes']"
                  "//div[contains(@class, 'node-list-compute')]",
            element_name="computes"
        )
        self.controllers = HtmlElement(
            xpath="//div[@id='tab-nodes']"
                  "//div[contains(@class, 'node-list-controller')]",
            element_name="controllers"
        )
        self.cinders = Button(
            xpath="//div[@id='tab-nodes']"
                  "//div[contains(@class, 'node-list-cinder')]",
            element_name="cinders"
        )
        self.deploymentMode = Link(
            xpath="//li[contains(@class, 'change-cluster-mode-btn')]",
            element_name="Deployment mode"
        )
        self.alertError = HtmlElement(
            xpath="//div[contains(@class, 'alert-block') "
                  "and contains(@class, 'global-error')]/p",
            element_name="Alert Error"
        )

        AbstractView.__init__(self, parent)
class Cluster_BrowseView(AbstractView):
    XPATH_ENVIRONMENTS = "//div[@id='content']//div[@class='cluster-list']" \
                         "//a[contains(@class, 'clusterbox') " \
                         "and div[contains(@class, 'cluster-name')]]"

    def __init__(self, parent=None):
        self.environment = HtmlElement(
            xpath="//div[@id='content']//div[@class='cluster-list']"
                  "//a[contains(@class, 'clusterbox') "
                  "and div[contains(@class, 'cluster-name') "
                  "and text()='{name}']]",
            element_name="Environment {name}"
        )

        self.newEnvironment = Link(
            xpath="//div[@id='content']//div[@class='cluster-list']"
                  "//div[contains(@class, 'clusterbox create-cluster')]",
            element_name="New environment")

        AbstractView.__init__(self, parent)
        self.url = "#clusters"

    def get_clusters(self):
        return [Cluster(x) for x in self.get_action_bot().find_elements(
            By.XPATH, self.XPATH_ENVIRONMENTS)]

    def click_add_new_cluster(self, key="cluster"):
        Storage.put(key, TD_Cluster())
        return self.newEnvironment.click_and_wait()

    def remove(self, name):
        rl = ResultList("Delete environment {name}".format(name=name)) \
            .push(self.environment.find(name=name).click_and_wait()) \
            .push(Cluster_View().click_actions_tab()) \
            .push(Cluster_Actions_View().click_delete_cluster_button()) \
            .push(DeleteEnvironmentDialog().delete())
        env = self.environment.find(name=name)
        if env.is_found():
                WaitBot().wait_for_web_element_disappears(env.get_element())
        return rl

    def remove_all(self):
        rl = ResultList("Remove all existing environments")
        for env in self.get_clusters():
            rl.push(self.remove(env.get_name()))
        rl.info("All environments were removed")
        return rl

    def select(self, name):
        return ResultList("Select environment [{}]".format(name)) \
            .push(self.environment.find(name=name).click_and_wait())

    def select_by_key(self, key):
        return self.select(Storage.get(key).name)
Example #6
0
    def __init__(self, parent=None):
        self.name = HtmlElement(xpath=".//div[@class='volume-group-name']",
                                element_name="name")

        self.size = HtmlElement(xpath=".//div[@class='volume-group-size']",
                                element_name="name")

        self.close = Link(xpath=".//div[@class='close-btn']",
                          element_name="close")

        BasePage.__init__(self, parent)
Example #7
0
    def __init__(self, parent=None):
        self.name = HtmlElement(xpath=".//div[@class='volume-group-box-name']",
                                element_name="name")

        self.size = Input(
            xpath=".//div[@class='volume-group-box-input']/input",
            element_name="size")

        self.use_all_unallocated = Link(
            xpath=".//div[@class='use-all-unallocated']",
            element_name="Use all unallocated")

        BasePage.__init__(self, parent)
    def __init__(self, parent=None):
        self.environment = HtmlElement(
            xpath="//div[@id='content']//div[@class='cluster-list']"
                  "//a[contains(@class, 'clusterbox') "
                  "and div[contains(@class, 'cluster-name') "
                  "and text()='{name}']]",
            element_name="Environment {name}"
        )

        self.newEnvironment = Link(
            xpath="//div[@id='content']//div[@class='cluster-list']"
                  "//div[contains(@class, 'clusterbox create-cluster')]",
            element_name="New environment")

        AbstractView.__init__(self, parent)
        self.url = "#clusters"
Example #9
0
class Cluster_Nodes_View(AbstractView):
    def __init__(self, parent=None):
        self.addCompute = Link(
            xpath="//div[@id='tab-nodes']"
                  "//div[contains(@class, 'node-list-compute')]"
                  "//a[contains(@class, 'btn-add-nodes')]",
            element_name="Add compute"
        )
        self.addController = Link(
            xpath="//div[@id='tab-nodes']"
                  "//div[contains(@class, 'node-list-controller')]"
                  "//a[contains(@class, 'btn-add-nodes')]",
            element_name="Add controller"
        )
        self.addCinder = Link(
            xpath="//div[@id='tab-nodes']"
                  "//div[contains(@class, 'node-list-cinder')]"
                  "//a[contains(@class, 'btn-add-nodes')]",
            element_name="Add controller"
        )
        self.computes = Button(
            xpath="//div[@id='tab-nodes']"
                  "//div[contains(@class, 'node-list-compute')]",
            element_name="computes"
        )
        self.controllers = HtmlElement(
            xpath="//div[@id='tab-nodes']"
                  "//div[contains(@class, 'node-list-controller')]",
            element_name="controllers"
        )
        self.cinders = Button(
            xpath="//div[@id='tab-nodes']"
                  "//div[contains(@class, 'node-list-cinder')]",
            element_name="cinders"
        )
        self.deploymentMode = Link(
            xpath="//li[contains(@class, 'change-cluster-mode-btn')]",
            element_name="Deployment mode"
        )
        self.alertError = HtmlElement(
            xpath="//div[contains(@class, 'alert-block') "
                  "and contains(@class, 'global-error')]/p",
            element_name="Alert Error"
        )

        AbstractView.__init__(self, parent)

    def click_add_compute(self):
        return self.addCompute.click_and_wait()

    def click_add_controller(self):
        return self.addController.click_and_wait()

    def click_add_cinder(self):
        return self.addCinder.click_and_wait()

    def click_deployment_mode(self):
        return self.deploymentMode.click()

    def select_environment_mode(self, deploymentMode):
        rl = ResultList(
            "Select environment mode [{mode}]".format(
                mode=deploymentMode)
        )
        rl.push(self.click_deployment_mode())
        rl.push(EnvironmentDeploymentModeDialog().populate(
            deploymentMode=deploymentMode,
            submit=True
        ))
        return rl

    def verify_cinder_nodes(self, *args):
        return Cluster_Nodes_ListView(
            self.cinders.get_element()
        ).verify_nodes(*args)

    def verify_compute_nodes(self, *args):
        return Cluster_Nodes_ListView(
            self.computes.get_element()
        ).verify_nodes(*args)

    def verify_controller_nodes(self, *args):
        return Cluster_Nodes_ListView(
            self.controllers.get_element()
        ).verify_nodes(*args)

    def get_nodes_controllers(self):
        return Cluster_Nodes_ListView(self.controllers.get_element())\
            .get_nodes()

    def get_nodes_computes(self):
        return Cluster_Nodes_ListView(self.computes.get_element())\
            .get_nodes()

    def get_nodes_cinders(self):
        return Cluster_Nodes_ListView(self.cinders.get_element())\
            .get_nodes()

    def verify_error_contains(self, *args):
        rl = ResultList("Verify error alert contains")
        for string in args:
            rl.push(Result(
                "String [{string}] exists".format(string=string),
                self.alertError.get_value().find(string) != -1
            ))
        return rl
Example #10
0
class Cluster_BrowseView(AbstractView):
    XPATH_ENVIRONMENTS = "//div[@id='content']//div[@class='cluster-list']" \
                         "//a[contains(@class, 'clusterbox') " \
                         "and div[contains(@class, 'cluster-name')]]"

    def __init__(self, parent=None):
        self.environment = HtmlElement(
            xpath="//div[@id='content']//div[@class='cluster-list']"
                  "//a[contains(@class, 'clusterbox') "
                  "and div[contains(@class, 'cluster-name') "
                  "and text()='{name}']]",
            element_name="Environment {name}"
        )

        self.newEnvironment = Link(
            xpath="//div[@id='content']//div[@class='cluster-list']"
                  "//div[contains(@class, 'clusterbox create-cluster')]",
            element_name="New environment")

        AbstractView.__init__(self, parent)
        self.url = "#clusters"

    def get_clusters(self):
        return [Cluster(x) for x in self.get_action_bot().find_elements(
            By.XPATH, self.XPATH_ENVIRONMENTS)]

    def click_add_new_cluster(self, key="cluster"):
        Storage.put(key, TD_Cluster())
        return self.newEnvironment.click_and_wait()

    def remove(self, name):
        rl = ResultList("Delete environment {name}".format(name=name)) \
            .push(self.environment.find(name=name).click_and_wait()) \
            .push(Cluster_View().click_actions_tab()) \
            .push(Cluster_Actions_View().click_delete_cluster_button()) \
            .push(DeleteEnvironmentDialog().delete())
        env = self.environment.find(name=name)
        if env.is_found():
                WaitBot().wait_for_web_element_disappears(env.get_element())
        return rl

    def remove_all(self):
        rl = ResultList("Remove all existing environments")
        _list = []
        for env in self.get_clusters():
            _list.append(env.get_name())
        rl.info("There is(are) {} environments to remove. Names: {}".format(
            len(_list), str(_list)
        ))
        for name in _list:
            rl.push(self.remove(name))
        rl.info("All environments were removed")
        return rl

    def select(self, name):
        rl = ResultList("Select environment [{}]".format(name))
        rl.push(self.environment.find(name=name).click_and_wait())
        rl.push(self.get_wait_bot().wait_for_time(2))
        return rl

    def select_by_key(self, key):
        return self.select(Storage.get(key).name)

    def verify_clusters_amount(self, value):
        return Result(
            "Verify if amount of clusters is {value}"
            .format(value=value),
            len(self.get_clusters()) == value
        )
Example #11
0
class Cluster_Nodes_View(AbstractView):
    def __init__(self, parent=None):
        self.addNodes = Link(
            xpath="//div//a[@class='btn btn-success btn-add-nodes']",
            element_name="Add nodes"
        )
        self.deleteNodes = Button(
            xpath="//button[contains(@class,'btn-delete-nodes')]",
            element_name="Delete nodes"
        )
        self.reassignRoles = Button(
            xpath="//button[contains(@class, 'btn-assign-roles')]"
                  "and contains(text(),'Reassign Roles')]",
            element_name="Reassign roles"
        )
        self.assignRoles = Button(
            xpath="//button[contains("
                  "@class, 'btn btn-success btn-assign-roles') "
                  "and contains(text(),'Assign Roles')]",
            element_name="Assign roles"
        )
        self.environment_status = HtmlElement(
            xpath="//div[@class='environment-status']",
            element_name="Environment status"
        )
        self.groupBy = Select(
            xpath="//div[@class='cluster-toolbar-item nodes-filter']"
                  "//select[@name='grouping']",
            element_name="Select group by"
        )
        self.backToEnvironmentNodeList = Button(
            xpath="//div[@class='btn btn-go-to-cluster']",
            element_name="Back to Environment Node List"
        )

        self.nodelist = HtmlElement(
            xpath="//div[@class='node-groups' and "
                  "contains(div[@class='row-fluid node-group-header']"
                  "//h4/text(),'{role}')]",
            element_name="'{role}' block"
        )
        self.deploymentMode = Button(
            xpath="//button[contains(@class,'btn btn-cluster-actions')]",
            element_name="Deployment mode"
        )
        self.alertError = HtmlElement(
            xpath="//div[contains(@class, 'alert-block') "
                  "and contains(@class, 'global-error')]/p",
            element_name="Alert Error"
        )

        AbstractView.__init__(self, parent)

    def click_deployment_mode(self):
        return self.deploymentMode.click()

    @catch_stale_error
    def click_add_nodes(self):
        return self.addNodes.click_and_wait()

    def select_environment_mode(self, deploymentMode):
        rl = ResultList(
            "Select environment mode [{mode}]".format(
                mode=deploymentMode)
        )
        rl.push(self.click_deployment_mode())
        rl.push(CreateEnvironmentDialog().select_deployment_mode(
            deploymentMode
        ))
        rl.push(CreateEnvironmentDialog().clickNext())
        return rl

    @catch_stale_error
    def verify_nodes(self, role, nodes):
        return Cluster_Nodes_ListView(
            self.nodelist.find(role=role).get_element()
        ).verify_nodes(*nodes)

    def get_nodes(self, role):
        return Cluster_Nodes_ListView(
            self.nodelist.find(role=role).get_element()).get_nodes()

    def verify_node_with_role_not_exists(self, role, *args):
        return Cluster_Nodes_ListView(
            self.nodelist.find(role=role).get_element()
        ).verify_nodes_not_exist(*args)

    def verify_error_contains(self, *args):
        rl = ResultList("Verify error alert contains")
        for string in args:
            rl.push(Result(
                "String [{string}] exists".format(string=string),
                self.alertError.get_value().find(string) != -1
            ))
        return rl

    def verify_nodelists_visibility(self, value, *roles):
        rl = ResultList("Verify node lists visibility")
        for role in roles:
            rl.push(VerifyBot().verify_visibility(
                self.nodelist.find(role=role).get_element(),
                value, "'{role}' nodelist"))
        return rl

    def verify_amount(self, elements_role, value):
        result = None
        try:
            elements = self.get_nodes(role=elements_role)

            if value == 0:
                result = Result(
                    "Verify if amount of {role} is 0".format(
                        role=elements_role, value=value),
                    VerifyBot().verify_visibility(
                        elements, False, elements_role).i_passed())
            else:
                result = Result(
                    "Verify if amount of {role} is {value}".format(
                        role=elements_role, value=value),
                    len(elements) == value)

        except ElementNotFoundException:
            if value == 0:
                result = Result("There are no {name}".format(
                    role=elements_role), True)
        return result

    def select_nodes(self, *args):
        rl = ResultList("Select nodes")
        for name in args:
            node = Node(Cluster_Nodes_ListView().node.find(
                name=name).get_element())
            rl.push(node.select())
        return rl

    def select_roles(self, *roles):
        rl = ResultList("Select roles")
        for role in roles:
            rl.push(RolesPanel().checkbox_role.find(role=role).set_value('on'))
        return rl

    def assign_roles_to_nodes(self, roles, node_names):
        rl = ResultList("Select nodes and assign roles")
        rl.push(self.select_nodes(*node_names))
        rl.push(self.select_roles(*roles))
        rl.push(self.apply())
        ActionBot().wait_for_time(2)
        return rl

    def delete_nodes(self, *args):
        rl = ResultList("Delete nodes")
        rl.push(self.select_nodes(*args))
        rl.push(self.deleteNodes.click_and_wait())
        rl.push(DeleteNodeDialog().delete())
        return rl