コード例 #1
0
    def get_random_node(self, retrydict):
        failed = True
        nodeid = None
        nodename = None
        with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                  'No load balancers being displayed',
                                  'FAILED - Load Balancers List Display Test'):
            nodeid_list = self.get_nodeid_list()
            nodeid = random.choice(nodeid_list)
            sellib.sleeper(self.conf.sleepdict)
            self.logger.debug('Load balancers list created')
            self.logger.info('PASSED - Load Balancers List Display Test')
            failed = False

        if not failed:
            with sellib.error_handler(
                    self.driver, self.all_loggers, retrydict,
                    'Unable to determine load balancer name from id',
                    'FAILED - Load Balancer Name Discovery Test'):
                nodename = self.get_nodename(nodeid)
                sellib.sleeper(self.conf.sleepdict)
                self.logger.debug('Load balancer name found')
                self.logger.info('PASSED - Load Balancer Name Discovery Test')
                failed = False

        return nodeid, nodename, failed
コード例 #2
0
def overview_reset(driver, all_loggers, retrydict, sleepdict):
    """
    Reset by reloading the page and clicking on the 'all nodes' link.
    
    Args:
        driver: object - WebDriver instance.
        all_loggers: tuple - Contains all logging objects.
        retrydict: dictionary - Contains current retry count and max retry count.
        sleepdict: dictionary - Universal sleep value (float) and "fast" on/off (boolean).

    Returns:
        Boolean "failed" (if True, test failed).
    """

    failed = True
    with sellib.error_handler(driver, all_loggers, retrydict,
                              'Unable to reset Overview page'):
        driver.refresh()
        sellib.element_wait(driver.find_element_by_link_text,
                            'all nodes',
                            element_action='click')
        sellib.sleeper(sleepdict)
        failed = False

    return failed
コード例 #3
0
def close_panel_menu(driver, all_loggers, retrydict, sleepdict, path_prepend):
    """
    Close the panel menu by clicking on the "X" in the upper right corner.
    
    Args:
        driver: object - WebDriver instance.
        all_loggers: tuple - Contains all logging objects.
        retrydict: dictionary - Contains current retry count and max retry count.
        sleepdict: dictionary - Universal sleep value (float) and "fast" on/off (boolean).
        path_prepend: string - Portion of XPath needed to isolate the correct panel-menu-close.

    Returns:
        Boolean "failed" (if True, test failed).
    """
    failed = True
    logger = all_loggers[0]
    with sellib.error_handler(driver, all_loggers, retrydict,
                              'Unable to close the panel menu using the "X"'):
        closepath = '%sdiv[attribute::class="panel-menu-close"]' % path_prepend
        sellib.element_wait(driver.find_element_by_xpath, closepath, 'click')
        sellib.sleeper(sleepdict)
        logger.debug('Closed the panel menu')
        failed = False

    return failed
コード例 #4
0
ファイル: oviewlib.py プロジェクト: LeonardoRO/qetest
def close_panel_menu(driver, all_loggers, retrydict, sleepdict, path_prepend):
    """
    Close the panel menu by clicking on the "X" in the upper right corner.
    
    Args:
        driver: object - WebDriver instance.
        all_loggers: tuple - Contains all logging objects.
        retrydict: dictionary - Contains current retry count and max retry count.
        sleepdict: dictionary - Universal sleep value (float) and "fast" on/off (boolean).
        path_prepend: string - Portion of XPath needed to isolate the correct panel-menu-close.

    Returns:
        Boolean "failed" (if True, test failed).
    """
    failed = True
    logger = all_loggers[0]
    with sellib.error_handler(driver, all_loggers, retrydict,
                              'Unable to close the panel menu using the "X"'):
        closepath = '%sdiv[attribute::class="panel-menu-close"]' % path_prepend
        sellib.element_wait(driver.find_element_by_xpath, closepath, 'click')
        sellib.sleeper(sleepdict)
        logger.debug('Closed the panel menu')
        failed = False

    return failed
コード例 #5
0
    def testSharedVirtualIp(self, retries):

        totals = {'passed': 0, 'failed': 0, 'executed': 0, 'total': 7,}
        (starttime, retrydict, failed) = self.setup('SharedVirtualIPTest', retries,)

        #Call function to go to Load Balancers
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                'Unable to find the Load Balancers button',
                'FAILED - Load Balancers button click'):

                lbaaslib.go_to_lbaas(self.driver)

                sellib.sleeper(self.sleepdict)
                self.logger.debug('Located Load Balancers button')
                self.logger.info('PASSED - Load Balancers button click')
                failed = False

        #Create 2 Load Balancers

        #Share IPs

        #Validation/Verification

        totals.update(executed = totals['executed'] + 1)
        totals = loglib.logPassFail('testListView', totals, failed, starttime, self.logger, retrydict)
        return failed, totals
コード例 #6
0
ファイル: resizetest.py プロジェクト: LeonardoRO/qetest
    def click_resize_option(self, pmn, testnode):
        """Find and click on the resize option in the panel menu.

        Args:
            pmn -- string - panel menu node number
            testnode -- string - randomly selected node name
        """

        resizepath = ('%sdiv[@class="panel-menuitem resize-panel-menuitem"]' % pmn)
        sellib.element_wait(self.driver.find_element_by_xpath, resizepath, 'click')
        sellib.sleeper(self.sleepdict)
        self.logger.debug('Located resize option for node %s' % testnode)
コード例 #7
0
ファイル: batchtest.py プロジェクト: LeonardoRO/qetest
    def all_nodes(self, retrydict, totals):
        failed = True
        totals.update(executed = totals['executed'] + 1)
        with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                  'Unable to find the batch action toggle',
                                  'FAILED - Batch Toggle Test'):
            sellib.element_wait(self.driver.find_element_by_id, 'batch_action_toggle', 'click')
            self.logger.debug('All nodes selected')
            self.logger.info('PASSED - Batch Toggle Test')
            sellib.sleeper(self.sleepdict)
            failed = False

        return failed, totals
コード例 #8
0
    def click_resize_option(self, pmn, testnode):
        """Find and click on the resize option in the panel menu.

        Args:
            pmn -- string - panel menu node number
            testnode -- string - randomly selected node name
        """

        resizepath = ('%sdiv[@class="panel-menuitem resize-panel-menuitem"]' %
                      pmn)
        sellib.element_wait(self.driver.find_element_by_xpath, resizepath,
                            'click')
        sellib.sleeper(self.sleepdict)
        self.logger.debug('Located resize option for node %s' % testnode)
コード例 #9
0
ファイル: batchtest.py プロジェクト: LeonardoRO/qetest
    def batch_sprocket(self, retrydict, totals):
        totals.update(executed = totals['executed'] + 1)
        failed = True
        with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                    'Unable to find the batch panel sprocket',
                                    'FAILED - Batch Panel Sprocket Test '):
            path = '//span[@class="batch_control_panel_button"]'
            sellib.element_wait(self.driver.find_element_by_xpath, path, 'click')
            self.logger.debug('Batch Control Panel selected')
            self.logger.info('PASSED - Batch Panel Sprocket Test')
            sellib.sleeper(self.sleepdict)
            failed = False

        return failed, totals
コード例 #10
0
    def all_nodes(self, retrydict, totals):
        failed = True
        totals.update(executed=totals['executed'] + 1)
        with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                  'Unable to find the batch action toggle',
                                  'FAILED - Batch Toggle Test'):
            sellib.element_wait(self.driver.find_element_by_id,
                                'batch_action_toggle', 'click')
            self.logger.debug('All nodes selected')
            self.logger.info('PASSED - Batch Toggle Test')
            sellib.sleeper(self.sleepdict)
            failed = False

        return failed, totals
コード例 #11
0
    def batch_sprocket(self, retrydict, totals):
        totals.update(executed=totals['executed'] + 1)
        failed = True
        with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                  'Unable to find the batch panel sprocket',
                                  'FAILED - Batch Panel Sprocket Test '):
            path = '//span[@class="batch_control_panel_button"]'
            sellib.element_wait(self.driver.find_element_by_xpath, path,
                                'click')
            self.logger.debug('Batch Control Panel selected')
            self.logger.info('PASSED - Batch Panel Sprocket Test')
            sellib.sleeper(self.sleepdict)
            failed = False

        return failed, totals
コード例 #12
0
    def testHardReboot(self, retries):
        """Test panel menu power hard reboot functionality.

        Args:
          retries: int - number of times a test has been run

        Returns:
          failed: boolean - If true, one test within the module has failed
        """

        totals = {
            'passed': 0,
            'failed': 0,
            'executed': 0,
            'total': 4,
        }
        (starttime, retrydict, failed, pmn,
         testnode) = self.setup('testHardReboot', retries)

        # Click on the panel menu's power option
        if not failed:
            totals.update(executed=totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                      'Unable to find the power option',
                                      'FAILED - Panel Menu Power Option Test'):
                powerpath = (
                    '%sdiv[attribute::class="panel-menuitem power-panel-menuitem"]'
                    % pmn)
                sellib.element_wait(self.driver.find_element_by_xpath,
                                    powerpath, 'click')
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Located power option for node %s' %
                                  testnode)
                self.logger.info('PASSED - Panel Menu Power Option Test')
                failed = False

        # Click on the hard reboot option
        if not failed:
            totals.update(executed=totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                      'Unable to find the hard reboot button',
                                      'FAILED - Power Hard Reboot Test'):
                hr_button_path = '//button[attribute::class="hard_reboot_button"]'
                sellib.element_wait(self.driver.find_element_by_xpath,
                                    hr_button_path, 'click')
                sellib.sleeper(self.sleepdict)
                sellib.element_wait(self.driver.find_element_by_xpath,
                                    '//button[attribute::name="ok"]', 'click')
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Hard rebooted node %s' % testnode)
                self.logger.info('PASSED - Power Reboot Test')
                failed = False

        totals.update(executed=totals['executed'] + 1)
        totals = loglib.logPassFail('testHardReboot', totals, failed,
                                    starttime, self.logger, retrydict)

        return failed, totals
コード例 #13
0
def add_server(driver, all_loggers, sleepdict):
    logger = all_loggers[0]
    add_server_button_top(driver)
    logger.debug('Clicked on the top Add Server button')
    sellib.sleeper(sleepdict)
    # Assign a server name
    server_name = add_server_name(driver)
    logger.debug('Added server name "%s"' % server_name)
    sellib.sleeper(sleepdict)
    # Pick a random OS
    os_flavor = add_server_os(driver)
    logger.debug('Picked "%s" for the OS flavor' % os_flavor)
    sellib.sleeper(sleepdict)
    # Pick a random size
    server_size = add_server_size(driver)
    logger.debug('Picked "%s" for server size' % server_size)
    sellib.sleeper(sleepdict)
    #Submit it
    add_server_button_bottom(driver)
    logger.debug('Clicked the bottom Add Server button to submit')
    sellib.sleeper(sleepdict)

    return server_name, os_flavor, server_size
コード例 #14
0
ファイル: oviewlib.py プロジェクト: LeonardoRO/qetest
def overview_reset(driver, all_loggers, retrydict, sleepdict):
    """
    Reset by reloading the page and clicking on the 'all nodes' link.
    
    Args:
        driver: object - WebDriver instance.
        all_loggers: tuple - Contains all logging objects.
        retrydict: dictionary - Contains current retry count and max retry count.
        sleepdict: dictionary - Universal sleep value (float) and "fast" on/off (boolean).

    Returns:
        Boolean "failed" (if True, test failed).
    """

    failed = True
    with sellib.error_handler(driver, all_loggers, retrydict,
                       'Unable to reset Overview page'):
        driver.refresh()
        sellib.element_wait(driver.find_element_by_link_text, 'all nodes', element_action='click')
        sellib.sleeper(sleepdict)
        failed = False

    return failed
コード例 #15
0
ファイル: oviewlib.py プロジェクト: LeonardoRO/qetest
def add_server(driver, all_loggers, sleepdict):
    logger = all_loggers[0]
    add_server_button_top(driver)
    logger.debug('Clicked on the top Add Server button')
    sellib.sleeper(sleepdict)
    # Assign a server name
    server_name = add_server_name(driver) 
    logger.debug('Added server name "%s"' % server_name)
    sellib.sleeper(sleepdict)
    # Pick a random OS
    os_flavor = add_server_os(driver)
    logger.debug('Picked "%s" for the OS flavor' % os_flavor)
    sellib.sleeper(sleepdict)
    # Pick a random size
    server_size = add_server_size(driver) 
    logger.debug('Picked "%s" for server size' % server_size)
    sellib.sleeper(sleepdict)
    #Submit it
    add_server_button_bottom(driver)
    logger.debug('Clicked the bottom Add Server button to submit') 
    sellib.sleeper(sleepdict)

    return server_name, os_flavor, server_size
コード例 #16
0
ファイル: powertest.py プロジェクト: LeonardoRO/qetest
    def testDestroy(self, retries):
        """Test panel menu power destroy functionality.

        NOTE: This is left in here and does not use the oviewlib.delete_node functionality because
        it is being called out as it's own explicit test.

        Args:
          retries: int - number of times a test has been run

        Returns:
          failed: boolean - If true, one test within the module has failed
        """

        totals = {'passed': 0, 'failed': 0, 'executed': 0, 'total': 3,}
        (starttime, retrydict, failed, pmn, testnode) = self.setup('testDestroy', retries)
        
        # Click on the panel menu's power option
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                        'Unable to find the power option',
                                        'FAILED - Panel Menu Power Option Test'):
                powerpath = ('%sdiv[attribute::class="panel-menuitem power-panel-menuitem"]' % pmn)
                sellib.element_wait(self.driver.find_element_by_xpath, powerpath, 'click')
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Located power option for node %s' % testnode)
                self.logger.info('PASSED - Panel Menu Power Option Test')
                failed = False

        # Click on the destroy option
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                        'Unable to find the destroy button',
                                        'FAILED - Destroy Server Node Test'):
                self.driver.find_element_by_xpath('//button[attribute::class='
                                                  '"destroy_button"]').click()
                sellib.sleeper(self.sleepdict)
                sellib.element_wait(self.driver.find_element_by_xpath,
                                    '//button[attribute::name="ok"]',
                                    'click')
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Clicked the "OK" button for node %s' % testnode)
                self.logger.info('PASSED - Destroy Server Node Test')
                failed = False

        # NOTE: This doesn't mean that it actually worked, just that Reach
        # tried to destroy the node.  There doesn't currently seem to be a
        # growl-ish confirmation message.

        totals.update(executed = totals['executed'] + 1)
        totals = loglib.logPassFail('testDestroy', totals, failed, starttime, self.logger,
                                    retrydict)
        return failed, totals
コード例 #17
0
def custom_colors(driver, logger, custompath, sleepdict):
    custom = driver.find_element_by_xpath(custompath)
    custom.clear()
    custom.send_keys("#FF0000\n")
    logger.debug('Changed to custom color (red) with #HEXVAL')
    sellib.sleeper(sleepdict)
    custom.clear()
    custom.send_keys("00FF00\n")
    logger.debug('Changed to custom color (lime green) with HEXVAL '
                 '(no # symbol)')
    sellib.sleeper(sleepdict)
    custom.clear()
    custom.send_keys("#ff00ff\n")
    logger.debug('Changed to custom color (fuschia) with lowercase '
                 'letters in #HEXVAL')
    sellib.sleeper(sleepdict)
    custom.clear()
    custom.send_keys("ffffff\n")
    logger.debug('Changed to custom color (white) with lowercase '
                 'letters in HEXVAL (no # symbol)')
    sellib.sleeper(sleepdict)
コード例 #18
0
ファイル: oviewlib.py プロジェクト: LeonardoRO/qetest
def custom_colors(driver, logger, custompath, sleepdict):
    custom = driver.find_element_by_xpath(custompath)
    custom.clear()
    custom.send_keys("#FF0000\n")
    logger.debug('Changed to custom color (red) with #HEXVAL')
    sellib.sleeper(sleepdict)
    custom.clear()
    custom.send_keys("00FF00\n")
    logger.debug('Changed to custom color (lime green) with HEXVAL '
                  '(no # symbol)')
    sellib.sleeper(sleepdict)
    custom.clear()
    custom.send_keys("#ff00ff\n")
    logger.debug('Changed to custom color (fuschia) with lowercase '
                  'letters in #HEXVAL')
    sellib.sleeper(sleepdict)
    custom.clear()
    custom.send_keys("ffffff\n")
    logger.debug('Changed to custom color (white) with lowercase '
                  'letters in HEXVAL (no # symbol)')
    sellib.sleeper(sleepdict)
