Skip to content

Commit

Permalink
Merge branch 'develop' into filesToDeleteAfterUpload-opt
Browse files Browse the repository at this point in the history
  • Loading branch information
julianCast committed Sep 16, 2024
2 parents 90730cf + 8d2e189 commit 3286596
Show file tree
Hide file tree
Showing 47 changed files with 400 additions and 148 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,13 @@ jobs:
overwrite: true
retention-days: 7

- name: Upload test results to Codecov
if: cancelled() == false
uses: codecov/test-results-action@v1
with:
directory: dev-packages/browser-integration-tests
token: ${{ secrets.CODECOV_TOKEN }}

job_browser_loader_tests:
name: PW ${{ matrix.bundle }} Tests
needs: [job_get_metadata, job_build]
Expand Down Expand Up @@ -653,6 +660,7 @@ jobs:
run: |
cd dev-packages/browser-integration-tests
yarn test:loader
- name: Upload Playwright Traces
uses: actions/upload-artifact@v4
if: failure()
Expand All @@ -662,6 +670,13 @@ jobs:
overwrite: true
retention-days: 7

- name: Upload test results to Codecov
if: cancelled() == false
uses: codecov/test-results-action@v1
with:
directory: dev-packages/browser-integration-tests
token: ${{ secrets.CODECOV_TOKEN }}

job_check_for_faulty_dts:
name: Check for faulty .d.ts files
needs: [job_get_metadata, job_build]
Expand Down Expand Up @@ -1013,6 +1028,13 @@ jobs:
overwrite: true
retention-days: 7

- name: Upload test results to Codecov
if: cancelled() == false
uses: codecov/test-results-action@v1
with:
directory: dev-packages/e2e-tests
token: ${{ secrets.CODECOV_TOKEN }}

job_optional_e2e_tests:
name: E2E ${{ matrix.label || matrix.test-application }} Test
# We only run E2E tests for non-fork PRs because the E2E tests require secrets to work and they can't be accessed from forks
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

- "You miss 100 percent of the chances you don't take. — Wayne Gretzky" — Michael Scott

Work in this release was contributed by @KyGuy2002. Thank you for your contribution!

## 8.30.0

