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 './astro'; describe('javascript-astro 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: 'Verify'})).toBeInTheDocument(); // Includes minimum required Astro version expect(screen.getByText(textWithMarkupMatcher(/Astro 3.0.0/))).toBeInTheDocument(); // Includes import statement expect( screen.getByText(textWithMarkupMatcher(/import sentry from "@sentry\/astro"/)) ).toBeInTheDocument(); }); /* The Astro SDK adds `browserTrackingIntegration` per default - it does not have to be explicitly added. */ it("doesn't display any sample rates by default", () => { renderWithOnboardingLayout(docs, { selectedProducts: [ ProductSolution.ERROR_MONITORING, ProductSolution.PERFORMANCE_MONITORING, ProductSolution.SESSION_REPLAY, ], }); expect( screen.queryByText(textWithMarkupMatcher(/tracesSampleRate/)) ).not.toBeInTheDocument(); expect( screen.queryByText(textWithMarkupMatcher(/replaysSessionSampleRate/)) ).not.toBeInTheDocument(); expect( screen.queryByText(textWithMarkupMatcher(/replaysOnErrorSampleRate/)) ).not.toBeInTheDocument(); }); it('disables performance setting the tracesSampleRate to 0', () => { renderWithOnboardingLayout(docs, { selectedProducts: [ ProductSolution.ERROR_MONITORING, ProductSolution.SESSION_REPLAY, ], }); expect( screen.getByText(textWithMarkupMatcher(/tracesSampleRate: 0/)) ).toBeInTheDocument(); }); it('disables replay by setting replay samplerates set to 0', () => { renderWithOnboardingLayout(docs, { selectedProducts: [ ProductSolution.ERROR_MONITORING, ProductSolution.PERFORMANCE_MONITORING, ], }); expect( screen.getByText(textWithMarkupMatcher(/replaysSessionSampleRate: 0/)) ).toBeInTheDocument(); expect( screen.getByText(textWithMarkupMatcher(/replaysOnErrorSampleRate: 0/)) ).toBeInTheDocument(); }); });