Пример #1
0
    def validate_datasource_list(self):
        nav= NavigationTree(self.web_session)
        nav.navigate_to_middleware_datasources_view()

        haw= hawkular_api(self.web_session)
        tab = table(self.web_session)
        dataDb = db(self.web_session)

        datasource_api = self.hawkular_api.get_hawkular_datasources()
        datasource_ui = table(self.web_session).get_middleware_datasources_table()
        datasource_db = db(self.web_session).get_datasources()
        assert len(datasource_db) == len(datasource_ui) == len(datasource_api), "Datasource length match"

        for data_ui in datasource_ui:
            datasource_name = data_ui.get('Datasource Name')
            data_api = self.ui_utils.find_row_in_list(datasource_api, 'Name', datasource_name)

            assert data_api, "Datasource Name {} not found".format(datasource_name)
            assert (datasource_name == data_api.get("Name")), \
                "Datasource Name mismatch ui:{}, hawk:{}".format(datasource_name, data_api.get("Name"))
            self.web_session.logger.info(
                "UI Datasource name is: {}, and Hawkular datasource is: {} ".format(datasource_name,
                                                                                    data_api.get("Name")))

        return True
Пример #2
0
    def validate_providers_details(self):

        # Test to validate hawkular provider details like name, hostname, port number
        # and to validate number of middleware servers, deployments and datasources in releationships section.

        self.web_session.logger.info("Begin providers details test.")
        NavigationTree(self.web_session).navigate_to_middleware_providers_view()
        providers_ui = table(self.web_session).get_middleware_providers_table()
        servers_hawk = self.hawkular_api.get_hawkular_servers()
        deployments_hawk = self.hawkular_api.get_hawkular_deployments()
        datasources_hawk = self.hawkular_api.get_hawkular_datasources()

        for prov_ui in providers_ui:
            if prov_ui.get('Name') == self.web_session.HAWKULAR_PROVIDER_NAME:
                ui_utils(self.web_session).click_on_row_containing_text(self.web_session.HAWKULAR_PROVIDER_NAME)

        assert ui_utils(self.web_session).waitForTextOnPage("Status", 15)
        providers_details_ui = ui_utils(self.web_session).get_generic_table_as_dict()

        assert (providers_details_ui.get('Name') == self.web_session.HAWKULAR_PROVIDER_NAME), "Provider name mismatch"
        assert (providers_details_ui.get('Host Name') == self.web_session.HAWKULAR_HOSTNAME), "Hostname mismatch"
        assert (providers_details_ui.get('Port') == self.web_session.HAWKULAR_PORT), "Port Number mismatch"

        assert providers_details_ui.get('Middleware Servers') == str(len(servers_hawk)), "Number of servers mismatch"

        self.web_session.logger.debug("UI Deploys: {}  HW Deploys: {}".format(providers_details_ui.get('Middleware Deployments'), str(len(deployments_hawk))))
        # assert providers_details_ui.get('Middleware Deployments') == str(len(deployments_hawk)), "Number of Deployments mismatch"
        assert providers_details_ui.get('Middleware Datasources') == str(len(datasources_hawk)), "Number of Datasources mismatch"

        return True
Пример #3
0
    def validate_deployments_list(self):
        deployments_ui = table(
            self.web_session).get_middleware_deployments_table()
        assert deployments_ui, "No UI Deployments found."
        deployments_hawk = self.hawkular_api.get_hawkular_deployments()
        assert deployments_hawk, "No Hawkular Deployments found."

        self.web_session.logger.debug(
            "UI Deployments: {}  HW Deployments: {}".format(
                deployments_ui.get('Middleware Deployments'),
                str(len(deployments_hawk))))
        #assert len(deployments_ui) == len(deployments_hawk), "Deployments lists size mismatch."

        for dep_ui in deployments_ui:
            deployment_name = dep_ui.get('Deployment Name')
            dep_hawk = self.ui_utils.find_row_in_list(deployments_hawk, 'Name',
                                                      deployment_name)

            #assert dep_hawk, "Deployment Name {} not found".format(deployment_name)
            #assert (deployment_name in dep_hawk.get("Name")), \
            #    "Deployment Name mismatch ui:{}, hawk:{}".format(deployment_name, dep_hawk.get("Name"))
            self.web_session.logger.info(
                "UI Deployment name is: {}, and Hawkular deployment is: {} ".
                format(deployment_name, dep_hawk.get("Name")))

        return True
