test_organization_alert_rule_details.py 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  1. from datetime import timedelta
  2. from django.utils import timezone
  3. from sentry.models import Rule
  4. from sentry.models.rulefirehistory import RuleFireHistory
  5. from sentry.testutils import AcceptanceTestCase, SnubaTestCase
  6. from sentry.testutils.silo import region_silo_test
  7. @region_silo_test
  8. class OrganizationAlertRuleDetailsTest(AcceptanceTestCase, SnubaTestCase):
  9. def setUp(self):
  10. super().setUp()
  11. self.login_as(self.user)
  12. self.rule = Rule.objects.filter(project=self.project).first()
  13. self.path = f"/organizations/{self.organization.slug}/alerts/rules/{self.project.slug}/{self.rule.id}/details/"
  14. def test_empty_alert_rule_details(self):
  15. self.browser.get(self.path)
  16. self.browser.wait_until_not('[data-test-id="loading-indicator"]')
  17. self.browser.snapshot("alert rule details - empty state")
  18. def test_alert_rule_with_issues(self):
  19. group = self.create_group()
  20. RuleFireHistory.objects.create(
  21. project=self.project,
  22. rule=self.rule,
  23. group=group,
  24. date_added=timezone.now() - timedelta(days=1),
  25. )
  26. self.browser.get(self.path)
  27. self.browser.wait_until_not('[data-test-id="loading-indicator"]')
  28. self.browser.snapshot("alert rule details - issues")