test_organization_alert_rule_details.py 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  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. from sentry.testutils.silo import region_silo_test
  6. @region_silo_test
  7. class OrganizationAlertRuleDetailsTest(AcceptanceTestCase, SnubaTestCase):
  8. def setUp(self):
  9. super().setUp()
  10. self.login_as(self.user)
  11. self.rule = Rule.objects.filter(project=self.project).first()
  12. self.path = f"/organizations/{self.organization.slug}/alerts/rules/{self.project.slug}/{self.rule.id}/details/"
  13. def test_empty_alert_rule_details(self):
  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. self.browser.get(self.path)
  26. self.browser.wait_until_not('[data-test-id="loading-indicator"]')
  27. self.browser.snapshot("alert rule details - issues")