コード例 #19
0
ファイル: powertest.py プロジェクト: LeonardoRO/qetest
    def testHardReboot(self, retries):
        """Test panel menu power hard reboot functionality.

        Args:
          retries: int - number of times a test has been run

        Returns:
          failed: boolean - If true, one test within the module has failed
        """

        totals = {'passed': 0, 'failed': 0, 'executed': 0, 'total': 4,}
        (starttime, retrydict, failed, pmn, testnode) = self.setup('testHardReboot', retries)

        # Click on the panel menu's power option
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                        'Unable to find the power option',
                                        'FAILED - Panel Menu Power Option Test'):
                powerpath = ('%sdiv[attribute::class="panel-menuitem power-panel-menuitem"]' % pmn)
                sellib.element_wait(self.driver.find_element_by_xpath, powerpath, 'click')
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Located power option for node %s' % testnode)
                self.logger.info('PASSED - Panel Menu Power Option Test')
                failed = False

        # Click on the hard reboot option
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                        'Unable to find the hard reboot button',
                                        'FAILED - Power Hard Reboot Test'):
                hr_button_path = '//button[attribute::class="hard_reboot_button"]'
                sellib.element_wait(self.driver.find_element_by_xpath, hr_button_path, 'click')
                sellib.sleeper(self.sleepdict)
                sellib.element_wait(self.driver.find_element_by_xpath,
                                    '//button[attribute::name="ok"]', 
                                    'click')
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Hard rebooted node %s' % testnode)
                self.logger.info('PASSED - Power Reboot Test')
                failed = False

        totals.update(executed = totals['executed'] + 1)
        totals = loglib.logPassFail('testHardReboot', totals, failed, starttime, self.logger,
                                    retrydict)

        return failed, totals
コード例 #20
0
    def login(self, all_loggers, driver, retries):
        failed = True
        retrydict = dict(retries=retries, max_retries=self.conf.retry + 1)
        with sellib.login_handler(all_loggers, retrydict):
            driver.get('%s/accounts/' % self.conf.testurl)
            sellib.element_wait(driver.find_element_by_name, 'username',
                                element_action='send_keys', action_arg=self.conf.username)
            sellib.sleeper(self.conf.sleepdict)
            sellib.element_wait(driver.find_element_by_name, 'password',
                                element_action='send_keys', action_arg=self.conf.password)
            sellib.sleeper(self.conf.sleepdict)
            sellib.element_wait(driver.find_element_by_class_name, 'submit', element_action='click')
            sellib.sleeper(self.conf.sleepdict)
            failed = False

        return failed
コード例 #21
0
ファイル: algorithmtest.py プロジェクト: LeonardoRO/qetest
    def algorithm_select(self, name):
        temp_failed = True

        #Open Algorithm popup
        sellib.element_wait(self.driver.find_element_by_xpath,
            '//div[@id="node_details"]/descendant::a[@id="algorithm_toggle"]', element_action='click')
        sellib.sleeper(self.sleepdict)

        #Select Algorithm
        self.click_algorithm_by_name(name)
        sellib.sleeper(self.sleepdict)

        #Save
        sellib.element_wait(self.driver.find_element_by_xpath,
            '//div[@class="ck-widgets-popup ck-widgets-popup-right"][2]/div[@class="ck-widgets-popup-content"]/form[@class="load-balancer-algorithm"]/div[@class="save-cancel"]/button[@class="button-save"]',
            element_action='click')
        sellib.sleeper(self.sleepdict)
コード例 #22
0
ファイル: oviewlib.py プロジェクト: LeonardoRO/qetest
def delete_node(driver, nodeid, sleepdict):
    """
    Deletes node (server) by using the Power >> Destroy feature.

    Args:
        driver: object - WebDriver instance.
        nodeid: string - Unique ID of node to be deleted. 
        sleepdict: dictionary - Universal sleep value (float) and "fast" on/off (boolean).
    """

    find_sprocket(driver, nodeid)
    sellib.sleeper(sleepdict)
    pmn = get_pmn(nodeid)
    powerpath = ('%sdiv[attribute::class="panel-menuitem power-panel-menuitem"]' % pmn)
    sellib.element_wait(driver.find_element_by_xpath, powerpath, 'click')
    sellib.sleeper(sleepdict)
    sellib.element_wait(driver.find_element_by_xpath, '//button[@class="destroy_button"]', 'click')
    sellib.sleeper(sleepdict)
    sellib.element_wait(driver.find_element_by_xpath, '//button[@name="ok"]', 'click')
コード例 #23
0
    def algorithm_select(self, name):
        temp_failed = True

        #Open Algorithm popup
        sellib.element_wait(
            self.driver.find_element_by_xpath,
            '//div[@id="node_details"]/descendant::a[@id="algorithm_toggle"]',
            element_action='click')
        sellib.sleeper(self.sleepdict)

        #Select Algorithm
        self.click_algorithm_by_name(name)
        sellib.sleeper(self.sleepdict)

        #Save
        sellib.element_wait(
            self.driver.find_element_by_xpath,
            '//div[@class="ck-widgets-popup ck-widgets-popup-right"][2]/div[@class="ck-widgets-popup-content"]/form[@class="load-balancer-algorithm"]/div[@class="save-cancel"]/button[@class="button-save"]',
            element_action='click')
        sellib.sleeper(self.sleepdict)
コード例 #24
0
def delete_node(driver, nodeid, sleepdict):
    """
    Deletes node (server) by using the Power >> Destroy feature.

    Args:
        driver: object - WebDriver instance.
        nodeid: string - Unique ID of node to be deleted. 
        sleepdict: dictionary - Universal sleep value (float) and "fast" on/off (boolean).
    """

    find_sprocket(driver, nodeid)
    sellib.sleeper(sleepdict)
    pmn = get_pmn(nodeid)
    powerpath = (
        '%sdiv[attribute::class="panel-menuitem power-panel-menuitem"]' % pmn)
    sellib.element_wait(driver.find_element_by_xpath, powerpath, 'click')
    sellib.sleeper(sleepdict)
    sellib.element_wait(driver.find_element_by_xpath,
                        '//button[@class="destroy_button"]', 'click')
    sellib.sleeper(sleepdict)
    sellib.element_wait(driver.find_element_by_xpath, '//button[@name="ok"]',
                        'click')
コード例 #25
0
ファイル: resizetest.py プロジェクト: LeonardoRO/qetest
    def testResize(self, retries):
        """Test the basic panel menu resize functionality.

        Args:
          retries: int - number of times a test has been run

        Returns:
          failed: boolean - If true, one test within the module has failed
        """

        totals = {'passed': 0, 'failed': 0, 'executed': 0, 'total': 4,}
        (starttime, retrydict, failed, pmn, testnode) = self.setup('testResize', retries)
        totals.update(executed = totals['executed'] + 1)

        # Click on the resize option
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                        'Unable to find the resize option',
                                        'FAILED - Resize Option Test'):
                self.click_resize_option(pmn, testnode)
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Found the resize option')
                self.logger.info('PASSED - Resize Option Test')
                failed = False

        # Select the first flavor in the flavor table list        
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                        'Unable to find or click on the first flavor in the table',
                                        'FAILED - Resize Flavor Selection Test'):
                
                sellib.element_wait(self.driver.find_element_by_xpath,
                                    '//div[@class="radio-menuitem-checkbox"]',
                                    'click')
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Clicked on the first choice in the flavor table')
                self.logger.info('PASSED - Resize Flavor Selection Test')
                failed = False

        # Click the resize server button and then OK the change
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                        'Unable to find or click on the first flavor in the table',
                                        'FAILED - Resize Node Test'):
                resize_button_path = ('//button[@class="resize-button goog-button" '
                                      'and contains(text(), "Resize Server")]')
                sellib.element_wait(self.driver.find_element_by_xpath, resize_button_path, 'click')
                sellib.sleeper(self.sleepdict)
                sellib.element_wait(self.driver.find_element_by_xpath, '//button[@name="ok"]',
                                    'click')
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Successfully able to resize node')
                self.logger.info('PASSED - Resize Node Test')
                failed = False

        totals = loglib.logPassFail('testResize', totals, failed, starttime, self.logger,
                                    retrydict)

        return failed, totals
コード例 #26
0
    def testBatchColors(self, retries):
        """Tests batch color changes for all test set nodes.

        Args:
          retries: int - number of times a test has been run

        Returns:
          failed: boolean - If true, one test within the module has failed
        """

        totals = {
            'passed': 0,
            'failed': 0,
            'executed': 0,
            'total': 7,
        }
        (starttime, retrydict, failed) = self.setup(
            'testBatchColors',
            retries,
        )

        colors = oviewlib.panel_colors()
        total_colors = len(colors)

        # Select all the nodes
        if not failed:
            (failed, totals) = self.all_nodes(retrydict, totals)

        # Click on the batch panel sprocket to bring up the 'tag' or 'color' option
        if not failed:
            (failed, totals) = self.batch_sprocket(retrydict, totals)

        # Click on the 'color' option to bring up the color panel
        if not failed:
            totals.update(executed=totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                      'Unable to find the color panel menu',
                                      'FAILED - Batch Color Menu Test'):
                color_opt_path = (
                    '%sdiv[attribute::class="panel-menuitem color-panel-menuitem"]'
                    % BATCH_PANEL)
                sellib.element_wait(self.driver.find_element_by_xpath,
                                    color_opt_path, 'click')
                self.logger.info('Found color panel menu')
                self.logger.info('PASSED - Batch Color Menu Test')
                sellib.sleeper(self.sleepdict)
                failed = False

        # Cycle through some random colors
        if not failed:
            totals.update(executed=totals['executed'] + 1)
            failed = True
            rand1 = random.randint(0, total_colors - 2)
            rand2 = rand1
            while rand2 == rand1:
                rand2 = random.randint(0, total_colors - 2)
            random_colors = (colors[rand1], colors[rand2],
                             colors[total_colors - 1])
            with sellib.error_handler(
                    self.driver, self.all_loggers, retrydict,
                    'Unable to cycle through some random colors',
                    'FAILED - Batch Color Change Test'):
                for kolor in random_colors:
                    colorpath = '//div[attribute::title="RGB %s"]' % kolor
                    sellib.element_wait(self.driver.find_element_by_xpath,
                                        colorpath, 'click')
                    sellib.sleeper(self.sleepdict)
                self.logger.debug('Random color selection succeeded')
                self.logger.info('PASSED - Batch Color Change Test')
                failed = False

        # Test the 'custom colors' input text box and close the batch panel menu
        if not failed:
            totals.update(executed=totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                      'Unable to set a custom color',
                                      'FAILED - Batch Custom Color Test'):
                custompath = ('%sinput[attribute::class="label-input-label"]' %
                              BATCH_PANEL)
                oviewlib.custom_colors(self.driver, self.logger, custompath,
                                       self.sleepdict)
                sellib.sleeper(self.sleepdict)
                self.logger.info('PASSED - Batch Custom Color Test')
                failed = False

        # Close the panel menu
        if not failed:
            totals.update(executed=totals['executed'] + 1)
            failed = oviewlib.close_panel_menu(self.driver, self.all_loggers,
                                               retrydict, self.sleepdict,
                                               BATCH_PANEL)

        totals.update(executed=totals['executed'] + 1)
        totals = loglib.logPassFail('testBatchColors', totals, failed,
                                    starttime, self.logger, retrydict)
        return failed, totals
コード例 #27
0
ファイル: resizetest.py プロジェクト: LeonardoRO/qetest
    def testDiskSorting(self, retries):
        """Test the sorting for Disk in the resize flavor table.

        Args:
          retries: int - number of times a test has been run

        Returns:
          failed: boolean - If true, one test within the module has failed
        """

        totals = {'passed': 0, 'failed': 0, 'executed': 0, 'total': 5,}
        (starttime, retrydict, failed, pmn, testnode) = self.setup('testDiskSorting', retries)
        totals.update(executed = totals['executed'] + 1)

        # Get the flavors of Disk
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                        'Unable to find or gather the resize Disk flavors',
                                        'FAILED - Disk Flavor Data Test'):
                self.click_resize_option(pmn, testnode)
                flavoritems1 = self.get_flavors(1)
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Disk flavor data located and gathered for node %s' % testnode)
                self.logger.info('PASSED - Disk Flavor Data Test')
                failed = False

        # Test Disk default list sorting
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                        'Default Disk column sorted incorrectly',
                                        'FAILED - Resize: Default Disk Sort Test'):
                def_disk_list = []
                for def_disk_element in flavoritems1:
                    def_disk_list.append(int(self.sortable_int(def_disk_element.text)))
                sorted_disk_list = sorted(def_disk_list)
                self.compare_sorting(def_disk_list, sorted_disk_list)
                self.logger.debug('Default Disk column sorted correctly for node %s' % testnode)
                self.logger.info('PASSED - Resize: Default Disk Sort Test')
                failed = False

        # Test sorting after reversing the list
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                        'Reversed Disk column sorted incorrectly',
                                        'FAILED - Resize: Reversed Disk Sort Test'):
                rev_sorted_disk_list = sorted(sorted_disk_list, reverse=True)
                # Click once to select the header, then a second time to reverse it
                sellib.element_wait(self.driver.find_element_by_xpath,
                                    '//div[contains(text(), "Disk")]',
                                    'click')
                sellib.element_wait(self.driver.find_element_by_xpath,
                                    '//div[contains(text(), "Disk")]',
                                    'click')
                self.logger.debug('Clicked on Disk column header to put flavor table in reverse '
                                  'Disk sort order')
                rev_flavoritems1 = self.get_flavors(1)
                sellib.sleeper(self.sleepdict)

                rev_disk_list = []
                for rev_element in rev_flavoritems1:
                    rev_disk_list.append(int(self.sortable_int(rev_element.text)))
                self.compare_sorting(rev_disk_list, rev_sorted_disk_list)
                self.logger.debug('Reversed Disk column sorted correctly for node %s' % testnode)
                self.logger.info('PASSED - Resize: Reversed Disk Sort Test')
                failed = False

        # Test sorting after reseting the list back to default 
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                        'Reset Disk column sorted incorrectly',
                                        'FAILED - Resize: Reset Disk Sort Test'):

                sellib.element_wait(self.driver.find_element_by_xpath,
                                    '//div[contains(text(), "Disk")]',
                                    'click')
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Clicked on Disk column header to put flavor table back to '
                                  'default Disk sort order')
                ret_flavoritems1 = self.get_flavors(1)
                ret_disk_list = []
                for ret_element in ret_flavoritems1:
                    ret_disk_list.append(int(self.sortable_int(ret_element.text)))
                
                self.compare_sorting(ret_disk_list, def_disk_list)
                self.logger.debug('Reset Disk column sorting correctly for node %s' % testnode)
                self.logger.info('PASSED - Resize: Reset Disk Sort Test')
                failed = False

        totals = loglib.logPassFail('testDiskSorting', totals, failed, starttime, self.logger,
                                    retrydict)

        return failed, totals
