Пример #1
0
    def create_milestone(self, name=None, due=None):
        """Creates the specified milestone, with a random name if none is
        provided.  Returns the name of the milestone.
        """
        if name == None:
            name = random_unique_camel()
        milestone_url = self.url + "/admin/ticket/milestones"
        tc.go(milestone_url)
        tc.url(milestone_url)
        tc.formvalue('addmilestone', 'name', name)
        if due:
            # TODO: How should we deal with differences in date formats?
            tc.formvalue('addmilestone', 'duedate', due)
        tc.submit()
        tc.notfind(internal_error)
        tc.notfind('Milestone .* already exists')
        tc.url(milestone_url)
        tc.find(name)

        # Make sure it's on the roadmap.
        tc.follow('Roadmap')
        tc.url(self.url + "/roadmap")
        tc.find('Milestone:.*%s' % name)
        tc.follow(name)
        tc.url('%s/milestone/%s' % (self.url, unicode_quote(name)))
        if not due:
            # [BLOODHOUND] No date set => Unscheduled
            tc.find('Unscheduled')

        return name
Пример #2
0
    def create_milestone(self, name=None, due=None):
        """Creates the specified milestone, with a random name if none is
        provided.  Returns the name of the milestone.
        """
        if name == None:
            name = random_unique_camel()
        milestone_url = self.url + "/admin/ticket/milestones"
        tc.go(milestone_url)
        tc.url(milestone_url)
        tc.formvalue('addmilestone', 'name', name)
        if due:
            # TODO: How should we deal with differences in date formats?
            tc.formvalue('addmilestone', 'duedate', due)
        tc.submit()
        tc.notfind(internal_error)
        tc.notfind('Milestone .* already exists')
        tc.url(milestone_url)
        tc.find(name)

        # Make sure it's on the roadmap.
        tc.follow('Roadmap')
        tc.url(self.url + "/roadmap")
        tc.find('Milestone:.*%s' % name)
        tc.follow(name)
        tc.url('%s/milestone/%s' % (self.url, unicode_quote(name)))
        if not due:
            # [BLOODHOUND] No date set => Unscheduled
            tc.find('Unscheduled')

        return name
Пример #3
0
 def runTest(self):
     """Test for regression of http://trac.edgewall.org/ticket/5765
     Unable to turn off 'Enable access keys' in Preferences
     """
     self._tester.go_to_front()
     # [BLOODHOUND] Preferences link removed
     tc.follow('/prefs')
     tc.follow('Keyboard Shortcuts')
     tc.formvalue('userprefs', 'accesskeys', True)
     tc.submit()
     tc.find('name="accesskeys".*checked="checked"')
     tc.formvalue('userprefs', 'accesskeys', False)
     tc.submit()
     tc.notfind('name="accesskeys".*checked="checked"')
Пример #4
0
    def _post_create_ticket(self):
        """Look at the newly created ticket page after creating it
        """
        # we should be looking at the newly created ticket
        tc.url(self.url + '/ticket/%s' % (self.ticketcount + 1))
        # Increment self.ticketcount /after/ we've verified that the ticket
        # was created so a failure does not trigger spurious later
        # failures.
        self.ticketcount += 1

        # verify the ticket creation event shows up in the timeline
        self.go_to_timeline()
        tc.formvalue('prefs', 'ticket', True)
        tc.submit()
        tc.find('Ticket.*#%s.*created' % self.ticketcount)
Пример #5
0
    def _post_create_ticket(self):
        """Look at the newly created ticket page after creating it
        """
        # we should be looking at the newly created ticket
        tc.url(self.url + '/ticket/%s' % (self.ticketcount + 1))
        # Increment self.ticketcount /after/ we've verified that the ticket
        # was created so a failure does not trigger spurious later
        # failures.
        self.ticketcount += 1

        # verify the ticket creation event shows up in the timeline
        self.go_to_timeline()
        tc.formvalue('prefs', 'ticket', True)
        tc.submit()
        tc.find('Ticket.*#%s.*created' % self.ticketcount)
