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
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
def runTest(self): """Test for regression of the fix in r5785""" prefs_url = self._tester.url + "/prefs" # [BLOODHOUND] Preferences link removed tc.follow('/prefs') tc.url(prefs_url) self._tester.logout() self._tester.login('admin')
def go_to_query(self): """Surf to the custom query page. """ self.go_to_front() # [BLOODHOUND] View Tickets (reports list) => Tickets (dashboard) tc.follow('^Tickets$') tc.notfind(internal_error) tc.url(self.url + '/dashboard') tc.follow('Custom Query') tc.url(self.url + '/query')
def go_to_query(self): """Surf to the custom query page. """ self.go_to_front() # [BLOODHOUND] View Tickets (reports list) => Tickets (dashboard) tc.follow('^Tickets$') tc.notfind(internal_error) tc.url(self.url + '/dashboard') tc.follow('Custom Query') tc.url(self.url + '/query')
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"')
def runTest(self): """Setup new product""" prefix, name = self._tester.create_product() base_url = self._testenv.get_env_href(prefix=prefix) tc.url(base_url()) tc.follow('Index') tc.find('Index by Title') tc.find('<a[^>]*>Index by Date') pages = ('TitleIndex', 'RecentChanges', 'InterTrac', 'InterWiki') for page in pages: tc.find('<a[^>]*>%s' % (page, )) tc.follow('Index by Date') tc.find('Index by Date') tc.find('<a[^>]*>Index by Title')
def runTest(self): """Setup new product""" prefix, name = self._tester.create_product() base_url = self._testenv.get_env_href(prefix=prefix) tc.url(base_url()) tc.follow('Index') tc.find('Index by Title') tc.find('<a[^>]*>Index by Date') pages = ('TitleIndex', 'RecentChanges', 'InterTrac', 'InterWiki') for page in pages: tc.find('<a[^>]*>%s' % (page,)) tc.follow('Index by Date') tc.find('Index by Date') tc.find('<a[^>]*>Index by Title')
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)
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)
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
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)
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
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)
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')
def go_to_dashboard(self): """Surf to the dashboard page.""" self.go_to_front() tc.follow('Tickets') tc.url(self.url + '/dashboard')
def go_to_newticket(self): self.go_to_front() tc.follow('More fields')
def go_to_newticket(self): self.go_to_front() tc.follow('More fields')
def go_to_dashboard(self): """Surf to the dashboard page.""" self.go_to_front() tc.follow('Tickets') tc.url(self.url + '/dashboard')