Skip to content

Commit 1f43170

Browse files
committed
Use locator instead of page.click.
1 parent 53412ca commit 1f43170

File tree

48 files changed

+141
-137
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+141
-137
lines changed

dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/dom/click/test.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,16 @@ sentryTest('captures Breadcrumb for clicks & debounces them for a second', async
2323

2424
await page.goto(url);
2525

26-
await page.click('#button1');
26+
await page.locator('#button1').click();
27+
2728
// not debounced because other target
28-
await page.click('#button2');
29+
await page.locator('#button2').click();
2930
// This should be debounced
30-
await page.click('#button2');
31+
await page.locator('#button2').click();
3132

3233
// Wait a second for the debounce to finish
3334
await page.waitForTimeout(1000);
34-
await page.click('#button2');
35+
await page.locator('#button2').click();
3536

3637
const [eventData] = await Promise.all([promise, page.evaluate('Sentry.captureException("test exception")')]);
3738

@@ -76,7 +77,7 @@ sentryTest(
7677
const promise = getFirstSentryEnvelopeRequest<Event>(page);
7778

7879
await page.goto(url);
79-
await page.click('#annotated-button');
80+
await page.locator('#annotated-button').click();
8081
await page.evaluate('Sentry.captureException("test exception")');
8182

8283
const eventData = await promise;

dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/dom/textInput/test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ sentryTest('captures Breadcrumb for events on inputs & debounced them', async ({
2323

2424
await page.goto(url);
2525

26-
await page.click('#input1');
26+
await page.locator('#input1').click();
2727
// Not debounced because other event type
2828
await page.locator('#input1').pressSequentially('John', { delay: 1 });
2929

@@ -88,7 +88,7 @@ sentryTest(
8888

8989
await page.goto(url);
9090

91-
await page.click('#annotated-input');
91+
await page.locator('#annotated-input').click();
9292
await page.locator('#annotated-input').pressSequentially('John', { delay: 1 });
9393

9494
await page.evaluate('Sentry.captureException("test exception")');

dev-packages/browser-integration-tests/suites/integrations/ContextLines/inline/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ sentryTest(
1919

2020
const eventReqPromise = waitForErrorRequestOnUrl(page, url);
2121

22-
const clickPromise = page.click('#inline-error-btn');
22+
const clickPromise = page.locator('#inline-error-btn').click();
2323

2424
const [req] = await Promise.all([eventReqPromise, clickPromise]);
2525

dev-packages/browser-integration-tests/suites/integrations/ContextLines/noAddedLines/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ sentryTest('should not add source context lines to errors from script files', as
88

99
const eventReqPromise = waitForErrorRequestOnUrl(page, url);
1010

11-
const clickPromise = page.click('#script-error-btn');
11+
const clickPromise = page.locator('#script-error-btn').click();
1212

1313
const [req] = await Promise.all([eventReqPromise, clickPromise]);
1414

dev-packages/browser-integration-tests/suites/integrations/ContextLines/scriptTag/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ sentryTest(
1919

2020
const eventReqPromise = waitForErrorRequestOnUrl(page, url);
2121

22-
const clickPromise = page.click('#inline-error-btn');
22+
const clickPromise = page.locator('#inline-error-btn').click();
2323

2424
const [req] = await Promise.all([eventReqPromise, clickPromise]);
2525

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

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ sentryTest(
4848
const url = await getLocalTestPath({ testDir: __dirname });
4949

5050
await page.goto(url);
51-
await page.click('#go-background');
52-
await page.click('#error');
51+
await page.locator('#go-background').click();
52+
await page.locator('#error').click();
5353
await new Promise(resolve => setTimeout(resolve, 1000));
5454

5555
// error, no replays
@@ -76,9 +76,9 @@ sentryTest(
7676
}),
7777
).toBe(true);
7878

79-
await page.click('#log');
80-
await page.click('#go-background');
81-
await page.click('#error2');
79+
await page.locator('#log').click();
80+
await page.locator('#go-background').click();
81+
await page.locator('#error2').click();
8282
await new Promise(resolve => setTimeout(resolve, 1000));
8383

8484
// 2 errors
@@ -98,8 +98,8 @@ sentryTest(
9898
await reqErrorPromise;
9999
expect(callsToSentry).toBeGreaterThanOrEqual(3);
100100

101-
await page.click('#log');
102-
await page.click('#go-background');
101+
await page.locator('#log').click();
102+
await page.locator('#go-background').click();
103103

104104
// Switches to session mode and then goes to background
105105
const req1 = await reqPromise1;
@@ -193,8 +193,8 @@ sentryTest(
193193
const url = await getLocalTestPath({ testDir: __dirname });
194194

195195
await page.goto(url);
196-
await page.click('#go-background');
197-
await page.click('#error');
196+
await page.locator('#go-background').click();
197+
await page.locator('#error').click();
198198
await new Promise(resolve => setTimeout(resolve, 1000));
199199

200200
// error, no replays
@@ -221,9 +221,9 @@ sentryTest(
221221
}),
222222
).toBe(true);
223223

224-
await page.click('#log');
225-
await page.click('#go-background');
226-
await page.click('#error2');
224+
await page.locator('#log').click();
225+
await page.locator('#go-background').click();
226+
await page.locator('#error2').click();
227227
await new Promise(resolve => setTimeout(resolve, 1000));
228228

229229
// 2 errors
@@ -243,8 +243,8 @@ sentryTest(
243243
await reqErrorPromise;
244244
expect(callsToSentry).toEqual(3);
245245

246-
await page.click('#log');
247-
await page.click('#go-background');
246+
await page.locator('#log').click();
247+
await page.locator('#go-background').click();
248248

249249
// Has stopped recording, should make no more calls to Sentry
250250
expect(callsToSentry).toEqual(3);
@@ -336,8 +336,8 @@ sentryTest(
336336
}),
337337
).toBe(true);
338338

339-
await page.click('#go-background');
340-
await page.click('#error');
339+
await page.locator('#go-background').click();
340+
await page.locator('#error').click();
341341
await new Promise(resolve => setTimeout(resolve, 1000));
342342

343343
// 1 unsampled error, no replay
@@ -357,7 +357,7 @@ sentryTest(
357357
const [req0] = await Promise.all([
358358
// 1 unsampled error, 1 sampled error -> 1 flush
359359
reqPromise0,
360-
page.click('#error2'),
360+
page.locator('#error2').click(),
361361
]);
362362

363363
const reqError1 = await reqErrorPromise1;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ sentryTest('continues buffer session in session mode after error & reload', asyn
2828
await page.goto(url);
2929

3030
// buffer session captures an error & switches to session mode
31-
await page.click('#buttonError');
31+
await page.locator('#buttonError').click();
3232
await new Promise(resolve => setTimeout(resolve, 300));
3333
await reqPromise1;
3434

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ sentryTest('should capture console messages in replay', async ({ getLocalTestPat
3434
5_000,
3535
);
3636

37-
await page.click('[data-log]');
37+
await page.locator('[data-log]').click();
3838

3939
// Sometimes this doesn't seem to trigger, so we trigger it twice to be sure...
40-
const [req1] = await Promise.all([reqPromise1, page.click('[data-log]')]);
40+
const [req1] = await Promise.all([reqPromise1, page.locator('[data-log]').click()]);
4141
await forceFlushReplay();
4242

4343
const { breadcrumbs } = getCustomRecordingEvents(req1);
@@ -87,7 +87,7 @@ sentryTest('should capture very large console logs', async ({ getLocalTestPath,
8787
5_000,
8888
);
8989

90-
const [req1] = await Promise.all([reqPromise1, page.click('[data-log-large]')]);
90+
const [req1] = await Promise.all([reqPromise1, page.locator('[data-log-large]').click()]);
9191
await forceFlushReplay();
9292

9393
const { breadcrumbs } = getCustomRecordingEvents(req1);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ sentryTest('should capture replays (@sentry/browser export)', async ({ getLocalT
2525
await page.goto(url);
2626
const replayEvent0 = getReplayEvent(await reqPromise0);
2727

28-
await page.click('button');
28+
await page.locator('button').click();
2929
const replayEvent1 = getReplayEvent(await reqPromise1);
3030

3131
expect(replayEvent0).toBeDefined();

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
</head>
66
<body>
77
<div role="button" id="error" class="btn btn-error" aria-label="An Error in aria-label">An Error</div>
8-
<button title="Button title">
8+
<button id="img-button" title="Button title">
99
<img id="img" alt="Alt Text" />
1010
</button>
1111
<button class="sentry-unmask" aria-label="Unmasked label">Unmasked</button>

0 commit comments

Comments
 (0)