| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
parent directory.. | ||||
Warning
These test applications are not intended to be used as example apps or templates. They may contain:
- Outdated or deprecated dependency versions used for backwards compatibility testing
- Known security vulnerabilities in dependencies that we intentionally test against
- Non-production-ready configurations and code patterns
For official examples and best practices, please refer to our official documentation.
E2E tests enable us to verify the behavior of the packages in this repository as if they were to be published in their current state.
To finally run all of the tests:
yarn test:e2eOr run only a single E2E test app:
yarn test:run <app-name>Or you can run a single E2E test app with a specific variant:
yarn test:run <app-name> --variant <variant-name>Variant name matching is case-insensitive and partial. For example, --variant 13 will match nextjs-pages-dir (next@13) if a matching variant is present in the test app's package.json.
Alternatively, you can use the provided Makefile for an interactive test selection experience:
Prerequisites: Install fzf with Homebrew:
brew install fzfRun tests interactively:
make runThis will display a fuzzy-finder menu of all available test applications. Select one to run it automatically.
List all test applications:
make listFor example, if you have the following variants in your test app's package.json:
"sentryTest": {
"variants": [
{
"build-command": "pnpm test:build-13",
"label": "nextjs-pages-dir (next@13)"
},
{
"build-command": "pnpm test:build-13-canary",
"label": "nextjs-pages-dir (next@13-canary)"
},
{
"build-command": "pnpm test:build-15",
"label": "nextjs-pages-dir (next@15)"
}
]
}If you run yarn test:run nextjs-pages-dir --variant 13, it will match against the very first matching variant, which is nextjs-pages-dir (next@13). If you need to target the second variant in the example, you need to be more specific and use --variant 13-canary.
We build our packages, pack them into tarballs (yarn build:tarball), and create symlinks in the packed/ directory that point to the versioned tarballs. When a test application is run, pnpm overrides are injected into its package.json to pin all @sentry/* and @sentry-internal/* packages to those local tarballs. This means test apps install the packages as if they were published, but from the local build output instead of a registry.
The E2E test script looks for test applications in the test-applications folder. These are standalone apps that use our SDKs and can be used to verify their behavior.
Test applications are completely standalone applications that can be used to verify our SDKs. To set one up:
cd dev-packages/e2e-tests
mkdir test-applications/my-new-test-applicationMake sure to add a test:build and test:assert command to the new app's package.json file.
Sentry packages are automatically resolved to the local build via pnpm overrides injected at test time, so no manual registry configuration is needed.
Different bundlers handle environment variables and code replacement differently. This is important when writing tests or SDK code that relies on build-time constants.
// Safe pattern for SDK code
let envValue: string | undefined;
try {
envValue = import.meta.env.VITE_SOME_VAR;
} catch {
// import.meta.env not available in this bundler
}Test apps in the folder test-applications will be automatically picked up by CI in the job job_e2e_tests (in .github/workflows/build.yml). The test matrix for CI is generated in dev-packages/e2e-tests/lib/getTestMatrix.mjs.
For each test app, CI checks its dependencies (and devDependencies) to see if any of them have changed in the current PR (based on nx affected projects). For example, if something is changed in the browser package, only E2E test apps that depend on browser will run, while others will be skipped.
You can add additional information about the test (e.g. canary versions, optional in CI) by adding sentryTest in the package.json of a test application.
If you add Sentry dependencies to your test application, set the dependency versions to latest || * in order for it to work with both regular and prerelease versions:
All that is left for you to do now is to create a test app and run yarn test:e2e.
For some of our E2E tests we define a standard for test applications as to how they should look and behave. Standardized test apps enables us to reuse the same test suite over a number of different frameworks/SDKs.
TODO: This is not up to date.
A standardized frontend test application has the following features:
Just for the sake of consistency we prefix the standardized frontend tests with standard-frontend-. For example standard-frontend-nextjs.
A page at path /
An empty page at /user/5
Apps should write all pageload and navigation transaction IDs into an array at window.recordedTransactions. This can be done with an event processor:
Sentry.addEventProcessor(event => {
if (
event.type === 'transaction' &&
(event.contexts?.trace?.op === 'pageload' || event.contexts?.trace?.op === 'navigation')
) {
const eventId = event.event_id;
window.recordedTransactions = window.recordedTransactions || [];
window.recordedTransactions.push(eventId);
}
return event;
});TBD
A standardized Meta-Framework test application has the following features:
This setup creates the scenario where the frontend page loads, and then immediately makes an API request to the backend API.
The following test cases for connected tracing should be implemented in the test app:
| Back | FazBrowse Home | New Git URL |