test_onboarding.py 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. self.browser.snapshot(name="onboarding - new - welcome")
  24. # Platform selection step
  25. self.browser.click('[aria-label="Start"]')
  26. self.browser.wait_until('[data-test-id="onboarding-step-select-platform"]')
  27. self.browser.snapshot(name="onboarding - new - select platform")
  28. # Select and create node JS project
  29. self.browser.click('[data-test-id="platform-node"]')
  30. self.browser.wait_until_not('[data-test-id="platform-select-next"][aria-disabled="true"]')
  31. self.browser.wait_until('[data-test-id="platform-select-next"][aria-disabled="false"]')
  32. @TimedRetryPolicy.wrap(timeout=5, exceptions=((TimeoutException,)))
  33. def click_platform_select_name(browser):
  34. browser.click('[data-test-id="platform-select-next"]')
  35. # Project getting started
  36. browser.wait_until('[data-test-id="onboarding-step-setup-docs"]')
  37. click_platform_select_name(self.browser)
  38. self.browser.snapshot(name="onboarding - new - setup docs")
  39. # Verify project was created for org
  40. project = Project.objects.get(organization=self.org)
  41. assert project.name == "node"
  42. assert project.platform == "node"