bottle.spec.tsx 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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 './bottle';
  6. describe('bottle 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\[bottle\]'/)
  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. const matches = screen.getAllByText(
  43. textWithMarkupMatcher(/profiles_sample_rate=1\.0,/)
  44. );
  45. expect(matches.length).toBeGreaterThan(0);
  46. matches.forEach(match => expect(match).toBeInTheDocument());
  47. });
  48. it('renders continuous profiling', function () {
  49. const organization = OrganizationFixture({
  50. features: ['continuous-profiling'],
  51. });
  52. renderWithOnboardingLayout(
  53. docs,
  54. {},
  55. {
  56. organization,
  57. }
  58. );
  59. // Does not render transaction profiling config
  60. expect(
  61. screen.queryByText(textWithMarkupMatcher(/profiles_sample_rate: 1\.0,/))
  62. ).not.toBeInTheDocument();
  63. // Does render continuous profiling config
  64. const matches = screen.getAllByText(
  65. textWithMarkupMatcher(/"continuous_profiling_auto_start": True,/)
  66. );
  67. expect(matches.length).toBeGreaterThan(0);
  68. matches.forEach(match => expect(match).toBeInTheDocument());
  69. });
  70. });