12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- 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 './quart';
- describe('quart 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: 'Verify'})).toBeInTheDocument();
- // Renders install instructions
- expect(
- screen.getByText(
- textWithMarkupMatcher(/pip install --upgrade 'sentry-sdk\[quart\]'/)
- )
- ).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(/"continuous_profiling_auto_start": True,/)
- )
- ).not.toBeInTheDocument();
- // Does render transaction profiling config
- const matches = screen.getAllByText(
- textWithMarkupMatcher(/profiles_sample_rate=1\.0,/)
- );
- expect(matches.length).toBeGreaterThan(0);
- matches.forEach(match => expect(match).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
- const matches = screen.getAllByText(
- textWithMarkupMatcher(/"continuous_profiling_auto_start": True,/)
- );
- expect(matches.length).toBeGreaterThan(0);
- matches.forEach(match => expect(match).toBeInTheDocument());
- });
- });
|