Beispiel #1
0
    def test_search_group(self):
        with session.begin():
            group = data_setup.create_group()
            whiteboard = data_setup.unique_name(u'whiteboard%s')
            job = data_setup.create_job(group=group, whiteboard=whiteboard)
            job2 = data_setup.create_job(whiteboard=whiteboard)

        b = self.browser
        # Ensures that both jobs are present
        b.get(get_server_base() + 'jobs')
        b.find_element_by_link_text('Show Search Options').click()
        wait_for_animation(b, '#searchform')
        b.find_element_by_xpath("//select[@id='jobsearch_0_table'] \
            /option[@value='Whiteboard']").click()
        b.find_element_by_xpath("//select[@id='jobsearch_0_operation'] \
            /option[@value='is']").click()
        b.find_element_by_xpath("//input[@id='jobsearch_0_value']"). \
            send_keys(whiteboard)
        b.find_element_by_id('searchform').submit()
        check_job_search_results(b, present=[job, job2])

        # Now do the actual test
        b.find_element_by_xpath("//select[@id='jobsearch_0_table'] \
            /option[@value='Group']").click()
        b.find_element_by_xpath("//select[@id='jobsearch_0_operation'] \
            /option[@value='is']").click()
        b.find_element_by_xpath("//input[@id='jobsearch_0_value']").clear()
        b.find_element_by_xpath("//input[@id='jobsearch_0_value']"). \
            send_keys(job.group.group_name)
        b.find_element_by_id('searchform').submit()
        check_job_search_results(b, present=[job], absent=[job2])
Beispiel #2
0
 def test_pool_column(self):
     with session.begin():
         pool = data_setup.create_system_pool()
         system_in_pool = data_setup.create_system()
         system_in_pool.pools.append(pool)
         system_outside_pool = data_setup.create_system()
     b = self.browser
     b.get(get_server_base())
     b.find_element_by_link_text('Show Search Options').click()
     wait_for_animation(b, '#searchform')
     Select(b.find_element_by_name('systemsearch-0.table'))\
         .select_by_visible_text('System/Pools')
     Select(b.find_element_by_name('systemsearch-0.operation'))\
         .select_by_visible_text('is')
     b.find_element_by_name('systemsearch-0.value').send_keys(pool.name)
     b.find_element_by_link_text('Toggle Result Columns').click()
     wait_for_animation(b, '#selectablecolumns')
     b.find_element_by_link_text('Select None').click()
     b.find_element_by_name('systemsearch_column_System/Name').click()
     b.find_element_by_name('systemsearch_column_System/Pools').click()
     b.find_element_by_id('searchform').submit()
     check_system_search_results(b,
                                 present=[system_in_pool],
                                 absent=[system_outside_pool])
     b.find_element_by_xpath('//table[@id="widget"]'
                             '//td[2][normalize-space(text())="%s"]' %
                             pool.name)
Beispiel #3
0
    def test_submission_delegate_cancel_job(self):
        with session.begin():
            submission_delegate = data_setup.create_user(password='******')
            self.user.submission_delegates[:] = [submission_delegate]
        b = self.browser
        login(b, submission_delegate.user_name, password='******')

        b.get(get_server_base() + 'jobs')
        b.find_element_by_link_text("Show Search Options").click()
        wait_for_animation(b, '#searchform')
        Select(b.find_element_by_name('jobsearch-0.table'))\
                .select_by_visible_text('Id')
        Select(b.find_element_by_name('jobsearch-0.operation'))\
                .select_by_visible_text('is')
        b.find_element_by_name('jobsearch-0.value').clear()
        b.find_element_by_name('jobsearch-0.value'). \
            send_keys('%s' % self.job.id)
        b.find_element_by_id('searchform').submit()
        # We are only a submission delegate, but not the submitter,
        # check we cannot Cancel
        action_text = b.find_element_by_xpath("//td[preceding-sibling::td/"
            "a[normalize-space(text())='%s']]/"
            "div[contains(@class, 'job-action-container')]" % self.job.t_id).text
        self.assertTrue('Cancel' not in action_text)

        # Add as submitting user and refresh, try to cancel.
        with session.begin():
            self.job.submitter = submission_delegate
        b.refresh()
        b.find_element_by_xpath("//td[preceding-sibling::td/"
            "a[normalize-space(text())='%s']]/div//"
            "a[normalize-space(text())='Cancel']" % self.job.t_id).click()
        b.find_element_by_xpath("//input[@class='submitbutton' and @value='Yes']").click()
        self.assertEquals(b.find_element_by_class_name('flash').text,
            'Successfully cancelled job %s' % self.job.id)
Beispiel #4
0
 def test_serial_number_column(self):
     with session.begin():
         system_with_serial = data_setup.create_system()
         system_with_serial.serial = u'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
         system_without_serial = data_setup.create_system()
         system_without_serial.serial = None
     b = self.browser
     b.get(get_server_base())
     b.find_element_by_link_text('Show Search Options').click()
     wait_for_animation(b, '#searchform')
     Select(b.find_element_by_name('systemsearch-0.table'))\
         .select_by_visible_text('System/SerialNumber')
     Select(b.find_element_by_name('systemsearch-0.operation'))\
         .select_by_visible_text('is')
     # This also tests that whitespace does not foil us
     b.find_element_by_name('systemsearch-0.value').send_keys(
         ' %s ' % system_with_serial.serial)
     b.find_element_by_link_text('Toggle Result Columns').click()
     wait_for_animation(b, '#selectablecolumns')
     b.find_element_by_link_text('Select None').click()
     b.find_element_by_name('systemsearch_column_System/Name').click()
     b.find_element_by_name(
         'systemsearch_column_System/SerialNumber').click()
     b.find_element_by_id('searchform').submit()
     check_system_search_results(b,
                                 present=[system_with_serial],
                                 absent=[system_without_serial])
     b.find_element_by_xpath('//table[@id="widget"]'
                             '//td[2][normalize-space(text())="%s"]' %
                             system_with_serial.serial)
def perform_search(browser, searchcriteria, search_url=''):
    b = browser
    b.get(get_server_base() + search_url)
    b.find_element_by_link_text('Show Search Options').click()
    wait_for_animation(b, '#searchform')

    for fieldid, criteria in enumerate(searchcriteria):
        if criteria[0] == 'Key/Value':
            assert len(criteria) == 4, "Key/Value criteria must be specified as" \
                    " ('Key/Value', keyname, operation, value)"
            fieldname, keyvalue, operation, value = criteria
        else:
            fieldname, operation, value = criteria
        if fieldid > 0:
            # press the add button to add a new row
            b.find_element_by_id('doclink').click()
        Select(b.find_element_by_name('systemsearch-%i.table' % fieldid))\
            .select_by_visible_text(fieldname)
        if criteria[0] == 'Key/Value':
            Select(browser.find_element_by_name('systemsearch-%i.keyvalue' % fieldid))\
                .select_by_visible_text(keyvalue)
        Select(b.find_element_by_name('systemsearch-%i.operation' % fieldid))\
            .select_by_visible_text(operation)
        b.find_element_by_name('systemsearch-%i.value' % fieldid).clear()
        b.find_element_by_name('systemsearch-%i.value' % fieldid).send_keys(value)

    b.find_element_by_id('searchform').submit()
