Skip to content

ci(e2e-test): Switch to https://example.com from http equivalent for Next.js e2e tests #15052

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useEffect } from 'react';
export default function FetchPage() {
useEffect(() => {
// test that a span is created in the pageload transaction for this fetch request
fetch('http://example.com').catch(() => {
fetch('https://example.com').catch(() => {
// no-empty
});
}, []);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect, test } from '@playwright/test';
import { waitForTransaction } from '@sentry-internal/test-utils';

test('should correctly instrument `fetch` for performance tracing', async ({ page }) => {
await page.route('http://example.com/**/*', route => {
await page.route('https://example.com/**/*', route => {
return route.fulfill({
status: 200,
body: JSON.stringify({
Expand Down Expand Up @@ -34,16 +34,16 @@ test('should correctly instrument `fetch` for performance tracing', async ({ pag
expect.objectContaining({
data: {
'http.method': 'GET',
url: 'http://example.com',
'http.url': 'http://example.com/',
url: 'https://example.com',
'http.url': 'https://example.com/',
'server.address': 'example.com',
type: 'fetch',
'http.response_content_length': expect.any(Number),
'http.response.status_code': 200,
'sentry.op': 'http.client',
'sentry.origin': 'auto.http.browser',
},
description: 'GET http://example.com',
description: 'GET https://example.com',
op: 'http.client',
parent_span_id: expect.stringMatching(/[a-f0-9]{16}/),
span_id: expect.stringMatching(/[a-f0-9]{16}/),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import http from 'http';
import https from 'https';

export const dynamic = 'force-dynamic';

export default async function Page() {
await fetch('http://example.com/', { cache: 'no-cache' }).then(res => res.text());
await fetch('https://example.com/', { cache: 'no-cache' }).then(res => res.text());
await new Promise<void>(resolve => {
http.get('http://example.com/', res => {
https.get('https://example.com/', res => {
res.on('data', () => {
// Noop consuming some data so that request can close :)
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ test('Should send a transaction with a fetch span', async ({ page }) => {
'sentry.op': 'http.client',
'sentry.origin': 'auto.http.otel.node_fetch',
}),
description: 'GET http://example.com/',
description: 'GET https://example.com/',
}),
);

Expand All @@ -30,7 +30,7 @@ test('Should send a transaction with a fetch span', async ({ page }) => {
'sentry.op': 'http.client',
'sentry.origin': 'auto.http.otel.http',
}),
description: 'GET http://example.com/',
description: 'GET https://example.com/',
}),
);
});
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default async function Page() {
}

export async function generateMetadata() {
(await fetch('http://example.com/', { cache: 'no-store' })).text();
(await fetch('https://example.com/', { cache: 'no-store' })).text();

return {
title: 'my title',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export const dynamic = 'force-dynamic';

export default async function Page() {
try {
use(fetch('http://example.com/'));
use(fetch('https://example.com/'));
} catch (e) {
Sentry.captureException(e); // This error should not be reported
await new Promise(resolve => setTimeout(resolve, 1000)); // Wait for any async event processors to run
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default function ServerComponent() {
'myServerAction',
{ formData, headers: headers(), recordResponse: true },
async () => {
await fetch('http://example.com/');
await fetch('https://example.com/');
return { city: 'Vienna' };
},
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { NextApiRequest, NextApiResponse } from 'next';

export default (_req: NextApiRequest, res: NextApiResponse) => {
// make an outgoing request in order to test that the `Http` integration creates a span
get('http://example.com/', message => {
get('https://example.com/', message => {
message.on('data', () => {
// Noop consuming some data so that request can close :)
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ test.skip('Should send a transaction with a http span', async ({ request }) => {
'sentry.op': 'http.client',
'sentry.origin': 'auto.http.otel.http',
}),
description: 'GET http://example.com/',
description: 'GET https://example.com/',
}),
);
});
Loading