コード例 #28
0
ファイル: resizetest.py プロジェクト: LeonardoRO/qetest
    def testPriceSorting(self, retries):
        """Test the sorting for Price in the resize flavor table.

        Args:
          retries: int - number of times a test has been run

        Returns:
          failed: boolean - If true, one test within the module has failed
        """

        totals = {'passed': 0, 'failed': 0, 'executed': 0, 'total': 5,}
        (starttime, retrydict, failed, pmn, testnode) = self.setup('testPriceSorting', retries)
        totals.update(executed = totals['executed'] + 1)

        # Get the flavors of Price
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                        'Unable to find or gather the resize Price flavors',
                                        'FAILED - Price Flavor Data Test'):
                self.click_resize_option(pmn, testnode)
                flavoritems2 = self.get_flavors(2)
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Price flavor data located and gathered for node %s' % testnode)
                self.logger.info('PASSED - Price Flavor Data Test')
                failed = False

        # Test Price list sorting
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                        'Price column sorted correctly',
                                        'FAILED - Resize: Default Price Sort Test'):
                def_price_list = []
                for def_price_element in flavoritems2:
                    def_price_list.append(int(self.sortable_int(def_price_element.text)))
                sorted_price_list = sorted(def_price_list)
                self.compare_sorting(def_price_list, sorted_price_list)
                self.logger.debug('Default Price column sorted correctly for node %s' % testnode)
                self.logger.info('PASSED - Resize: Default Price Sort Test')
                failed = False

        # Test sorting after reversing the list
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                        'Reversed Price column sorted incorrectly',
                                        'FAILED - Resize: Reversed Price Sort Test'):
                rev_sorted_price_list = sorted(sorted_price_list, reverse=True)
                sellib.element_wait(self.driver.find_element_by_xpath,
                                    '//div[contains(text(), "Price")]',
                                    'click')
                sellib.element_wait(self.driver.find_element_by_xpath,
                                    '//div[contains(text(), "Price")]',
                                    'click')
                sellib.sleeper(self.sleepdict)
                rev_flavoritems2 = self.driver.find_elements_by_xpath('//div[@class="ck-widgets-split-'
                                                                   'menuitem-section ck-widgets-split-'
                                                                   'menuitem-section-2"]')
                self.logger.debug('Clicked on Price column header to put flavor table in reverse '
                                  'Price sort order')
                
                rev_price_list = []
                for rev_element in rev_flavoritems2:
                    rev_price_list.append(int(self.sortable_int(rev_element.text)))
                self.compare_sorting(rev_price_list, rev_sorted_price_list)
                self.logger.debug('Reversed Price column sorted correctly for node %s' % testnode)
                self.logger.info('PASSED - Resize: Reversed Price Sort Test')
                failed = False

        # Test sorting after reseting the list back to default 
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                        'Reset Price column sorted incorrectly',
                                        'FAILED - Resize: Reset Price Sort Test'):
                sellib.element_wait(self.driver.find_element_by_xpath,
                                    '//div[contains(text(), "Price")]',
                                    'click')
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Clicked on Price column header to put flavor table back to '
                                  'default Price sort order')
                ret_flavoritems2 = self.driver.find_elements_by_xpath('//div[@class="ck-widgets-split-'
                                                                   'menuitem-section ck-widgets-split-'
                                                                   'menuitem-section-2"]')
                ret_price_list = []
                for ret_element in ret_flavoritems2:
                    ret_price_list.append(int(self.sortable_int(ret_element.text)))
                self.compare_sorting(ret_price_list, def_price_list)
                self.logger.debug('Price column sorting correctly for node %s' % testnode)
                self.logger.info('PASSED - Resize: Reset Price Sort Test')
                failed = False

        totals = loglib.logPassFail('testPriceSorting', totals, failed, starttime, self.logger,
                                    retrydict)

        return failed, totals
コード例 #29
0
ファイル: renametest.py プロジェクト: LeonardoRO/qetest
    def testRenaming(self, retries):
        """Test node renaming functionality.

        Args:
          retries: int - number of times a test has been run

        Returns:
          failed: boolean - If true, one test within the module has failed
        """

        totals = {'passed': 0, 'failed': 0, 'executed': 0, 'total': 4,}
        (starttime, retrydict, failed, pmn, testnode) = self.setup('testRenaming', retries)

        # Click on the panel menu's rename option
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                        'Unable to find the rename menu item',
                                        'FAILED - Rename Menu Item Test'):
                self.driver.find_element_by_xpath('%sdiv[attribute::class="panel-menuitem'
                                             ' rename-panel-menuitem"]' % pmn).click()
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Located rename option in the panel menu')
                self.logger.info('PASSED - Rename Menu Item Test')
                failed = False

        # Verify existing node name and change the name of the node to something
        # session specific
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                        'Unable to rename node %s' % testnode,
                                        'FAILED - Rename Node Test Pt. 1'):
                rand1 = ''.join(random.sample(string.letters + string.digits, 5))
                newnodename = '%s-%s' % (random.choice(self.conf.peeps), rand1)
                current_name = ('%sdiv[attribute::class="input-panel"]/'
                                'descendant::input[attribute::class="input-panel-input'
                                ' label-input"]' % pmn)
                name_change = sellib.element_wait(self.driver.find_element_by_xpath, current_name)
                sellib.sleeper(self.sleepdict)
                sellib.element_wait(name_change, element_action='clear')
                sellib.sleeper(self.sleepdict)
                sellib.element_wait(name_change, element_action='send_keys',
                                    action_arg=newnodename)
                sellib.sleeper(self.sleepdict)
                sellib.element_wait(name_change, element_action='send_keys',
                                    action_arg=self.keys.RETURN)
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Successfully renamed node %s to %s' % (testnode, newnodename))
                self.logger.info('PASSED - Rename Node Test Pt. 1')
                failed = False

        # Verify the new node name and change the node name back to it's
        # starting name
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                        'Unable to change node name back to %s'
                                        % testnode,
                                        'FAILED - Rename Node Test Pt. 2'):
                current_name = ('%sdiv[attribute::class="input-panel"]/'
                                'descendant::input[attribute::class="input-panel-input'
                                ' label-input"]' % pmn)
                change_back = sellib.element_wait(self.driver.find_element_by_xpath, current_name)
                sellib.sleeper(self.sleepdict)
                sellib.element_wait(change_back, element_action='clear')
                sellib.sleeper(self.sleepdict)
                sellib.element_wait(change_back, element_action='send_keys',
                                    action_arg=testnode)
                sellib.sleeper(self.sleepdict)
                sellib.element_wait(change_back, element_action='send_keys',
                                    action_arg=self.keys.RETURN)
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Successfully renamed node %s back to %s' % (newnodename,
                                                                          testnode))
                self.logger.info('PASSED - Rename Node Test Pt. 2')
                failed = False

        totals.update(executed = totals['executed'] + 1)
        totals = loglib.logPassFail('testRenaming', totals, failed, starttime, self.logger,
                                    retrydict)

        return failed, totals
コード例 #30
0
    def testPanelMenuTags(self, retries):
        """Tests for changing individual node's tag panel tags (labels).

        Args:
          retries: int - number of times a test has been run

        Returns:
          failed: boolean - If true, one test within the module has failed
        """

        totals = {'passed': 0, 'failed': 0, 'executed': 0, 'total': 6,}
        (starttime, retrydict, failed, pmn, testnode) = self.setup('testPanelMenuTags', retries)

        # Click on the 'tag' option to bring up the tag panel
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            tagpanelpath = ('%sspan[attribute::class="panel-menuitem-icon'
                            ' tag-panel-menuitem-icon"]' % pmn)
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                        'Failed to find the tag panel menu',
                                        'FAILED - Tag Panel Menu Test'):
                self.driver.find_element_by_xpath(tagpanelpath).click()
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Clicked on "tag" menu item')
                self.logger.info('PASSED - Tag Panel Menu Test')
                failed = False

        # Create a new tag (session specific) and assign it
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            rand1 = ''.join(random.sample(string.letters + string.digits, 5))
            newtag = '%s-%s' % (random.choice(self.conf.peeps), rand1)
            newtagpath = ('%sdiv[contains(text(), "Search for or create a tag")]/'
                          'following-sibling::input' % pmn)
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                        'Failed to create tag "%s"' % newtag,
                                        'FAILED - Custom Tag Creation Test'):
                inputtag = sellib.element_wait(self.driver.find_element_by_xpath, newtagpath)
                inputtag.send_keys(newtag)
                createpath = ('%sdiv[attribute::class="ck_widgets_action_button" and '
                             'contains(text(), "(create new)")]' % pmn)
                sellib.element_wait(self.driver.find_element_by_xpath, createpath, 'click')
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Created tag "%s"' % newtag)
                self.logger.info('PASSED - Custom Tag Creation Test')
                failed = False

        # Remove the custom tag
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            removalpath = ('%sdiv[attribute::class="goog-inline-block ck_widgets_closable'
                      '_label" and contains(text(), "%s")]' % (pmn, newtag))
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                        'Failed to remove tag "%s"' % newtag,
                                        'FAILED - Custom Tag Removal Test'):
                sellib.element_wait(self.driver.find_element_by_xpath, removalpath, 'click')
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Removed tag "%s"' % newtag)
                self.logger.info('PASSED - Custom Tag Removal Test')
                failed = False

        # Re-add then re-remove the custom tag.  Use the tag above the
        # text box to remove the tag as a test to confirm that it was added back.

        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            widgetpath = ('%sdiv[@class="ck_widgets_action_menuitem-content"' ' and contains(text(), "%s")]'
                       % (pmn, newtag))
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                        'Failed to re-add/remove tag "%s"' % newtag,
                                        'FAILED - RE Add/Remove Tag Test'):
                sellib.element_wait(self.driver.find_element_by_xpath, widgetpath, 'click')
                sellib.sleeper(self.sleepdict)
                newtag_path = '%sdiv[@role="button" and ' 'contains(text(), "%s")]' % (pmn, newtag)
                sellib.element_wait(self.driver.find_element_by_xpath, newtag_path, 'click')
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Re-added then re-removed tag "%s"' % newtag)
                self.logger.info('PASSED - RE Add/Remove Tag Test')
                failed = False

        # Completely delete the custom tag.
        # TODO (dborin): Figure out how to verify that the custom tag was removed

        # NOTE: This uses the widgetpath value from the previous section
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            deletepath = ('%s/following-sibling::div[attribute::class="ck_widgets_'
                       'action_button"]' % widgetpath)
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                        'Unable to delete custom tag "%s"' % newtag,
                                        'FAILED - Custom Tag Deletion Test'):
                sellib.element_wait(self.driver.find_element_by_xpath, deletepath, 'click')
                sellib.sleeper(self.sleepdict)
                sellib.element_wait(self.driver.find_element_by_xpath,
                                    '//button[@name="ok"]', 'click')
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Custom tag "%s" deleted' % newtag)
                self.logger.info('PASSED - Custom Tag Deletion Test')
                failed = False

        totals.update(executed = totals['executed'] + 1)
        totals = loglib.logPassFail('testPanelMenuTags', totals, failed, starttime, self.logger,
                                    retrydict)

        return failed, totals
コード例 #31
0
    def testBatchTags(self, retries):
        """Tests batch changes to tags (labels) for all test set nodes.

        Args:
          retries: int - number of times a test has been run

        Returns:
          failed: boolean - If true, one test within the module has failed
        """

        totals = {
            'passed': 0,
            'failed': 0,
            'executed': 0,
            'total': 8,
        }
        (starttime, retrydict, failed) = self.setup(
            'testBatchTags',
            retries,
        )

        # Select all the nodes
        if not failed:
            (failed, totals) = self.all_nodes(retrydict, totals)

        # Click on the batch panel sprocket to bring up the 'tag' or 'color' option
        if not failed:
            (failed, totals) = self.batch_sprocket(retrydict, totals)

        # Click on the 'tag' option to bring up the tag panel
        if not failed:
            totals.update(executed=totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                      'Failed to find the tag panel menu',
                                      'FAILED - Tag Panel Menu Test'):
                tagpath = (
                    '%sdiv[attribute::class="panel-menuitem tag-panel-menuitem"]'
                    % BATCH_PANEL)
                sellib.element_wait(self.driver.find_element_by_xpath, tagpath,
                                    'click')
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Found the tag panel menu')
                self.logger.info('PASSED - Tag Panel Menu Test')
                failed = False

        # Create a new tag (session specific) and assign to all nodes
        if not failed:
            totals.update(executed=totals['executed'] + 1)
            failed = True
            rand1 = ''.join(random.sample(string.letters + string.digits, 5))
            newtag = '%s-%s' % (random.choice(self.conf.peeps), rand1)
            newtagpath = (
                '%sdiv[contains(text(), "Search for or create a tag")]/'
                'following-sibling::input' % BATCH_PANEL)
            with sellib.error_handler(
                    self.driver, self.all_loggers, retrydict,
                    'Failed to create tag "%s" for all nodes' % newtag,
                    'FAILED - Custom Tag Creation Test'):
                sellib.element_wait(self.driver.find_element_by_xpath,
                                    newtagpath, 'send_keys', newtag)
                sellib.sleeper(self.sleepdict)
                createpath = (
                    '%sdiv[attribute::class="ck_widgets_action_button" and '
                    'contains(text(), "(create new)")]' % BATCH_PANEL)
                sellib.element_wait(self.driver.find_element_by_xpath,
                                    createpath, 'click')
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Created tag "%s" for all the nodes' %
                                  newtag)
                self.logger.info('PASSED - Custom Tag Creation Test')
                failed = False

        # Remove the custom tag from all nodes
        if not failed:
            totals.update(executed=totals['executed'] + 1)
            failed = True
            with sellib.error_handler(
                    self.driver, self.all_loggers, retrydict,
                    'Failed to remove tag "%s" from the nodes' % newtag,
                    'FAILED - Custom Tag Removal Test'):
                custtagpath = (
                    '%sdiv[attribute::class="goog-inline-block ck_widgets_closable'
                    '_label" and contains(text(), "%s")]' %
                    (BATCH_PANEL, newtag))
                sellib.element_wait(self.driver.find_element_by_xpath,
                                    custtagpath, 'click')
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Removed tag "%s" from all nodes' % newtag)
                self.logger.info('PASSED - Custom Tag Removal Test')
                failed = False

        # Re-add then re-remove the custom tag for all nodes.  Use the tag above
        # the text box to remove the tag as a test to confirm that it was added
        # back.

        if not failed:
            totals.update(executed=totals['executed'] + 1)
            failed = True
            with sellib.error_handler(
                    self.driver, self.all_loggers, retrydict,
                    'Failed to re-add/remove tag "%s"' % newtag,
                    'FAILED - RE Add/Remove Tag Test'):
                addpath = (
                    '%sdiv[attribute::class="ck_widgets_action_menuitem-content"'
                    ' and contains(text(), "%s")]' % (BATCH_PANEL, newtag))
                sellib.element_wait(self.driver.find_element_by_xpath, addpath,
                                    'click')
                sellib.sleeper(self.sleepdict)
                sellib.element_wait(
                    self.driver.find_element_by_xpath,
                    '%sdiv[attribute::role="button" and contains(text(), "%s")]'
                    % (BATCH_PANEL, newtag), 'click')
                sellib.sleeper(self.sleepdict)
                self.logger.debug(
                    'Re-added then re-removed tag "%s" to all nodes' % newtag)
                self.logger.info('PASSED - RE Add/Remove Tag Test')
                failed = False

        # Completely delete the custom tag
        # TODO (dborin): Figure out how to verify that the custom tag was removed

        # NOTE: This uses the addpath value from the previous section
        if not failed:
            totals.update(executed=totals['executed'] + 1)
            failed = True
            with sellib.error_handler(
                    self.driver, self.all_loggers, retrydict,
                    'Unable to delete custom tag "%s"' % newtag,
                    'FAILED - Custom Tag Deletion Test'):
                delpath = (
                    '%s/following-sibling::div[attribute::class="ck_widgets_'
                    'action_button"]' % addpath)
                sellib.element_wait(self.driver.find_element_by_xpath, delpath,
                                    'click')
                sellib.sleeper(self.sleepdict)
                sellib.element_wait(self.driver.find_element_by_xpath,
                                    '//button[attribute::name="ok"]', 'click')
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Custom tag "%s" deleted' % newtag)
                self.logger.info('PASSED - Custom Tag Deletion Test')
                failed = False

        totals.update(executed=totals['executed'] + 1)
        totals = loglib.logPassFail('testBatchTags', totals, failed, starttime,
                                    self.logger, retrydict)

        return failed, totals