Beispiel #6
0
 def test_numa_column(self):
     with session.begin():
         system_with_numa = data_setup.create_system()
         system_with_numa.numa = Numa(nodes=2)
         system_without_numa = data_setup.create_system()
         system_without_numa.numa = None
     b = self.browser
     b.get(get_server_base())
     b.find_element_by_link_text('Show Search Options').click()
     wait_for_animation(b, '#searchform')
     Select(b.find_element_by_name('systemsearch-0.table'))\
         .select_by_visible_text('System/NumaNodes')
     Select(b.find_element_by_name('systemsearch-0.operation'))\
         .select_by_visible_text('is not')
     b.find_element_by_link_text('Toggle Result Columns').click()
     wait_for_animation(b, '#selectablecolumns')
     b.find_element_by_link_text('Select None').click()
     b.find_element_by_name('systemsearch_column_System/Name').click()
     b.find_element_by_name('systemsearch_column_System/NumaNodes').click()
     b.find_element_by_id('searchform').submit()
     check_system_search_results(b,
                                 present=[system_with_numa],
                                 absent=[system_without_numa])
     b.find_element_by_xpath('//table[@id="widget"]'
                             '//td[2][normalize-space(text())="2"]')
    def test_search_by_tag(self):
        with session.begin():
            released_distro = data_setup.create_distro(
                tags=[u'STABLE', u'RELEASED'])
            data_setup.create_distro_tree(distro=released_distro)
            unreleased_distro = data_setup.create_distro(tags=[u'STABLE'])
            data_setup.create_distro_tree(distro=unreleased_distro)

        b = self.browser
        b.get(get_server_base() + 'distros')
        b.find_element_by_link_text('Show Search Options').click()
        wait_for_animation(b, '#searchform')
        Select(b.find_element_by_name(
            'distrosearch-0.table')).select_by_visible_text('Tag')
        Select(b.find_element_by_name(
            'distrosearch-0.operation')).select_by_visible_text('is')
        Select(b.find_element_by_name(
            'distrosearch-0.value')).select_by_visible_text('RELEASED')
        b.find_element_by_name('distrosearch').submit()
        check_distro_search_results(b,
                                    present=[released_distro],
                                    absent=[unreleased_distro])

        Select(b.find_element_by_name(
            'distrosearch-0.operation')).select_by_visible_text('is not')
        b.find_element_by_name('distrosearch').submit()
        check_distro_search_results(b,
                                    present=[unreleased_distro],
                                    absent=[released_distro])
Beispiel #8
0
    def test_by_device(self):
        b = self.browser
        b.get(get_server_base())
        b.find_element_by_link_text('Show Search Options').click()
        wait_for_animation(b, '#searchform')
        Select(b.find_element_by_name('systemsearch-0.table'))\
            .select_by_visible_text('Devices/Subsys_device_id')
        Select(b.find_element_by_name('systemsearch-0.operation'))\
            .select_by_visible_text('is')
        b.find_element_by_name('systemsearch-0.value').send_keys('1112')
        b.find_element_by_id('searchform').submit()
        check_system_search_results(b,
                                    present=[self.system_three],
                                    absent=[self.system_one, self.system_two])

        Select(b.find_element_by_name('systemsearch-0.table'))\
            .select_by_visible_text('Devices/Subsys_vendor_id')
        Select(b.find_element_by_name('systemsearch-0.operation'))\
            .select_by_visible_text('is not')
        b.find_element_by_name('systemsearch-0.value').send_keys('1111')
        b.find_element_by_id('doclink').click()
        Select(b.find_element_by_name('systemsearch-1.table'))\
            .select_by_visible_text('Devices/Subsys_device_id')
        Select(b.find_element_by_name('systemsearch-1.operation'))\
            .select_by_visible_text('is')
        b.find_element_by_name('systemsearch-1.value').send_keys('2224')
        b.find_element_by_id('searchform').submit()
        check_system_search_results(
            b,
            present=[self.system_two],
            absent=[self.system_one, self.system_three])
