def runTest(self): # Create a sprint to generate twill panic on Mac env = self.testenv.get_trac_environment() teh = TestEnvHelper(env=env, env_key=self.env_key) teh.create_sprint("Panic Sprint1") teh.create_sprint("Panic Sprint2") # Now at least one sprint is there self.tester.login_as(Usernames.product_owner) st_id = self.tester.create_new_agilo_ticket(Type.USER_STORY, "My Story") # Now login as team member and create an associated task to the story self.tester.login_as(Usernames.team_member) task_id = self.tester.create_referenced_ticket(st_id, Type.TASK, "My Task") # Make sure no sprint has been set for this task task_page = self.tester.navigate_to_ticket_page(task_id) self.assertEqual('n.a.', task_page.sprint()) # Now login as admin and edit the ticket self.tester.login_as(Usernames.admin) self.tester.go_to_view_ticket_page(task_id) tc.fv('propertyform', 'field-remaining_time', '12') tc.submit('submit') task_page = self.tester.navigate_to_ticket_page(task_id) self.assertEqual('12.0h', task_page.remaining_time()) self.assertEqual('n.a.', task_page.sprint()) # Now login as team member and become the owner of the ticket self.tester.login_as(Usernames.team_member) self.tester.go_to_view_ticket_page(task_id) tc.fv('propertyform', 'field-remaining_time', '8') tc.fv('propertyform', 'action', 'accept') tc.submit('submit') task_page = self.tester.navigate_to_ticket_page(task_id) self.assertEqual('8.0h', task_page.remaining_time()) self.assertEqual('n.a.', task_page.sprint()) self.assertEqual(Usernames.team_member, task_page.owner()) # Now the admin should be able to edit the task again self.tester.login_as(Usernames.admin) self.tester.go_to_view_ticket_page(task_id) tc.fv('propertyform', 'field-remaining_time', '9') tc.submit('submit') task_page = self.tester.navigate_to_ticket_page(task_id) self.assertEqual('9.0h', task_page.remaining_time()) self.assertEqual('n.a.', task_page.sprint()) # The Scrum Master should also be able self.tester.login_as(Usernames.scrum_master) self.tester.go_to_view_ticket_page(task_id) tc.fv('propertyform', 'field-remaining_time', '10') tc.submit('submit') task_page = self.tester.navigate_to_ticket_page(task_id) self.assertEqual('10.0h', task_page.remaining_time()) self.assertEqual('n.a.', task_page.sprint()) self.assertEqual(Usernames.team_member, task_page.owner())
def assertNotFindItem(self, fieldname, value, message): try: tc.fv('propertyform', fieldname, value) self.fail(message) except TwillAssertionError, e: # AT: looks like after 0.11.4 the Trac guys are wrapping # machanize errors into TwillAssertionError self.assertTrue('cannot find value/label "%s" in list control' % value in str(e))
def _test_adding_a_backlog(self, page_url, backlog_name): tc.go(page_url) tc.url(page_url) tc.fv('addbacklog', 'name', backlog_name) tc.submit('add') # we're at the edit page backlog_url = page_url + '/' + backlog_name tc.url(backlog_url)
def _test_ajax_update_fields(self): # test Ajax functionality by clicking "update fields" or # passing the new values as a GET parameter tc.fv('modcomp', 'scope', 'milestone') tc.submit('preview') # see if the available and selected fields for this backlog # type are display correctly tc.find('<option selected="selected" [^>]*>milestone</option>')
def runTest(self): self._tester.login_as(Usernames.scrum_master) t_id = self._tester.create_new_agilo_task('Type should not be set') #Now go to edit page and save. self._tester.go_to_view_ticket_page(t_id) tc.fv('propertyform', 'submit', 'click') tc.submit('submit') # Now check that in the view page there is not type set to Task tc.notfind("<li>\s*<strong>type</strong>\s*set to\s*<em>Task</em>\s*</li>", flags='ims')
def runTest(self): self._tester.login_as(Usernames.scrum_master) t_id = self._tester.create_new_agilo_task('Type should not be set') #Now go to edit page and save. self._tester.go_to_view_ticket_page(t_id) tc.fv('propertyform', 'submit', 'click') tc.submit('submit') # Now check that in the view page there is not type set to Task tc.notfind( "<li>\s*<strong>type</strong>\s*set to\s*<em>Task</em>\s*</li>", flags='ims')
def runTest(self): # First login as team member, there should be no Requirement but the task self._tester.login_as(Usernames.team_member) tc.go('/newticket?type=task') tc.url(r'(.+)(/newticket\?type=task)') error_msg = 'Requirement should not be allowed for team members!' self.assertNotFindItem('field-type', 'Requirement', error_msg) tc.fv('propertyform', 'field-type', 'Task') # Now login as PO and the Requirement should be there, but the task not self._tester.login_as(Usernames.product_owner) tc.go('/newticket?type=requirement') tc.url(r'(.+)(/newticket\?type=requirement)') error_msg = 'Task should not be allowed for product owner!' self.assertNotFindItem('field-type', 'Task', error_msg) tc.fv('propertyform', 'field-type', 'Requirement')
def _create_sprint(self, name, start_date=None, duration=20, team=None): """Creates a sprint""" page_url = self._tester.url + '/roadmap' tc.go(page_url) # click "Add new sprint" tc.fv('addnew', 'add', 'click') tc.submit() tc.url(SPRINT_URL) tc.fv('editform', 'name', name) if not start_date: start_date = now() # This is with localtz start_date = normalize_date(start_date) tc.fv('editform', 'start', format_datetime(start_date)) tc.fv('editform', 'duration', str(duration)) if team: tc.fv('editform', 'team', team) tc.submit('save') tc.url('%s/%s' % (SPRINT_URL, name)) tc.find('"%s"' % name) tc.find(r'(%s)' % format_datetime(start_date))
def _close_sprint(name, retarget=None): page_url = '%s/%s' % (SPRINT_URL, name) confirm_url = '%s/%s/confirm' % (SPRINT_URL, name) tc.go(page_url) tc.fv('confirmform', 'close', 'click') tc.submit() # show confirmation form tc.url(confirm_url) if retarget is not None: # should show that one ticket can be retargeted tc.find('Retarget the \d+ remaining tickets to sprint') tc.fv('confirmform', 'retarget', retarget) tc.fv('confirmform', 'sure', 'click') tc.submit('sure') # we're back at the roadmap tc.url('/roadmap')
def _delete_sprint(name, retarget=None, tickets=0): page_url = '%s/%s' % (SPRINT_URL, name) confirm_url = '%s/%s/confirm' % (SPRINT_URL, name) tc.go(page_url) tc.fv('confirmform', 'delete', 'click') tc.submit() # show confirmation form tc.url(confirm_url) if retarget is not None: # should show that some tickets can be re-targeted tc.find('Retarget the %s remaining tickets to sprint' % tickets) tc.fv('confirmform', 'retarget', retarget) tc.fv('confirmform', 'sure', 'click') tc.submit('sure') # we're back at the roadmap tc.code(200) tc.url('/roadmap')
def runTest(self): self._tester.login_as(Usernames.admin) page_url = self._tester.url + '/admin/agilo/teams' #TODO: find a way to test with umlaut without compromising the encoding team_name = self.classname() + 'Team' utf8_team_name = team_name.encode('UTF-8') team_desc = "'''Testdescription'''" self._tester.create_new_team(team_name) # set description tc.fv('modcomp', 'description', team_desc) tc.submit('save') # back at list view tc.url(page_url) tc.code(200) # add a new team and team member #TODO: find a way to test team names with umlaut without assuming the # locale of the testing system is UTF-8.de_DE member_name = self.classname() + 'Member' utf8_member_name = member_name.encode('UTF-8') member_desc = "Goldmember" team_name2 = "T-team" tc.fv('addteam', 'name', team_name2) tc.submit('add') tc.code(200) tc.fv('modcomp', 'team_member', utf8_member_name) tc.fv('modcomp', 'member_description', member_desc) tc.submit('add') tc.code(200) try: # IF the accountmanagerplugin is enabled has to appear # the Confirm user creation frame tc.find('Create new user') except TwillAssertionError: account_manager_plugin_enabled = False else: account_manager_plugin_enabled = True tc.fv('modcomp', 'createUser_ok', 'click') tc.submit('createUser_ok') tc.code(200) # correct team selected? tc.find('<option selected="selected">%s</option>' % team_name2) tc.find(utf8_member_name) tc.find(member_desc) # set new value for mondays and tuesdays tc.fv('modcomp', 'ts_0', '0') tc.fv('modcomp', 'ts_1', '') tc.submit('save') # back at team page tc.url("%s/%s" % (page_url, quote(team_name2))) tc.find(utf8_member_name) # three days x 6h tc.find('18.0h') user_not_confirmed = None if account_manager_plugin_enabled: # start to add a new user as team member but cancel at last user_not_confirmed = 'user-not-confirmed' tc.fv('modcomp', 'team_member', user_not_confirmed) tc.submit('add') # abort user creation tc.find('Create new user') tc.fv('modcomp', 'createUser_cancel', 'click') tc.submit('createUser_cancel') # back at team page tc.url("%s/%s" % (page_url, quote(team_name2))) tc.find(utf8_member_name) if user_not_confirmed is not None: tc.notfind(user_not_confirmed) # change team tc.follow(utf8_member_name) tc.fv('modcomp', 'team', utf8_team_name) tc.submit('save') tc.notfind(utf8_member_name) tc.go("%s/%s" % (page_url, unicode_quote(team_name))) tc.find(utf8_member_name) # --------- unassigned team members functionality -------- # add another team member to team 1 member_name2 = 'member #2' tc.fv('modcomp', 'team_member', member_name2) tc.submit('add') if account_manager_plugin_enabled: tc.find('Create new user') tc.find(member_name2) tc.fv('modcomp', 'createUser_ok', 'click') tc.submit('createUser_ok') tc.fv('modcomp', 'member_description', '') tc.submit('save') # back at team list, delete first team member tc.url("%s/%s" % (page_url, unicode_quote(team_name))) tc.fv('modcomp', 'delete', utf8_member_name) tc.submit('save') # same url, should not list this member anymore tc.url("%s/%s" % (page_url, unicode_quote(team_name))) tc.notfind(utf8_member_name) # select the other one but cancel back to team list. Formvalue # must use True here because Twill treats checkboxes differently # when there are several with the same name or only one tc.fv('modcomp', 'delete', True) tc.submit('cancel') tc.go(page_url) tc.follow('Unassigned team members') # shows the member we deleted, not the one we canceled on tc.url(page_url + "/unassigned") tc.find(utf8_member_name) tc.notfind(member_name2) # completely delete the team member tc.fv('modcomp', 'delete', True) tc.submit('remove') # no team members without teams anymore tc.url(page_url) tc.notfind('unassigned') # now delete the teams tc.fv('team_table', 'delete', utf8_team_name) tc.fv('team_table', 'delete', team_name2) tc.submit() tc.notfind(utf8_team_name) tc.notfind(team_name2) tc.find('unassigned')