Пример #4
0
    def validate_servers_list(self):
        servers_db = None
        servers_ui = table(self.web_session).get_middleware_servers_table()
        servers_hawk = self.hawkular_api.get_hawkular_servers()

        if self.db:
            servers_db = self.db.get_servers()
            assert len(servers_ui) == len(servers_hawk) == len(
                servers_db), "Servers lists size mismatch."
        else:
            assert len(servers_ui) == len(
                servers_hawk), "Servers lists size mismatch."

        for serv_ui in servers_ui:
            serv_hawk = self.ui_utils.find_row_in_list(servers_hawk, 'Feed',
                                                       serv_ui.get('Feed'))

            assert serv_hawk, "Feed {} not found in Hawkular Server".format(
                serv_ui.get('Feed'))
            assert (serv_ui.get('Host Name') == serv_hawk.get("details").get("Hostname")), \
                "Host Name mismatch ui:{}, hawk:{}".format(serv_ui.get('Feed'), serv_hawk.get("details").get("Hostname"))
            assert (serv_ui.get('Product') == serv_hawk.get("details").get("Product Name")), \
                "Product mismatch ui:{}, hawk:{}".format(serv_ui.get('Product'), serv_hawk.get("Product Name"))

        return True
Пример #5
0
def _test_cfui_instance(web_session):
    t = table(web_session)
    print "List of middleware datasources: ", t.get_middleware_datasource_table(), "\n"
    print "List of middleware providers: ", t.get_middleware_providers_table(), "\n"
    print "List of middleware deployments: ", t.get_middleware_deployments_table(), "\n"
    servers_list = t.get_middleware_servers_table()
    print "Full servers list: ", servers_list, "\n"
Пример #6
0
    def validate_server_details(self):

        servers_ui = table(self.web_session).get_middleware_servers_table()
        servers_hawk = self.hawkular_api.get_hawkular_servers()

        for serv_ui in servers_ui:
            feed = serv_ui.get('Feed')  # Unique Server identifier
            self.web_session.web_driver.get(
                "{}/middleware_server/show_list".format(
                    self.web_session.MIQ_URL))

            self.ui_utils.click_on_row_containing_text(serv_ui.get('Feed'))
            self.ui_utils.waitForTextOnPage("Properties", 15)

            server_details_ui = self.ui_utils.get_generic_table_as_dict()
            server_details_hawk = self.ui_utils.find_row_in_list(
                servers_hawk, 'Feed', feed)

            assert server_details_hawk, "Feed {} not found in Hawkular Server List".format(
                feed)

            assert (server_details_ui.get('Product') == server_details_hawk.get("details").get("Product Name")), \
                    "Product mismatch ui:{}, hawk:{}".format(server_details_ui.get('Product'), server_details_hawk.get("details").get("Product Name"))
            assert (server_details_ui.get('Version') == server_details_hawk.get("details").get("Version")), \
                    "Version mismatch ui:{}, hawk:{}".format(server_details_ui.get('Version'), server_details_hawk.get("details").get("Version"))

        return True
