123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- 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 docs from './celery';
- describe('celery onboarding docs', function () {
- it('renders doc correctly', function () {
- 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: 'Standalone Setup'})).toBeInTheDocument();
- expect(screen.getByRole('heading', {name: 'Setup With Django'})).toBeInTheDocument();
- expect(screen.getByRole('heading', {name: 'Verify'})).toBeInTheDocument();
- // Renders install instructions
- expect(
- screen.getByText(
- textWithMarkupMatcher(/pip install --upgrade 'sentry-sdk\[celery\]'/)
- )
- ).toBeInTheDocument();
- });
- it('renders without tracing', function () {
- renderWithOnboardingLayout(docs, {
- selectedProducts: [],
- });
- // Does not render config option
- expect(
- screen.queryByText(textWithMarkupMatcher(/profiles_sample_rate=1\.0,/))
- ).not.toBeInTheDocument();
- // Does not render config option
- expect(
- screen.queryByText(textWithMarkupMatcher(/traces_sample_rate=1\.0,/))
- ).not.toBeInTheDocument();
- });
- it('renders transaction profiling', function () {
- renderWithOnboardingLayout(docs);
- // Does not render continuous profiling config
- expect(
- screen.queryByText(textWithMarkupMatcher(/sentry_sdk.profiler.start_profiler\(\)/))
- ).not.toBeInTheDocument();
- expect(
- screen.queryByText(textWithMarkupMatcher(/sentry_sdk.profiler.stop_profiler\(\)/))
- ).not.toBeInTheDocument();
- // Does render transaction profiling config
- expect(
- screen.queryByText(textWithMarkupMatcher(/profiles_sample_rate=1\.0,/))
- ).toBeInTheDocument();
- });
- it('renders continuous profiling', function () {
- const organization = OrganizationFixture({
- features: ['continuous-profiling'],
- });
- renderWithOnboardingLayout(
- docs,
- {},
- {
- organization,
- }
- );
- // Does not render transaction profiling config
- expect(
- screen.queryByText(textWithMarkupMatcher(/profiles_sample_rate=1\.0,/))
- ).not.toBeInTheDocument();
- // Does render continuous profiling config
- expect(
- screen.queryByText(textWithMarkupMatcher(/sentry_sdk.profiler.start_profiler\(\)/))
- ).toBeInTheDocument();
- expect(
- screen.queryByText(textWithMarkupMatcher(/sentry_sdk.profiler.stop_profiler\(\)/))
- ).toBeInTheDocument();
- });
- });
|