test_onboarding.py 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. from unittest import mock
  2. from selenium.common.exceptions import TimeoutException
  3. from sentry.models import Project
  4. from sentry.testutils import AcceptanceTestCase
  5. from sentry.utils.retries import TimedRetryPolicy
  6. class OrganizationOnboardingTest(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.member = self.create_member(
  13. user=self.user, organization=self.org, role="owner", teams=[self.team]
  14. )
  15. self.login_as(self.user)
  16. @mock.patch("sentry.models.ProjectKey.generate_api_key", return_value="test-dsn")
  17. def test_onboarding(self, generate_api_key):
  18. self.browser.get("/onboarding/%s/" % self.org.slug)
  19. # Welcome step
  20. self.browser.wait_until('[data-test-id="onboarding-step-welcome"]')
  21. self.browser.snapshot(name="onboarding - welcome")
  22. # Platform selection step
  23. self.browser.click('[data-test-id="welcome-next"]')
  24. self.browser.wait_until('[data-test-id="onboarding-step-select-platform"]')
  25. self.browser.snapshot(name="onboarding - select platform")
  26. # Select and create node JS project
  27. self.browser.click('[data-test-id="platform-node"]')
  28. self.browser.wait_until_not('[data-test-id="platform-select-next"][aria-disabled="true"]')
  29. self.browser.wait_until('[data-test-id="platform-select-next"][aria-disabled="false"]')
  30. @TimedRetryPolicy.wrap(timeout=5, exceptions=((TimeoutException,)))
  31. def click_platform_select_name(browser):
  32. browser.click('[data-test-id="platform-select-next"]')
  33. # Project getting started
  34. browser.wait_until('[data-test-id="onboarding-step-get-started"]')
  35. click_platform_select_name(self.browser)
  36. self.browser.snapshot(name="onboarding - get started")
  37. # Verify project was created for org
  38. project = Project.objects.get(organization=self.org)
  39. assert project.name == "rowdy-tiger"
  40. assert project.platform == "node"
  41. self.browser.click('[data-test-id="onboarding-getting-started-invite-members"]')
  42. self.browser.wait_until("[role='dialog']")
  43. self.browser.snapshot(name="onboarding - invite members")