asgi.spec.tsx 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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 './asgi';
  6. describe('asgi 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(
  36. textWithMarkupMatcher(/"continuous_profiling_auto_start": True,/)
  37. )
  38. ).not.toBeInTheDocument();
  39. // Does render transaction profiling config
  40. expect(
  41. screen.queryByText(textWithMarkupMatcher(/profiles_sample_rate=1\.0,/))
  42. ).toBeInTheDocument();
  43. });
  44. it('renders continuous profiling', function () {
  45. const organization = OrganizationFixture({
  46. features: ['continuous-profiling'],
  47. });
  48. renderWithOnboardingLayout(
  49. docs,
  50. {},
  51. {
  52. organization,
  53. }
  54. );
  55. // Does not render transaction profiling config
  56. expect(
  57. screen.queryByText(textWithMarkupMatcher(/profiles_sample_rate=1\.0,/))
  58. ).not.toBeInTheDocument();
  59. // Does render continuous profiling config
  60. expect(
  61. screen.queryByText(
  62. textWithMarkupMatcher(/"continuous_profiling_auto_start": True,/)
  63. )
  64. ).toBeInTheDocument();
  65. });
  66. });