Пример #7
0
    def validate_deployment_details(self):
        deployments_ui = table(
            self.web_session).get_middleware_deployments_table()
        assert deployments_ui, "No UI Deployments found."

        deployments_hawk = self.hawkular_api.get_hawkular_deployments()
        assert deployments_hawk, "No Hawkular Deployments found."

        deployments_db = self.db.get_deployments()
        assert deployments_db, "No DB Deployments found."

        # Test only a random sameple of the entire Deployments list
        for dep in self.ui_utils.get_random_list(deployments_ui, 3):
            deployment_name = dep.get('Deployment Name')
            self.web_session.logger.info(
                "Validate Deployment {}.".format(deployment_name))

            self.web_session.web_driver.get(
                "{}/middleware_deployment/show_list".format(
                    self.web_session.MIQ_URL))
            assert self.ui_utils.waitForTextOnPage("Middleware Deployments",
                                                   15)

            self.ui_utils.click_on_row_containing_text(deployment_name)
            self.ui_utils.waitForTextOnPage("Nativeid", 15)

            dep_details_ui = self.ui_utils.get_generic_table_as_dict()
            assert dep_details_ui, "UI Deployment {} not found.".format(
                deployment_name)
            self.web_session.logger.info(
                "dep_details_ui: {}".format(dep_details_ui))

            dep_details_hawk = self.ui_utils.find_row_in_list(
                deployments_hawk, 'Name', deployment_name)
            assert dep_details_hawk, "Hawkular Deployment {} not found.".format(
                deployment_name)
            self.web_session.logger.info(
                "dep_details_hawk: {}".format(dep_details_hawk))

            dep_details_db = self.ui_utils.find_row_in_list(
                deployments_db, 'name', deployment_name)
            assert dep_details_db, "DB Deployment {} not found.".format(
                deployment_name)
            self.web_session.logger.info(
                "dep_details_hawk: {}".format(dep_details_db))

            assert dep_details_ui.get(
                'Middleware Provider'
            ) == self.web_session.HAWKULAR_PROVIDER_NAME

            assert deployment_name in dep_details_hawk.get(
                'Name') and deployment_name == dep_details_db.get('name')

            ui_nativeid = dep_details_ui.get('Nativeid')
            assert ui_nativeid == dep_details_hawk.get(
                'Nativeid') and ui_nativeid == dep_details_db.get('nativeid')

        return True
Пример #8
0
def _test_cfui_instance(web_session):
    t = table(web_session)
    print "List of middleware datasources: ", t.get_middleware_datasource_table(
    ), "\n"
    print "List of middleware providers: ", t.get_middleware_providers_table(
    ), "\n"
    print "List of middleware deployments: ", t.get_middleware_deployments_table(
    ), "\n"
    servers_list = t.get_middleware_servers_table()
    print "Full servers list: ", servers_list, "\n"
Пример #9
0
def test_cfui_details_by_text(web_session):

    nav = NavigationTree(web_session)
    nav.jump_to_middleware_servers_view()

    pattern = "488ef4f1-9df2-4a79"
    if nav.found_by_pattern(pattern):
        sleep(5)
        t = table(web_session)
        t.pretty_print(t.page_elements())
    else:
        raise ValueError("Detail page is still unavailable")
Пример #10
0
def test_cfui_details_by_text(web_session):

    nav = NavigationTree(web_session)
    nav.jump_to_middleware_servers_view()

    pattern = "488ef4f1-9df2-4a79"
    if nav.found_by_pattern(pattern):
        sleep(5)
        t = table(web_session)
        t.pretty_print(t.page_elements())
    else:
        raise ValueError("Detail page is still unavailable")
Пример #11
0
    def undeploy_application_archive(self, app_to_undeploy=APPLICATION_WAR):
        NavigationTree(self.web_session).navigate_to_middleware_deployment_view()

        deployments_ui = table(self.web_session).get_middleware_deployments_table()
        self.ui_utils.click_on_row_containing_text(app_to_undeploy)

        # Undeploy
        self.undeploy_server_deployment(app_to_undeploy)

        # Validate that application is "Disabled"
        assert self.ui_utils.refresh_until_text_appears('Disabled', 300)

        return True
Пример #12
0
def _test_cfui_details(web_session):
    t = table(web_session)
    datasources_table = t.get_middleware_datasource_table()
    ds_num = len(datasources_table)
    print "List of middleware datasources ({}): ".format(ds_num)
    t.pretty_print(datasources_table)
    print "\nList of middleware datasources: "
    t.pretty_print( t.get_datasource_details() )
    print "List of middleware providers: "
    t.pretty_print( t.get_providers_details())
    print "List of middleware deployments: "
    t.pretty_print( t.get_deployments_details())
    print "Middleware servers list: "
    t.pretty_print( t.get_servers_details())
Пример #13
0
def _test_cfui_details(web_session):
    t = table(web_session)
    datasources_table = t.get_middleware_datasource_table()
    ds_num = len(datasources_table)
    print "List of middleware datasources ({}): ".format(ds_num)
    t.pretty_print(datasources_table)
    print "\nList of middleware datasources: "
    t.pretty_print(t.get_datasource_details())
    print "List of middleware providers: "
    t.pretty_print(t.get_providers_details())
    print "List of middleware deployments: "
    t.pretty_print(t.get_deployments_details())
    print "Middleware servers list: "
    t.pretty_print(t.get_servers_details())
