Skip to content

Commit c4f83fd

Browse files
committed
idk trying this
1 parent 05a3bd9 commit c4f83fd

File tree

2 files changed

+46
-40
lines changed

2 files changed

+46
-40
lines changed

packages/integration-tests/suites/replay/privacyInput/test.ts

Lines changed: 42 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -39,63 +39,67 @@ sentryTest('should mask input initial value and its changes', async ({ getLocalT
3939

4040
const text = 'test';
4141

42-
await page.locator('#input').type(text);
42+
page.on('console', message => console.log(message.text()))
43+
await page.locator('#input').type(text, { timeout: 5000 });
4344
await forceFlushReplay();
4445
const snapshots = getIncrementalRecordingSnapshots(await reqPromise1).filter(isInputMutation);
4546
const lastSnapshot = snapshots[snapshots.length - 1];
4647
expect(lastSnapshot.text).toBe(text);
4748

48-
await page.locator('#input-masked').type(text);
49+
await page.locator('#input-masked').type(text, { timeout: 5000 });
4950
await forceFlushReplay();
5051
const snapshots2 = getIncrementalRecordingSnapshots(await reqPromise2).filter(isInputMutation);
5152
const lastSnapshot2 = snapshots2[snapshots2.length - 1];
5253
expect(lastSnapshot2.text).toBe('*'.repeat(text.length));
5354

54-
await page.locator('#input-ignore').type(text);
55+
await page.locator('#input-ignore').type(text, { timeout: 5000 });
5556
await forceFlushReplay();
5657
const snapshots3 = getIncrementalRecordingSnapshots(await reqPromise3).filter(isInputMutation);
5758
expect(snapshots3.length).toBe(0);
5859
});
5960

60-
sentryTest('should mask textarea initial value and its changes', async ({ getLocalTestPath, forceFlushReplay, page }) => {
61-
if (shouldSkipReplayTest()) {
62-
sentryTest.skip();
63-
}
64-
65-
const reqPromise0 = waitForReplayRequest(page, 0);
66-
const reqPromise1 = waitForReplayRequest(page, 1);
67-
const reqPromise2 = waitForReplayRequest(page, 2);
68-
const reqPromise3 = waitForReplayRequest(page, 3);
69-
70-
await page.route('https://dsn.ingest.sentry.io/**/*', route => {
71-
return route.fulfill({
72-
status: 200,
73-
contentType: 'application/json',
74-
body: JSON.stringify({ id: 'test-id' }),
61+
sentryTest(
62+
'should mask textarea initial value and its changes',
63+
async ({ getLocalTestPath, forceFlushReplay, page }) => {
64+
if (shouldSkipReplayTest()) {
65+
sentryTest.skip();
66+
}
67+
68+
const reqPromise0 = waitForReplayRequest(page, 0);
69+
const reqPromise1 = waitForReplayRequest(page, 1);
70+
const reqPromise2 = waitForReplayRequest(page, 2);
71+
const reqPromise3 = waitForReplayRequest(page, 3);
72+
73+
await page.route('https://dsn.ingest.sentry.io/**/*', route => {
74+
return route.fulfill({
75+
status: 200,
76+
contentType: 'application/json',
77+
body: JSON.stringify({ id: 'test-id' }),
78+
});
7579
});
76-
});
7780

78-
const url = await getLocalTestPath({ testDir: __dirname });
81+
const url = await getLocalTestPath({ testDir: __dirname });
7982

80-
await page.goto(url);
83+
await page.goto(url);
8184

82-
await reqPromise0;
85+
await reqPromise0;
8386

84-
const text = 'test';
85-
await page.locator('#textarea').type(text);
86-
await forceFlushReplay();
87-
const snapshots = getIncrementalRecordingSnapshots(await reqPromise1).filter(isInputMutation);
88-
const lastSnapshot = snapshots[snapshots.length - 1];
89-
expect(lastSnapshot.text).toBe(text);
87+
const text = 'test';
88+
await page.locator('#textarea').type(text, { timeout: 5000 });
89+
await forceFlushReplay();
90+
const snapshots = getIncrementalRecordingSnapshots(await reqPromise1).filter(isInputMutation);
91+
const lastSnapshot = snapshots[snapshots.length - 1];
92+
expect(lastSnapshot.text).toBe(text);
9093

91-
await page.locator('#textarea-masked').type(text);
92-
await forceFlushReplay();
93-
const snapshots2 = getIncrementalRecordingSnapshots(await reqPromise2).filter(isInputMutation);
94-
const lastSnapshot2 = snapshots2[snapshots2.length - 1];
95-
expect(lastSnapshot2.text).toBe('*'.repeat(text.length));
94+
await page.locator('#textarea-masked').type(text, { timeout: 5000 });
95+
await forceFlushReplay();
96+
const snapshots2 = getIncrementalRecordingSnapshots(await reqPromise2).filter(isInputMutation);
97+
const lastSnapshot2 = snapshots2[snapshots2.length - 1];
98+
expect(lastSnapshot2.text).toBe('*'.repeat(text.length));
9699

97-
await page.locator('#textarea-ignore').type(text);
98-
await forceFlushReplay();
99-
const snapshots3 = getIncrementalRecordingSnapshots(await reqPromise3).filter(isInputMutation);
100-
expect(snapshots3.length).toBe(0);
101-
});
100+
await page.locator('#textarea-ignore').type(text, { timeout: 5000 });
101+
await forceFlushReplay();
102+
const snapshots3 = getIncrementalRecordingSnapshots(await reqPromise3).filter(isInputMutation);
103+
expect(snapshots3.length).toBe(0);
104+
},
105+
);

packages/integration-tests/utils/fixtures.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,17 @@ const sentryTest = base.extend<TestFixtures>({
9595
},
9696

9797
forceFlushReplay: ({ page }, use) => {
98-
return use(() => page.evaluate(`
98+
return use(() =>
99+
page.evaluate(`
99100
Object.defineProperty(document, 'visibilityState', {
100101
configurable: true,
101102
get: function () {
102103
return 'hidden';
103104
},
104105
});
105106
document.dispatchEvent(new Event('visibilitychange'));
106-
`));
107+
`),
108+
);
107109
},
108110
});
109111

0 commit comments

Comments
 (0)