Beispiel #9
0
    def test_search_group(self):
        with session.begin():
            group = data_setup.create_group()
            whiteboard = data_setup.unique_name(u'whiteboard%s')
            job = data_setup.create_job(group=group, whiteboard=whiteboard)
            job2 = data_setup.create_job(whiteboard=whiteboard)

        b = self.browser
        # Ensures that both jobs are present
        b.get(get_server_base() + 'jobs')
        b.find_element_by_link_text('Show Search Options').click()
        wait_for_animation(b, '#searchform')
        b.find_element_by_xpath("//select[@id='jobsearch_0_table'] \
            /option[@value='Whiteboard']").click()
        b.find_element_by_xpath("//select[@id='jobsearch_0_operation'] \
            /option[@value='is']").click()
        b.find_element_by_xpath("//input[@id='jobsearch_0_value']"). \
            send_keys(whiteboard)
        b.find_element_by_id('searchform').submit()
        check_job_search_results(b, present=[job, job2])

        # Now do the actual test
        b.find_element_by_xpath("//select[@id='jobsearch_0_table'] \
            /option[@value='Group']").click()
        b.find_element_by_xpath("//select[@id='jobsearch_0_operation'] \
            /option[@value='is']").click()
        b.find_element_by_xpath("//input[@id='jobsearch_0_value']").clear()
        b.find_element_by_xpath("//input[@id='jobsearch_0_value']"). \
            send_keys(job.group.group_name)
        b.find_element_by_id('searchform').submit()
        check_job_search_results(b, present=[job], absent=[job2])
 def test_group_column(self):
     with session.begin():
         group = data_setup.create_group()
         system_with_group = data_setup.create_system()
         system_with_group.groups.append(group)
         system_without_group = data_setup.create_system()
     b = self.browser
     b.get(get_server_base())
     b.find_element_by_link_text('Show Search Options').click()
     wait_for_animation(b, '#searchform')
     Select(b.find_element_by_name('systemsearch-0.table'))\
         .select_by_visible_text('System/Group')
     Select(b.find_element_by_name('systemsearch-0.operation'))\
         .select_by_visible_text('is')
     b.find_element_by_name('systemsearch-0.value').send_keys(group.group_name)
     b.find_element_by_link_text('Toggle Result Columns').click()
     wait_for_animation(b, '#selectablecolumns')
     b.find_element_by_link_text('Select None').click()
     b.find_element_by_name('systemsearch_column_System/Name').click()
     b.find_element_by_name('systemsearch_column_System/Group').click()
     b.find_element_by_id('searchform').submit()
     check_system_search_results(b, present=[system_with_group],
             absent=[system_without_group])
     b.find_element_by_xpath('//table[@id="widget"]'
             '//td[2][normalize-space(text())="%s"]' % group.group_name)
    def test_by_key_value_is(self):
        b = self.browser
        b.get(get_server_base())
        b.find_element_by_link_text('Show Search Options').click()
        wait_for_animation(b, '#searchform')
        Select(b.find_element_by_name('systemsearch-0.table'))\
            .select_by_visible_text('Key/Value')
        Select(b.find_element_by_name('systemsearch-0.keyvalue'))\
            .select_by_visible_text('CPUMODEL')
        Select(b.find_element_by_name('systemsearch-0.operation'))\
            .select_by_visible_text('is')
        b.find_element_by_name('systemsearch-0.value').send_keys('foocodename')
        b.find_element_by_id('searchform').submit()
        check_system_search_results(b, present=[self.system_one],
                                    absent=[self.system_two, 
                                            self.system_three, 
                                            self.system_four])

        # Key Value search from "Removed Systems"
        b.get(urljoin(get_server_base(), 'removed'))
        b.find_element_by_link_text('Show Search Options').click()
        wait_for_animation(b, '#searchform')
        Select(b.find_element_by_name('systemsearch-0.table'))\
            .select_by_visible_text('Key/Value')
        Select(b.find_element_by_name('systemsearch-0.keyvalue'))\
            .select_by_visible_text('CPUMODEL')
        Select(b.find_element_by_name('systemsearch-0.operation'))\
            .select_by_visible_text('is')
        b.find_element_by_name('systemsearch-0.value').send_keys('foocodename')
        b.find_element_by_id('searchform').submit()
        check_system_search_results(b, present=[self.system_four],
                                    absent=[self.system_one, 
                                            self.system_two, 
                                            self.system_three])
 def test_serial_number_column(self):
     with session.begin():
         system_with_serial = data_setup.create_system()
         system_with_serial.serial = u'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
         system_without_serial = data_setup.create_system()
         system_without_serial.serial = None
     b = self.browser
     b.get(get_server_base())
     b.find_element_by_link_text('Show Search Options').click()
     wait_for_animation(b, '#searchform')
     Select(b.find_element_by_name('systemsearch-0.table'))\
         .select_by_visible_text('System/SerialNumber')
     Select(b.find_element_by_name('systemsearch-0.operation'))\
         .select_by_visible_text('is')
     # This also tests that whitespace does not foil us
     b.find_element_by_name('systemsearch-0.value').send_keys(
             ' %s ' % system_with_serial.serial)
     b.find_element_by_link_text('Toggle Result Columns').click()
     wait_for_animation(b, '#selectablecolumns')
     b.find_element_by_link_text('Select None').click()
     b.find_element_by_name('systemsearch_column_System/Name').click()
     b.find_element_by_name('systemsearch_column_System/SerialNumber').click()
     b.find_element_by_id('searchform').submit()
     check_system_search_results(b, present=[system_with_serial],
             absent=[system_without_serial])
     b.find_element_by_xpath('//table[@id="widget"]'
             '//td[2][normalize-space(text())="%s"]' % system_with_serial.serial)
    def test_by_device(self):
        b = self.browser
        b.get(get_server_base())
        b.find_element_by_link_text('Show Search Options').click()
        wait_for_animation(b, '#searchform')
        Select(b.find_element_by_name('systemsearch-0.table'))\
            .select_by_visible_text('Devices/Subsys_device_id')
        Select(b.find_element_by_name('systemsearch-0.operation'))\
            .select_by_visible_text('is')
        b.find_element_by_name('systemsearch-0.value').send_keys('1112')
        b.find_element_by_id('searchform').submit()
        check_system_search_results(b, present=[self.system_three],
                absent=[self.system_one, self.system_two])

        Select(b.find_element_by_name('systemsearch-0.table'))\
            .select_by_visible_text('Devices/Subsys_vendor_id')
        Select(b.find_element_by_name('systemsearch-0.operation'))\
            .select_by_visible_text('is not')
        b.find_element_by_name('systemsearch-0.value').send_keys('1111')
        b.find_element_by_id('doclink').click()
        Select(b.find_element_by_name('systemsearch-1.table'))\
            .select_by_visible_text('Devices/Subsys_device_id')
        Select(b.find_element_by_name('systemsearch-1.operation'))\
            .select_by_visible_text('is')
        b.find_element_by_name('systemsearch-1.value').send_keys('2224')
        b.find_element_by_id('searchform').submit()
        check_system_search_results(b, present=[self.system_two],
                absent=[self.system_one, self.system_three])
Beispiel #14
0
    def test_submission_delegate_cancel_job(self):
        with session.begin():
            submission_delegate = data_setup.create_user(password='******')
            self.user.submission_delegates[:] = [submission_delegate]
        b = self.browser
        login(b, submission_delegate.user_name, password='******')

        b.get(get_server_base() + 'jobs')
        b.find_element_by_link_text("Show Search Options").click()
        wait_for_animation(b, '#searchform')
        Select(b.find_element_by_name('jobsearch-0.table'))\
                .select_by_visible_text('Id')
        Select(b.find_element_by_name('jobsearch-0.operation'))\
                .select_by_visible_text('is')
        b.find_element_by_name('jobsearch-0.value').clear()
        b.find_element_by_name('jobsearch-0.value'). \
            send_keys('%s' % self.job.id)
        b.find_element_by_id('searchform').submit()
        # We are only a submission delegate, but not the submitter,
        # check we cannot Cancel
        action_text = b.find_element_by_xpath("//td[preceding-sibling::td/"
            "a[normalize-space(text())='%s']]/"
            "div[contains(@class, 'job-action-container')]" % self.job.t_id).text
        self.assertTrue('Cancel' not in action_text)

        # Add as submitting user and refresh, try to cancel.
        with session.begin():
            self.job.submitter = submission_delegate
        b.refresh()
        b.find_element_by_xpath("//td[preceding-sibling::td/"
            "a[normalize-space(text())='%s']]/div//"
            "a[normalize-space(text())='Cancel']" % self.job.t_id).click()
        b.find_element_by_xpath("//input[@class='submitbutton' and @value='Yes']").click()
        self.assertEquals(b.find_element_by_class_name('flash').text,
            'Successfully cancelled job %s' % self.job.id)
Beispiel #15
0
def perform_search(browser, searchcriteria, search_url=''):
    b = browser
    b.get(get_server_base() + search_url)
    b.find_element_by_link_text('Show Search Options').click()
    wait_for_animation(b, '#searchform')

    for fieldid, criteria in enumerate(searchcriteria):
        if criteria[0] == 'Key/Value':
            assert len(criteria) == 4, "Key/Value criteria must be specified as" \
                    " ('Key/Value', keyname, operation, value)"
            fieldname, keyvalue, operation, value = criteria
        else:
            fieldname, operation, value = criteria
        if fieldid > 0:
            # press the add button to add a new row
            b.find_element_by_id('doclink').click()
        Select(b.find_element_by_name('systemsearch-%i.table' % fieldid))\
            .select_by_visible_text(fieldname)
        if criteria[0] == 'Key/Value':
            Select(browser.find_element_by_name('systemsearch-%i.keyvalue' % fieldid))\
                .select_by_visible_text(keyvalue)
        Select(b.find_element_by_name('systemsearch-%i.operation' % fieldid))\
            .select_by_visible_text(operation)
        b.find_element_by_name('systemsearch-%i.value' % fieldid).clear()
        b.find_element_by_name('systemsearch-%i.value' %
                               fieldid).send_keys(value)

    b.find_element_by_id('searchform').submit()
    def test_inventoried_search_range(self):

        b = self.browser
        b.get(get_server_base() + 'mine')
        b.find_element_by_link_text('Show Search Options').click()
        wait_for_animation(b, '#searchform')

        #after
        Select(b.find_element_by_id('systemsearch_0_table'))\
            .select_by_visible_text('System/LastInventoried')
        Select(b.find_element_by_id('systemsearch_0_operation'))\
            .select_by_visible_text('after')
        b.find_element_by_id('systemsearch_0_value').clear()
        b.find_element_by_id('systemsearch_0_value').send_keys(self.date_yesterday)

        b.find_element_by_id('doclink').click()

        #before
        Select(b.find_element_by_id('systemsearch_1_table'))\
            .select_by_visible_text('System/LastInventoried')
        Select(b.find_element_by_id('systemsearch_1_operation'))\
            .select_by_visible_text('before')
        b.find_element_by_id('systemsearch_1_value').clear()
        b.find_element_by_id('systemsearch_1_value').send_keys(self.date_tomorrow)

        b.find_element_by_id('searchform').submit()
        check_system_search_results(b, present=[self.inv1, self.inv2],
                absent=[self.not_inv, self.inv3, self.inv4])
