Repository navigation
ref(replays): Add component name to selector - #68631
Conversation
Bundle ReportChanges will increase total bundle size by 5.39kB ⬆️
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #68631 +/- ##
========================================
Coverage 79.76% 79.77%
========================================
Files 6409 6413 +4
Lines 283806 284152 +346
Branches 48903 48980 +77
========================================
+ Hits 226384 226679 +295
- Misses 57035 57086 +51
Partials 387 387
|
| assert ( | ||
| response_data["data"][0]["dom_element"] | ||
| == 'div#myid.class1.class2[role="button"][alt="Alt"][testid="1"][aria="AriaLabel"][title="MyTitle"]' | ||
| == 'SignUpForm[role="button"][alt="Alt"][testid="1"][aria="AriaLabel"][title="MyTitle"]' |
There was a problem hiding this comment.
looks like tag along with id and class attrs are gone, replaced by the component name. other attrs remain.
There was a problem hiding this comment.
yes if the component name exists, we want to show the component name everywhere instead of the tag, id and class since it's more readable and descriptive. This also makes it so that you can search the component name in dead and rage selectors.
There was a problem hiding this comment.
We might want to leave id in there, it's generally pretty descriptive/readable and not autogenerated like class
| @@ -77,19 +77,19 @@ class ReplayExamples: | |||
| { | |||
There was a problem hiding this comment.
could we also keep an example where there isn't a component name? could just be another elem in the data array
| assert ( | ||
| response_data["data"][0]["dom_element"] | ||
| == 'div#myid.class1.class2[role="button"][alt="Alt"][testid="1"][aria="AriaLabel"][title="MyTitle"]' | ||
| == 'SignUpForm[role="button"][alt="Alt"][testid="1"][aria="AriaLabel"][title="MyTitle"]' |
There was a problem hiding this comment.
We might want to leave id in there, it's generally pretty descriptive/readable and not autogenerated like class
| if row["click_component_name"]: | ||
| selector = row["click_component_name"] | ||
| if row["click_id"]: | ||
| selector = selector + f"#{row['click_id']}" |
There was a problem hiding this comment.
Is there a reason we don't want to include the classes? They are part of the aggregation key as well.
There was a problem hiding this comment.
we want to switch to use component name if that's available since the class is usually autogenerated in react and not descriptive
There was a problem hiding this comment.
We're still aggregating by class. We're hiding the true name of the aggregation key not altering the aggregation. We should remove class aggregation if its not valuable.
There was a problem hiding this comment.
Ah, can we generate a "display name" type selector on the frontend and keep the selector the same?
There was a problem hiding this comment.
I think we want to be able to search by the component name in the r&d selectors too, which would require changing the selectors.
There was a problem hiding this comment.
Searching is a different problem to aggregation. We can search by component name regardless of this change.
If we're aggregating two rows:
| Component Name | Classes |
|---|---|
| SignUpForm | [blue, square] |
| SignUpForm | [red, circle] |
Should we return:
["SignUpFrom", "SignUpForm"]Or should we return:
["SignUpFrom"]Or should we return:
["SignUpFrom.blue.square", "SignUpForm.red.circle"]There was a problem hiding this comment.
We are keeping the selector mostly the same, except with an added component name attribute, and we will generate a "display name" type selector in the frontend
cmanallen
left a comment
There was a problem hiding this comment.
@c298lee Can you write test coverage that asserts your component_name attribute is searchable. You can updates this test here:
sentry/tests/sentry/replays/test_organization_replay_index.py
Lines 1131 to 1166 in cdbd524
There's already a mock component SignUpForm so no need to insert anything in the database. Just add a selector filter to the list and whatever code is needed to transform the selector to a valid query.
Adds the component name to the selector as an attribute.
Example:
div#myid.class1.class2[role="button"][alt="Alt"][testid="1"][aria="AriaLabel"][title="MyTitle"][component_name="SignUpForm"]Relates to #64673