コード例 #32
0
    def testPriceSorting(self, retries):
        """Test the sorting for Price in the resize flavor table.

        Args:
          retries: int - number of times a test has been run

        Returns:
          failed: boolean - If true, one test within the module has failed
        """

        totals = {
            'passed': 0,
            'failed': 0,
            'executed': 0,
            'total': 5,
        }
        (starttime, retrydict, failed, pmn,
         testnode) = self.setup('testPriceSorting', retries)
        totals.update(executed=totals['executed'] + 1)

        # Get the flavors of Price
        if not failed:
            totals.update(executed=totals['executed'] + 1)
            failed = True
            with sellib.error_handler(
                    self.driver, self.all_loggers, retrydict,
                    'Unable to find or gather the resize Price flavors',
                    'FAILED - Price Flavor Data Test'):
                self.click_resize_option(pmn, testnode)
                flavoritems2 = self.get_flavors(2)
                sellib.sleeper(self.sleepdict)
                self.logger.debug(
                    'Price flavor data located and gathered for node %s' %
                    testnode)
                self.logger.info('PASSED - Price Flavor Data Test')
                failed = False

        # Test Price list sorting
        if not failed:
            totals.update(executed=totals['executed'] + 1)
            failed = True
            with sellib.error_handler(
                    self.driver, self.all_loggers, retrydict,
                    'Price column sorted correctly',
                    'FAILED - Resize: Default Price Sort Test'):
                def_price_list = []
                for def_price_element in flavoritems2:
                    def_price_list.append(
                        int(self.sortable_int(def_price_element.text)))
                sorted_price_list = sorted(def_price_list)
                self.compare_sorting(def_price_list, sorted_price_list)
                self.logger.debug(
                    'Default Price column sorted correctly for node %s' %
                    testnode)
                self.logger.info('PASSED - Resize: Default Price Sort Test')
                failed = False

        # Test sorting after reversing the list
        if not failed:
            totals.update(executed=totals['executed'] + 1)
            failed = True
            with sellib.error_handler(
                    self.driver, self.all_loggers, retrydict,
                    'Reversed Price column sorted incorrectly',
                    'FAILED - Resize: Reversed Price Sort Test'):
                rev_sorted_price_list = sorted(sorted_price_list, reverse=True)
                sellib.element_wait(self.driver.find_element_by_xpath,
                                    '//div[contains(text(), "Price")]',
                                    'click')
                sellib.element_wait(self.driver.find_element_by_xpath,
                                    '//div[contains(text(), "Price")]',
                                    'click')
                sellib.sleeper(self.sleepdict)
                rev_flavoritems2 = self.driver.find_elements_by_xpath(
                    '//div[@class="ck-widgets-split-'
                    'menuitem-section ck-widgets-split-'
                    'menuitem-section-2"]')
                self.logger.debug(
                    'Clicked on Price column header to put flavor table in reverse '
                    'Price sort order')

                rev_price_list = []
                for rev_element in rev_flavoritems2:
                    rev_price_list.append(
                        int(self.sortable_int(rev_element.text)))
                self.compare_sorting(rev_price_list, rev_sorted_price_list)
                self.logger.debug(
                    'Reversed Price column sorted correctly for node %s' %
                    testnode)
                self.logger.info('PASSED - Resize: Reversed Price Sort Test')
                failed = False

        # Test sorting after reseting the list back to default
        if not failed:
            totals.update(executed=totals['executed'] + 1)
            failed = True
            with sellib.error_handler(
                    self.driver, self.all_loggers, retrydict,
                    'Reset Price column sorted incorrectly',
                    'FAILED - Resize: Reset Price Sort Test'):
                sellib.element_wait(self.driver.find_element_by_xpath,
                                    '//div[contains(text(), "Price")]',
                                    'click')
                sellib.sleeper(self.sleepdict)
                self.logger.debug(
                    'Clicked on Price column header to put flavor table back to '
                    'default Price sort order')
                ret_flavoritems2 = self.driver.find_elements_by_xpath(
                    '//div[@class="ck-widgets-split-'
                    'menuitem-section ck-widgets-split-'
                    'menuitem-section-2"]')
                ret_price_list = []
                for ret_element in ret_flavoritems2:
                    ret_price_list.append(
                        int(self.sortable_int(ret_element.text)))
                self.compare_sorting(ret_price_list, def_price_list)
                self.logger.debug(
                    'Price column sorting correctly for node %s' % testnode)
                self.logger.info('PASSED - Resize: Reset Price Sort Test')
                failed = False

        totals = loglib.logPassFail('testPriceSorting', totals, failed,
                                    starttime, self.logger, retrydict)

        return failed, totals
コード例 #33
0
    def testAlgorithm(self, retries):

        totals = {
            'passed': 0,
            'failed': 0,
            'executed': 0,
            'total': 7,
        }
        (starttime, retrydict, failed) = self.setup(
            'DetailViewTest',
            retries,
        )

        if not failed:
            totals.update(executed=totals['executed'] + 1)
            failed = True
            with sellib.error_handler(
                    self.driver, self.all_loggers, retrydict,
                    'Unable to find the Load Balancers button',
                    'FAILED - Load Balancers button click'):

                #lbaaslib.go_to_lbaas(self.driver)
                self.driver.get(
                    "https://privatebeta.rackspace.com/a/reachdevsf/load_balancers"
                )

                sellib.sleeper(self.sleepdict)
                self.logger.debug('Located Load Balancers button')
                self.logger.info('PASSED - Load Balancers button click')
                failed = False

        #Call function to click on a random Load Balancer
        if not failed:
            totals.update(executed=totals['executed'] + 1)
            failed = True
            with sellib.error_handler(
                    self.driver, self.all_loggers, retrydict,
                    'Unable to select a random Load Balancer',
                    'FAILED - Random Load Balancer selection'):

                lbaaslib.random_load_balancer(self.driver)

                sellib.sleeper(self.sleepdict)
                self.logger.debug('Random Load Balancer Selected')
                self.logger.info('PASSED - Random Load Balancer selection')
                failed = False

#        #Algorithm Cancel
#        if not failed:
#            totals.update(executed = totals['executed'] + 1)
#            failed = True
#            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
#                'Unable to open the Algorithm popup',
#                'FAILED - Algorithm Popup Test'):
#
#                sellib.element_wait(self.driver.find_element_by_xpath,
#                    '//div[@id="node_details"]/descendant::a[@id="algorithm_toggle"]', element_action='click')
#
#                sellib.element_wait(self.driver.find_element_by_xpath,
#                    '//div[@class="ck-widgets-popup ck-widgets-popup-right"][2]/div[@class="ck-widgets-popup-content"]/form[@class="load-balancer-algorithm"]/div[@class="save-cancel"]/button[@class="button-cancel"]',
#                    element_action='click')
#
#                sellib.sleeper(self.sleepdict)
#                self.logger.debug('Algorithm Popup Test Passed')
#                self.logger.info('PASSED - Algorithm Popup Test')
#                failed = False

#Select Algorithm
        if not failed:
            totals.update(executed=totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                      'Unable to open the Algorithm popup',
                                      'FAILED - Algorithm Popup Test'):

                algorithm_list = [
                    'Round Robin', 'Weighted Round Robin', 'Random',
                    'Least Connections', 'Weighted Least Connections'
                ]
                for name in algorithm_list:
                    self.algorithm_select(name)
                    current_name = self.get_algorithm_name_details_view()
                    if current_name != name:
                        print name
                        print current_name
                        print('its different!')
                    else:
                        sellib.sleeper(self.sleepdict)
                        self.logger.debug('Algorithm Popup Test Passed')
                        self.logger.info('PASSED - Algorithm Popup Test')
                        failed = False

#                #TODO: get list from screen
#                algorithm_list = ['Round Robin', 'Weighted Round Robin', 'Random', 'Least Connections', 'Weighted Least Connections']
#                for name in algorithm_list:
#                    current_name = self.get_algorithm_name_details_view()
#                    if current_name != name:
#                        temp_failed = self.algorithm_select(name)
#                        if temp_failed:
#                            break
#            if temp_failed:
#                raise texterror
#            else:
#                sellib.sleeper(self.sleepdict)
#                self.logger.debug('Algorithm Popup Test Passed')
#                self.logger.info('PASSED - Algorithm Popup Test')
#                failed = False

#
##        close algorithm popup
##        sellib.element_wait(self.driver.find_element_by_xpath,
##            '//div[@class="ck-widgets-popup ck-widgets-popup-right"][2]/div[@class="ck-widgets-popup-content"]/form[@class="load-balancer-algorithm"]/div[@class="save-cancel"]/button[@class="button-cancel"]',
##            element_action='click')

        totals.update(executed=totals['executed'] + 1)
        totals = loglib.logPassFail('testListView', totals, failed, starttime,
                                    self.logger, retrydict)
        return failed, totals
コード例 #34
0
ファイル: imagetest.py プロジェクト: LeonardoRO/qetest
    def testCreateImage(self, retries):
        """Tests for panel menu create image feature.

        NOTE: As of 15-Dec-2011 there is very little beyond the three steps being taken below to
        test Create Image.  There are currently no confirmations or notifications to the end
        user to use for validation.

        Args:
          retries: int - number of times a test has been run

        Returns:
          failed: boolean - If true, one test within the module has failed
        """

        totals = {'passed': 0, 'failed': 0, 'executed': 0, 'total': 4,}
        (starttime, retrydict, failed, pmn, testnode) = self.setup('testCreateImage', retries)

        # Click on the panel menu's rebuild option
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                        'Unable to find the create image link',
                                        'FAILED - Create Image Option Test'):
                createpath = ('%sdiv[@class="panel-menuitem create_image-panel-menuitem"]' % pmn)
                sellib.element_wait(self.driver.find_element_by_xpath, createpath, 'click')
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Located create image option for node %s' % testnode)
                self.logger.info('PASSED - Create Image Option Test')
                failed = False

        # Click on the panel menu's rebuild option
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                        'Unable to input image name',
                                        'FAILED - Image Name Input Test'):

                rand1 = ''.join(random.sample(string.letters + string.digits, 16))
                image_name = 'myimage-%s' % rand1
                sellib.element_wait(self.driver.find_element_by_xpath,
                                    '%sinput[attribute::type="text"]' % pmn,
                                    'send_keys', image_name)
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Able to input name "%s"' % image_name)
                self.logger.info('PASSED - Image Name Input Test')
                failed = False

        # Click on the panel menu's rebuild option
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                        'Unable to click on the submit button',
                                        'FAILED - Create Image Submit Test'):

                sellib.element_wait(self.driver.find_element_by_xpath,
                                    '%sbutton[@class="input-panel-button"]' % pmn,
                                    'click')
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Able to click on the submit button')
                self.logger.info('PASSED - Create Image Submit Test')
                failed = False


        totals.update(executed = totals['executed'] + 1)
        totals = loglib.logPassFail('testCreateImage', totals, failed, starttime, self.logger,
                                    retrydict)
        return failed, totals
コード例 #35
0
ファイル: powertest.py プロジェクト: LeonardoRO/qetest
    def testCancelReboot(self, retries):
        """Tests panel menu power cancel then reboot functionality.

        Args:
          retries: int - number of times a test has been run

        Returns:
          failed: boolean - If true, one test within the module has failed
        """

        totals = {'passed': 0, 'failed': 0, 'executed': 0, 'total': 3,}
        (starttime, retrydict, failed, pmn, testnode) = self.setup('testCancelReboot', retries)

        # Click on the panel menu's power option
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                        'Unable to find the power option',
                                        'FAILED - Panel Menu Power Option Test'):
                powerpath = ('%sdiv[attribute::class="panel-menuitem power-panel-menuitem"]' % pmn)
                sellib.element_wait(self.driver.find_element_by_xpath, powerpath, 'click')
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Located power option for node %s' % testnode)
                self.logger.info('PASSED - Panel Menu Power Option Test')
                failed = False

        # Validate the 'cancel' functionality
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                        'Cancel then reboot doesn\'t appear to be working',
                                        'FAILED - Power Panel Cancel Link Test'):
                sellib.element_wait(self.driver.find_element_by_xpath,
                                    '//button[attribute::class="soft_reboot_button"]', 'click')
                sellib.sleeper(self.sleepdict)
                sellib.element_wait(self.driver.find_element_by_xpath,
                                    '//button[attribute::name="cancel"]', 'click')
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Clicked on reboot then on cancel in the confirmation pop-up')
                try:
                    sellib.element_wait(self.driver.find_element_by_xpath,
                                        '//div[attribute::class="ck_widgets_message_default" and '
                                        'contains(text(), "Rebooting %s")]' % testnode)
                    temp_failed = True
                    self.logger.error('Reboot confirm message found, indicating cancel failure')
                except Exception:
                    self.logger.debug('After clicking cancel, no reboot confirmation seen')
                    temp_failed = False
                sellib.element_wait(self.driver.find_element_by_xpath,
                                    '//button[attribute::class="soft_reboot_button"]', 'click')
                sellib.sleeper(self.sleepdict)
                sellib.element_wait(self.driver.find_element_by_xpath,
                                    '//button[attribute::name="ok"]', 'click')
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Clicked on reboot again, and on ok (in the confirmation pop-up)')
                self.logger.debug('Cancel button seems to be working %s' % testnode)
                self.logger.info('PASSED - Power Panel Cancel Link Test')
                if not temp_failed:
                    failed = False

        totals.update(executed = totals['executed'] + 1)
        totals = loglib.logPassFail('testCancelReboot', totals, failed, starttime, self.logger,
                                    retrydict)
        return failed, totals
コード例 #36
0
ファイル: algorithmtest.py プロジェクト: LeonardoRO/qetest
    def testAlgorithm(self, retries):

        totals = {'passed': 0, 'failed': 0, 'executed': 0, 'total': 7,}
        (starttime, retrydict, failed) = self.setup('DetailViewTest', retries,)

        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                'Unable to find the Load Balancers button',
                'FAILED - Load Balancers button click'):

                    #lbaaslib.go_to_lbaas(self.driver)
                    self.driver.get("https://privatebeta.rackspace.com/a/reachdevsf/load_balancers")

                    sellib.sleeper(self.sleepdict)
                    self.logger.debug('Located Load Balancers button')
                    self.logger.info('PASSED - Load Balancers button click')
                    failed = False

        #Call function to click on a random Load Balancer
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                'Unable to select a random Load Balancer',
                'FAILED - Random Load Balancer selection'):

                lbaaslib.random_load_balancer(self.driver)

                sellib.sleeper(self.sleepdict)
                self.logger.debug('Random Load Balancer Selected')
                self.logger.info('PASSED - Random Load Balancer selection')
                failed = False

#        #Algorithm Cancel
#        if not failed:
#            totals.update(executed = totals['executed'] + 1)
#            failed = True
#            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
#                'Unable to open the Algorithm popup',
#                'FAILED - Algorithm Popup Test'):
#
#                sellib.element_wait(self.driver.find_element_by_xpath,
#                    '//div[@id="node_details"]/descendant::a[@id="algorithm_toggle"]', element_action='click')
#
#                sellib.element_wait(self.driver.find_element_by_xpath,
#                    '//div[@class="ck-widgets-popup ck-widgets-popup-right"][2]/div[@class="ck-widgets-popup-content"]/form[@class="load-balancer-algorithm"]/div[@class="save-cancel"]/button[@class="button-cancel"]',
#                    element_action='click')
#
#                sellib.sleeper(self.sleepdict)
#                self.logger.debug('Algorithm Popup Test Passed')
#                self.logger.info('PASSED - Algorithm Popup Test')
#                failed = False

        #Select Algorithm
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                'Unable to open the Algorithm popup',
                'FAILED - Algorithm Popup Test'):

                algorithm_list = ['Round Robin', 'Weighted Round Robin', 'Random', 'Least Connections', 'Weighted Least Connections']
                for name in algorithm_list:
                    self.algorithm_select(name)
                    current_name = self.get_algorithm_name_details_view()
                    if current_name != name:
                        print name
                        print current_name
                        print ('its different!')
                    else:
                        sellib.sleeper(self.sleepdict)
                        self.logger.debug('Algorithm Popup Test Passed')
                        self.logger.info('PASSED - Algorithm Popup Test')
                        failed = False

