test_api.py 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. from sentry.testutils import AcceptanceTestCase
  2. class ApiTokensTest(AcceptanceTestCase):
  3. def setUp(self):
  4. super().setUp()
  5. self.user = self.create_user(email="foo@example.com", name="User Name")
  6. self.login_as(self.user)
  7. self.path = "/api/"
  8. def test_simple(self):
  9. self.browser.get(self.path)
  10. self.browser.wait_until_not(".loading")
  11. self.browser.snapshot("api tokens - no tokens")
  12. self.browser.click_when_visible('[data-test-id="create-token"]')
  13. self.browser.wait_until_not(".loading")
  14. self.browser.snapshot("api tokens - new token")
  15. self.browser.click_when_visible('[data-test-id="form-submit"]')
  16. self.browser.wait_until_not(".loading")
  17. self.browser.snapshot("api tokens - single token")
  18. class ApiApplicationTest(AcceptanceTestCase):
  19. def setUp(self):
  20. super().setUp()
  21. self.user = self.create_user(email="foo@example.com", name="User Name")
  22. self.login_as(self.user)
  23. self.path = "/api/applications/"
  24. def test_simple(self):
  25. self.browser.get(self.path)
  26. self.browser.wait_until_not(".loading")
  27. self.browser.snapshot("api applications - no applications")
  28. self.browser.click_when_visible('[aria-label="Create New Application"]')
  29. self.browser.wait_until_not(".loading")
  30. self.browser.snapshot("api applications - new application")
  31. self.browser.click('[href="/settings/account/api/applications/"]')
  32. self.browser.wait_until_not(".loading")
  33. self.browser.click_when_visible('[data-test-id="toast-success"]')
  34. self.browser.wait_until_not('[data-test-id="toast-success"]')
  35. self.browser.snapshot("api applications - single application")
  36. self.browser.get(self.path)
  37. self.browser.wait_until_not(".loading")
  38. self.browser.click_when_visible('[aria-label="Remove"]')
  39. self.browser.wait_until_not('[data-test-id="toast-loading"]')
  40. self.browser.wait_until_test_id("empty-message")