Skip to content

Commit

Permalink
Add click field for data-sentry-component attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
cmanallen authored and giovanni-guidini committed Dec 20, 2023
1 parent 658f707 commit eb8bdb3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/sentry/replays/usecases/ingest/dom_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"event_hash": str,
"id": str,
"node_id": int,
"react_component_name": str,
"role": str,
"tag": str,
"testid": str,
Expand Down Expand Up @@ -296,6 +297,7 @@ def create_click_event(
"testid": _get_testid(attributes)[:64],
"aria_label": attributes.get("aria-label", "")[:64],
"title": attributes.get("title", "")[:64],
"react_component_name": attributes.get("data-sentry-component", "")[:64],
"is_dead": int(is_dead),
"is_rage": int(is_rage),
"timestamp": int(payload["timestamp"]),
Expand Down
10 changes: 10 additions & 0 deletions tests/sentry/replays/unit/test_ingest_dom_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def test_get_user_actions():
"alt": "1",
"data-testid": "2",
"title": "3",
"data-sentry-component": "SignUpForm",
},
"textContent": "Hello, world!",
},
Expand All @@ -61,6 +62,7 @@ def test_get_user_actions():
assert user_actions[0]["testid"] == "2"
assert user_actions[0]["aria_label"] == "test"
assert user_actions[0]["title"] == "3"
assert user_actions[0]["react_component_name"] == "SignUpForm"
assert user_actions[0]["is_dead"] == 0
assert user_actions[0]["is_rage"] == 0
assert user_actions[0]["timestamp"] == 1674298825
Expand Down Expand Up @@ -114,6 +116,7 @@ def test_parse_replay_actions():
"alt": "1",
"data-testid": "2",
"title": "3",
"data-sentry-component": "SignUpForm",
},
"textContent": "text",
},
Expand Down Expand Up @@ -148,6 +151,7 @@ def test_parse_replay_actions():
assert action["alt"] == "1"
assert action["testid"] == "2"
assert action["title"] == "3"
assert action["react_component_name"] == "SignUpForm"
assert action["is_dead"] == 0
assert action["is_rage"] == 0
assert action["timestamp"] == 1
Expand Down Expand Up @@ -181,6 +185,7 @@ def test_parse_replay_dead_click_actions():
"alt": "1",
"data-testid": "2",
"title": "3",
"data-sentry-component": "SignUpForm",
},
"textContent": "text",
},
Expand Down Expand Up @@ -214,6 +219,7 @@ def test_parse_replay_dead_click_actions():
"alt": "1",
"data-testid": "2",
"title": "3",
"data-sentry-component": "SignUpForm",
},
"textContent": "text",
},
Expand Down Expand Up @@ -248,6 +254,7 @@ def test_parse_replay_dead_click_actions():
"alt": "1",
"data-testid": "2",
"title": "3",
"data-sentry-component": "SignUpForm",
},
"textContent": "text",
},
Expand Down Expand Up @@ -282,6 +289,7 @@ def test_parse_replay_dead_click_actions():
assert action["alt"] == "1"
assert action["testid"] == "2"
assert action["title"] == "3"
assert action["react_component_name"] == "SignUpForm"
assert action["is_dead"] == 1
assert action["is_rage"] == 0
assert action["timestamp"] == 1
Expand Down Expand Up @@ -326,6 +334,7 @@ def test_parse_replay_rage_click_actions():
"alt": "1",
"data-testid": "2",
"title": "3",
"data-sentry-component": "SignUpForm",
},
"textContent": "text",
},
Expand Down Expand Up @@ -360,6 +369,7 @@ def test_parse_replay_rage_click_actions():
assert action["alt"] == "1"
assert action["testid"] == "2"
assert action["title"] == "3"
assert action["react_component_name"] == "SignUpForm"
assert action["is_dead"] == 1
assert action["is_rage"] == 1
assert action["timestamp"] == 1
Expand Down

0 comments on commit eb8bdb3

Please sign in to comment.