Пример #14
0
    def undeploy_application_archive(self, app_to_undeploy=APPLICATION_WAR):
        NavigationTree(
            self.web_session).navigate_to_middleware_deployment_view()

        deployments_ui = table(
            self.web_session).get_middleware_deployments_table()
        self.ui_utils.click_on_row_containing_text(app_to_undeploy)

        # Undeploy
        self.undeploy_server_deployment(app_to_undeploy)

        # Validate that application is "Disabled"
        assert self.ui_utils.refresh_until_text_appears('Disabled', 300)

        return True
Пример #15
0
    def validate_providers_list(self):

        # Test to validate provider list page in UI and validate matching providers hostname, port number

        self.web_session.logger.info("Begin providers list test.")
        NavigationTree(self.web_session).navigate_to_middleware_providers_view()
        providers_ui = table(self.web_session).get_middleware_providers_table()

        assert len(providers_ui) > 0, "Providers list is empty."

        for prov_ui in providers_ui:

            if prov_ui.get('Name') == self.web_session.HAWKULAR_PROVIDER_NAME:
                assert (prov_ui.get('Hostname') == self.web_session.HAWKULAR_HOSTNAME), "Hostname mismatch"
                assert (prov_ui.get('Port') == self.web_session.HAWKULAR_PORT), "Port Number mismatch"

        return True
Пример #16
0
    def validate_providers_list(self):

        # Test to validate provider list page in UI and validate matching providers hostname, port number

        self.web_session.logger.info("Begin providers list test.")
        NavigationTree(
            self.web_session).navigate_to_middleware_providers_view()
        providers_ui = table(self.web_session).get_middleware_providers_table()

        assert len(providers_ui) > 0, "Providers list is empty."

        for prov_ui in providers_ui:

            if prov_ui.get('Name') == self.web_session.HAWKULAR_PROVIDER_NAME:
                assert (prov_ui.get('Hostname') == self.web_session.
                        HAWKULAR_HOSTNAME), "Hostname mismatch"
                assert (prov_ui.get('Port') == self.web_session.HAWKULAR_PORT
                        ), "Port Number mismatch"

        return True
Пример #17
0
    def validate_deployment_details(self):
        deployments_ui = table(self.web_session).get_middleware_deployments_table()
        assert deployments_ui, "No UI Deployments found."

        deployments_hawk = self.hawkular_api.get_hawkular_deployments()
        assert deployments_hawk, "No Hawkular Deployments found."

        deployments_db = self.db.get_deployments()
        assert deployments_db, "No DB Deployments found."

        # Test only a random sameple of the entire Deployments list
        for dep in self.ui_utils.get_random_list(deployments_ui, 3):
            deployment_name = dep.get('Deployment Name')
            self.web_session.logger.info("Validate Deployment {}.".format(deployment_name))

            self.web_session.web_driver.get("{}/middleware_deployment/show_list".format(self.web_session.MIQ_URL))
            assert self.ui_utils.waitForTextOnPage("Middleware Deployments", 15)

            self.ui_utils.click_on_row_containing_text(deployment_name)
            self.ui_utils.waitForTextOnPage("Nativeid", 15)

            dep_details_ui = self.ui_utils.get_generic_table_as_dict()
            assert dep_details_ui, "UI Deployment {} not found.".format(deployment_name)
            self.web_session.logger.info("dep_details_ui: {}".format(dep_details_ui))

            dep_details_hawk = self.ui_utils.find_row_in_list(deployments_hawk, 'Name', deployment_name)
            assert dep_details_hawk, "Hawkular Deployment {} not found.".format(deployment_name)
            self.web_session.logger.info("dep_details_hawk: {}".format(dep_details_hawk))

            dep_details_db = self.ui_utils.find_row_in_list(deployments_db, 'name', deployment_name)
            assert dep_details_db, "DB Deployment {} not found.".format(deployment_name)
            self.web_session.logger.info("dep_details_hawk: {}".format(dep_details_db))

            assert dep_details_ui.get('Middleware Provider') == self.web_session.HAWKULAR_PROVIDER_NAME

            assert deployment_name in dep_details_hawk.get('Name') and deployment_name == dep_details_db.get('name')

            ui_nativeid = dep_details_ui.get('Nativeid')
            assert ui_nativeid == dep_details_hawk.get('Nativeid') and ui_nativeid == dep_details_db.get('nativeid')

        return True