#                #TODO: get list from screen
#                algorithm_list = ['Round Robin', 'Weighted Round Robin', 'Random', 'Least Connections', 'Weighted Least Connections']
#                for name in algorithm_list:
#                    current_name = self.get_algorithm_name_details_view()
#                    if current_name != name:
#                        temp_failed = self.algorithm_select(name)
#                        if temp_failed:
#                            break
#            if temp_failed:
#                raise texterror
#            else:
#                sellib.sleeper(self.sleepdict)
#                self.logger.debug('Algorithm Popup Test Passed')
#                self.logger.info('PASSED - Algorithm Popup Test')
#                failed = False

#
##        close algorithm popup
##        sellib.element_wait(self.driver.find_element_by_xpath,
##            '//div[@class="ck-widgets-popup ck-widgets-popup-right"][2]/div[@class="ck-widgets-popup-content"]/form[@class="load-balancer-algorithm"]/div[@class="save-cancel"]/button[@class="button-cancel"]',
##            element_action='click')

        totals.update(executed = totals['executed'] + 1)
        totals = loglib.logPassFail('testListView', totals, failed, starttime, self.logger, retrydict)
        return failed, totals
コード例 #37
0
    def testDetailView(self, retries):

        totals = {
            'passed': 0,
            'failed': 0,
            'executed': 0,
            'total': 7,
        }
        (starttime, retrydict, failed) = self.setup(
            'DetailViewTest',
            retries,
        )

        #Call function to go to Load Balancers
        if not failed:
            totals.update(executed=totals['executed'] + 1)
            failed = True
            with sellib.error_handler(
                    self.driver, self.all_loggers, retrydict,
                    'Unable to find the Load Balancers button',
                    'FAILED - Load Balancers button click'):

                lbaaslib.go_to_lbaas(self.driver)

                sellib.sleeper(self.sleepdict)
                self.logger.debug('Located Load Balancers button')
                self.logger.info('PASSED - Load Balancers button click')
                failed = False

        #Call function to click on a random Load Balancer
        if not failed:
            totals.update(executed=totals['executed'] + 1)
            failed = True
            with sellib.error_handler(
                    self.driver, self.all_loggers, retrydict,
                    'Unable to select a random Load Balancer',
                    'FAILED - Random Load Balancer selection'):

                lbaaslib.random_load_balancer(self.driver)

                sellib.sleeper(self.sleepdict)
                self.logger.debug('Random Load Balancer Selected')
                self.logger.info('PASSED - Random Load Balancer selection')
                failed = False

        #Check if Load Balancer Details section exist
        if not failed:
            totals.update(executed=totals['executed'] + 1)
            failed = True
            with sellib.error_handler(
                    self.driver, self.all_loggers, retrydict,
                    'Unable to find Load Balancer Details section',
                    'FAILED - Find Load Balancer Details Section'):

                sellib.element_wait(
                    self.driver.find_element_by_xpath,
                    '//div[@id="content"]/div[@id="node_details"]')

                sellib.sleeper(self.sleepdict)
                self.logger.debug('Load Balancer Details Section Found')
                self.logger.info('PASSED - Find Load Balancer Details Section')
                failed = False

        #Check if Nodes section exist
        if not failed:
            totals.update(executed=totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                      'Unable to find nodes section',
                                      'FAILED - Find Nodes Section'):

                sellib.element_wait(
                    self.driver.find_element_by_xpath,
                    '//div[@id="content"]/div[@id="node_servers"]')

        sellib.sleeper(self.sleepdict)
        self.logger.debug('Nodes Section Found')
        self.logger.info('PASSED - Find Nodes Section')
        failed = False

        #Check if Optional Features section exist
        if not failed:
            totals.update(executed=totals['executed'] + 1)
            failed = True
            with sellib.error_handler(
                    self.driver, self.all_loggers, retrydict,
                    'Unable to find Optional Features section',
                    'FAILED - Find Optional Features Section'):

                sellib.element_wait(
                    self.driver.find_element_by_xpath,
                    '//div[@id="content"]/div[@id="node_options"]')

        sellib.sleeper(self.sleepdict)
        self.logger.debug('Optional Features Section Found')
        self.logger.info('PASSED - Find Optional Features Section')
        failed = False

        #Protocol/Port
        if not failed:
            totals.update(executed=totals['executed'] + 1)
            failed = True
            with sellib.error_handler(
                    self.driver, self.all_loggers, retrydict,
                    'Unable to open the Protocol/Port popup',
                    'FAILED - Protocol/Port Popup Test'):

                sellib.element_wait(
                    self.driver.find_element_by_xpath,
                    '//div[@id="node_details"]/descendant::a[@id="protocol_port_toggle"]',
                    element_action='click')
                sellib.sleeper(self.sleepdict)

                sellib.element_wait(
                    self.driver.find_element_by_xpath,
                    '//form[@class="protocol-port"]/div[@class="save-cancel"]/button[@class="button-cancel"]',
                    element_action='click')

                sellib.sleeper(self.sleepdict)
                self.logger.debug('Protocol/Port popup test passed')
                self.logger.info('PASSED - Protocol/Port Popup Test')
                failed = False

        #Algorithm
        if not failed:
            totals.update(executed=totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                      'Unable to open the Algorithm popup',
                                      'FAILED - Algorithm Popup Test'):

                sellib.element_wait(
                    self.driver.find_element_by_xpath,
                    '//div[@id="node_details"]/descendant::a[@id="algorithm_toggle"]',
                    element_action='click')
                sellib.sleeper(self.sleepdict)

                sellib.element_wait(
                    self.driver.find_element_by_xpath,
                    '//form[@class="load-balancer-algorithm"]/div[@class="save-cancel"]/button[@class="button-cancel"]',
                    element_action='click')

                sellib.sleeper(self.sleepdict)
                self.logger.debug('Algorithm Popup Test Passed')
                self.logger.info('PASSED - Algorithm Popup Test')
                failed = False

    #Nodes
        if not failed:
            totals.update(executed=totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                      'Unable to find a Node on the table',
                                      'FAILED - Node not found'):

                sellib.element_wait(
                    self.driver.find_element_by_xpath,
                    '//div[@id="node_servers"]/div[@id="node_list"]/div[@class="data_table"]/div[@class="data_table_body"]/div[@class="data_table_row"][1]/div[@class="data_table_cell name"]'
                )

            sellib.sleeper(self.sleepdict)
            self.logger.debug('Find a Node on the Table')
            self.logger.info('PASSED - node Found')
            failed = False

##Optional Features #TODO: make it random
#Health Monitoring
        if not failed:
            totals.update(executed=totals['executed'] + 1)
            failed = True
            with sellib.error_handler(
                    self.driver, self.all_loggers, retrydict,
                    'Unable to open the Health Monitoring popup',
                    'FAILED - Health Monitoring Test'):

                sellib.element_wait(
                    self.driver.find_element_by_xpath,
                    '//div[@id="node_options"]/descendant::a[@id="health_monitor_toggle"]',
                    element_action='click')

                sellib.element_wait(
                    self.driver.find_element_by_xpath,
                    '//div[@class="health_monitor"]/div[@class="save-cancel"]/a[@class="cancel"]',
                    element_action='click')

                sellib.sleeper(self.sleepdict)
                self.logger.debug('Health Monitoring Test Passed')
                self.logger.info('PASSED - Health Monitoring Test')
                failed = False

        totals.update(executed=totals['executed'] + 1)
        totals = loglib.logPassFail('testListView', totals, failed, starttime,
                                    self.logger, retrydict)
        return failed, totals
コード例 #38
0
ファイル: detailsviewtest.py プロジェクト: LeonardoRO/qetest
    def testDetailView(self, retries):

        totals = {'passed': 0, 'failed': 0, 'executed': 0, 'total': 7,}
        (starttime, retrydict, failed) = self.setup('DetailViewTest', retries,)

        #Call function to go to Load Balancers
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                'Unable to find the Load Balancers button',
                'FAILED - Load Balancers button click'):

                lbaaslib.go_to_lbaas(self.driver)

                sellib.sleeper(self.sleepdict)
                self.logger.debug('Located Load Balancers button')
                self.logger.info('PASSED - Load Balancers button click')
                failed = False

        #Call function to click on a random Load Balancer
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                'Unable to select a random Load Balancer',
                'FAILED - Random Load Balancer selection'):

                lbaaslib.random_load_balancer(self.driver)

                sellib.sleeper(self.sleepdict)
                self.logger.debug('Random Load Balancer Selected')
                self.logger.info('PASSED - Random Load Balancer selection')
                failed = False

        #Check if Load Balancer Details section exist
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                'Unable to find Load Balancer Details section',
                'FAILED - Find Load Balancer Details Section'):

                sellib.element_wait(self.driver.find_element_by_xpath,
                    '//div[@id="content"]/div[@id="node_details"]')

                sellib.sleeper(self.sleepdict)
                self.logger.debug('Load Balancer Details Section Found')
                self.logger.info('PASSED - Find Load Balancer Details Section')
                failed = False

        #Check if Nodes section exist
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                'Unable to find nodes section',
                'FAILED - Find Nodes Section'):

                sellib.element_wait(self.driver.find_element_by_xpath,
                    '//div[@id="content"]/div[@id="node_servers"]')

        sellib.sleeper(self.sleepdict)
        self.logger.debug('Nodes Section Found')
        self.logger.info('PASSED - Find Nodes Section')
        failed = False

        #Check if Optional Features section exist
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                'Unable to find Optional Features section',
                'FAILED - Find Optional Features Section'):

                sellib.element_wait(self.driver.find_element_by_xpath,
                    '//div[@id="content"]/div[@id="node_options"]')

        sellib.sleeper(self.sleepdict)
        self.logger.debug('Optional Features Section Found')
        self.logger.info('PASSED - Find Optional Features Section')
        failed = False

        #Protocol/Port
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                'Unable to open the Protocol/Port popup',
                'FAILED - Protocol/Port Popup Test'):

                sellib.element_wait(self.driver.find_element_by_xpath,
                    '//div[@id="node_details"]/descendant::a[@id="protocol_port_toggle"]', element_action='click')
                sellib.sleeper(self.sleepdict)

                sellib.element_wait(self.driver.find_element_by_xpath,
                    '//form[@class="protocol-port"]/div[@class="save-cancel"]/button[@class="button-cancel"]',
                    element_action='click')

                sellib.sleeper(self.sleepdict)
                self.logger.debug('Protocol/Port popup test passed')
                self.logger.info('PASSED - Protocol/Port Popup Test')
                failed = False

        #Algorithm
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                'Unable to open the Algorithm popup',
                'FAILED - Algorithm Popup Test'):

                sellib.element_wait(self.driver.find_element_by_xpath,
                    '//div[@id="node_details"]/descendant::a[@id="algorithm_toggle"]', element_action='click')
                sellib.sleeper(self.sleepdict)

                sellib.element_wait(self.driver.find_element_by_xpath,
                    '//form[@class="load-balancer-algorithm"]/div[@class="save-cancel"]/button[@class="button-cancel"]',
                    element_action='click')

                sellib.sleeper(self.sleepdict)
                self.logger.debug('Algorithm Popup Test Passed')
                self.logger.info('PASSED - Algorithm Popup Test')
                failed = False

    #Nodes
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                'Unable to find a Node on the table',
                'FAILED - Node not found'):

                sellib.element_wait(self.driver.find_element_by_xpath,
                    '//div[@id="node_servers"]/div[@id="node_list"]/div[@class="data_table"]/div[@class="data_table_body"]/div[@class="data_table_row"][1]/div[@class="data_table_cell name"]')

            sellib.sleeper(self.sleepdict)
            self.logger.debug('Find a Node on the Table')
            self.logger.info('PASSED - node Found')
            failed = False

##Optional Features #TODO: make it random
        #Health Monitoring
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                'Unable to open the Health Monitoring popup',
                'FAILED - Health Monitoring Test'):

                sellib.element_wait(self.driver.find_element_by_xpath,
                    '//div[@id="node_options"]/descendant::a[@id="health_monitor_toggle"]', element_action='click')

                sellib.element_wait(self.driver.find_element_by_xpath,
                    '//div[@class="health_monitor"]/div[@class="save-cancel"]/a[@class="cancel"]',
                    element_action='click')

                sellib.sleeper(self.sleepdict)
                self.logger.debug('Health Monitoring Test Passed')
                self.logger.info('PASSED - Health Monitoring Test')
                failed = False

        totals.update(executed = totals['executed'] + 1)
        totals = loglib.logPassFail('testListView', totals, failed, starttime, self.logger, retrydict)
        return failed, totals
コード例 #39
0
    def testCancelReboot(self, retries):
        """Tests panel menu power cancel then reboot functionality.

        Args:
          retries: int - number of times a test has been run

        Returns:
          failed: boolean - If true, one test within the module has failed
        """

        totals = {
            'passed': 0,
            'failed': 0,
            'executed': 0,
            'total': 3,
        }
        (starttime, retrydict, failed, pmn,
         testnode) = self.setup('testCancelReboot', retries)

        # Click on the panel menu's power option
        if not failed:
            totals.update(executed=totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                      'Unable to find the power option',
                                      'FAILED - Panel Menu Power Option Test'):
                powerpath = (
                    '%sdiv[attribute::class="panel-menuitem power-panel-menuitem"]'
                    % pmn)
                sellib.element_wait(self.driver.find_element_by_xpath,
                                    powerpath, 'click')
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Located power option for node %s' %
                                  testnode)
                self.logger.info('PASSED - Panel Menu Power Option Test')
                failed = False

        # Validate the 'cancel' functionality
        if not failed:
            totals.update(executed=totals['executed'] + 1)
            failed = True
            with sellib.error_handler(
                    self.driver, self.all_loggers, retrydict,
                    'Cancel then reboot doesn\'t appear to be working',
                    'FAILED - Power Panel Cancel Link Test'):
                sellib.element_wait(
                    self.driver.find_element_by_xpath,
                    '//button[attribute::class="soft_reboot_button"]', 'click')
                sellib.sleeper(self.sleepdict)
                sellib.element_wait(self.driver.find_element_by_xpath,
                                    '//button[attribute::name="cancel"]',
                                    'click')
                sellib.sleeper(self.sleepdict)
                self.logger.debug(
                    'Clicked on reboot then on cancel in the confirmation pop-up'
                )
                try:
                    sellib.element_wait(
                        self.driver.find_element_by_xpath,
                        '//div[attribute::class="ck_widgets_message_default" and '
                        'contains(text(), "Rebooting %s")]' % testnode)
                    temp_failed = True
                    self.logger.error(
                        'Reboot confirm message found, indicating cancel failure'
                    )
                except Exception:
                    self.logger.debug(
                        'After clicking cancel, no reboot confirmation seen')
                    temp_failed = False
                sellib.element_wait(
                    self.driver.find_element_by_xpath,
                    '//button[attribute::class="soft_reboot_button"]', 'click')
                sellib.sleeper(self.sleepdict)
                sellib.element_wait(self.driver.find_element_by_xpath,
                                    '//button[attribute::name="ok"]', 'click')
                sellib.sleeper(self.sleepdict)
                self.logger.debug(
                    'Clicked on reboot again, and on ok (in the confirmation pop-up)'
                )
                self.logger.debug('Cancel button seems to be working %s' %
                                  testnode)
                self.logger.info('PASSED - Power Panel Cancel Link Test')
                if not temp_failed:
                    failed = False

        totals.update(executed=totals['executed'] + 1)
        totals = loglib.logPassFail('testCancelReboot', totals, failed,
                                    starttime, self.logger, retrydict)
        return failed, totals
