Skip to content

Commit

Permalink
test(replay): Add test for ignoring file inputs for dead clicks (#14227)
Browse files Browse the repository at this point in the history
  • Loading branch information
chargome authored Nov 19, 2024
1 parent 11fdb3c commit 4ffc81a
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
]);
});
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
Expand Down Expand Up @@ -27,6 +27,7 @@
<input type="button" id="inputButton" value="Input button" />
<input type="submit" id="inputSubmit" value="Input submit" />
<input type="text" id="inputText" />
<input type="file" id="inputFile" />

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

Expand Down

0 comments on commit 4ffc81a

Please sign in to comment.