test_create_team.py 1.4 KB

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