celery.spec.tsx 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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 './celery';
  6. describe('celery 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: 'Standalone Setup'})).toBeInTheDocument();
  13. expect(screen.getByRole('heading', {name: 'Setup With Django'})).toBeInTheDocument();
  14. expect(screen.getByRole('heading', {name: 'Verify'})).toBeInTheDocument();
  15. // Renders install instructions
  16. expect(
  17. screen.getByText(
  18. textWithMarkupMatcher(/pip install --upgrade 'sentry-sdk\[celery\]'/)
  19. )
  20. ).toBeInTheDocument();
  21. });
  22. it('renders without tracing', function () {
  23. renderWithOnboardingLayout(docs, {
  24. selectedProducts: [],
  25. });
  26. // Does not render config option
  27. expect(
  28. screen.queryByText(textWithMarkupMatcher(/profiles_sample_rate=1\.0,/))
  29. ).not.toBeInTheDocument();
  30. // Does not render config option
  31. expect(
  32. screen.queryByText(textWithMarkupMatcher(/traces_sample_rate=1\.0,/))
  33. ).not.toBeInTheDocument();
  34. });
  35. it('renders transaction profiling', function () {
  36. renderWithOnboardingLayout(docs);
  37. // Does not render continuous profiling config
  38. expect(
  39. screen.queryByText(textWithMarkupMatcher(/sentry_sdk.profiler.start_profiler\(\)/))
  40. ).not.toBeInTheDocument();
  41. expect(
  42. screen.queryByText(textWithMarkupMatcher(/sentry_sdk.profiler.stop_profiler\(\)/))
  43. ).not.toBeInTheDocument();
  44. // Does render transaction profiling config
  45. expect(
  46. screen.queryByText(textWithMarkupMatcher(/profiles_sample_rate=1\.0,/))
  47. ).toBeInTheDocument();
  48. });
  49. it('renders continuous profiling', function () {
  50. const organization = OrganizationFixture({
  51. features: ['continuous-profiling'],
  52. });
  53. renderWithOnboardingLayout(
  54. docs,
  55. {},
  56. {
  57. organization,
  58. }
  59. );
  60. // Does not render transaction profiling config
  61. expect(
  62. screen.queryByText(textWithMarkupMatcher(/profiles_sample_rate=1\.0,/))
  63. ).not.toBeInTheDocument();
  64. // Does render continuous profiling config
  65. expect(
  66. screen.queryByText(textWithMarkupMatcher(/sentry_sdk.profiler.start_profiler\(\)/))
  67. ).toBeInTheDocument();
  68. expect(
  69. screen.queryByText(textWithMarkupMatcher(/sentry_sdk.profiler.stop_profiler\(\)/))
  70. ).toBeInTheDocument();
  71. });
  72. });