Пример #6
0
    def runTest(self):
        """Admin set default product"""
        prefix, name, owner = self._tester.admin_create_product(owner='admin')
        products_url = self._tester.url + '/admin/ticket/products'
        tc.go(products_url)
        tc.formvalue('product_table', 'default', prefix)
        tc.submit('apply')
        tc.find('type="radio" name="default" value="%s" checked="checked"'
                % prefix)
        tc.go(self._tester.url + '/newticket')
        tc.find('<option selected="selected" value="%s">%s</option>'
                % (prefix, name))

        # Test the "Clear default" button
        tc.go(products_url)
        tc.submit('clear', 'product_table')
        tc.notfind('type="radio" name="default" value=".+" checked="checked"')
Пример #7
0
    def runTest(self):
        """Admin set default product"""
        prefix, name, owner = self._tester.admin_create_product(owner='admin')
        products_url = self._tester.url + '/admin/ticket/products'
        tc.go(products_url)
        tc.formvalue('product_table', 'default', prefix)
        tc.submit('apply')
        tc.find('type="radio" name="default" value="%s" checked="checked"' %
                prefix)
        tc.go(self._tester.url + '/newticket')
        tc.find('<option selected="selected" value="%s">%s</option>' %
                (prefix, name))

        # Test the "Clear default" button
        tc.go(products_url)
        tc.submit('clear', 'product_table')
        tc.notfind('type="radio" name="default" value=".+" checked="checked"')
Пример #8
0
    def create_ticket(self, summary=None, info=None):
        """Create a new (random) ticket in the test environment.  Returns
        the new ticket number.

        :param summary:
            may optionally be set to the desired summary
        :param info:
            may optionally be set to a dictionary of field value pairs for
            populating the ticket.  ``info['summary']`` overrides summary.

        `summary` and `description` default to randomly-generated values.
        """
        # [BLOODHOUND] New Ticket => More fields (in create ticket menu)
        self.go_to_newticket()

        tc.notfind(internal_error)
        if summary == None:
            summary = random_sentence(4)
        tc.formvalue('propertyform', 'field_summary', summary)
        tc.formvalue('propertyform', 'field_description', random_page())
        if info:
            for field, value in info.items():
                tc.formvalue('propertyform', 'field_%s' % field, value)

        # [BLOODHOUND] no actual button to submit /newticket `propertyform`
        tc.submit()

        self._post_create_ticket()
        return self.ticketcount
Пример #9
0
    def quick_create_ticket(self, summary=None, info=None):
        """Create a new (random) ticket in the test environment via quick
        create ticket shortcut. Returns the new ticket number.

        :param summary:
            may optionally be set to the desired summary
        :param info:
            may optionally be set to a dictionary of field value pairs for
            populating the ticket.  Fields are populated afterwards by
            navigating to ticket page, thereby ``info['summary']``overrides
            ``summary``.

        `summary` and `description` default to randomly-generated values.
        """
        self.go_to_front()
        tc.notfind(internal_error)

        if summary == None:
            summary = random_sentence(4)
        tc.formvalue('qct-form', 'field_summary', summary)
        tc.formvalue('qct-form', 'field_description', random_page())
        self._post_create_ticket()

        if info:
            # Second pass to update ticket fields
            tc.url(self.url + '/ticket/%s' % (self.ticketcount + 1))
            tc.notfind(internal_error)
            for field, value in info.items():
                tc.formvalue('inplace-propertyform', 'field_%s' % field, value)
            tc.submit('submit')

        return self.ticketcount
Пример #10
0
    def quick_create_ticket(self, summary=None, info=None):
        """Create a new (random) ticket in the test environment via quick
        create ticket shortcut. Returns the new ticket number.

        :param summary:
            may optionally be set to the desired summary
        :param info:
            may optionally be set to a dictionary of field value pairs for
            populating the ticket.  Fields are populated afterwards by
            navigating to ticket page, thereby ``info['summary']``overrides
            ``summary``.

        `summary` and `description` default to randomly-generated values.
        """
        self.go_to_front()
        tc.notfind(internal_error)

        if summary == None:
            summary = random_sentence(4)
        tc.formvalue('qct-form', 'field_summary', summary)
        tc.formvalue('qct-form', 'field_description', random_page())
        self._post_create_ticket()

        if info:
            # Second pass to update ticket fields
            tc.url(self.url + '/ticket/%s' % (self.ticketcount + 1))
            tc.notfind(internal_error)
            for field, value in info.items():
                tc.formvalue('inplace-propertyform', 'field_%s' % field, value)
            tc.submit('submit')

        return self.ticketcount