Beispiel #17
0
    def go_to_search_results(self, display_columns=None):
        b = self.browser
        b.get(get_server_base())
        b.find_element_by_link_text('Show Search Options').click()
        Select(b.find_element_by_name('systemsearch-0.table'))\
            .select_by_visible_text('CPU/Cores')
        Select(b.find_element_by_name('systemsearch-0.operation'))\
            .select_by_visible_text('greater than')
        b.find_element_by_name('systemsearch-0.value').send_keys('1')
        b.find_element_by_link_text('Add').click()
        Select(b.find_element_by_name('systemsearch-1.table'))\
            .select_by_visible_text('System/Name')
        Select(b.find_element_by_name('systemsearch-1.operation'))\
            .select_by_visible_text('is not')
        b.find_element_by_name('systemsearch-1.value').send_keys('bob')

        if display_columns is None:
            display_columns = []
        for column in display_columns:
            b.find_element_by_link_text('Toggle Result Columns').click()
            wait_for_animation(b, '#selectablecolumns')
            checkbox = b.find_element_by_id('systemsearch_column_%s' % column)
            if not checkbox.is_selected():
                checkbox.click()

        b.find_element_by_id('searchform').submit()
        b.find_element_by_xpath('//title[text()="Systems"]')
Beispiel #18
0
    def go_to_search_results(self, display_columns=None):
        b = self.browser
        b.get(get_server_base())
        b.find_element_by_link_text('Show Search Options').click()
        Select(b.find_element_by_name('systemsearch-0.table'))\
            .select_by_visible_text('CPU/Cores')
        Select(b.find_element_by_name('systemsearch-0.operation'))\
            .select_by_visible_text('greater than')
        b.find_element_by_name('systemsearch-0.value').send_keys('1')
        b.find_element_by_link_text('Add').click()
        Select(b.find_element_by_name('systemsearch-1.table'))\
            .select_by_visible_text('System/Name')
        Select(b.find_element_by_name('systemsearch-1.operation'))\
            .select_by_visible_text('is not')
        b.find_element_by_name('systemsearch-1.value').send_keys('bob')

        if display_columns is None:
            display_columns = []
        for column in display_columns:
            b.find_element_by_link_text('Toggle Result Columns').click()
            wait_for_animation(b, '#selectablecolumns')
            checkbox = b.find_element_by_id('systemsearch_column_%s' % column)
            if not checkbox.is_selected():
                checkbox.click()

        b.find_element_by_id('searchform').submit()
        b.find_element_by_xpath('//title[text()="Systems"]')
Beispiel #19
0
    def test_inventoried_search_range(self):

        b = self.browser
        b.get(get_server_base() + 'mine')
        b.find_element_by_link_text('Show Search Options').click()
        wait_for_animation(b, '#searchform')

        #after
        Select(b.find_element_by_id('systemsearch_0_table'))\
            .select_by_visible_text('System/LastInventoried')
        Select(b.find_element_by_id('systemsearch_0_operation'))\
            .select_by_visible_text('after')
        b.find_element_by_id('systemsearch_0_value').clear()
        b.find_element_by_id('systemsearch_0_value').send_keys(
            self.date_yesterday)

        b.find_element_by_id('doclink').click()

        #before
        Select(b.find_element_by_id('systemsearch_1_table'))\
            .select_by_visible_text('System/LastInventoried')
        Select(b.find_element_by_id('systemsearch_1_operation'))\
            .select_by_visible_text('before')
        b.find_element_by_id('systemsearch_1_value').clear()
        b.find_element_by_id('systemsearch_1_value').send_keys(
            self.date_tomorrow)

        b.find_element_by_id('searchform').submit()
        check_system_search_results(
            b,
            present=[self.inv1, self.inv2],
            absent=[self.not_inv, self.inv3, self.inv4])
Beispiel #20
0
    def test_by_key_value_is(self):
        b = self.browser
        b.get(get_server_base())
        b.find_element_by_link_text('Show Search Options').click()
        wait_for_animation(b, '#searchform')
        Select(b.find_element_by_name('systemsearch-0.table'))\
            .select_by_visible_text('Key/Value')
        Select(b.find_element_by_name('systemsearch-0.keyvalue'))\
            .select_by_visible_text('CPUMODEL')
        Select(b.find_element_by_name('systemsearch-0.operation'))\
            .select_by_visible_text('is')
        b.find_element_by_name('systemsearch-0.value').send_keys('foocodename')
        b.find_element_by_id('searchform').submit()
        check_system_search_results(
            b,
            present=[self.system_one],
            absent=[self.system_two, self.system_three, self.system_four])

        # Key Value search from "Removed Systems"
        b.get(urljoin(get_server_base(), 'removed'))
        b.find_element_by_link_text('Show Search Options').click()
        wait_for_animation(b, '#searchform')
        Select(b.find_element_by_name('systemsearch-0.table'))\
            .select_by_visible_text('Key/Value')
        Select(b.find_element_by_name('systemsearch-0.keyvalue'))\
            .select_by_visible_text('CPUMODEL')
        Select(b.find_element_by_name('systemsearch-0.operation'))\
            .select_by_visible_text('is')
        b.find_element_by_name('systemsearch-0.value').send_keys('foocodename')
        b.find_element_by_id('searchform').submit()
        check_system_search_results(
            b,
            present=[self.system_four],
            absent=[self.system_one, self.system_two, self.system_three])
Beispiel #21
0
 def test_by_multiple_key_values_again(self):
     b = self.browser
     b.get(get_server_base())
     b.find_element_by_link_text('Show Search Options').click()
     wait_for_animation(b, '#searchform')
     Select(b.find_element_by_name('systemsearch-0.table'))\
         .select_by_visible_text('Key/Value')
     Select(b.find_element_by_name('systemsearch-0.keyvalue'))\
         .select_by_visible_text('HVM')
     Select(b.find_element_by_name('systemsearch-0.operation'))\
         .select_by_visible_text('is')
     b.find_element_by_name('systemsearch-0.value').send_keys('1')
     b.find_element_by_id('doclink').click()
     Select(b.find_element_by_name('systemsearch-1.table'))\
         .select_by_visible_text('Key/Value')
     Select(b.find_element_by_name('systemsearch-1.keyvalue'))\
         .select_by_visible_text('DISKSPACE')
     Select(b.find_element_by_name('systemsearch-1.operation'))\
         .select_by_visible_text('greater than')
     b.find_element_by_name('systemsearch-1.value').send_keys('1000')
     b.find_element_by_id('searchform').submit()
     check_system_search_results(
         b,
         present=[self.system_one],
         absent=[self.system_two, self.system_three])
