python.spec.tsx 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. import {OrganizationFixture} from 'sentry-fixture/organization';
  2. import {renderWithOnboardingLayout} from 'sentry-test/onboarding/renderWithOnboardingLayout';
  3. import {screen} from 'sentry-test/reactTestingLibrary';
  4. import {textWithMarkupMatcher} from 'sentry-test/utils';
  5. import docs from './python';
  6. describe('python onboarding docs', function () {
  7. it('renders doc correctly', function () {
  8. renderWithOnboardingLayout(docs);
  9. // Renders main headings
  10. expect(screen.getByRole('heading', {name: 'Install'})).toBeInTheDocument();
  11. expect(screen.getByRole('heading', {name: 'Configure SDK'})).toBeInTheDocument();
  12. expect(screen.getByRole('heading', {name: 'Verify'})).toBeInTheDocument();
  13. // Renders install instructions
  14. expect(
  15. screen.getByText(textWithMarkupMatcher(/pip install --upgrade sentry-sdk/))
  16. ).toBeInTheDocument();
  17. });
  18. it('renders without tracing', function () {
  19. renderWithOnboardingLayout(docs, {
  20. selectedProducts: [],
  21. });
  22. // Does not render config option
  23. expect(
  24. screen.queryByText(textWithMarkupMatcher(/profiles_sample_rate=1\.0,/))
  25. ).not.toBeInTheDocument();
  26. // Does not render config option
  27. expect(
  28. screen.queryByText(textWithMarkupMatcher(/traces_sample_rate=1\.0,/))
  29. ).not.toBeInTheDocument();
  30. });
  31. it('renders transaction profiling', function () {
  32. renderWithOnboardingLayout(docs);
  33. // Does not render continuous profiling config
  34. expect(
  35. screen.queryByText(textWithMarkupMatcher(/sentry_sdk.profiler.start_profiler\(\)/))
  36. ).not.toBeInTheDocument();
  37. expect(
  38. screen.queryByText(textWithMarkupMatcher(/sentry_sdk.profiler.stop_profiler\(\)/))
  39. ).not.toBeInTheDocument();
  40. // Does render transaction profiling config
  41. expect(
  42. screen.queryByText(textWithMarkupMatcher(/profiles_sample_rate=1\.0,/))
  43. ).toBeInTheDocument();
  44. });
  45. it('renders continuous profiling', function () {
  46. const organization = OrganizationFixture({
  47. features: ['continuous-profiling'],
  48. });
  49. renderWithOnboardingLayout(
  50. docs,
  51. {},
  52. {
  53. organization,
  54. }
  55. );
  56. // Does not render transaction profiling config
  57. expect(
  58. screen.queryByText(textWithMarkupMatcher(/profiles_sample_rate=1\.0,/))
  59. ).not.toBeInTheDocument();
  60. // Does render continuous profiling config
  61. expect(
  62. screen.queryByText(textWithMarkupMatcher(/sentry_sdk.profiler.start_profiler\(\)/))
  63. ).toBeInTheDocument();
  64. expect(
  65. screen.queryByText(textWithMarkupMatcher(/sentry_sdk.profiler.stop_profiler\(\)/))
  66. ).toBeInTheDocument();
  67. });
  68. });