Пример #18
0
    def validate_servers_list(self):
        servers_db = None
        servers_ui = table(self.web_session).get_middleware_servers_table()
        servers_hawk = self.hawkular_api.get_hawkular_servers()

        if self.db:
            servers_db = self.db.get_servers()
            assert len(servers_ui) == len(servers_hawk) == len(servers_db), "Servers lists size mismatch."
        else:
            assert len(servers_ui) == len(servers_hawk), "Servers lists size mismatch."

        for serv_ui in servers_ui:
            serv_hawk = self.ui_utils.find_row_in_list(servers_hawk, 'Feed', serv_ui.get('Feed'))

            assert serv_hawk, "Feed {} not found in Hawkular Server".format(serv_ui.get('Feed'))
            assert (serv_ui.get('Host Name') == serv_hawk.get("details").get("Hostname")), \
                "Host Name mismatch ui:{}, hawk:{}".format(serv_ui.get('Feed'), serv_hawk.get("details").get("Hostname"))
            assert (serv_ui.get('Product') == serv_hawk.get("details").get("Product Name")), \
                "Product mismatch ui:{}, hawk:{}".format(serv_ui.get('Product'), serv_hawk.get("Product Name"))

        return True
Пример #19
0
    def validate_providers_details(self):

        # Test to validate hawkular provider details like name, hostname, port number
        # and to validate number of middleware servers, deployments and datasources in releationships section.

        self.web_session.logger.info("Begin providers details test.")
        NavigationTree(
            self.web_session).navigate_to_middleware_providers_view()
        providers_ui = table(self.web_session).get_middleware_providers_table()
        servers_hawk = self.hawkular_api.get_hawkular_servers()
        deployments_hawk = self.hawkular_api.get_hawkular_deployments()
        datasources_hawk = self.hawkular_api.get_hawkular_datasources()

        for prov_ui in providers_ui:
            if prov_ui.get('Name') == self.web_session.HAWKULAR_PROVIDER_NAME:
                ui_utils(self.web_session).click_on_row_containing_text(
                    self.web_session.HAWKULAR_PROVIDER_NAME)

        assert ui_utils(self.web_session).waitForTextOnPage("Status", 15)
        providers_details_ui = ui_utils(
            self.web_session).get_generic_table_as_dict()

        assert (providers_details_ui.get('Name') == self.web_session.
                HAWKULAR_PROVIDER_NAME), "Provider name mismatch"
        assert (providers_details_ui.get('Host Name') ==
                self.web_session.HAWKULAR_HOSTNAME), "Hostname mismatch"
        assert (providers_details_ui.get('Port') ==
                self.web_session.HAWKULAR_PORT), "Port Number mismatch"

        assert providers_details_ui.get('Middleware Servers') == str(
            len(servers_hawk)), "Number of servers mismatch"

        self.web_session.logger.debug("UI Deploys: {}  HW Deploys: {}".format(
            providers_details_ui.get('Middleware Deployments'),
            str(len(deployments_hawk))))
        # assert providers_details_ui.get('Middleware Deployments') == str(len(deployments_hawk)), "Number of Deployments mismatch"
        assert providers_details_ui.get('Middleware Datasources') == str(
            len(datasources_hawk)), "Number of Datasources mismatch"

        return True
Пример #20
0
    def validate_datasource_detail(self):
        datasource_ui = table(self.web_session).get_middleware_datasources_table()
        datasource_api = self.hawkular_api.get_hawkular_datasources()

        for dat in self.ui_utils.get_random_list(datasource_ui, 3):
            datasource_name = dat.get('Datasource Name')
            self.web_session.logger.info("Validate Datasource {}.".format(datasource_name))

            self.web_session.web_driver.get("{}/middleware_datasource/show_list".format(self.web_session.MIQ_URL))
            assert self.ui_utils.waitForTextOnPage("Middleware Datasources", 15)

            self.ui_utils.click_on_row_containing_text(datasource_name)
            self.ui_utils.waitForTextOnPage("Nativeid", 15)
            dat_details_ui = self.ui_utils.get_generic_table_as_dict()
            self.web_session.logger.info("dat_details_ui: {}".format(dat_details_ui))
            dat_details_api = self.ui_utils.find_row_in_list(datasource_api, 'Name', datasource_name)
            self.web_session.logger.info("dat_details_api: {}".format(dat_details_api))

            assert dat_details_ui.get('Name') == dat_details_api.get('Name')
            assert dat_details_ui.get('Nativeid') == dat_details_api.get('Nativeid')

        return True