Beispiel #22
0
 def test_can_sort_search_results_by_reserved(self):
     self.go_to_search_results()
     b = self.browser
     b.find_element_by_link_text("Toggle Result Columns").click()
     wait_for_animation(b, "#selectablecolumns")
     b.find_element_by_name("systemsearch_column_System/Reserved").click()
     b.find_element_by_id("searchform").submit()
     self.check_column_sort("Reserved")
Beispiel #23
0
 def test_can_sort_search_results_by_reserved(self):
     self.go_to_search_results()
     b = self.browser
     b.find_element_by_link_text('Toggle Result Columns').click()
     wait_for_animation(b, '#selectablecolumns')
     b.find_element_by_name('systemsearch_column_System/Reserved').click()
     b.find_element_by_id('searchform').submit()
     self.check_column_sort('Reserved')
Beispiel #24
0
 def test_closing_script_tag_escaped_in_search_bar(self):
     with session.begin():
         Key.lazy_create(key_name=u'</script>')
     b = self.browser
     b.get(get_server_base())
     b.find_element_by_link_text('Show Search Options').click()
     wait_for_animation(b, '#searchform')
     Select(b.find_element_by_name('systemsearch-0.table'))\
         .select_by_visible_text('Key/Value')
     Select(b.find_element_by_name('systemsearch-0.keyvalue'))\
         .select_by_visible_text('</script>')
Beispiel #25
0
 def test_closing_script_tag_escaped_in_search_bar(self):
     with session.begin():
         Key.lazy_create(key_name=u'</script>')
     b = self.browser
     b.get(get_server_base())
     b.find_element_by_link_text('Show Search Options').click()
     wait_for_animation(b, '#searchform')
     Select(b.find_element_by_name('systemsearch-0.table'))\
         .select_by_visible_text('Key/Value')
     Select(b.find_element_by_name('systemsearch-0.keyvalue'))\
         .select_by_visible_text('</script>')
Beispiel #26
0
 def test_search_by_osminor(self):
     b = self.browser
     b.get(get_server_base() + 'distros')
     b.find_element_by_link_text('Show Search Options').click()
     wait_for_animation(b, '#searchform')
     b.find_element_by_xpath("//select[@id='distrosearch_0_table']/option[@value='OSMinor']").click()
     b.find_element_by_xpath("//select[@id='distrosearch_0_operation']/option[@value='is']").click()
     b.find_element_by_xpath('//input[@id="distrosearch_0_value"]').clear()
     b.find_element_by_xpath('//input[@id="distrosearch_0_value"]').send_keys('1')
     b.find_element_by_id('searchform').submit()
     check_distro_search_results(b, present=[self.distro_one],
                                 absent=[self.distro_two, self.distro_three])
Beispiel #27
0
 def test_search_by_osminor(self):
     b = self.browser
     b.get(get_server_base() + 'distros')
     b.find_element_by_link_text('Show Search Options').click()
     wait_for_animation(b, '#searchform')
     b.find_element_by_xpath("//select[@id='distrosearch_0_table']/option[@value='OSMinor']").click()
     b.find_element_by_xpath("//select[@id='distrosearch_0_operation']/option[@value='is']").click()
     b.find_element_by_xpath('//input[@id="distrosearch_0_value"]').clear()
     b.find_element_by_xpath('//input[@id="distrosearch_0_value"]').send_keys('1')
     b.find_element_by_id('searchform').submit()
     check_distro_search_results(b, present=[self.distro_one],
                                 absent=[self.distro_two, self.distro_three])
Beispiel #28
0
 def test_search_by_name(self):
     b = self.browser
     b.get(get_server_base() + 'distros')
     b.find_element_by_link_text('Show Search Options').click()
     wait_for_animation(b, '#searchform')
     b.find_element_by_xpath("//select[@id='distrosearch_0_table']/option[@value='Name']").click()
     b.find_element_by_xpath('//input[@id="distrosearch_0_value" and '
                         'not(contains(@title, "date in YYYY-MM-DD format"))]')
     b.find_element_by_xpath('//input[@id="distrosearch_0_value"]').clear()
     b.find_element_by_xpath('//input[@id="distrosearch_0_value"]').send_keys(self.distro_one.name)
     b.find_element_by_id('searchform').submit()
     check_distro_search_results(b, present=[self.distro_one],
                 absent=[self.distro_two, self.distro_three])
Beispiel #29
0
 def test_search_hypervisor_is_blank(self):
     b = self.browser
     b.get(get_server_base() + 'mine')
     b.find_element_by_link_text('Show Search Options').click()
     wait_for_animation(b, '#searchform')
     Select(b.find_element_by_name('systemsearch-0.table'))\
         .select_by_visible_text('System/Hypervisor')
     Select(b.find_element_by_name('systemsearch-0.operation'))\
         .select_by_visible_text('is')
     Select(b.find_element_by_name('systemsearch-0.value'))\
         .select_by_visible_text('')
     b.find_element_by_id('searchform').submit()
     check_system_search_results(b, present=[self.phys], absent=[self.kvm, self.xen])
Beispiel #30
0
 def test_search_by_variant(self):
     b = self.browser
     b.get(get_server_base() + "distrotrees")
     b.find_element_by_link_text("Show Search Options").click()
     wait_for_animation(b, "#searchform")
     b.find_element_by_xpath("//select[@id='search_0_table']/" "option[@value='Variant']").click()
     b.find_element_by_xpath("//select[@id='search_0_operation']/" "option[@value='is']").click()
     b.find_element_by_xpath('//input[@id="search_0_value"]').clear()
     b.find_element_by_xpath('//input[@id="search_0_value"]').send_keys("%s" % self.distro_one_variant)
     b.find_element_by_id("searchform").submit()
     check_distro_search_results(
         b, present=[self.distro_tree_one], absent=[self.distro_tree_two, self.distro_tree_three]
     )
Beispiel #31
0
 def test_search_by_name(self):
     b = self.browser
     b.get(get_server_base() + 'distros')
     b.find_element_by_link_text('Show Search Options').click()
     wait_for_animation(b, '#searchform')
     b.find_element_by_xpath("//select[@id='distrosearch_0_table']/option[@value='Name']").click()
     b.find_element_by_xpath('//input[@id="distrosearch_0_value" and '
                         'not(contains(@title, "date in YYYY-MM-DD format"))]')
     b.find_element_by_xpath('//input[@id="distrosearch_0_value"]').clear()
     b.find_element_by_xpath('//input[@id="distrosearch_0_value"]').send_keys(self.distro_one.name)
     b.find_element_by_id('searchform').submit()
     check_distro_search_results(b, present=[self.distro_one],
                 absent=[self.distro_two, self.distro_three])
