test_organization_alert_rule_details.py 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. from datetime import timedelta
  2. from django.utils import timezone
  3. from sentry.models.rule import Rule
  4. from sentry.models.rulefirehistory import RuleFireHistory
  5. from sentry.testutils.cases import AcceptanceTestCase, SnubaTestCase
  6. from sentry.testutils.silo import no_silo_test
  7. @no_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.get(project=self.project)
  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. 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"]')