Пример #21
0
    def validate_deployments_list(self):
        deployments_ui = table(self.web_session).get_middleware_deployments_table()
        assert deployments_ui, "No UI Deployments found."
        deployments_hawk = self.hawkular_api.get_hawkular_deployments()
        assert deployments_hawk, "No Hawkular Deployments found."

        self.web_session.logger.debug(
            "UI Deployments: {}  HW Deployments: {}".format(deployments_ui.get('Middleware Deployments'), str(len(deployments_hawk))))
        #assert len(deployments_ui) == len(deployments_hawk), "Deployments lists size mismatch."

        for dep_ui in deployments_ui:
            deployment_name = dep_ui.get('Deployment Name')
            dep_hawk = self.ui_utils.find_row_in_list(deployments_hawk, 'Name', deployment_name)

            #assert dep_hawk, "Deployment Name {} not found".format(deployment_name)
            #assert (deployment_name in dep_hawk.get("Name")), \
            #    "Deployment Name mismatch ui:{}, hawk:{}".format(deployment_name, dep_hawk.get("Name"))
            self.web_session.logger.info(
                "UI Deployment name is: {}, and Hawkular deployment is: {} ".format(deployment_name,
                                                                                    dep_hawk.get("Name")))

        return True
Пример #22
0
    def validate_server_details(self):

        servers_ui = table(self.web_session).get_middleware_servers_table()
        servers_hawk = self.hawkular_api.get_hawkular_servers()

        for serv_ui in servers_ui:
            feed = serv_ui.get('Feed')  # Unique Server identifier
            self.web_session.web_driver.get("{}/middleware_server/show_list".format(self.web_session.MIQ_URL))

            self.ui_utils.click_on_row_containing_text(serv_ui.get('Feed'))
            self.ui_utils.waitForTextOnPage("Properties", 15)

            server_details_ui = self.ui_utils.get_generic_table_as_dict()
            server_details_hawk = self.ui_utils.find_row_in_list(servers_hawk, 'Feed', feed)

            assert server_details_hawk, "Feed {} not found in Hawkular Server List".format(feed)

            assert (server_details_ui.get('Product') == server_details_hawk.get("details").get("Product Name")), \
                    "Product mismatch ui:{}, hawk:{}".format(server_details_ui.get('Product'), server_details_hawk.get("details").get("Product Name"))
            assert (server_details_ui.get('Version') == server_details_hawk.get("details").get("Version")), \
                    "Version mismatch ui:{}, hawk:{}".format(server_details_ui.get('Version'), server_details_hawk.get("details").get("Version"))

        return True
Пример #23
0
    def server_policy_edit(self, server_type):
        origValue = -1
        server = None

        servers_ui = table(self.web_session).get_middleware_servers_table()
        assert servers_ui, "No servers found."

        if server_type == 'provider':
            server = self.ui_utils.find_row_in_list(servers_ui, 'Product', self.web_session.PROVIDER)
        elif server_type == 'eap':
            for eap in {'WildFly', 'JBoss'}:
                server = self.ui_utils.find_row_in_list(servers_ui, 'Product', eap)
                if server: break

        assert server, "No server {} found.".format(server)

        # Feed is unique ID for this server
        self.ui_utils.click_on_row_containing_text(server.get('Feed'))

        server_details = self.ui_utils.get_generic_table_as_dict()
        assert server_details, "No server details found for {}.".format(self.web_session.PROVIDER)

        if not str(server_details.get('My Company Tags')).__contains__("No My Company Tags have been assigned"):
            origValue = int(server_details.get('My Company Tags')[-1:])

        self.web_session.logger.info("Current Company Tags: {}".format(origValue))

        self.web_driver.find_element_by_id('middleware_server_policy_choice').click()
        self.web_driver.find_element_by_id('middleware_server_policy_choice__middleware_server_tag').click()
        self.ui_utils.waitForTextOnPage('Tag Assignment', 5)

        # Click on Drop-down title Name
        tag = '"<Select a value to assign>"'
        self.web_driver.execute_script("return $('*[data-original-title={}]').trigger('click')".format(tag))
        self.ui_utils.sleep(1)

        # Select value - always just select first value in list (list is index):
        # By Browser type - for now - to-do, find a better approach
        if self.web_session.BROWSER == 'Firefox':
            self.web_driver.find_element_by_xpath('//th[3]/div/div/div/ul/li[1]/a').click()
        else:
            tag = 'data-original-index=1'
            el = self.web_driver.execute_script("return $('*[{}]')".format(tag))
            try:
                el[0].click()
            except:
                el[1].click()

        # To-Do: Need a better polling/wait mechanism
        self.ui_utils.sleep(3)

        el = self.web_driver.find_elements_by_xpath("//*[contains(text(), '{}')]".format('Save'))
        el[0].click()

        self.ui_utils.waitForTextOnPage("My Company Tags", 5)

        server_details = self.ui_utils.get_generic_table_as_dict()
        newValue = server_details.get('My Company Tags')[-1:]

        if newValue != origValue:
            return True
        else:
            return False
