test_onboarding.py 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. from unittest import mock
  2. from selenium.common.exceptions import TimeoutException
  3. from sentry.models import Project
  4. from sentry.testutils.cases import AcceptanceTestCase
  5. from sentry.testutils.silo import no_silo_test
  6. from sentry.utils.retries import TimedRetryPolicy
  7. @no_silo_test(stable=True)
  8. class OrganizationOnboardingTest(AcceptanceTestCase):
  9. def setUp(self):
  10. super().setUp()
  11. self.user = self.create_user("foo@example.com")
  12. self.org = self.create_organization(name="Rowdy Tiger", owner=None)
  13. self.team = self.create_team(organization=self.org, name="Mariachi Band")
  14. self.member = self.create_member(
  15. user=self.user, organization=self.org, role="owner", teams=[self.team]
  16. )
  17. self.login_as(self.user)
  18. @mock.patch("sentry.models.ProjectKey.generate_api_key", return_value="test-dsn")
  19. def test_onboarding(self, generate_api_key):
  20. self.browser.get("/onboarding/%s/" % self.org.slug)
  21. # Welcome step
  22. self.browser.wait_until('[data-test-id="onboarding-step-welcome"]')
  23. # Platform selection step
  24. self.browser.click('[aria-label="Start"]')
  25. self.browser.wait_until('[data-test-id="onboarding-step-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-setup-docs"]')
  35. click_platform_select_name(self.browser)
  36. # Verify project was created for org
  37. project = Project.objects.get(organization=self.org)
  38. assert project.name == "node"
  39. assert project.platform == "node"