test_organization_alert_rule_details.py 1.2 KB

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