Пример #11
0
    def create_ticket(self, summary=None, info=None):
        """Create a new (random) ticket in the test environment.  Returns
        the new ticket number.

        :param summary:
            may optionally be set to the desired summary
        :param info:
            may optionally be set to a dictionary of field value pairs for
            populating the ticket.  ``info['summary']`` overrides summary.

        `summary` and `description` default to randomly-generated values.
        """
        # [BLOODHOUND] New Ticket => More fields (in create ticket menu)
        self.go_to_newticket()

        tc.notfind(internal_error)
        if summary == None:
            summary = random_sentence(4)
        tc.formvalue('propertyform', 'field_summary', summary)
        tc.formvalue('propertyform', 'field_description', random_page())
        if info:
            for field, value in info.items():
                tc.formvalue('propertyform', 'field_%s' % field, value)

        # [BLOODHOUND] no actual button to submit /newticket `propertyform`
        tc.submit()

        self._post_create_ticket()
        return self.ticketcount
Пример #12
0
    def login(self, username):
        """Login as the given user

        Consider that 'logged in as user' label has been replaced by
        '<i class="icon-user"></i>user'
        """
        #FIXME: Keep/remove this ?
        #tc.add_auth("", self.url, username, username)
        self.go_to_front()
        tc.find("Login")
        tc.follow("Login")

        # Submit user + password via account manager login form
        tc.formvalue('acctmgr_loginform', 'user', username)
        tc.formvalue('acctmgr_loginform', 'password', username)
        tc.submit()
        self.go_to_front()

        tc.find(r'<i class="icon-user"></i>\s*%s' % username)
        tc.find("Logout")
        tc.url(self.url)
        tc.notfind(internal_error)
Пример #13
0
    def runTest(self):
        """Rename product from the admin page."""
        prefix, name, owner = self._tester.admin_create_product(owner='admin')
        with self.in_product(prefix) as (testenv, tester):
            t1 = tester.create_ticket()
            t2 = tester.create_ticket()
        new_name = '%s%s' % (name, str(uuid.uuid4()).split('-')[0])

        admin_product_url = self._tester.url + '/admin/ticket/products'
        tc.go(admin_product_url + '/' + prefix)
        tc.formvalue('modprod', 'name', new_name)
        tc.submit('save')
        tc.find("Your changes have been saved")
        tc.find(r'<a href="/admin/ticket/products/%s">%s</a>'
                % (prefix, new_name))

        with self.in_product(prefix) as (testenv, tester):
            tester.go_to_ticket(t1)
            comment = "Product %s renamed to %s" % (name, new_name)
            tc.find(comment)
            tester.go_to_ticket(t2)
            tc.find(comment)
Пример #14
0
    def login(self, username):
        """Login as the given user

        Consider that 'logged in as user' label has been replaced by
        '<i class="icon-user"></i>user'
        """
        #FIXME: Keep/remove this ?
        #tc.add_auth("", self.url, username, username)
        self.go_to_front()
        tc.find("Login")
        tc.follow("Login")

        # Submit user + password via account manager login form
        tc.formvalue('acctmgr_loginform', 'user', username)
        tc.formvalue('acctmgr_loginform', 'password', username)
        tc.submit()
        self.go_to_front()

        tc.find(r'<i class="icon-user"></i>\s*%s' % username)
        tc.find("Logout")
        tc.url(self.url)
        tc.notfind(internal_error)
Пример #15
0
    def runTest(self):
        """Rename product from the admin page."""
        prefix, name, owner = self._tester.admin_create_product(owner='admin')
        with self.in_product(prefix) as (testenv, tester):
            t1 = tester.create_ticket()
            t2 = tester.create_ticket()
        new_name = '%s%s' % (name, str(uuid.uuid4()).split('-')[0])

        admin_product_url = self._tester.url + '/admin/ticket/products'
        tc.go(admin_product_url + '/' + prefix)
        tc.formvalue('modprod', 'name', new_name)
        tc.submit('save')
        tc.find("Your changes have been saved")
        tc.find(r'<a href="/admin/ticket/products/%s">%s</a>' %
                (prefix, new_name))

        with self.in_product(prefix) as (testenv, tester):
            tester.go_to_ticket(t1)
            comment = "Product %s renamed to %s" % (name, new_name)
            tc.find(comment)
            tester.go_to_ticket(t2)
            tc.find(comment)
