django.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 './django';
  6. describe('django 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(
  16. textWithMarkupMatcher("pip install --upgrade 'sentry-sdk[django]'")
  17. )
  18. ).toBeInTheDocument();
  19. });
  20. it('renders without tracing', function () {
  21. renderWithOnboardingLayout(docs, {
  22. selectedProducts: [],
  23. });
  24. // Does not render config option
  25. expect(
  26. screen.queryByText(textWithMarkupMatcher(/profiles_sample_rate=1\.0,/))
  27. ).not.toBeInTheDocument();
  28. // Does not render config option
  29. expect(
  30. screen.queryByText(textWithMarkupMatcher(/traces_sample_rate=1\.0,/))
  31. ).not.toBeInTheDocument();
  32. });
  33. it('renders transaction profiling', function () {
  34. renderWithOnboardingLayout(docs);
  35. // Does not render continuous profiling config
  36. expect(
  37. screen.queryByText(
  38. textWithMarkupMatcher(/"continuous_profiling_auto_start": True,/)
  39. )
  40. ).not.toBeInTheDocument();
  41. // Does render transaction profiling config
  42. expect(
  43. screen.getByText(textWithMarkupMatcher(/profiles_sample_rate=1\.0,/))
  44. ).toBeInTheDocument();
  45. });
  46. it('renders continuous profiling', function () {
  47. const organization = OrganizationFixture({
  48. features: ['continuous-profiling'],
  49. });
  50. renderWithOnboardingLayout(
  51. docs,
  52. {},
  53. {
  54. organization,
  55. }
  56. );
  57. // Does not render transaction profiling config
  58. expect(
  59. screen.queryByText(textWithMarkupMatcher(/profiles_sample_rate=1\.0,/))
  60. ).not.toBeInTheDocument();
  61. // Does render continuous profiling config
  62. expect(
  63. screen.getByText(textWithMarkupMatcher(/"continuous_profiling_auto_start": True,/))
  64. ).toBeInTheDocument();
  65. });
  66. });