|
@@ -8,12 +8,14 @@ import requests
|
|
|
from django.conf import settings
|
|
|
|
|
|
from sentry.issues.issue_occurrence import IssueEvidence
|
|
|
+from sentry.models.group import Group
|
|
|
from sentry.replays.testutils import mock_replay
|
|
|
from sentry.replays.usecases.ingest.events import SentryEvent
|
|
|
from sentry.replays.usecases.ingest.issue_creation import (
|
|
|
report_rage_click_issue,
|
|
|
report_rage_click_issue_with_replay_event,
|
|
|
)
|
|
|
+from sentry.testutils.helpers.features import Feature
|
|
|
from sentry.testutils.pytest.fixtures import django_db_all
|
|
|
from sentry.testutils.skips import requires_snuba
|
|
|
from tests.sentry.replays.unit.test_ingest_dom_index import mock_replay_event
|
|
@@ -149,3 +151,56 @@ def test_report_rage_click_issue_with_replay_event(mock_new_issue_occurrence, de
|
|
|
"email": "test@test.com",
|
|
|
},
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+@pytest.mark.snuba
|
|
|
+@django_db_all
|
|
|
+def test_report_rage_click_long_url(default_project):
|
|
|
+ replay_id = "b58a67446c914f44a4e329763420047b"
|
|
|
+ seq1_timestamp = datetime.now() - timedelta(minutes=10, seconds=52)
|
|
|
+ seq2_timestamp = datetime.now() - timedelta(minutes=10, seconds=35)
|
|
|
+ response = requests.post(
|
|
|
+ settings.SENTRY_SNUBA + "/tests/entities/replays/insert",
|
|
|
+ json=[
|
|
|
+ mock_replay(
|
|
|
+ seq1_timestamp,
|
|
|
+ default_project.id,
|
|
|
+ replay_id,
|
|
|
+ segment_id=0,
|
|
|
+ urls=[
|
|
|
+ "http://localhost/",
|
|
|
+ "http://localhost/home/",
|
|
|
+ "http://localhost/profile/",
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ mock_replay(seq2_timestamp, default_project.id, replay_id, segment_id=1),
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ assert response.status_code == 200
|
|
|
+
|
|
|
+ event = {
|
|
|
+ "data": {
|
|
|
+ "payload": {
|
|
|
+ "data": {
|
|
|
+ "node": {"tagName": "a"},
|
|
|
+ "endReason": "timeout",
|
|
|
+ "url": f"https://www.sentry.io{'a' * 300}",
|
|
|
+ },
|
|
|
+ "message": "div.xyz > a",
|
|
|
+ "timestamp": time.time(),
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ with Feature(
|
|
|
+ {
|
|
|
+ "organizations:replay-click-rage-ingest": True,
|
|
|
+ }
|
|
|
+ ):
|
|
|
+ report_rage_click_issue(
|
|
|
+ project_id=default_project.id, replay_id=replay_id, event=cast(SentryEvent, event)
|
|
|
+ )
|
|
|
+
|
|
|
+ # test that the Issue gets created with the truncated url
|
|
|
+ assert Group.objects.get(message__contains="div.xyz > a")
|
|
|
+ assert Group.objects.get(culprit__contains="www.sentry.io")
|