Пример #16
0
    def runTest(self):
        """Check for correct author in ticket comments on product rename
        https://issues.apache.org/bloodhound/ticket/671
        """
        prefix, name = self._tester.create_product()
        with self.in_product(prefix) as (testenv, tester):
            t1 = tester.create_ticket()
            t2 = tester.create_ticket()
        new_name = '%s%s' % (name, str(uuid4()).split('-')[0])

        tc.go(self._tester.url + '/products')
        tc.follow('.*/products/' + prefix + r'\?action=edit$')
        tc.find('Edit Product')
        tc.find(prefix)
        tc.formvalue('edit', 'name', new_name)
        tc.submit()
        tc.find('Your changes have been saved')

        with self.in_product(prefix) as (testenv, tester):
            tester.go_to_ticket(t1)
            comment = 'Product %s renamed to %s' % (name, new_name)
            tc.find(comment)
            tester.go_to_ticket(t2)
            tc.find(comment)
Пример #17
0
    def runTest(self):
        """Check for correct author in ticket comments on product rename
        https://issues.apache.org/bloodhound/ticket/671
        """
        prefix, name = self._tester.create_product()
        with self.in_product(prefix) as (testenv, tester):
            t1 = tester.create_ticket()
            t2 = tester.create_ticket()
        new_name = '%s%s' % (name, str(uuid4()).split('-')[0])

        tc.go(self._tester.url + '/products')
        tc.follow('.*/products/' + prefix + r'\?action=edit$')
        tc.find('Edit Product')
        tc.find(prefix)
        tc.formvalue('edit', 'name', new_name)
        tc.submit()
        tc.find('Your changes have been saved')

        with self.in_product(prefix) as (testenv, tester):
            tester.go_to_ticket(t1)
            comment = 'Product %s renamed to %s' % (name, new_name)
            tc.find(comment)
            tester.go_to_ticket(t2)
            tc.find(comment)
Пример #18
0
 def create_report(self, title, query, description):
     """Create a new report with the given title, query, and description
     """
     self.go_to_front()
     # [BLOODHOUND] View Tickets renamed to Tickets pointing at dashboard
     tc.follow(r'\bTickets\b')
     tc.notfind(internal_error)
     tc.follow(r'\bReports\b')
     tc.notfind(internal_error)
     tc.formvalue('create_report', 'action', 'new') # select new report form
     tc.submit()
     tc.find('New Report')
     tc.notfind(internal_error)
     tc.formvalue('edit_report', 'title', title)
     tc.formvalue('edit_report', 'description', description)
     tc.formvalue('edit_report', 'query', query)
     tc.submit()
     reportnum = b.get_url().split('/')[-1]
     # TODO: verify the url is correct
     # TODO: verify the report number is correct
     # TODO: verify the report does not cause an internal error
     # TODO: verify the title appears on the report list
     return reportnum
Пример #19
0
 def create_report(self, title, query, description):
     """Create a new report with the given title, query, and description
     """
     self.go_to_front()
     # [BLOODHOUND] View Tickets renamed to Tickets pointing at dashboard
     tc.follow(r'\bTickets\b')
     tc.notfind(internal_error)
     tc.follow(r'\bReports\b')
     tc.notfind(internal_error)
     tc.formvalue('create_report', 'action',
                  'new')  # select new report form
     tc.submit()
     tc.find('New Report')
     tc.notfind(internal_error)
     tc.formvalue('edit_report', 'title', title)
     tc.formvalue('edit_report', 'description', description)
     tc.formvalue('edit_report', 'query', query)
     tc.submit()
     reportnum = b.get_url().split('/')[-1]
     # TODO: verify the url is correct
     # TODO: verify the report number is correct
     # TODO: verify the report does not cause an internal error
     # TODO: verify the title appears on the report list
     return reportnum
