Skip to content

Commit 4ffc81a

Browse files
authored
test(replay): Add test for ignoring file inputs for dead clicks (#14227)
1 parent 11fdb3c commit 4ffc81a

File tree

2 files changed

+43
-1
lines changed

2 files changed

+43
-1
lines changed

dev-packages/browser-integration-tests/suites/replay/slowClick/ignore/test.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,44 @@ sentryTest('click is ignored on div', async ({ getLocalTestUrl, page }) => {
8686
},
8787
]);
8888
});
89+
90+
sentryTest('click is ignored on input file by default', async ({ getLocalTestUrl, page }) => {
91+
if (shouldSkipReplayTest()) {
92+
sentryTest.skip();
93+
}
94+
95+
const url = await getLocalTestUrl({ testDir: __dirname });
96+
97+
await Promise.all([waitForReplayRequest(page, 0), page.goto(url)]);
98+
99+
const [req1] = await Promise.all([
100+
waitForReplayRequest(page, (event, res) => {
101+
const { breadcrumbs } = getCustomRecordingEvents(res);
102+
103+
return breadcrumbs.some(breadcrumb => breadcrumb.category === 'ui.click');
104+
}),
105+
page.locator('#inputFile').click(),
106+
]);
107+
108+
const { breadcrumbs } = getCustomRecordingEvents(req1);
109+
110+
expect(breadcrumbs).toEqual([
111+
{
112+
category: 'ui.click',
113+
data: {
114+
node: {
115+
attributes: {
116+
id: 'inputFile',
117+
},
118+
id: expect.any(Number),
119+
tagName: 'input',
120+
textContent: '',
121+
},
122+
nodeId: expect.any(Number),
123+
},
124+
message: 'body > input#inputFile[type="file"]',
125+
timestamp: expect.any(Number),
126+
type: 'default',
127+
},
128+
]);
129+
});

dev-packages/browser-integration-tests/suites/replay/slowClick/template.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html>
33
<head>
44
<meta charset="utf-8" />
@@ -27,6 +27,7 @@
2727
<input type="button" id="inputButton" value="Input button" />
2828
<input type="submit" id="inputSubmit" value="Input submit" />
2929
<input type="text" id="inputText" />
30+
<input type="file" id="inputFile" />
3031

3132
<h1 id="h1">Heading</h1>
3233

0 commit comments

Comments
 (0)