123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- import {OrganizationFixture} from 'sentry-fixture/organization';
- import {renderWithOnboardingLayout} from 'sentry-test/onboarding/renderWithOnboardingLayout';
- import {screen} from 'sentry-test/reactTestingLibrary';
- import {textWithMarkupMatcher} from 'sentry-test/utils';
- import {ProductSolution} from 'sentry/components/onboarding/productSelection';
- import docs from './awslambda';
- describe('awslambda onboarding docs', function () {
- it('renders onboarding docs correctly', () => {
- renderWithOnboardingLayout(docs);
- // Renders main headings
- expect(screen.getByRole('heading', {name: 'Install'})).toBeInTheDocument();
- expect(screen.getByRole('heading', {name: 'Configure SDK'})).toBeInTheDocument();
- expect(screen.getByRole('heading', {name: 'Upload Source Maps'})).toBeInTheDocument();
- expect(screen.getByRole('heading', {name: 'Verify'})).toBeInTheDocument();
- // Includes import statement
- const allMatches = screen.getAllByText(
- textWithMarkupMatcher(/const Sentry = require\("@sentry\/aws-serverless"\);/)
- );
- allMatches.forEach(match => {
- expect(match).toBeInTheDocument();
- });
- });
- it('displays sample rates by default', () => {
- renderWithOnboardingLayout(docs, {
- selectedProducts: [
- ProductSolution.ERROR_MONITORING,
- ProductSolution.PERFORMANCE_MONITORING,
- ProductSolution.PROFILING,
- ],
- });
- expect(
- screen.queryByText(textWithMarkupMatcher(/tracesSampleRate/))
- ).toBeInTheDocument();
- expect(
- screen.queryByText(textWithMarkupMatcher(/profilesSampleRate/))
- ).toBeInTheDocument();
- });
- it('enables performance setting the tracesSampleRate to 1', () => {
- renderWithOnboardingLayout(docs, {
- selectedProducts: [
- ProductSolution.ERROR_MONITORING,
- ProductSolution.PERFORMANCE_MONITORING,
- ],
- });
- expect(
- screen.getByText(textWithMarkupMatcher(/tracesSampleRate: 1\.0/))
- ).toBeInTheDocument();
- });
- it('enables profiling by setting profiling samplerates', () => {
- renderWithOnboardingLayout(docs, {
- selectedProducts: [ProductSolution.ERROR_MONITORING, ProductSolution.PROFILING],
- });
- expect(
- screen.getByText(
- textWithMarkupMatcher(
- /const { nodeProfilingIntegration } = require\("@sentry\/profiling-node"\)/
- )
- )
- ).toBeInTheDocument();
- expect(
- screen.getByText(textWithMarkupMatcher(/profilesSampleRate: 1\.0/))
- ).toBeInTheDocument();
- });
- it('continuous profiling', () => {
- const organization = OrganizationFixture({
- features: ['continuous-profiling'],
- });
- renderWithOnboardingLayout(
- docs,
- {},
- {
- organization,
- }
- );
- expect(
- screen.getByText(
- textWithMarkupMatcher(
- /const { nodeProfilingIntegration } = require\("@sentry\/profiling-node"\)/
- )
- )
- ).toBeInTheDocument();
- // Profiles sample rate should not be set for continuous profiling
- expect(
- screen.queryByText(textWithMarkupMatcher(/profilesSampleRate: 1\.0/))
- ).not.toBeInTheDocument();
- // Should have start and stop profiling calls
- expect(
- screen.queryByText(textWithMarkupMatcher(/Sentry.profiler.startProfiler/))
- ).toBeInTheDocument();
- expect(
- screen.queryByText(textWithMarkupMatcher(/Sentry.profiler.stopProfiler/))
- ).toBeInTheDocument();
- });
- });
|