Skip to content

Commit 9858f4e

Browse files
committed
Update playwright tests
1 parent 8d0a63f commit 9858f4e

File tree

4 files changed

+47
-20
lines changed

4 files changed

+47
-20
lines changed

dev-packages/browser-integration-tests/suites/integrations/supabase/queues-rpc/init.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ Sentry.init({
1818
// Simulate queue operations
1919
async function performQueueOperations() {
2020
try {
21-
await supabaseClient.rpc('enqueue', {
21+
await supabaseClient.rpc('send', {
2222
queue_name: 'todos',
2323
msg: { title: 'Test Todo' },
2424
});
2525

26-
await supabaseClient.rpc('dequeue', {
26+
await supabaseClient.rpc('pop', {
2727
queue_name: 'todos',
2828
});
2929
} catch (error) {

dev-packages/browser-integration-tests/suites/integrations/supabase/queues-rpc/test.ts

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,24 @@ import { sentryTest } from '../../../../utils/fixtures';
55
import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers';
66

77
async function mockSupabaseRoute(page: Page) {
8-
await page.route('**/rest/v1/rpc**', route => {
8+
await page.route('**/rpc/**/send', route => {
99
return route.fulfill({
1010
status: 200,
11-
body: JSON.stringify({
12-
foo: ['bar', 'baz'],
13-
}),
11+
body: JSON.stringify([0]),
12+
headers: {
13+
'Content-Type': 'application/json',
14+
},
15+
});
16+
});
17+
18+
await page.route('**/rpc/**/pop', route => {
19+
return route.fulfill({
20+
status: 200,
21+
body: JSON.stringify([
22+
{
23+
msg_id: 0,
24+
},
25+
]),
1426
headers: {
1527
'Content-Type': 'application/json',
1628
},
@@ -25,16 +37,16 @@ if (bundle.startsWith('bundle')) {
2537
}
2638

2739
sentryTest('should capture Supabase queue spans from client.rpc', async ({ getLocalTestUrl, page }) => {
28-
await mockSupabaseRoute(page);
29-
3040
if (shouldSkipTracingTest()) {
3141
return;
3242
}
3343

44+
await mockSupabaseRoute(page);
45+
3446
const url = await getLocalTestUrl({ testDir: __dirname });
3547

3648
const event = await getFirstSentryEnvelopeRequest<Event>(page, url);
37-
const queueSpans = event.spans?.filter(({ op }) => op?.startsWith('queue'));
49+
const queueSpans = event.spans?.filter(({ op }) => op?.startsWith('queue.'));
3850

3951
expect(queueSpans).toHaveLength(2);
4052

@@ -49,7 +61,7 @@ sentryTest('should capture Supabase queue spans from client.rpc', async ({ getLo
4961
'sentry.op': 'queue.publish',
5062
'sentry.origin': 'auto.db.supabase',
5163
'messaging.destination.name': 'todos',
52-
'messaging.message.id': 'Test Todo',
64+
'messaging.message.id': '0',
5365
}),
5466
});
5567

@@ -64,6 +76,7 @@ sentryTest('should capture Supabase queue spans from client.rpc', async ({ getLo
6476
'sentry.op': 'queue.process',
6577
'sentry.origin': 'auto.db.supabase',
6678
'messaging.destination.name': 'todos',
79+
'messaging.message.id': '0',
6780
}),
6881
});
6982
});

dev-packages/browser-integration-tests/suites/integrations/supabase/queues-schema/init.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ Sentry.init({
1818
// Simulate queue operations
1919
async function performQueueOperations() {
2020
try {
21-
await supabaseClient.schema('pgmq_public').rpc('enqueue', {
21+
await supabaseClient.schema('pgmq_public').rpc('send', {
2222
queue_name: 'todos',
2323
msg: { title: 'Test Todo' },
2424
});
2525

26-
await supabaseClient.schema('pgmq_public').rpc('dequeue', {
26+
await supabaseClient.schema('pgmq_public').rpc('pop', {
2727
queue_name: 'todos',
2828
});
2929
} catch (error) {

dev-packages/browser-integration-tests/suites/integrations/supabase/queues-schema/test.ts

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,24 @@ import { sentryTest } from '../../../../utils/fixtures';
44
import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers';
55

66
async function mockSupabaseRoute(page: Page) {
7-
await page.route('**/rest/v1/rpc**', route => {
7+
await page.route('**/rpc/**/send', route => {
88
return route.fulfill({
99
status: 200,
10-
body: JSON.stringify({
11-
foo: ['bar', 'baz'],
12-
}),
10+
body: JSON.stringify([0]),
11+
headers: {
12+
'Content-Type': 'application/json',
13+
},
14+
});
15+
});
16+
17+
await page.route('**/rpc/**/pop', route => {
18+
return route.fulfill({
19+
status: 200,
20+
body: JSON.stringify([
21+
{
22+
msg_id: 0,
23+
},
24+
]),
1325
headers: {
1426
'Content-Type': 'application/json',
1527
},
@@ -24,16 +36,17 @@ if (bundle.startsWith('bundle')) {
2436
}
2537

2638
sentryTest('should capture Supabase queue spans from client.schema(...).rpc', async ({ getLocalTestUrl, page }) => {
27-
await mockSupabaseRoute(page);
28-
2939
if (shouldSkipTracingTest()) {
3040
return;
3141
}
3242

43+
await mockSupabaseRoute(page);
44+
3345
const url = await getLocalTestUrl({ testDir: __dirname });
3446

3547
const event = await getFirstSentryEnvelopeRequest<Event>(page, url);
36-
const queueSpans = event.spans?.filter(({ op }) => op?.startsWith('queue'));
48+
49+
const queueSpans = event.spans?.filter(({ op }) => op?.startsWith('queue.'));
3750

3851
expect(queueSpans).toHaveLength(2);
3952

@@ -48,7 +61,7 @@ sentryTest('should capture Supabase queue spans from client.schema(...).rpc', as
4861
'sentry.op': 'queue.publish',
4962
'sentry.origin': 'auto.db.supabase',
5063
'messaging.destination.name': 'todos',
51-
'messaging.message.id': 'Test Todo',
64+
'messaging.message.id': '0',
5265
}),
5366
});
5467

@@ -63,6 +76,7 @@ sentryTest('should capture Supabase queue spans from client.schema(...).rpc', as
6376
'sentry.op': 'queue.process',
6477
'sentry.origin': 'auto.db.supabase',
6578
'messaging.destination.name': 'todos',
79+
'messaging.message.id': '0',
6680
}),
6781
});
6882
});

0 commit comments

Comments
 (0)