コード例 #40
0
ファイル: renametest.py プロジェクト: LeonardoRO/qetest
    def testRename(self, retries):

        totals = {'passed': 0, 'failed': 0, 'executed': 0, 'total': 7,}
        (starttime, retrydict, failed) = self.setup('RenameTest', retries,)

        #Call function to go to Load Balancers
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                'Unable to find the Load Balancers button',
                'FAILED - Load Balancers button click'):

                lbaaslib.go_to_lbaas(self.driver)

                sellib.sleeper(self.sleepdict)
                self.logger.debug('Located Load Balancers button')
                self.logger.info('PASSED - Load Balancers button click')
                failed = False

        #Call function to click on a random Load Balancer
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                'Unable to select a random Load Balancer',
                'FAILED - Random Load Balancer selection'):

                lbaaslib.random_load_balancer(self.driver)

                sellib.sleeper(self.sleepdict)
                self.logger.debug('Random Load Balancer Selected')
                self.logger.info('PASSED - Random Load Balancer selection')
                failed = False

        #Rename a Load Balancer (From Detail Page)
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                'Unable to rename a random Load Balancer',
                'FAILED - Random Load Balancer Rename'):

                #Click the name to enable editing
                path = '//div[@id="node_header"]/descendant::div[@class="node_name"]/div/div'
                sellib.element_wait(self.driver.find_element_by_xpath, path, element_action='click')

                #Insert new name
                path = '//div[@id="node_header"]/descendant::div[@class="node_name"]/div/input'
                name = lbaaslib.get_random_name()
                sellib.element_wait(self.driver.find_element_by_xpath, path, element_action='clear')
                sellib.element_wait(self.driver.find_element_by_xpath, path, element_action='send_keys', action_arg=name)

                #Get back to load balancers list and click the renamed load balancer
                lbaaslib.go_to_lbaas(self.driver)
                lbaaslib.click_load_balancer_by_name(self.driver, name)

                sellib.sleeper(self.sleepdict)
                self.logger.debug('Random Load Balancer Renamed')
                self.logger.info('PASSED - Load Balancer Rename')
                failed = False

        totals.update(executed = totals['executed'] + 1)
        totals = loglib.logPassFail('testListView', totals, failed, starttime, self.logger, retrydict)
        return failed, totals
コード例 #41
0
    def testListView(self, retries):

        totals = {'passed': 0, 'failed': 0, 'executed': 0, 'total': 7,}
        (starttime, retrydict, failed) = self.setup('ListViewTest', retries,)

        #Call function to go to Load Balancers
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                'Unable to find the Load Balancers button',
                'FAILED - Load Balancers button click'):

                lbaaslib.go_to_lbaas(self.driver)

                sellib.sleeper(self.sleepdict)
                self.logger.debug('Located Load Balancers button')
                self.logger.info('PASSED - Load Balancers button click')
                failed = False

        # Get the initial load balancers lists
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                'Unable to find or gather the load balancers',
                'FAILED - Gather Load Balancers Test'):

                initial_name_list = self.get_loadbalancer_list() #list of objects

                self.initial_elements_list = [name.text.lower() for name in initial_name_list]

                sellib.sleeper(self.sleepdict)
                self.logger.info('PASSED - Gather Load Balancers Test')
                failed = False

        #Compare list sorted by Name (Ascending)
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                'Failed comparison of sorted names list (ascending)',
                'FAILED - Sort by Name Test (ascending)'):

                ascending_elements = self.get_loadbalancer_list()
                ascending_name_list = [name.text.lower() for name in ascending_elements]

                self.compare_sorting(ascending_name_list, sorted(self.initial_elements_list))

                sellib.sleeper(self.sleepdict)
                self.logger.debug('Names list assorted correctly (ascending)')
                self.logger.info('PASSED - Sort by Name Test (ascending)')
                failed = False

        #Sort by Name (Descending)
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                'Failed to find the name header (descending)',
                'FAILED - Sort by Name Test (descending)'):

                lbaaslib.sort_by_name_desc(self.driver)

                sellib.sleeper(self.sleepdict)
                self.logger.debug('Found the name header (descending)')
                self.logger.info('PASSED - Sort by Name Test (descending)')
                failed = False

        #Compare list sorted by Name (Descending)
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                'Failed comparison of sorted names list (descending)',
                'FAILED - Sort by Name Test (descending)'):

                descending_elements = self.get_loadbalancer_list()
                descending_name_list = [name.text.lower() for name in descending_elements]

                self.compare_sorting(descending_name_list, sorted(self.initial_elements_list, reverse=True))

                sellib.sleeper(self.sleepdict)
                self.logger.debug('Names list assorted correctly (descending)')
                self.logger.info('PASSED - Sort by Name Test (descending)')
                failed = False

        # Get the initial protocol/ports list
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                'Unable to find or gather the protocol/ports',
                'FAILED - Gather Protocol/Port Test'):

                initial_protocolport_list = self.get_protocolports() #list of objects
                self.initial_protocolports_elements_list = [name.text.lower() for name in initial_protocolport_list]

                sellib.sleeper(self.sleepdict)
                self.logger.info('PASSED - Gather Protocol/Port Test')
                failed = False

        #Sort by Protocol/Port (Ascending)
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                'Failed to find the protocol/port header (ascending)',
                'FAILED - Sort by Protocol/Port Test (ascending)'):

                lbaaslib.sort_by_protocol_port_asc(self.driver)

                sellib.sleeper(self.sleepdict)
                self.logger.debug('Found the protocol/port header (ascending)')
                self.logger.info('PASSED - Sort by Protocol/Port Test (ascending)')
                failed = False

        #Compare list sorted by Protocol/Port (Ascending)
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                'Failed comparison of sorted protocol/ports list (ascending)',
                'FAILED - Sort by Protocol/Port Test (ascending)'):

                ascending_protocolport_elements = self.get_protocolports()
                ascending_protocolport_list = [name.text.lower() for name in ascending_protocolport_elements]

                humansorted_list = humansortlib.sort_nicely(self.initial_protocolports_elements_list)
                self.compare_sorting(ascending_protocolport_list, humansorted_list)

                sellib.sleeper(self.sleepdict)
                self.logger.debug('Protocol/Port list assorted correctly (ascending)')
                self.logger.info('PASSED - Sort by Protocol/Port Test (ascending)')
                failed = False

        #Sort by Protocol/Port (Descending)
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                'Failed to find the protocol/port header (descending)',
                'FAILED - Sort by Protocol/Port Test (descending)'):

                lbaaslib.sort_by_protocol_port_desc(self.driver)

                sellib.sleeper(self.sleepdict)
                self.logger.debug('Found the protocol/port header (descending)')
                self.logger.info('PASSED - Sort by Protocol/Port Test (descending)')
                failed = False

        #Compare list sorted by Protocol/Port (Descending)
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                'Failed comparison of sorted protocol/ports list (descending)',
                'FAILED - Sort by Protocol/Port Test (descending)'):

                descending_protocolport_elements = self.get_protocolports()
                descending_protocolport_list = [name.text.lower() for name in descending_protocolport_elements]

                humansorted_list = humansortlib.sort_nicely_reverse(self.initial_protocolports_elements_list)
                self.compare_sorting(descending_protocolport_list, humansorted_list)

                sellib.sleeper(self.sleepdict)
                self.logger.debug('Protocol/Port list assorted correctly (descending)')
                self.logger.info('PASSED - Sort by Protocol/Port Test (descending)')
                failed = False

        #TODO: Sort by Node

        totals.update(executed = totals['executed'] + 1)
        totals = loglib.logPassFail('testListView', totals, failed, starttime, self.logger,
        retrydict)
        return failed, totals
コード例 #42
0
    def testDestroy(self, retries):
        """Test panel menu power destroy functionality.

        NOTE: This is left in here and does not use the oviewlib.delete_node functionality because
        it is being called out as it's own explicit test.

        Args:
          retries: int - number of times a test has been run

        Returns:
          failed: boolean - If true, one test within the module has failed
        """

        totals = {
            'passed': 0,
            'failed': 0,
            'executed': 0,
            'total': 3,
        }
        (starttime, retrydict, failed, pmn,
         testnode) = self.setup('testDestroy', retries)

        # Click on the panel menu's power option
        if not failed:
            totals.update(executed=totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                      'Unable to find the power option',
                                      'FAILED - Panel Menu Power Option Test'):
                powerpath = (
                    '%sdiv[attribute::class="panel-menuitem power-panel-menuitem"]'
                    % pmn)
                sellib.element_wait(self.driver.find_element_by_xpath,
                                    powerpath, 'click')
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Located power option for node %s' %
                                  testnode)
                self.logger.info('PASSED - Panel Menu Power Option Test')
                failed = False

        # Click on the destroy option
        if not failed:
            totals.update(executed=totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                      'Unable to find the destroy button',
                                      'FAILED - Destroy Server Node Test'):
                self.driver.find_element_by_xpath('//button[attribute::class='
                                                  '"destroy_button"]').click()
                sellib.sleeper(self.sleepdict)
                sellib.element_wait(self.driver.find_element_by_xpath,
                                    '//button[attribute::name="ok"]', 'click')
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Clicked the "OK" button for node %s' %
                                  testnode)
                self.logger.info('PASSED - Destroy Server Node Test')
                failed = False

        # NOTE: This doesn't mean that it actually worked, just that Reach
        # tried to destroy the node.  There doesn't currently seem to be a
        # growl-ish confirmation message.

        totals.update(executed=totals['executed'] + 1)
        totals = loglib.logPassFail('testDestroy', totals, failed, starttime,
                                    self.logger, retrydict)
        return failed, totals
コード例 #43
0
    def testProtocolPort(self, retries):

        totals = {
            'passed': 0,
            'failed': 0,
            'executed': 0,
            'total': 7,
        }
        (starttime, retrydict, failed) = self.setup(
            'ProtocolPortTest',
            retries,
        )

        #Call function to go to Load Balancers
        if not failed:
            totals.update(executed=totals['executed'] + 1)
            failed = True
            with sellib.error_handler(
                    self.driver, self.all_loggers, retrydict,
                    'Unable to find the Load Balancers button',
                    'FAILED - Load Balancers button click'):

                lbaaslib.go_to_lbaas(self.driver)

                sellib.sleeper(self.sleepdict)
                self.logger.debug('Located Load Balancers button')
                self.logger.info('PASSED - Load Balancers button click')
                failed = False

        #Call function to click on a random Load Balancer
        if not failed:
            totals.update(executed=totals['executed'] + 1)
            failed = True
            with sellib.error_handler(
                    self.driver, self.all_loggers, retrydict,
                    'Unable to select a random Load Balancer',
                    'FAILED - Random Load Balancer selection'):

                lbaaslib.random_load_balancer(self.driver)

                sellib.sleeper(self.sleepdict)
                self.logger.debug('Random Load Balancer Selected')
                self.logger.info('PASSED - Random Load Balancer selection')
                failed = False

        #Protocol/Port
        if not failed:
            totals.update(executed=totals['executed'] + 1)
            failed = True
            with sellib.error_handler(
                    self.driver, self.all_loggers, retrydict,
                    'Unable to select a random Load Balancer',
                    'FAILED - Random Load Balancer selection'):

                #TODO: add tests on the popup (change protocol/port and save)
                #string
                #special chars
                #script
                #0.5
                #5.5
                #5.5.5
                sellib.element_wait(
                    self.driver.find_element_by_xpath,
                    '//div[@id="node_details"]/descendant::a[@id="protocol_port_toggle"]',
                    element_action='click')

                sellib.sleeper(self.sleepdict)
                self.logger.debug('Random Load Balancer Selected')
                self.logger.info('PASSED - Random Load Balancer selection')
                failed = False

        totals.update(executed=totals['executed'] + 1)
        totals = loglib.logPassFail('testListView', totals, failed, starttime,
                                    self.logger, retrydict)
        return failed, totals
コード例 #44
0
    def testRenaming(self, retries):
        """Test node renaming functionality.

        Args:
          retries: int - number of times a test has been run

        Returns:
          failed: boolean - If true, one test within the module has failed
        """

        totals = {
            'passed': 0,
            'failed': 0,
            'executed': 0,
            'total': 4,
        }
        (starttime, retrydict, failed, pmn,
         testnode) = self.setup('testRenaming', retries)

        # Click on the panel menu's rename option
        if not failed:
            totals.update(executed=totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                      'Unable to find the rename menu item',
                                      'FAILED - Rename Menu Item Test'):
                self.driver.find_element_by_xpath(
                    '%sdiv[attribute::class="panel-menuitem'
                    ' rename-panel-menuitem"]' % pmn).click()
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Located rename option in the panel menu')
                self.logger.info('PASSED - Rename Menu Item Test')
                failed = False

        # Verify existing node name and change the name of the node to something
        # session specific
        if not failed:
            totals.update(executed=totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                      'Unable to rename node %s' % testnode,
                                      'FAILED - Rename Node Test Pt. 1'):
                rand1 = ''.join(
                    random.sample(string.letters + string.digits, 5))
                newnodename = '%s-%s' % (random.choice(self.conf.peeps), rand1)
                current_name = (
                    '%sdiv[attribute::class="input-panel"]/'
                    'descendant::input[attribute::class="input-panel-input'
                    ' label-input"]' % pmn)
                name_change = sellib.element_wait(
                    self.driver.find_element_by_xpath, current_name)
                sellib.sleeper(self.sleepdict)
                sellib.element_wait(name_change, element_action='clear')
                sellib.sleeper(self.sleepdict)
                sellib.element_wait(name_change,
                                    element_action='send_keys',
                                    action_arg=newnodename)
                sellib.sleeper(self.sleepdict)
                sellib.element_wait(name_change,
                                    element_action='send_keys',
                                    action_arg=self.keys.RETURN)
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Successfully renamed node %s to %s' %
                                  (testnode, newnodename))
                self.logger.info('PASSED - Rename Node Test Pt. 1')
                failed = False

        # Verify the new node name and change the node name back to it's
        # starting name
        if not failed:
            totals.update(executed=totals['executed'] + 1)
            failed = True
            with sellib.error_handler(
                    self.driver, self.all_loggers, retrydict,
                    'Unable to change node name back to %s' % testnode,
                    'FAILED - Rename Node Test Pt. 2'):
                current_name = (
                    '%sdiv[attribute::class="input-panel"]/'
                    'descendant::input[attribute::class="input-panel-input'
                    ' label-input"]' % pmn)
                change_back = sellib.element_wait(
                    self.driver.find_element_by_xpath, current_name)
                sellib.sleeper(self.sleepdict)
                sellib.element_wait(change_back, element_action='clear')
                sellib.sleeper(self.sleepdict)
                sellib.element_wait(change_back,
                                    element_action='send_keys',
                                    action_arg=testnode)
                sellib.sleeper(self.sleepdict)
                sellib.element_wait(change_back,
                                    element_action='send_keys',
                                    action_arg=self.keys.RETURN)
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Successfully renamed node %s back to %s' %
                                  (newnodename, testnode))
                self.logger.info('PASSED - Rename Node Test Pt. 2')
                failed = False

        totals.update(executed=totals['executed'] + 1)
        totals = loglib.logPassFail('testRenaming', totals, failed, starttime,
                                    self.logger, retrydict)

        return failed, totals
