test_replay_list.py 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. from datetime import datetime, timedelta
  2. from sentry.models import Project
  3. from sentry.replays.testutils import mock_replay
  4. from sentry.testutils.cases import ReplaysAcceptanceTestCase
  5. FEATURE_NAME = ["organizations:session-replay"]
  6. class ReplayListTest(ReplaysAcceptanceTestCase):
  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 1")
  12. self.project = self.create_project(
  13. organization=self.org,
  14. teams=[self.team],
  15. name="Bengal",
  16. flags=Project.flags.has_replays,
  17. )
  18. self.create_member(user=self.user, organization=self.org, role="owner", teams=[self.team])
  19. seq1_timestamp = datetime.now() - timedelta(minutes=10, seconds=52)
  20. seq2_timestamp = datetime.now() - timedelta(minutes=10, seconds=35)
  21. for replay_id in [
  22. "3dfe4aae8e4941feb0e4a18cb2a14777",
  23. "8273c28ecf9649f198736bc1c56adf71",
  24. "3b7a731012aa494bad541625637e5ea1",
  25. ]:
  26. self.store_replays(
  27. [
  28. mock_replay(
  29. seq1_timestamp,
  30. self.project.id,
  31. replay_id,
  32. segment_id=0,
  33. urls=[
  34. "http://localhost/",
  35. "http://localhost/home/",
  36. "http://localhost/profile/",
  37. ],
  38. ),
  39. mock_replay(seq2_timestamp, self.project.id, replay_id, segment_id=1),
  40. ]
  41. )
  42. self.login_as(self.user)
  43. self.path = f"/organizations/{self.org.slug}/replays/"
  44. def test_simple(self):
  45. with self.feature(FEATURE_NAME):
  46. self.browser.get(self.path)
  47. self.browser.wait_until_not('[data-test-id="loading-indicator"]')
  48. self.browser.wait_until_not('[data-test-id="loading-placeholder"]')
  49. self.browser.snapshot("replay list")