aiohttp.spec.tsx 2.5 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 './aiohttp';
  6. describe('aiohttp 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. const matches = screen.getAllByText(
  41. textWithMarkupMatcher(/profiles_sample_rate=1\.0,/)
  42. );
  43. expect(matches.length).toBeGreaterThan(0);
  44. matches.forEach(match => expect(match).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. const matches = screen.getAllByText(
  63. textWithMarkupMatcher(/"continuous_profiling_auto_start": True,/)
  64. );
  65. expect(matches.length).toBeGreaterThan(0);
  66. matches.forEach(match => expect(match).toBeInTheDocument());
  67. });
  68. });