Пример #24
0
    def server_policy_edit(self, server_type):
        origValue = -1
        server = None

        servers_ui = table(self.web_session).get_middleware_servers_table()
        assert servers_ui, "No servers found."

        if server_type == 'provider':
            server = self.ui_utils.find_row_in_list(servers_ui, 'Product',
                                                    self.web_session.PROVIDER)
        elif server_type == 'eap':
            for eap in {'WildFly', 'JBoss'}:
                server = self.ui_utils.find_row_in_list(
                    servers_ui, 'Product', eap)
                if server: break

        assert server, "No server {} found.".format(server)

        # Feed is unique ID for this server
        self.ui_utils.click_on_row_containing_text(server.get('Feed'))

        server_details = self.ui_utils.get_generic_table_as_dict()
        assert server_details, "No server details found for {}.".format(
            self.web_session.PROVIDER)

        if not str(server_details.get('My Company Tags')).__contains__(
                "No My Company Tags have been assigned"):
            origValue = int(server_details.get('My Company Tags')[-1:])

        self.web_session.logger.info(
            "Current Company Tags: {}".format(origValue))

        self.web_driver.find_element_by_id(
            'middleware_server_policy_choice').click()
        self.web_driver.find_element_by_id(
            'middleware_server_policy_choice__middleware_server_tag').click()
        self.ui_utils.waitForTextOnPage('Tag Assignment', 5)

        # Click on Drop-down title Name
        tag = '"<Select a value to assign>"'
        self.web_driver.execute_script(
            "return $('*[data-original-title={}]').trigger('click')".format(
                tag))
        self.ui_utils.sleep(1)

        # Select value - always just select first value in list (list is index):
        # By Browser type - for now - to-do, find a better approach
        if self.web_session.BROWSER == 'Firefox':
            self.web_driver.find_element_by_xpath(
                '//th[3]/div/div/div/ul/li[1]/a').click()
        else:
            tag = 'data-original-index=1'
            el = self.web_driver.execute_script(
                "return $('*[{}]')".format(tag))
            try:
                el[0].click()
            except:
                el[1].click()

        # To-Do: Need a better polling/wait mechanism
        self.ui_utils.sleep(3)

        el = self.web_driver.find_elements_by_xpath(
            "//*[contains(text(), '{}')]".format('Save'))
        el[0].click()

        self.ui_utils.waitForTextOnPage("My Company Tags", 5)

        server_details = self.ui_utils.get_generic_table_as_dict()
        newValue = server_details.get('My Company Tags')[-1:]

        if newValue != origValue:
            return True
        else:
            return False
Пример #25
0
def _test_cfui_single_detail_page(web_session):
    nav = NavigationTree(web_session)
    nav.jump_to_middleware_providers_view()
    nav.to_first_details()
    t = table(web_session)
    t.pretty_print(t.page_elements())
Пример #26
0
def _test_cfui_single_detail_page(web_session):
    nav = NavigationTree(web_session)
    nav.jump_to_middleware_providers_view()
    nav.to_first_details()
    t = table(web_session)
    t.pretty_print(t.page_elements())