### Important Changes
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ package. Please refer to the README and instructions of those SDKs for more deta
for native crashes
- [`@sentry/bun`](https://github.com/getsentry/sentry-javascript/tree/master/packages/bun): SDK for Bun
- [`@sentry/deno`](https://github.com/getsentry/sentry-javascript/tree/master/packages/deno): SDK for Deno
- [`@sentry/cloudflare`](https://github.com/getsentry/sentry-javascript/tree/master/packages/cloudflare): SDK for
Cloudflare

## Version Support Policy

Expand Down
2 changes: 1 addition & 1 deletion dev-packages/browser-integration-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"test:loader:replay_buffer": "PW_BUNDLE=loader_replay_buffer yarn test:loader",
"test:loader:full": "PW_BUNDLE=loader_tracing_replay yarn test:loader",
"test:loader:debug": "PW_BUNDLE=loader_debug yarn test:loader",
"test:ci": "yarn test:all --reporter='line'",
"test:ci": "yarn test:all",
"test:update-snapshots": "yarn test:all --update-snapshots",
"test:detect-flaky": "ts-node scripts/detectFlakyTests.ts"
},
Expand Down
2 changes: 2 additions & 0 deletions dev-packages/browser-integration-tests/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ const config: PlaywrightTestConfig = {
},
],

reporter: process.env.CI ? [['line'], ['junit', { outputFile: 'results.junit.xml' }]] : 'list',

globalSetup: require.resolve('./playwright.setup.ts'),
globalTeardown: require.resolve('./playwright.teardown.ts'),
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,10 @@ sentryTest('should set extras from multiple consecutive calls', async ({ getLoca
const eventData = await getFirstSentryEnvelopeRequest<Event>(page, url);

expect(eventData.message).toBe('consecutive_calls');
expect(eventData.extra).toMatchObject({ extra: [], Infinity: 2, null: null, obj: { foo: ['bar', 'baz', 1] } });
expect(eventData.extra).toMatchObject({
extra: [],
Infinity: 2,
null: '[Infinity]',
obj: { foo: ['bar', 'baz', 1] },
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -59,23 +59,30 @@ sentryTest('paint web vitals values are greater than TTFB', async ({ browserName
expect(fpValue).toBeGreaterThanOrEqual(ttfbValue!);
});

sentryTest('captures time origin as span attribute', async ({ getLocalTestPath, page }) => {
// Only run in chromium to ensure all vitals are present
if (shouldSkipTracingTest()) {
sentryTest.skip();
}
sentryTest(
'captures time origin and navigation activationStart as span attributes',
async ({ getLocalTestPath, page }) => {
// Only run in chromium to ensure all vitals are present
if (shouldSkipTracingTest()) {
sentryTest.skip();
}

const url = await getLocalTestPath({ testDir: __dirname });
const [eventData] = await Promise.all([getFirstSentryEnvelopeRequest<Event>(page), page.goto(url)]);
const url = await getLocalTestPath({ testDir: __dirname });
const [eventData] = await Promise.all([getFirstSentryEnvelopeRequest<Event>(page), page.goto(url)]);

const timeOriginAttribute = eventData.contexts?.trace?.data?.['performance.timeOrigin'];
const transactionStartTimestamp = eventData.start_timestamp;
const timeOriginAttribute = eventData.contexts?.trace?.data?.['performance.timeOrigin'];
const activationStart = eventData.contexts?.trace?.data?.['performance.activationStart'];

expect(timeOriginAttribute).toBeDefined();
expect(transactionStartTimestamp).toBeDefined();
const transactionStartTimestamp = eventData.start_timestamp;

const delta = Math.abs(transactionStartTimestamp! - timeOriginAttribute);
expect(timeOriginAttribute).toBeDefined();
expect(transactionStartTimestamp).toBeDefined();

// The delta should be less than 1ms if this flakes, we should increase the threshold
expect(delta).toBeLessThanOrEqual(1);
});
const delta = Math.abs(transactionStartTimestamp! - timeOriginAttribute);

// The delta should be less than 1ms if this flakes, we should increase the threshold
expect(delta).toBeLessThanOrEqual(1);

expect(activationStart).toBeGreaterThanOrEqual(0);
},
);
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const config: PlaywrightTestConfig = {
forbidOnly: !!process.env.CI,
retries: 0,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: 'list',
reporter: process.env.CI ? [['line'], ['junit', { outputFile: 'results.junit.xml' }]] : 'list',
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const config: PlaywrightTestConfig = {
forbidOnly: !!process.env.CI,
retries: 0,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: 'list',
reporter: process.env.CI ? [['line'], ['junit', { outputFile: 'results.junit.xml' }]] : 'list',
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,9 @@ export class AppController {
testServiceWithCanActivate() {
return this.appService.canActivate();
}

@Get('test-function-name')
testFunctionName() {
return this.appService.getFunctionName();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ export class AppService {
return { result: 'test' };
}

@SentryTraced('return the function name')
getFunctionName(): { result: string } {
return { result: this.getFunctionName.name };
}

async testSpanDecoratorSync() {
const returned = this.getString();
// Will fail if getString() is async, because returned will be a Promise<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,10 @@ test('Transaction includes span and correct value for decorated sync function',
]),
);
});

test('preserves original function name on decorated functions', async ({ baseURL }) => {
const response = await fetch(`${baseURL}/test-function-name`);
const body = await response.json();

expect(body.result).toEqual('getFunctionName');
});
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"dependencies": {
"@sentry/node": "latest || *",
"@sentry/opentelemetry": "latest || *",
"express": "4.19.2"
"express": "4.20.0"
},
"devDependencies": {
"@playwright/test": "^1.44.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"dependencies": {
"@sentry/node": "latest || *",
"@sentry/opentelemetry": "latest || *",
"express": "4.19.2"
"express": "4.20.0"
},
"devDependencies": {
"@playwright/test": "^1.44.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"dependencies": {
"@sentry/node": "latest || *",
"@sentry/opentelemetry": "latest || *",
"express": "4.19.2"
"express": "4.20.0"
},
"devDependencies": {
"@playwright/test": "^1.44.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"dependencies": {
"@sentry/node": "latest || *",
"@sentry/opentelemetry": "latest || *",
"express": "4.19.2"
"express": "4.20.0"
},
"devDependencies": {
"@playwright/test": "^1.44.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@trpc/client": "10.45.2",
"@types/express": "4.17.17",
"@types/node": "18.15.1",
"express": "4.19.2",
"express": "4.20.0",
"typescript": "4.9.5",
"zod": "~3.22.4"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const config = {
/* Retry on CI only */
retries: 0,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: 'list',
reporter: process.env.CI ? [['line'], ['junit', { outputFile: 'results.junit.xml' }]] : 'list',
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@trpc/client": "10.45.2",
"@types/express": "4.17.17",
"@types/node": "18.15.1",
"express": "4.19.2",
"express": "4.20.0",
"typescript": "4.9.5",
"zod": "~3.22.4"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ Sentry.init({
dsn: useRuntimeConfig().public.sentry.dsn,
tunnel: `http://localhost:3031/`, // proxy server
tracesSampleRate: 1.0,
trackComponents: true,
});

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import { expect, test } from '@nuxt/test-utils/playwright';
import { waitForTransaction } from '@sentry-internal/test-utils';
import type { Span } from '@sentry/nuxt';

test('sends a pageload root span with a parameterized URL', async ({ page }) => {
const transactionPromise = waitForTransaction('nuxt-3', async transactionEvent => {
return transactionEvent.transaction === '/test-param/:param()';
});

await page.goto(`/test-param/1234`);

const rootSpan = await transactionPromise;

expect(rootSpan).toMatchObject({
contexts: {
trace: {
data: {
'sentry.source': 'route',
'sentry.origin': 'auto.pageload.vue',
'sentry.op': 'pageload',
'params.param': '1234',
},
op: 'pageload',
origin: 'auto.pageload.vue',
},
},
transaction: '/test-param/:param()',
transaction_info: {
source: 'route',
},
});
});

test('sends component tracking spans when `trackComponents` is enabled', async ({ page }) => {
const transactionPromise = waitForTransaction('nuxt-3', async transactionEvent => {
return transactionEvent.transaction === '/client-error';
});

await page.goto(`/client-error`);

const rootSpan = await transactionPromise;
const errorButtonSpan = rootSpan.spans.find((span: Span) => span.description === 'Vue <ErrorButton>');

const expected = {
data: { 'sentry.origin': 'auto.ui.vue', 'sentry.op': 'ui.vue.mount' },
description: 'Vue <ErrorButton>',
op: 'ui.vue.mount',
parent_span_id: expect.any(String),
span_id: expect.any(String),
start_timestamp: expect.any(Number),
timestamp: expect.any(Number),
trace_id: expect.any(String),
origin: 'auto.ui.vue',
};

expect(errorButtonSpan).toMatchObject(expected);
});
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ test('Captures a pageload transaction', async ({ page }) => {
'sentry.sample_rate': 1,
'sentry.source': 'route',
'performance.timeOrigin': expect.any(Number),
'performance.activationStart': expect.any(Number),
},
op: 'pageload',
span_id: expect.any(String),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const config = {
/* Opt out of parallel tests on CI. */
workers: 1,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: 'list',
reporter: process.env.CI ? [['line'], ['junit', { outputFile: 'results.junit.xml' }]] : 'list',
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
Expand Down
Loading

0 comments on commit 3286596

Please sign in to comment.