Beispiel #32
0
 def test_searchbar_dropdowns_are_sorted(self):
     b = self.browser
     b.get(get_server_base())
     b.find_element_by_link_text('Show Search Options').click()
     wait_for_animation(b, '#searchform')
     table_options = b.find_element_by_name('systemsearch-0.table')\
             .find_elements_by_tag_name('option')
     assert_sorted([option.text for option in table_options])
     Select(b.find_element_by_name('systemsearch-0.table'))\
         .select_by_visible_text('Key/Value')
     keyvalue_options = b.find_element_by_name('systemsearch-0.keyvalue')\
             .find_elements_by_tag_name('option')
     assert_sorted([option.text for option in keyvalue_options])
Beispiel #33
0
 def test_osmajor_is_not(self):
     b = self.browser
     b.get(get_server_base() + 'tasks')
     b.find_element_by_link_text('Show Search Options').click()
     wait_for_animation(b, '#searchform')
     Select(b.find_element_by_id('tasksearch_0_table'))\
         .select_by_visible_text('OSMajor')
     Select(b.find_element_by_id('tasksearch_0_operation'))\
         .select_by_visible_text('is not')
     b.find_element_by_id('tasksearch_0_value').send_keys(self.osmajor_one)
     b.find_element_by_id('searchform').submit()
     check_task_search_results(b, present=[self.task_three],
             absent=[self.task_one, self.task_two])
 def test_searchbar_dropdowns_are_sorted(self):
     b = self.browser
     b.get(get_server_base())
     b.find_element_by_link_text('Show Search Options').click()
     wait_for_animation(b, '#searchform')
     table_options = b.find_element_by_name('systemsearch-0.table')\
             .find_elements_by_tag_name('option')
     assert_sorted([option.text for option in table_options])
     Select(b.find_element_by_name('systemsearch-0.table'))\
         .select_by_visible_text('Key/Value')
     keyvalue_options = b.find_element_by_name('systemsearch-0.keyvalue')\
             .find_elements_by_tag_name('option')
     assert_sorted([option.text for option in keyvalue_options])
 def test_search_hypervisor_is_blank(self):
     b = self.browser
     b.get(get_server_base() + 'mine')
     b.find_element_by_link_text('Show Search Options').click()
     wait_for_animation(b, '#searchform')
     Select(b.find_element_by_name('systemsearch-0.table'))\
         .select_by_visible_text('System/Hypervisor')
     Select(b.find_element_by_name('systemsearch-0.operation'))\
         .select_by_visible_text('is')
     Select(b.find_element_by_name('systemsearch-0.value'))\
         .select_by_visible_text('')
     b.find_element_by_id('searchform').submit()
     check_system_search_results(b, present=[self.phys], absent=[self.kvm, self.xen])
 def test_by_name(self):
     b = self.browser
     b.get(get_server_base())
     b.find_element_by_link_text('Show Search Options').click()
     wait_for_animation(b, '#searchform')
     Select(b.find_element_by_name('systemsearch-0.table'))\
         .select_by_visible_text('System/Name')
     Select(b.find_element_by_name('systemsearch-0.operation'))\
         .select_by_visible_text('is')
     b.find_element_by_name('systemsearch-0.value').send_keys(self.system_one.fqdn)
     b.find_element_by_id('searchform').submit()
     check_system_search_results(b, present=[self.system_one],
             absent=[self.system_two, self.system_three])
Beispiel #37
0
 def test_search_by_osmajor(self):
     b = self.browser
     b.get(get_server_base() + 'distros')
     b.find_element_by_id('advancedsearch').click()
     wait_for_animation(b, '#searchform')
     b.find_element_by_xpath("//select[@id='distrosearch_0_table']/option[@value='OSMajor']").click()
     b.find_element_by_xpath("//select[@id='distrosearch_0_operation']/option[@value='is']").click()
     b.find_element_by_xpath('//input[@id="distrosearch_0_value"]').clear()
     # This also tests that whitespace does not foil us
     b.find_element_by_xpath('//input[@id="distrosearch_0_value"]').send_keys('  osmajortest1 ')
     b.find_element_by_name('Search').click()
     self.check_search_results(present=[self.distro_one],
             absent=[self.distro_two, self.distro_three])
 def test_search_by_tag(self):
     b = self.browser
     b.get(get_server_base() + 'distrotrees')
     b.find_element_by_link_text('Show Search Options').click()
     wait_for_animation(b, '#searchform')
     b.find_element_by_xpath("//select[@id='search_0_table']/"
         "option[@value='Tag']").click()
     b.find_element_by_xpath("//select[@id='search_0_operation']/"
         "option[@value='is']").click()
     b.find_element_by_xpath("//select[@id='search_0_value']/"
         "option[@value='%s']" % self.distro_one_tag[0]).click()
     b.find_element_by_id('searchform').submit()
     check_distro_search_results(b, present=[self.distro_tree_one],
                                 absent=[self.distro_tree_two, self.distro_tree_three])
Beispiel #39
0
 def test_search_by_created(self):
     b = self.browser
     b.get(get_server_base() + 'distros')
     b.find_element_by_link_text('Show Search Options').click()
     wait_for_animation(b, '#searchform')
     b.find_element_by_xpath("//select[@id='distrosearch_0_table']/option[@value='Created']").click()
     b.find_element_by_xpath("//select[@id='distrosearch_0_operation']/option[@value='after']").click()
     b.find_element_by_xpath('//input[@id="distrosearch_0_value"]').clear()
     now_and_1 = datetime.utcnow() + timedelta(days=1)
     now_and_1_string = now_and_1.strftime('%Y-%m-%d')
     b.find_element_by_xpath('//input[@id="distrosearch_0_value"]').send_keys(now_and_1_string)
     b.find_element_by_id('searchform').submit()
     check_distro_search_results(b, present=[self.distro_one],
                                 absent=[self.distro_two, self.distro_three])
 def test_search_by_tag(self):
     b = self.browser
     b.get(get_server_base() + 'distrotrees')
     b.find_element_by_link_text('Show Search Options').click()
     wait_for_animation(b, '#searchform')
     b.find_element_by_xpath("//select[@id='search_0_table']/"
         "option[@value='Tag']").click()
     b.find_element_by_xpath("//select[@id='search_0_operation']/"
         "option[@value='is']").click()
     b.find_element_by_xpath("//select[@id='search_0_value']/"
         "option[@value='%s']" % self.distro_one_tag[0]).click()
     b.find_element_by_id('searchform').submit()
     check_distro_search_results(b, present=[self.distro_tree_one],
                                 absent=[self.distro_tree_two, self.distro_tree_three])
 def test_osmajor_is_not(self):
     b = self.browser
     b.get(get_server_base() + 'tasks')
     b.find_element_by_link_text('Show Search Options').click()
     wait_for_animation(b, '#searchform')
     Select(b.find_element_by_id('tasksearch_0_table'))\
         .select_by_visible_text('OSMajor')
     Select(b.find_element_by_id('tasksearch_0_operation'))\
         .select_by_visible_text('is not')
     b.find_element_by_id('tasksearch_0_value').send_keys(self.osmajor_one)
     b.find_element_by_id('searchform').submit()
     check_task_search_results(b,
                               present=[self.task_three],
                               absent=[self.task_one, self.task_two])
 def test_search_size_greater_than(self):
     b = self.browser
     b.get(get_server_base() + 'mine')
     b.find_element_by_link_text('Show Search Options').click()
     wait_for_animation(b, '#searchform')
     Select(b.find_element_by_id('systemsearch_0_table'))\
         .select_by_visible_text('Disk/Size')
     Select(b.find_element_by_id('systemsearch_0_operation'))\
         .select_by_visible_text('greater than')
     b.find_element_by_id('systemsearch_0_value').clear()
     b.find_element_by_id('systemsearch_0_value').send_keys('10000000000')
     b.find_element_by_id('searchform').submit()
     check_system_search_results(b, present=[self.big_disk, self.two_disks],
             absent=[self.small_disk, self.no_disks])