コード例 #45
0
    def testPanelMenuColors(self, retries):
        """Tests for changing individual node's background color.

        Args:
          retries: int - number of times a test has been run

        Returns:
          failed: boolean - If true, one test within the module has failed
        """

        totals = {
            'passed': 0,
            'failed': 0,
            'executed': 0,
            'total': 5,
        }
        (starttime, retrydict, failed, pmn,
         testnode) = self.setup('testPanelMenuColors', retries)

        colors = oviewlib.panel_colors()
        total_colors = len(colors)

        # Click on the panel menu's color option
        if not failed:
            totals.update(executed=totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                      'Unable to find the color panel',
                                      'FAILED - Panel Menu Color Option Test'):
                colorpanelpath = ('%sdiv[attribute::class="panel-menuitem '
                                  'color-panel-menuitem"]' % pmn)
                sellib.element_wait(self.driver.find_element_by_xpath,
                                    colorpanelpath, 'click')
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Located color panel for node %s' % testnode)
                self.logger.info('PASSED - Panel Menu Color Option Test')
                failed = False

        # Click on a few random colors then set it back to white
        if not failed:
            totals.update(executed=totals['executed'] + 1)
            failed = True
            rand1 = random.randint(0, total_colors - 2)
            rand2 = rand1
            while rand2 == rand1:
                rand2 = random.randint(0, total_colors - 2)
            random_colors = (colors[rand1], colors[rand2],
                             colors[total_colors - 1])
            with sellib.error_handler(
                    self.driver, self.all_loggers, retrydict,
                    'Failed to randomly set some colors',
                    'FAILED - Panel Menu Color Selection Test'):
                for kolor in random_colors:
                    colorpath = ('%sdiv[attribute::title="RGB %s"]' %
                                 (pmn, kolor))
                    sellib.element_wait(self.driver.find_element_by_xpath,
                                        colorpath, 'click')
                    sellib.sleeper(self.sleepdict)
                self.logger.debug('Random color change succeeded')
                self.logger.info('PASSED - Panel Menu Color Selection Test')
                failed = False

        # Test the 'custom colors' input box and close the panel menu
        if not failed:
            totals.update(executed=totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                      'Unable to set a custom color',
                                      'FAILED - Node Custom Color Test'):
                colorpath = ('%sinput[attribute::class="label-input-label"]' %
                             pmn)
                oviewlib.custom_colors(self.driver, self.logger, colorpath,
                                       self.sleepdict)
                self.logger.info('PASSED - Node Custom Color Test')
                failed = False

        # Close the panel menu
        if not failed:
            totals.update(executed=totals['executed'] + 1)
            failed = oviewlib.close_panel_menu(self.driver, self.all_loggers,
                                               retrydict, self.sleepdict, pmn)

        totals.update(executed=totals['executed'] + 1)
        totals = loglib.logPassFail('testPanelMenuColors', totals, failed,
                                    starttime, self.logger, retrydict)
        return failed, totals
コード例 #46
0
ファイル: batchtest.py プロジェクト: LeonardoRO/qetest
    def testBatchTags(self, retries):
        """Tests batch changes to tags (labels) for all test set nodes.

        Args:
          retries: int - number of times a test has been run

        Returns:
          failed: boolean - If true, one test within the module has failed
        """

        totals = {'passed': 0, 'failed': 0, 'executed': 0, 'total': 8,}
        (starttime, retrydict, failed) = self.setup('testBatchTags', retries,)

        # Select all the nodes
        if not failed:
            (failed, totals) = self.all_nodes(retrydict, totals)

        # Click on the batch panel sprocket to bring up the 'tag' or 'color' option
        if not failed:
            (failed, totals) = self.batch_sprocket(retrydict, totals)

        # Click on the 'tag' option to bring up the tag panel
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                        'Failed to find the tag panel menu',
                                        'FAILED - Tag Panel Menu Test'):
                tagpath = ('%sdiv[attribute::class="panel-menuitem tag-panel-menuitem"]'
                           % BATCH_PANEL)
                sellib.element_wait(self.driver.find_element_by_xpath, tagpath, 'click')
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Found the tag panel menu')
                self.logger.info('PASSED - Tag Panel Menu Test')
                failed = False

        # Create a new tag (session specific) and assign to all nodes
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            rand1 = ''.join(random.sample(string.letters + string.digits, 5))
            newtag = '%s-%s' % (random.choice(self.conf.peeps), rand1)
            newtagpath = ('%sdiv[contains(text(), "Search for or create a tag")]/'
                          'following-sibling::input' % BATCH_PANEL)
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                        'Failed to create tag "%s" for all nodes' % newtag,
                                        'FAILED - Custom Tag Creation Test'):
                sellib.element_wait(self.driver.find_element_by_xpath, newtagpath, 'send_keys',
                                    newtag)
                sellib.sleeper(self.sleepdict)
                createpath = ('%sdiv[attribute::class="ck_widgets_action_button" and '
                             'contains(text(), "(create new)")]' % BATCH_PANEL)
                sellib.element_wait(self.driver.find_element_by_xpath, createpath, 'click')
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Created tag "%s" for all the nodes' % newtag)
                self.logger.info('PASSED - Custom Tag Creation Test')
                failed = False

        # Remove the custom tag from all nodes
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                        'Failed to remove tag "%s" from the nodes'
                                        % newtag,
                                        'FAILED - Custom Tag Removal Test'):
                custtagpath = ('%sdiv[attribute::class="goog-inline-block ck_widgets_closable'
                               '_label" and contains(text(), "%s")]' % (BATCH_PANEL, newtag))
                sellib.element_wait(self.driver.find_element_by_xpath, custtagpath, 'click')
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Removed tag "%s" from all nodes' % newtag)
                self.logger.info('PASSED - Custom Tag Removal Test')
                failed = False

        # Re-add then re-remove the custom tag for all nodes.  Use the tag above
        # the text box to remove the tag as a test to confirm that it was added
        # back.

        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                        'Failed to re-add/remove tag "%s"' % newtag,
                                        'FAILED - RE Add/Remove Tag Test'):
                addpath = ('%sdiv[attribute::class="ck_widgets_action_menuitem-content"'
                           ' and contains(text(), "%s")]' % (BATCH_PANEL, newtag))
                sellib.element_wait(self.driver.find_element_by_xpath, addpath, 'click')
                sellib.sleeper(self.sleepdict)
                sellib.element_wait(self.driver.find_element_by_xpath,
                                    '%sdiv[attribute::role="button" and contains(text(), "%s")]'
                                    % (BATCH_PANEL, newtag),
                                    'click')
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Re-added then re-removed tag "%s" to all nodes' % newtag)
                self.logger.info('PASSED - RE Add/Remove Tag Test')
                failed = False

        # Completely delete the custom tag
        # TODO (dborin): Figure out how to verify that the custom tag was removed

        # NOTE: This uses the addpath value from the previous section
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                        'Unable to delete custom tag "%s"' % newtag,
                                        'FAILED - Custom Tag Deletion Test'):
                delpath = ('%s/following-sibling::div[attribute::class="ck_widgets_'
                           'action_button"]' % addpath)
                sellib.element_wait(self.driver.find_element_by_xpath, delpath, 'click')
                sellib.sleeper(self.sleepdict)
                sellib.element_wait(self.driver.find_element_by_xpath,
                                    '//button[attribute::name="ok"]',
                                    'click')
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Custom tag "%s" deleted' % newtag)
                self.logger.info('PASSED - Custom Tag Deletion Test')
                failed = False

        totals.update(executed = totals['executed'] + 1)
        totals = loglib.logPassFail('testBatchTags', totals, failed, starttime, self.logger,
                                    retrydict)

        return failed, totals
コード例 #47
0
    def testResetPassword(self, retries):
        """Tests for panel menu password reset feature.

        Args:
          retries: int - number of times a test has been run

        Returns:
          failed: boolean - If true, one test within the module has failed
        """
        totals = {'passed': 0, 'failed': 0, 'executed': 0, 'total': 5,}
        (starttime, retrydict, failed, pmn, testnode) = self.setup('testResetPassword', retries)

        # Click on the panel menu's reset password option
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                        'Unable to find the reset password link',
                                        'FAILED - Panel Menu Reset Password Option Test'):
                resetpath = ('%sdiv[attribute::class="panel-menuitem password-panel-'
                             'menuitem"]' % pmn)
                sellib.element_wait(self.driver.find_element_by_xpath, resetpath, 'click')
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Located reset password option for node %s' % testnode)
                self.logger.info('PASSED - Panel Menu Reset Password Option Test')
                failed = False

        # Click on the 'Reset root password' button
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                        'Unable to find the \'Reset root password\' button',
                                        'FAILED - Reset Password Button Test'):
                sellib.element_wait(self.driver.find_element_by_xpath,
                                    '//button[attribute::class="reset_root_button"]',
                                    'click')
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Found and clicked on the \'Reset root password\' button')
                self.logger.info('PASSED - Reset Password Button Test')
                failed = False

        # Click on the 'Show password' button
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                        'Show password is working incorrectly or not clickable',
                                        'FAILED - Show Password Button Test'):
                # Is it hidden?
                sellib.element_wait(self.driver.find_element_by_xpath,
                                     '//input[@class="display_password" and @type="password"]')
                # Click on the button to show it
                sellib.element_wait(self.driver.find_element_by_xpath,
                                    '//button[@class="show_password"]', 'click')
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Show password is working correctly and is clickable')
                self.logger.info('PASSED - Show Password Button Test')
                failed = False

        # Click on the 'Hide password' button
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                        'Hide password is working incorrectly or not clickable',
                                        'FAILED - Hide Password Button Test'):
                # Is is displayed?
                sellib.element_wait(self.driver.find_element_by_xpath,
                                    '//input[@class="display_password" and @type="input"]')
                # Click on the button to hide it
                sellib.element_wait(self.driver.find_element_by_xpath,
                                    '//button[@class="hide_password"]', 'click')
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Hide password is working correctly and is clickable')
                self.logger.info('PASSED - Hide Password Button Test')
                failed = False

        totals.update(executed = totals['executed'] + 1)
        totals = loglib.logPassFail('testResetPassword', totals, failed, starttime, self.logger,
                                    retrydict)
        return failed, totals
コード例 #48
0
    def testRename(self, retries):

        totals = {
            'passed': 0,
            'failed': 0,
            'executed': 0,
            'total': 7,
        }
        (starttime, retrydict, failed) = self.setup(
            'RenameTest',
            retries,
        )

        #Call function to go to Load Balancers
        if not failed:
            totals.update(executed=totals['executed'] + 1)
            failed = True
            with sellib.error_handler(
                    self.driver, self.all_loggers, retrydict,
                    'Unable to find the Load Balancers button',
                    'FAILED - Load Balancers button click'):

                lbaaslib.go_to_lbaas(self.driver)

                sellib.sleeper(self.sleepdict)
                self.logger.debug('Located Load Balancers button')
                self.logger.info('PASSED - Load Balancers button click')
                failed = False

        #Call function to click on a random Load Balancer
        if not failed:
            totals.update(executed=totals['executed'] + 1)
            failed = True
            with sellib.error_handler(
                    self.driver, self.all_loggers, retrydict,
                    'Unable to select a random Load Balancer',
                    'FAILED - Random Load Balancer selection'):

                lbaaslib.random_load_balancer(self.driver)

                sellib.sleeper(self.sleepdict)
                self.logger.debug('Random Load Balancer Selected')
                self.logger.info('PASSED - Random Load Balancer selection')
                failed = False

        #Rename a Load Balancer (From Detail Page)
        if not failed:
            totals.update(executed=totals['executed'] + 1)
            failed = True
            with sellib.error_handler(
                    self.driver, self.all_loggers, retrydict,
                    'Unable to rename a random Load Balancer',
                    'FAILED - Random Load Balancer Rename'):

                #Click the name to enable editing
                path = '//div[@id="node_header"]/descendant::div[@class="node_name"]/div/div'
                sellib.element_wait(self.driver.find_element_by_xpath,
                                    path,
                                    element_action='click')

                #Insert new name
                path = '//div[@id="node_header"]/descendant::div[@class="node_name"]/div/input'
                name = lbaaslib.get_random_name()
                sellib.element_wait(self.driver.find_element_by_xpath,
                                    path,
                                    element_action='clear')
                sellib.element_wait(self.driver.find_element_by_xpath,
                                    path,
                                    element_action='send_keys',
                                    action_arg=name)

                #Get back to load balancers list and click the renamed load balancer
                lbaaslib.go_to_lbaas(self.driver)
                lbaaslib.click_load_balancer_by_name(self.driver, name)

                sellib.sleeper(self.sleepdict)
                self.logger.debug('Random Load Balancer Renamed')
                self.logger.info('PASSED - Load Balancer Rename')
                failed = False

        totals.update(executed=totals['executed'] + 1)
        totals = loglib.logPassFail('testListView', totals, failed, starttime,
                                    self.logger, retrydict)
        return failed, totals
コード例 #49
0
ファイル: addservertest.py プロジェクト: LeonardoRO/qetest
    def testAddServer(self, retries):
        
        totals = {'passed': 0, 'failed': 0, 'executed': 0, 'total': 7,}
        (starttime, retrydict, failed) = self.setup('testAddServer', retries,)

        # Click on the top Add Server button
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                        'Failed to find the top "Add Server" button',
                                        'FAILED - Add Server Top Button Test'):
                oviewlib.add_server_button_top(self.driver) 
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Found the top "Add Server" button')
                self.logger.info('PASSED - Add Server Top Button Test')
                failed = False

        # Input a server name
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                        'Failed to add the server name',
                                        'FAILED - Add Server Name Test'):
                server_name = oviewlib.add_server_name(self.driver) 
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Added the server name "%s"' % server_name)
                self.logger.info('PASSED - Add Server Name Test')
                failed = False

        # Randomly pick an OS
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                        'Unable to grab the list of OS flavors and select one',
                                        'FAILED - Add Server OS Test'):
                os_flavor = oviewlib.add_server_os(self.driver) 
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Randomly selected "%s" for the server' % os_flavor)
                self.logger.info('PASSED - Add Server OS Test')
                failed = False

        # Randomly choose a size
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                        'Unable to grab the list of server sizes and select one,',
                                        'FAILED - Add Server Size Test'):
                server_size = oviewlib.add_server_size(self.driver) 
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Randomly selected "%s" as the server size' % server_size)
                self.logger.info('PASSED - Add Server Size Test')
                failed = False

        # Click on the bottom Add Server to submit it
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                        'Failed to find the bottom "Add Server" button',
                                        'FAILED - Add Server Submit Test'):
                oviewlib.add_server_button_bottom(self.driver) 
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Found the bottom "Add Server" button')
                self.logger.info('PASSED - Add Server Submit Test')
                failed = False

        # Look for a "server being created" growl notification
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                        'Didn\'t see a server creation confirmation',
                                        'FAILED - Add Server Confirmation Test'):
                path = ('//div[@class="ck_widgets_message_default" and contains(text(), '
                        '"Server %s is being created")]' % server_name)
                sellib.element_wait(self.driver.find_element_by_xpath, path)
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Found a growl "create" confirmation message')
                self.logger.info('PASSED - Add Server Confirmation Test')
                failed = False

        # Do a check for servers created from previous tests and delete them
        # TODO: Need to move this out from here, into it's own module and have
        #       the test manager call it.
#        with sellib.error_handler(self.driver, self.all_loggers, retrydict,
#                                        'There was an issue removing previous, session specific '
#                                        'nodes'):
#            oviewlib.overview_reset(self.driver, self.all_loggers, retrydict, self.sleepdict)
#            nodeid_list = oviewlib.get_nodeid_list(self.driver)
#            server_name_list = oviewlib.get_server_name_list()
#            for item in nodeid_list:
#                nodename = oviewlib.get_nodename(self.driver, item)
#                for server_name in server_name_list:
#                    if server_name == nodename[:len(server_name)]:
#                        self.driver.refresh()
#                        time.sleep(10)
#                        oviewlib.delete_node(self.driver, item, self.sleepdict)
#                        sellib.sleeper(self.sleepdict)
#                        self.logger.debug('Server "%s" deleted' % nodename)

        totals.update(executed = totals['executed'] + 1)
        totals = loglib.logPassFail('testAddServer', totals, failed, starttime, self.logger,
                                    retrydict)
        return failed, totals
