connect.spec.tsx 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import {renderWithOnboardingLayout} from 'sentry-test/onboarding/renderWithOnboardingLayout';
  2. import {screen} from 'sentry-test/reactTestingLibrary';
  3. import {textWithMarkupMatcher} from 'sentry-test/utils';
  4. import {ProductSolution} from 'sentry/components/onboarding/productSelection';
  5. import docs from './connect';
  6. describe('connect onboarding docs', function () {
  7. it('renders onboarding docs correctly', () => {
  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: 'Upload Source Maps'})).toBeInTheDocument();
  13. // Includes import statement
  14. expect(
  15. screen.getByText(textWithMarkupMatcher(/import \* as Sentry from "@sentry\/node"/))
  16. ).toBeInTheDocument();
  17. });
  18. it('displays sample rates by default', () => {
  19. renderWithOnboardingLayout(docs, {
  20. selectedProducts: [
  21. ProductSolution.ERROR_MONITORING,
  22. ProductSolution.PERFORMANCE_MONITORING,
  23. ProductSolution.PROFILING,
  24. ],
  25. });
  26. expect(
  27. screen.queryByText(textWithMarkupMatcher(/tracesSampleRate/))
  28. ).toBeInTheDocument();
  29. expect(
  30. screen.queryByText(textWithMarkupMatcher(/profilesSampleRate/))
  31. ).toBeInTheDocument();
  32. });
  33. it('enables performance setting the tracesSampleRate to 1', () => {
  34. renderWithOnboardingLayout(docs, {
  35. selectedProducts: [
  36. ProductSolution.ERROR_MONITORING,
  37. ProductSolution.PERFORMANCE_MONITORING,
  38. ],
  39. });
  40. expect(
  41. screen.getByText(textWithMarkupMatcher(/tracesSampleRate: 1\.0/))
  42. ).toBeInTheDocument();
  43. });
  44. it('enables profiling by setting profiling samplerates', () => {
  45. renderWithOnboardingLayout(docs, {
  46. selectedProducts: [ProductSolution.ERROR_MONITORING, ProductSolution.PROFILING],
  47. });
  48. expect(
  49. screen.getByText(textWithMarkupMatcher(/profilesSampleRate: 1\.0/))
  50. ).toBeInTheDocument();
  51. });
  52. });