awslambda.spec.tsx 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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 './awslambda';
  6. describe('awslambda 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. expect(screen.getByRole('heading', {name: 'Verify'})).toBeInTheDocument();
  14. // Includes import statement
  15. expect(
  16. screen.getByText(
  17. textWithMarkupMatcher(/const Sentry = require\("@sentry\/serverless"\);/)
  18. )
  19. ).toBeInTheDocument();
  20. });
  21. it('displays sample rates by default', () => {
  22. renderWithOnboardingLayout(docs, {
  23. selectedProducts: [
  24. ProductSolution.ERROR_MONITORING,
  25. ProductSolution.PERFORMANCE_MONITORING,
  26. ProductSolution.PROFILING,
  27. ],
  28. });
  29. expect(
  30. screen.queryByText(textWithMarkupMatcher(/tracesSampleRate/))
  31. ).toBeInTheDocument();
  32. expect(
  33. screen.queryByText(textWithMarkupMatcher(/profilesSampleRate/))
  34. ).toBeInTheDocument();
  35. });
  36. it('enables performance setting the tracesSampleRate to 1', () => {
  37. renderWithOnboardingLayout(docs, {
  38. selectedProducts: [
  39. ProductSolution.ERROR_MONITORING,
  40. ProductSolution.PERFORMANCE_MONITORING,
  41. ],
  42. });
  43. expect(
  44. screen.getByText(textWithMarkupMatcher(/tracesSampleRate: 1\.0/))
  45. ).toBeInTheDocument();
  46. });
  47. it('enables profiling by setting profiling samplerates', () => {
  48. renderWithOnboardingLayout(docs, {
  49. selectedProducts: [ProductSolution.ERROR_MONITORING, ProductSolution.PROFILING],
  50. });
  51. expect(
  52. screen.getByText(textWithMarkupMatcher(/profilesSampleRate: 1\.0/))
  53. ).toBeInTheDocument();
  54. });
  55. });