fastapi.spec.tsx 2.4 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 './fastapi';
  6. describe('flask 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\[fastapi\]'/)
  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.queryByText(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.queryByText(
  64. textWithMarkupMatcher(/"continuous_profiling_auto_start": True,/)
  65. )
  66. ).toBeInTheDocument();
  67. });
  68. });