Beispiel #43
0
 def show_all_columns(self):
     b = self.browser
     b.get(get_server_base())
     b.find_element_by_link_text("Show Search Options").click()
     Select(b.find_element_by_name("systemsearch-0.table")).select_by_visible_text("System/Name")
     b.find_element_by_link_text("Toggle Result Columns").click()
     wait_for_animation(b, "#selectablecolumns")
     b.find_element_by_link_text("Select All").click()
     # Wait for checkboxes to be checked
     b.find_element_by_css_selector("#selectablecolumns input:checked")
     b.find_element_by_id("searchform").submit()
     # Wait for the new page to load (the row header changes from Name to
     # System-Name when all columns are shown)
     b.find_element_by_xpath('//table[@id="widget"]/thead/tr/th/a[text()="System-Name"]')
Beispiel #44
0
 def test_search_by_created(self):
     b = self.browser
     b.get(get_server_base() + 'distros')
     b.find_element_by_link_text('Show Search Options').click()
     wait_for_animation(b, '#searchform')
     b.find_element_by_xpath("//select[@id='distrosearch_0_table']/option[@value='Created']").click()
     b.find_element_by_xpath("//select[@id='distrosearch_0_operation']/option[@value='after']").click()
     b.find_element_by_xpath('//input[@id="distrosearch_0_value"]').clear()
     now_and_1 = datetime.utcnow() + timedelta(days=1)
     now_and_1_string = now_and_1.strftime('%Y-%m-%d')
     b.find_element_by_xpath('//input[@id="distrosearch_0_value"]').send_keys(now_and_1_string)
     b.find_element_by_id('searchform').submit()
     check_distro_search_results(b, present=[self.distro_one],
                                 absent=[self.distro_two, self.distro_three])
 def test_search_by_name(self):
     b = self.browser
     b.get(get_server_base() + 'distrotrees')
     b.find_element_by_link_text('Show Search Options').click()
     wait_for_animation(b, '#searchform')
     b.find_element_by_xpath("//select[@id='search_0_table']/"
         "option[@value='Name']").click()
     b.find_element_by_xpath("//select[@id='search_0_operation']/"
         "option[@value='is']").click()
     b.find_element_by_xpath('//input[@id="search_0_value"]').clear()
     b.find_element_by_xpath('//input[@id="search_0_value"]'). \
         send_keys('%s' % self.distro_three_name)
     b.find_element_by_id('searchform').submit()
     check_distro_search_results(b, present=[self.distro_tree_three],
                                 absent=[self.distro_tree_one, self.distro_tree_two])
Beispiel #46
0
 def test_search_by_variant(self):
     b = self.browser
     b.get(get_server_base() + 'distrotrees')
     b.find_element_by_id('advancedsearch').click()
     wait_for_animation(b, '#searchform')
     b.find_element_by_xpath("//select[@id='search_0_table']/"
         "option[@value='Variant']").click()
     b.find_element_by_xpath("//select[@id='search_0_operation']/"
         "option[@value='is']").click()
     b.find_element_by_xpath('//input[@id="search_0_value"]').clear()
     b.find_element_by_xpath('//input[@id="search_0_value"]'). \
         send_keys('%s' % self.distro_one_variant)
     b.find_element_by_name('Search').click()
     self.check_search_results(present=[self.distro_tree_one],
             absent=[self.distro_tree_two, self.distro_tree_three])
    def test_uninventoried_search(self):

        b = self.browser
        b.get(get_server_base() + 'mine')
        b.find_element_by_link_text('Show Search Options').click()
        wait_for_animation(b, '#searchform')
        Select(b.find_element_by_id('systemsearch_0_table'))\
            .select_by_visible_text('System/LastInventoried')
        Select(b.find_element_by_id('systemsearch_0_operation'))\
            .select_by_visible_text('is')
        b.find_element_by_id('systemsearch_0_value').clear()
        b.find_element_by_id('systemsearch_0_value').send_keys(' ')
        b.find_element_by_id('searchform').submit()
        check_system_search_results(b, present=[self.not_inv],
                absent=[self.inv1, self.inv2, self.inv3, self.inv4])
Beispiel #48
0
 def test_by_type(self):
     b = self.browser
     b.get(get_server_base())
     b.find_element_by_link_text('Show Search Options').click()
     wait_for_animation(b, '#searchform')
     Select(b.find_element_by_name('systemsearch-0.table'))\
         .select_by_visible_text('System/Type')
     Select(b.find_element_by_name('systemsearch-0.operation'))\
         .select_by_visible_text('is not')
     Select(b.find_element_by_name('systemsearch-0.value'))\
         .select_by_visible_text(self.system_three_details['type'])
     b.find_element_by_id('searchform').submit()
     check_system_search_results(b,
                                 present=[self.system_one, self.system_two],
                                 absent=[self.system_three])
Beispiel #49
0
 def test_search_size_greater_than(self):
     b = self.browser
     b.get(get_server_base() + 'mine')
     b.find_element_by_link_text('Show Search Options').click()
     wait_for_animation(b, '#searchform')
     Select(b.find_element_by_id('systemsearch_0_table'))\
         .select_by_visible_text('Disk/Size')
     Select(b.find_element_by_id('systemsearch_0_operation'))\
         .select_by_visible_text('greater than')
     b.find_element_by_id('systemsearch_0_value').clear()
     b.find_element_by_id('systemsearch_0_value').send_keys('10000000000')
     b.find_element_by_id('searchform').submit()
     check_system_search_results(b,
                                 present=[self.big_disk, self.two_disks],
                                 absent=[self.small_disk, self.no_disks])
 def test_search_by_name(self):
     b = self.browser
     b.get(get_server_base() + 'distrotrees')
     b.find_element_by_link_text('Show Search Options').click()
     wait_for_animation(b, '#searchform')
     b.find_element_by_xpath("//select[@id='search_0_table']/"
         "option[@value='Name']").click()
     b.find_element_by_xpath("//select[@id='search_0_operation']/"
         "option[@value='is']").click()
     b.find_element_by_xpath('//input[@id="search_0_value"]').clear()
     b.find_element_by_xpath('//input[@id="search_0_value"]'). \
         send_keys('%s' % self.distro_three_name)
     b.find_element_by_id('searchform').submit()
     check_distro_search_results(b, present=[self.distro_tree_three],
                                 absent=[self.distro_tree_one, self.distro_tree_two])