Пример #20
0
    def create_product(self, prefix=None, name=None, desc=None):
        """Create a product from the product list page."""
        products_url = self.url + '/products'
        tc.go(products_url)
        tc.find('Products')
        tc.submit('add', 'new')
        tc.find('New Product')

        prefix = prefix or random_word()
        name = name or random_sentence()
        desc = desc or random_paragraph()

        tc.formvalue('edit', 'prefix', prefix)
        tc.formvalue('edit', 'name', name)
        tc.formvalue('edit', 'description', desc)
        tc.submit()
        tc.find('The product "%s" has been added' % prefix)
        return prefix, name
Пример #21
0
    def create_product(self, prefix=None, name=None, desc=None):
        """Create a product from the product list page."""
        products_url = self.url + '/products'
        tc.go(products_url)
        tc.find('Products')
        tc.submit('add', 'new')
        tc.find('New Product')

        prefix = prefix or random_word()
        name = name or random_sentence()
        desc = desc or random_paragraph()

        tc.formvalue('edit', 'prefix', prefix)
        tc.formvalue('edit', 'name', name)
        tc.formvalue('edit', 'description', desc)
        tc.submit()
        tc.find('The product "%s" has been added' % prefix)
        return prefix, name
Пример #22
0
    def admin_create_product(self, prefix=None, name=None, owner=None):
        """Create a product from the admin page."""
        admin_product_url = self.url + '/admin/ticket/products'
        tc.go(admin_product_url)
        tc.url(admin_product_url + '$')
        prefix = prefix or random_word()
        name = name or random_sentence()
        owner = owner or random_word()
        tc.formvalue('addproduct', 'prefix', prefix)
        tc.formvalue('addproduct', 'name', name)
        tc.formvalue('addproduct', 'owner', owner)
        tc.submit()

        tc.find(r'The product "%s" has been added' % prefix)
        tc.find(r'<a href="/admin/ticket/products/%s">%s</a>' %
                (prefix, prefix))
        tc.find(r'<a href="/admin/ticket/products/%s">%s</a>' % (prefix, name))
        tc.find(r'<td class="owner">%s</td>' % owner)
        return prefix, name, owner
Пример #23
0
    def admin_create_product(self, prefix=None, name=None, owner=None):
        """Create a product from the admin page."""
        admin_product_url = self.url + '/admin/ticket/products'
        tc.go(admin_product_url)
        tc.url(admin_product_url + '$')
        prefix = prefix or random_word()
        name = name or random_sentence()
        owner = owner or random_word()
        tc.formvalue('addproduct', 'prefix', prefix)
        tc.formvalue('addproduct', 'name', name)
        tc.formvalue('addproduct', 'owner', owner)
        tc.submit()

        tc.find(r'The product "%s" has been added' % prefix)
        tc.find(r'<a href="/admin/ticket/products/%s">%s</a>'
                % (prefix, prefix))
        tc.find(r'<a href="/admin/ticket/products/%s">%s</a>'
                % (prefix, name))
        tc.find(r'<td class="owner">%s</td>' % owner)
        return prefix, name, owner
Пример #24
0
 def runTest(self):
     """Set preferences for admin user"""
     prefs_url = self._tester.url + "/prefs"
     # [BLOODHOUND] Preferences link removed
     tc.follow('/prefs')
     tc.url(prefs_url)
     tc.notfind('Your preferences have been saved.')
     tc.formvalue('userprefs', 'name', ' System Administrator ')
     tc.formvalue('userprefs', 'email', ' [email protected] ')
     tc.submit()
     tc.find('Your preferences have been saved.')
     tc.follow('Date & Time')
     tc.url(prefs_url + '/datetime')
     tc.formvalue('userprefs', 'tz', 'GMT -10:00')
     tc.submit()
     tc.find('Your preferences have been saved.')
     tc.follow('General')
     tc.url(prefs_url)
     tc.notfind('Your preferences have been saved.')
     tc.find('value="System Administrator"')
     tc.find(r'value="admin@example\.com"')
     tc.follow('Date & Time')
     tc.url(prefs_url + '/datetime')
     tc.find('GMT -10:00')
Пример #25
0
 def quickjump(self, search):
     """Do a quick search to jump to a page."""
     tc.formvalue('mainsearch', 'q', search)
     tc.submit()
     tc.notfind(internal_error)
Пример #26
0
 def quickjump(self, search):
     """Do a quick search to jump to a page."""
     tc.formvalue('mainsearch', 'q', search)
     tc.submit()
     tc.notfind(internal_error)