test_replay_list.py 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. from datetime import datetime, timedelta
  2. from uuid import uuid4
  3. from sentry.models import Project
  4. from sentry.replays.testutils import mock_replay
  5. from sentry.testutils import ReplaysAcceptanceTestCase
  6. FEATURE_NAME = ["organizations:session-replay"]
  7. class ReplayListTest(ReplaysAcceptanceTestCase):
  8. def setUp(self):
  9. super().setUp()
  10. self.user = self.create_user("foo@example.com")
  11. self.org = self.create_organization(name="Rowdy Tiger", owner=None)
  12. self.team = self.create_team(organization=self.org, name="Mariachi Band 1")
  13. self.project = self.create_project(
  14. organization=self.org,
  15. teams=[self.team],
  16. name="Bengal",
  17. flags=Project.flags.has_replays,
  18. )
  19. self.create_member(user=self.user, organization=self.org, role="owner", teams=[self.team])
  20. seq1_timestamp = datetime.now() - timedelta(minutes=10, seconds=52)
  21. seq2_timestamp = datetime.now() - timedelta(minutes=10, seconds=35)
  22. for replay_id in [uuid4().hex, uuid4().hex, uuid4().hex]:
  23. self.store_replays(
  24. [
  25. mock_replay(
  26. seq1_timestamp,
  27. self.project.id,
  28. replay_id,
  29. segment_id=0,
  30. urls=[
  31. "http://localhost/",
  32. "http://localhost/home/",
  33. "http://localhost/profile/",
  34. ],
  35. ),
  36. mock_replay(seq2_timestamp, self.project.id, replay_id, segment_id=1),
  37. ]
  38. )
  39. self.login_as(self.user)
  40. self.path = f"/organizations/{self.org.slug}/replays/"
  41. def test_simple(self):
  42. with self.feature(FEATURE_NAME):
  43. self.browser.get(self.path)
  44. self.browser.wait_until_not('[data-test-id="loading-indicator"]')
  45. self.browser.wait_until_not('[data-test-id="loading-placeholder"]')
  46. self.browser.snapshot("replay list")