test_create_team.py 1.5 KB

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