test_create_team.py 1.3 KB

12345678910111213141516171819202122232425262728293031
  1. from sentry.models import Team
  2. from sentry.testutils import AcceptanceTestCase
  3. class CreateTeamTest(AcceptanceTestCase):
  4. def setUp(self):
  5. super().setUp()
  6. self.user = self.create_user("foo@example.com")
  7. self.org = self.create_organization(name="Rowdy Tiger", owner=None)
  8. self.team = self.create_team(organization=self.org, name="Mariachi Band")
  9. self.project = self.create_project(organization=self.org, teams=[self.team], name="Bengal")
  10. self.create_member(user=self.user, organization=self.org, role="owner", teams=[self.team])
  11. self.login_as(self.user)
  12. self.path = f"/settings/{self.org.slug}/teams/"
  13. def test_create(self):
  14. self.browser.get(self.path)
  15. self.browser.wait_until_test_id("team-list")
  16. # Open the modal
  17. self.browser.click('button[aria-label="Create Team"]')
  18. self.browser.wait_until("[role='dialog']")
  19. self.browser.element('input[id="slug"]').send_keys("new-team")
  20. self.browser.click("[role='dialog'] button[aria-label='Create Team']")
  21. # Wait for modal to go away.
  22. self.browser.wait_until_not("[role='dialog']")
  23. # New team should be in dom
  24. assert self.browser.find_element_by_xpath("//span[contains(text(), 'new-team')]")
  25. assert Team.objects.filter(slug="new-team", organization=self.org).exists()