Skip to content

Commit ddd2bbd

Browse files
committed
Use locator instead of page.click.
1 parent aa7a960 commit ddd2bbd

File tree

49 files changed

+142
-138
lines changed

Some content is hidden

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

49 files changed

+142
-138
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
@@ -75,9 +75,9 @@ sentryTest(
7575
}),
7676
).toBe(true);
7777

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

8383
// 2 errors
@@ -96,8 +96,8 @@ sentryTest(
9696
await reqErrorPromise;
9797
expect(callsToSentry).toBeGreaterThanOrEqual(3);
9898

99-
await page.click('#log');
100-
await page.click('#go-background');
99+
await page.locator('#log').click();
100+
await page.locator('#go-background').click();
101101

102102
// Switches to session mode and then goes to background
103103
const req1 = await reqPromise1;
@@ -191,8 +191,8 @@ sentryTest(
191191
const url = await getLocalTestPath({ testDir: __dirname });
192192

193193
await page.goto(url);
194-
await page.click('#go-background');
195-
await page.click('#error');
194+
await page.locator('#go-background').click();
195+
await page.locator('#error').click();
196196
await new Promise(resolve => setTimeout(resolve, 1000));
197197

198198
// error, no replays
@@ -218,9 +218,9 @@ sentryTest(
218218
}),
219219
).toBe(true);
220220

221-
await page.click('#log');
222-
await page.click('#go-background');
223-
await page.click('#error2');
221+
await page.locator('#log').click();
222+
await page.locator('#go-background').click();
223+
await page.locator('#error2').click();
224224
await new Promise(resolve => setTimeout(resolve, 1000));
225225

226226
// 2 errors
@@ -239,8 +239,8 @@ sentryTest(
239239
await reqErrorPromise;
240240
expect(callsToSentry).toEqual(3);
241241

242-
await page.click('#log');
243-
await page.click('#go-background');
242+
await page.locator('#log').click();
243+
await page.locator('#go-background').click();
244244

245245
// Has stopped recording, should make no more calls to Sentry
246246
expect(callsToSentry).toEqual(3);
@@ -331,8 +331,8 @@ sentryTest(
331331
}),
332332
).toBe(true);
333333

334-
await page.click('#go-background');
335-
await page.click('#error');
334+
await page.locator('#go-background').click();
335+
await page.locator('#error').click();
336336
await new Promise(resolve => setTimeout(resolve, 1000));
337337

338338
// 1 unsampled error, no replay
@@ -351,7 +351,7 @@ sentryTest(
351351
const [req0] = await Promise.all([
352352
// 1 unsampled error, 1 sampled error -> 1 flush
353353
reqPromise0,
354-
page.click('#error2'),
354+
page.locator('#error2').click(),
355355
]);
356356

357357
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/canvas/records/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ sentryTest('can record canvas', async ({ getLocalTestUrl, page, browserName }) =
2424

2525
await page.goto(url);
2626
await reqPromise0;
27-
await Promise.all([page.click('#draw'), reqPromise1]);
27+
await Promise.all([page.locator('#draw').click(), reqPromise1]);
2828

2929
const { incrementalSnapshots } = getReplayRecordingContent(await reqPromise2);
3030
expect(incrementalSnapshots).toEqual(

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();

0 commit comments

Comments
 (0)