starlette.spec.tsx 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import {renderWithOnboardingLayout} from 'sentry-test/onboarding/renderWithOnboardingLayout';
  2. import {screen} from 'sentry-test/reactTestingLibrary';
  3. import {textWithMarkupMatcher} from 'sentry-test/utils';
  4. import docs from './starlette';
  5. describe('starlette onboarding docs', function () {
  6. it('renders doc correctly', function () {
  7. renderWithOnboardingLayout(docs);
  8. // Renders main headings
  9. expect(screen.getByRole('heading', {name: 'Install'})).toBeInTheDocument();
  10. expect(screen.getByRole('heading', {name: 'Configure SDK'})).toBeInTheDocument();
  11. expect(screen.getByRole('heading', {name: 'Verify'})).toBeInTheDocument();
  12. // Renders install instructions
  13. expect(
  14. screen.getByText(
  15. textWithMarkupMatcher(/pip install --upgrade 'sentry-sdk\[starlette\]'/)
  16. )
  17. ).toBeInTheDocument();
  18. });
  19. it('renders without tracing', function () {
  20. renderWithOnboardingLayout(docs, {
  21. selectedProducts: [],
  22. });
  23. // Does not render config option
  24. expect(
  25. screen.queryByText(textWithMarkupMatcher(/traces_sample_rate: 1\.0,/))
  26. ).not.toBeInTheDocument();
  27. // Does not render config option
  28. expect(
  29. screen.queryByText(textWithMarkupMatcher(/profiles_sample_rate: 1\.0,/))
  30. ).not.toBeInTheDocument();
  31. });
  32. });