Beispiel #51
0
    def test_inventoried_search_before(self):

        b = self.browser
        b.get(get_server_base() + 'mine')
        b.find_element_by_id('advancedsearch').click()
        wait_for_animation(b, '#searchform')
        Select(b.find_element_by_id('systemsearch_0_table'))\
            .select_by_visible_text('System/LastInventoried')
        Select(b.find_element_by_id('systemsearch_0_operation'))\
            .select_by_visible_text('before')
        b.find_element_by_id('systemsearch_0_value').clear()
        b.find_element_by_id('systemsearch_0_value').send_keys(self.date_today)
        b.find_element_by_name('Search').click()
        self.check_search_results(present=[self.inv4], \
                                      absent=[self.not_inv, self.inv1,
                                              self.inv2, self.inv3])
Beispiel #52
0
 def test_by_status(self):
     with session.begin():
         self.system.status = SystemStatus.manual
     b = self.browser
     b.get(urljoin(get_server_base(),'mine'))
     b.find_element_by_link_text('Show Search Options').click()
     wait_for_animation(b, '#searchform')
     Select(b.find_element_by_name('systemsearch-0.table'))\
         .select_by_visible_text('System/Status')
     Select(b.find_element_by_name('systemsearch-0.operation'))\
         .select_by_visible_text('is')
     Select(b.find_element_by_name('systemsearch-0.value'))\
         .select_by_visible_text('Manual')
     b.find_element_by_id('searchform').submit()
     check_system_search_results(b, present=[self.system],
             absent=[self.another_system])
Beispiel #53
0
 def test_invalid_date(self):
     b = self.browser
     b.get(get_server_base())
     b.find_element_by_link_text('Show Search Options').click()
     wait_for_animation(b, '#searchform')
     Select(b.find_element_by_name('systemsearch-0.table'))\
         .select_by_visible_text('System/Added')
     Select(b.find_element_by_name('systemsearch-0.operation'))\
         .select_by_visible_text('after')
     search_field = b.find_element_by_name('systemsearch-0.value')
     search_field.click()
     # close the date picker
     search_field.send_keys(Keys.ESCAPE)
     search_field.send_keys('02-02-2002')
     # we can't actually check the HTML5 validation error
     b.find_element_by_css_selector('input[name="systemsearch-0.value"]:invalid')
Beispiel #54
0
 def test_invalid_date(self):
     b = self.browser
     b.get(get_server_base())
     b.find_element_by_link_text('Show Search Options').click()
     wait_for_animation(b, '#searchform')
     Select(b.find_element_by_name('systemsearch-0.table'))\
         .select_by_visible_text('System/Added')
     Select(b.find_element_by_name('systemsearch-0.operation'))\
         .select_by_visible_text('after')
     search_field = b.find_element_by_name('systemsearch-0.value')
     search_field.click()
     # close the date picker
     search_field.send_keys(Keys.ESCAPE)
     search_field.send_keys('02-02-2002')
     # we can't actually check the HTML5 validation error
     b.find_element_by_css_selector('input[name="systemsearch-0.value"]:invalid')
Beispiel #55
0
 def show_all_columns(self):
     b = self.browser
     b.get(get_server_base())
     b.find_element_by_link_text('Show Search Options').click()
     Select(b.find_element_by_name('systemsearch-0.table'))\
         .select_by_visible_text('System/Name')
     b.find_element_by_link_text('Toggle Result Columns').click()
     wait_for_animation(b, '#selectablecolumns')
     b.find_element_by_link_text('Select All').click()
     # Wait for checkboxes to be checked
     b.find_element_by_css_selector('#selectablecolumns input:checked')
     b.find_element_by_id('searchform').submit()
     # Wait for the new page to load (the row header changes from Name to
     # System-Name when all columns are shown)
     b.find_element_by_xpath(
         '//table[@id="widget"]/thead/tr/th/a[text()="System-Name"]')
Beispiel #56
0
 def test_search_by_created(self):
     b = self.browser
     b.get(get_server_base() + 'distrotrees')
     b.find_element_by_id('advancedsearch').click()
     wait_for_animation(b, '#searchform')
     b.find_element_by_xpath("//select[@id='search_0_table']/"
         "option[@value='Created']").click()
     b.find_element_by_xpath("//select[@id='search_0_operation']/"
         "option[@value='after']").click()
     b.find_element_by_xpath('//input[@id="search_0_value"]').clear()
     now_and_1 = datetime.utcnow() + timedelta(days=1)
     now_and_1_string = now_and_1.strftime('%Y-%m-%d')
     b.find_element_by_xpath('//input[@id="search_0_value"]'). \
         send_keys(now_and_1_string)
     b.find_element_by_name('Search').click()
     self.check_search_results(present=[self.distro_tree_two],
             absent=[self.distro_tree_one, self.distro_tree_three])
Beispiel #57
0
    def test_uninventoried_search(self):

        b = self.browser
        b.get(get_server_base() + 'mine')
        b.find_element_by_link_text('Show Search Options').click()
        wait_for_animation(b, '#searchform')
        Select(b.find_element_by_id('systemsearch_0_table'))\
            .select_by_visible_text('System/LastInventoried')
        Select(b.find_element_by_id('systemsearch_0_operation'))\
            .select_by_visible_text('is')
        b.find_element_by_id('systemsearch_0_value').clear()
        b.find_element_by_id('systemsearch_0_value').send_keys(' ')
        b.find_element_by_id('searchform').submit()
        check_system_search_results(
            b,
            present=[self.not_inv],
            absent=[self.inv1, self.inv2, self.inv3, self.inv4])
Beispiel #58
0
 def test_by_key_value_is(self):
     with session.begin():
         self.system.key_values_string.append(Key_Value_String(
                 Key.by_name(u'CPUMODEL'), 'foocodename'))
     b = self.browser
     b.get(get_server_base())
     b.find_element_by_link_text('Show Search Options').click()
     wait_for_animation(b, '#searchform')
     Select(b.find_element_by_name('systemsearch-0.table'))\
         .select_by_visible_text('Key/Value')
     Select(b.find_element_by_name('systemsearch-0.keyvalue'))\
         .select_by_visible_text('CPUMODEL')
     Select(b.find_element_by_name('systemsearch-0.operation'))\
         .select_by_visible_text('is')
     b.find_element_by_name('systemsearch-0.value').send_keys('foocodename')
     b.find_element_by_id('searchform').submit()
     check_system_search_results(b, present=[self.system],
             absent=[self.another_system])
Beispiel #59
0
 def test_sector_size_is_not_for_multiple_disks(self):
     # The search bar special-cases "is not" searches on one-to-many
     # relationships. "Disk/Size is not 1000" does not mean "systems with
     # a disk whose size is not 1000" but rather "systems with no disks of
     # size 1000".
     b = self.browser
     b.get(get_server_base() + 'mine')
     b.find_element_by_link_text('Show Search Options').click()
     wait_for_animation(b, '#searchform')
     Select(b.find_element_by_id('systemsearch_0_table'))\
         .select_by_visible_text('Disk/SectorSize')
     Select(b.find_element_by_id('systemsearch_0_operation'))\
         .select_by_visible_text('is not')
     b.find_element_by_id('systemsearch_0_value').clear()
     b.find_element_by_id('systemsearch_0_value').send_keys('512')
     b.find_element_by_id('searchform').submit()
     check_system_search_results(b,
                                 present=[self.big_disk, self.no_disks],
                                 absent=[self.small_disk, self.two_disks])