test_organization_alert_rule_details.py 1.3 KB

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