コード例 #50
0
    def testDiskSorting(self, retries):
        """Test the sorting for Disk in the resize flavor table.

        Args:
          retries: int - number of times a test has been run

        Returns:
          failed: boolean - If true, one test within the module has failed
        """

        totals = {
            'passed': 0,
            'failed': 0,
            'executed': 0,
            'total': 5,
        }
        (starttime, retrydict, failed, pmn,
         testnode) = self.setup('testDiskSorting', retries)
        totals.update(executed=totals['executed'] + 1)

        # Get the flavors of Disk
        if not failed:
            totals.update(executed=totals['executed'] + 1)
            failed = True
            with sellib.error_handler(
                    self.driver, self.all_loggers, retrydict,
                    'Unable to find or gather the resize Disk flavors',
                    'FAILED - Disk Flavor Data Test'):
                self.click_resize_option(pmn, testnode)
                flavoritems1 = self.get_flavors(1)
                sellib.sleeper(self.sleepdict)
                self.logger.debug(
                    'Disk flavor data located and gathered for node %s' %
                    testnode)
                self.logger.info('PASSED - Disk Flavor Data Test')
                failed = False

        # Test Disk default list sorting
        if not failed:
            totals.update(executed=totals['executed'] + 1)
            failed = True
            with sellib.error_handler(
                    self.driver, self.all_loggers, retrydict,
                    'Default Disk column sorted incorrectly',
                    'FAILED - Resize: Default Disk Sort Test'):
                def_disk_list = []
                for def_disk_element in flavoritems1:
                    def_disk_list.append(
                        int(self.sortable_int(def_disk_element.text)))
                sorted_disk_list = sorted(def_disk_list)
                self.compare_sorting(def_disk_list, sorted_disk_list)
                self.logger.debug(
                    'Default Disk column sorted correctly for node %s' %
                    testnode)
                self.logger.info('PASSED - Resize: Default Disk Sort Test')
                failed = False

        # Test sorting after reversing the list
        if not failed:
            totals.update(executed=totals['executed'] + 1)
            failed = True
            with sellib.error_handler(
                    self.driver, self.all_loggers, retrydict,
                    'Reversed Disk column sorted incorrectly',
                    'FAILED - Resize: Reversed Disk Sort Test'):
                rev_sorted_disk_list = sorted(sorted_disk_list, reverse=True)
                # Click once to select the header, then a second time to reverse it
                sellib.element_wait(self.driver.find_element_by_xpath,
                                    '//div[contains(text(), "Disk")]', 'click')
                sellib.element_wait(self.driver.find_element_by_xpath,
                                    '//div[contains(text(), "Disk")]', 'click')
                self.logger.debug(
                    'Clicked on Disk column header to put flavor table in reverse '
                    'Disk sort order')
                rev_flavoritems1 = self.get_flavors(1)
                sellib.sleeper(self.sleepdict)

                rev_disk_list = []
                for rev_element in rev_flavoritems1:
                    rev_disk_list.append(
                        int(self.sortable_int(rev_element.text)))
                self.compare_sorting(rev_disk_list, rev_sorted_disk_list)
                self.logger.debug(
                    'Reversed Disk column sorted correctly for node %s' %
                    testnode)
                self.logger.info('PASSED - Resize: Reversed Disk Sort Test')
                failed = False

        # Test sorting after reseting the list back to default
        if not failed:
            totals.update(executed=totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                      'Reset Disk column sorted incorrectly',
                                      'FAILED - Resize: Reset Disk Sort Test'):

                sellib.element_wait(self.driver.find_element_by_xpath,
                                    '//div[contains(text(), "Disk")]', 'click')
                sellib.sleeper(self.sleepdict)
                self.logger.debug(
                    'Clicked on Disk column header to put flavor table back to '
                    'default Disk sort order')
                ret_flavoritems1 = self.get_flavors(1)
                ret_disk_list = []
                for ret_element in ret_flavoritems1:
                    ret_disk_list.append(
                        int(self.sortable_int(ret_element.text)))

                self.compare_sorting(ret_disk_list, def_disk_list)
                self.logger.debug(
                    'Reset Disk column sorting correctly for node %s' %
                    testnode)
                self.logger.info('PASSED - Resize: Reset Disk Sort Test')
                failed = False

        totals = loglib.logPassFail('testDiskSorting', totals, failed,
                                    starttime, self.logger, retrydict)

        return failed, totals
コード例 #51
0
    def testRebuild(self, retries):
        """Tests for panel menu rebuild feature.

        Args:
          retries: int - number of times a test has been run

        Returns:
          failed: boolean - If true, one test within the module has failed
        """

        totals = {
            'passed': 0,
            'failed': 0,
            'executed': 0,
            'total': 5,
        }
        (starttime, retrydict, failed, pmn,
         testnode) = self.setup('testRebuild', retries)

        # Click on the panel menu's rebuild option
        if not failed:
            totals.update(executed=totals['executed'] + 1)
            failed = True
            with sellib.error_handler(
                    self.driver, self.all_loggers, retrydict,
                    'Unable to find the rebuild link',
                    'FAILED - Panel Menu Rebuild Option Test'):
                rebuildpath = (
                    '%sdiv[attribute::class="panel-menuitem rebuild-panel-'
                    'menuitem"]' % pmn)
                sellib.element_wait(self.driver.find_element_by_xpath,
                                    rebuildpath, 'click')
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Located rebuild option for node %s' %
                                  testnode)
                self.logger.info('PASSED - Panel Menu Rebuild Option Test')
                failed = False

        # Randomly pick an OS flavor
        if not failed:
            totals.update(executed=totals['executed'] + 1)
            failed = True
            with sellib.error_handler(
                    self.driver, self.all_loggers, retrydict,
                    'Unable to grab the list of OS flavors and select one',
                    'FAILED - Rebuild Server OS Test'):
                os_flavor = oviewlib.add_server_os(self.driver)
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Randomly selected "%s" for the server' %
                                  os_flavor)
                self.logger.info('PASSED - Rebuild Server OS Test')
                failed = False

        # Submit the change by clicking on 'Rebuild Server' button
        if not failed:
            totals.update(executed=totals['executed'] + 1)
            failed = True
            with sellib.error_handler(
                    self.driver, self.all_loggers, retrydict,
                    'Unable to click on the Rebuild Server submit button',
                    'FAILED - Rebuild Server Submit Test'):
                sellib.element_wait(self.driver.find_element_by_xpath,
                                    '//button[@class="rebuild_button"]',
                                    'click')
                sellib.sleeper(self.sleepdict)
                self.logger.debug(
                    'Clicked on the Rebuild Server button to submit')
                self.logger.info('PASSED - Rebuild Server Submit Test')
                failed = False

        # Click on the OK in the pop-up confirmation dialog
        if not failed:
            totals.update(executed=totals['executed'] + 1)
            failed = True
            with sellib.error_handler(
                    self.driver, self.all_loggers, retrydict,
                    'Unable to click on the OK button in the confirmation box',
                    'FAILED - Rebuild Server Submit Test'):
                sellib.element_wait(self.driver.find_element_by_xpath,
                                    '//button[@name="ok"]', 'click')
                sellib.sleeper(self.sleepdict)
                self.logger.debug(
                    'Clicked on the OK button in the confirmation box')
                self.logger.info('PASSED - Rebuild Server Submit Test')
                failed = False

        totals.update(executed=totals['executed'] + 1)
        totals = loglib.logPassFail('testRebuild', totals, failed, starttime,
                                    self.logger, retrydict)

        return failed, totals
コード例 #52
0
    def testResize(self, retries):
        """Test the basic panel menu resize functionality.

        Args:
          retries: int - number of times a test has been run

        Returns:
          failed: boolean - If true, one test within the module has failed
        """

        totals = {
            'passed': 0,
            'failed': 0,
            'executed': 0,
            'total': 4,
        }
        (starttime, retrydict, failed, pmn,
         testnode) = self.setup('testResize', retries)
        totals.update(executed=totals['executed'] + 1)

        # Click on the resize option
        if not failed:
            totals.update(executed=totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                      'Unable to find the resize option',
                                      'FAILED - Resize Option Test'):
                self.click_resize_option(pmn, testnode)
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Found the resize option')
                self.logger.info('PASSED - Resize Option Test')
                failed = False

        # Select the first flavor in the flavor table list
        if not failed:
            totals.update(executed=totals['executed'] + 1)
            failed = True
            with sellib.error_handler(
                    self.driver, self.all_loggers, retrydict,
                    'Unable to find or click on the first flavor in the table',
                    'FAILED - Resize Flavor Selection Test'):

                sellib.element_wait(self.driver.find_element_by_xpath,
                                    '//div[@class="radio-menuitem-checkbox"]',
                                    'click')
                sellib.sleeper(self.sleepdict)
                self.logger.debug(
                    'Clicked on the first choice in the flavor table')
                self.logger.info('PASSED - Resize Flavor Selection Test')
                failed = False

        # Click the resize server button and then OK the change
        if not failed:
            totals.update(executed=totals['executed'] + 1)
            failed = True
            with sellib.error_handler(
                    self.driver, self.all_loggers, retrydict,
                    'Unable to find or click on the first flavor in the table',
                    'FAILED - Resize Node Test'):
                resize_button_path = (
                    '//button[@class="resize-button goog-button" '
                    'and contains(text(), "Resize Server")]')
                sellib.element_wait(self.driver.find_element_by_xpath,
                                    resize_button_path, 'click')
                sellib.sleeper(self.sleepdict)
                sellib.element_wait(self.driver.find_element_by_xpath,
                                    '//button[@name="ok"]', 'click')
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Successfully able to resize node')
                self.logger.info('PASSED - Resize Node Test')
                failed = False

        totals = loglib.logPassFail('testResize', totals, failed, starttime,
                                    self.logger, retrydict)

        return failed, totals
コード例 #53
0
ファイル: colortest.py プロジェクト: LeonardoRO/qetest
    def testPanelMenuColors(self, retries):
        """Tests for changing individual node's background color.

        Args:
          retries: int - number of times a test has been run

        Returns:
          failed: boolean - If true, one test within the module has failed
        """

        totals = {'passed': 0, 'failed': 0, 'executed': 0, 'total': 5,}
        (starttime, retrydict, failed, pmn, testnode) = self.setup('testPanelMenuColors', retries)

        colors = oviewlib.panel_colors()
        total_colors = len(colors)

        # Click on the panel menu's color option
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                        'Unable to find the color panel',
                                        'FAILED - Panel Menu Color Option Test'):
                colorpanelpath = ('%sdiv[attribute::class="panel-menuitem '
                                  'color-panel-menuitem"]' % pmn)
                sellib.element_wait(self.driver.find_element_by_xpath, colorpanelpath, 'click')
                sellib.sleeper(self.sleepdict)
                self.logger.debug('Located color panel for node %s' % testnode)
                self.logger.info('PASSED - Panel Menu Color Option Test')
                failed = False

        # Click on a few random colors then set it back to white
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            rand1 = random.randint(0, total_colors - 2)
            rand2 = rand1
            while rand2 == rand1:
                rand2 = random.randint(0, total_colors - 2)
            random_colors = (colors[rand1], colors[rand2], colors[total_colors - 1])
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                        'Failed to randomly set some colors',
                                        'FAILED - Panel Menu Color Selection Test'):
                for kolor in random_colors:
                    colorpath = ('%sdiv[attribute::title="RGB %s"]' % (pmn, kolor))
                    sellib.element_wait(self.driver.find_element_by_xpath, colorpath, 'click')
                    sellib.sleeper(self.sleepdict)
                self.logger.debug('Random color change succeeded')
                self.logger.info('PASSED - Panel Menu Color Selection Test')
                failed = False

        # Test the 'custom colors' input box and close the panel menu
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                        'Unable to set a custom color',
                                        'FAILED - Node Custom Color Test'):
                colorpath = ('%sinput[attribute::class="label-input-label"]' % pmn)
                oviewlib.custom_colors(self.driver, self.logger, colorpath, self.sleepdict)
                self.logger.info('PASSED - Node Custom Color Test')
                failed = False

        # Close the panel menu
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = oviewlib.close_panel_menu(self.driver, self.all_loggers, retrydict,
                                               self.sleepdict, pmn)

        totals.update(executed = totals['executed'] + 1)
        totals = loglib.logPassFail('testPanelMenuColors', totals, failed, starttime, self.logger,
                                    retrydict)
        return failed, totals
コード例 #54
0
ファイル: protocolporttest.py プロジェクト: LeonardoRO/qetest
    def testProtocolPort(self, retries):

        totals = {'passed': 0, 'failed': 0, 'executed': 0, 'total': 7,}
        (starttime, retrydict, failed) = self.setup('ProtocolPortTest', retries,)

        #Call function to go to Load Balancers
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                'Unable to find the Load Balancers button',
                'FAILED - Load Balancers button click'):

                lbaaslib.go_to_lbaas(self.driver)

                sellib.sleeper(self.sleepdict)
                self.logger.debug('Located Load Balancers button')
                self.logger.info('PASSED - Load Balancers button click')
                failed = False

        #Call function to click on a random Load Balancer
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                'Unable to select a random Load Balancer',
                'FAILED - Random Load Balancer selection'):

                lbaaslib.random_load_balancer(self.driver)

                sellib.sleeper(self.sleepdict)
                self.logger.debug('Random Load Balancer Selected')
                self.logger.info('PASSED - Random Load Balancer selection')
                failed = False

        #Protocol/Port
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                'Unable to select a random Load Balancer',
                'FAILED - Random Load Balancer selection'):

                #TODO: add tests on the popup (change protocol/port and save)
                #string
                #special chars
                #script
                #0.5
                #5.5
                #5.5.5
                sellib.element_wait(self.driver.find_element_by_xpath,
                    '//div[@id="node_details"]/descendant::a[@id="protocol_port_toggle"]', element_action='click')

                sellib.sleeper(self.sleepdict)
                self.logger.debug('Random Load Balancer Selected')
                self.logger.info('PASSED - Random Load Balancer selection')
                failed = False

        totals.update(executed = totals['executed'] + 1)
        totals = loglib.logPassFail('testListView', totals, failed, starttime, self.logger, retrydict)
        return failed, totals
コード例 #55
0
ファイル: batchtest.py プロジェクト: LeonardoRO/qetest
    def testBatchColors(self, retries):
        """Tests batch color changes for all test set nodes.

        Args:
          retries: int - number of times a test has been run

        Returns:
          failed: boolean - If true, one test within the module has failed
        """


        totals = {'passed': 0, 'failed': 0, 'executed': 0, 'total': 7,}
        (starttime, retrydict, failed) = self.setup('testBatchColors', retries,)

        colors = oviewlib.panel_colors()
        total_colors = len(colors)

        # Select all the nodes
        if not failed:
            (failed, totals) = self.all_nodes(retrydict, totals)

        # Click on the batch panel sprocket to bring up the 'tag' or 'color' option
        if not failed:
            (failed, totals) = self.batch_sprocket(retrydict, totals)
            

        # Click on the 'color' option to bring up the color panel
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                        'Unable to find the color panel menu',
                                        'FAILED - Batch Color Menu Test'):
                color_opt_path = ('%sdiv[attribute::class="panel-menuitem color-panel-menuitem"]'
                                  % BATCH_PANEL)
                sellib.element_wait(self.driver.find_element_by_xpath, color_opt_path, 'click')
                self.logger.info('Found color panel menu')
                self.logger.info('PASSED - Batch Color Menu Test')
                sellib.sleeper(self.sleepdict)
                failed = False

        # Cycle through some random colors
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            rand1 = random.randint(0, total_colors - 2)
            rand2 = rand1
            while rand2 == rand1:
                rand2 = random.randint(0, total_colors - 2)
            random_colors = (colors[rand1], colors[rand2], colors[total_colors - 1])
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                        'Unable to cycle through some random colors',
                                        'FAILED - Batch Color Change Test'):
                for kolor in random_colors:
                    colorpath = '//div[attribute::title="RGB %s"]' % kolor
                    sellib.element_wait(self.driver.find_element_by_xpath, colorpath, 'click')
                    sellib.sleeper(self.sleepdict)
                self.logger.debug('Random color selection succeeded')
                self.logger.info('PASSED - Batch Color Change Test')
                failed = False

        # Test the 'custom colors' input text box and close the batch panel menu
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = True
            with sellib.error_handler(self.driver, self.all_loggers, retrydict,
                                        'Unable to set a custom color',
                                        'FAILED - Batch Custom Color Test'):
                custompath = ('%sinput[attribute::class="label-input-label"]' % BATCH_PANEL)
                oviewlib.custom_colors(self.driver, self.logger, custompath, self.sleepdict)
                sellib.sleeper(self.sleepdict)
                self.logger.info('PASSED - Batch Custom Color Test')
                failed = False

        # Close the panel menu
        if not failed:
            totals.update(executed = totals['executed'] + 1)
            failed = oviewlib.close_panel_menu(self.driver, self.all_loggers, retrydict,
                                               self.sleepdict, BATCH_PANEL)

        totals.update(executed = totals['executed'] + 1)
        totals = loglib.logPassFail('testBatchColors', totals, failed, starttime, self.logger,
                                    retrydict)
        return failed, totals