From ab867d4f43c139d9086ba2dd3c8776625205ea3e Mon Sep 17 00:00:00 2001 From: Charly Gomez Date: Mon, 11 Nov 2024 16:18:22 +0100 Subject: [PATCH 1/3] add default values to slow click ignore selector --- packages/replay-internal/src/integration.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/replay-internal/src/integration.ts b/packages/replay-internal/src/integration.ts index 1f690f9af88a..703aa6d58bda 100644 --- a/packages/replay-internal/src/integration.ts +++ b/packages/replay-internal/src/integration.ts @@ -32,6 +32,8 @@ const MEDIA_SELECTORS = const DEFAULT_NETWORK_HEADERS = ['content-length', 'content-type', 'accept']; +const DEFAULT_SLOW_CLICK_IGNORE_SELECTORS = ['input[type="file"]']; + let _initialized = false; /** @@ -102,7 +104,7 @@ export class Replay implements Integration { mutationLimit = 10_000, slowClickTimeout = 7_000, - slowClickIgnoreSelectors = [], + slowClickIgnoreSelectors = DEFAULT_SLOW_CLICK_IGNORE_SELECTORS, networkDetailAllowUrls = [], networkDetailDenyUrls = [], From 8c2c6dab398731bb05ae011e60707d50b673b749 Mon Sep 17 00:00:00 2001 From: Charly Gomez Date: Mon, 11 Nov 2024 16:18:29 +0100 Subject: [PATCH 2/3] add test --- .../suites/replay/slowClick/ignore/test.ts | 41 +++++++++++++++++++ .../suites/replay/slowClick/template.html | 3 +- 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/dev-packages/browser-integration-tests/suites/replay/slowClick/ignore/test.ts b/dev-packages/browser-integration-tests/suites/replay/slowClick/ignore/test.ts index 1928bfcf2c2e..475453f6b3f0 100644 --- a/dev-packages/browser-integration-tests/suites/replay/slowClick/ignore/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/slowClick/ignore/test.ts @@ -86,3 +86,44 @@ sentryTest('click is ignored on div', async ({ getLocalTestUrl, page }) => { }, ]); }); + +sentryTest('click is ignored on input file by default', async ({ getLocalTestUrl, page }) => { + if (shouldSkipReplayTest()) { + sentryTest.skip(); + } + + const url = await getLocalTestUrl({ testDir: __dirname }); + + await Promise.all([waitForReplayRequest(page, 0), page.goto(url)]); + + const [req1] = await Promise.all([ + waitForReplayRequest(page, (event, res) => { + const { breadcrumbs } = getCustomRecordingEvents(res); + + return breadcrumbs.some(breadcrumb => breadcrumb.category === 'ui.click'); + }), + page.locator('#inputFile').click(), + ]); + + const { breadcrumbs } = getCustomRecordingEvents(req1); + + expect(breadcrumbs).toEqual([ + { + category: 'ui.click', + data: { + node: { + attributes: { + id: 'inputFile', + }, + id: expect.any(Number), + tagName: 'input', + textContent: '', + }, + nodeId: expect.any(Number), + }, + message: 'body > input#inputFile[type="file"]', + timestamp: expect.any(Number), + type: 'default', + }, + ]); +}); diff --git a/dev-packages/browser-integration-tests/suites/replay/slowClick/template.html b/dev-packages/browser-integration-tests/suites/replay/slowClick/template.html index 45cc78aef02e..a3f5d9d54882 100644 --- a/dev-packages/browser-integration-tests/suites/replay/slowClick/template.html +++ b/dev-packages/browser-integration-tests/suites/replay/slowClick/template.html @@ -1,4 +1,4 @@ - + @@ -27,6 +27,7 @@ +

Heading

From 737e7bc5de4a4412ae142f34f92f436fae6de60f Mon Sep 17 00:00:00 2001 From: Charly Gomez Date: Thu, 14 Nov 2024 09:42:59 +0100 Subject: [PATCH 3/3] remove default selectors --- packages/replay-internal/src/integration.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/replay-internal/src/integration.ts b/packages/replay-internal/src/integration.ts index 703aa6d58bda..1f690f9af88a 100644 --- a/packages/replay-internal/src/integration.ts +++ b/packages/replay-internal/src/integration.ts @@ -32,8 +32,6 @@ const MEDIA_SELECTORS = const DEFAULT_NETWORK_HEADERS = ['content-length', 'content-type', 'accept']; -const DEFAULT_SLOW_CLICK_IGNORE_SELECTORS = ['input[type="file"]']; - let _initialized = false; /** @@ -104,7 +102,7 @@ export class Replay implements Integration { mutationLimit = 10_000, slowClickTimeout = 7_000, - slowClickIgnoreSelectors = DEFAULT_SLOW_CLICK_IGNORE_SELECTORS, + slowClickIgnoreSelectors = [], networkDetailAllowUrls = [], networkDetailDenyUrls = [],