awslambda.spec.tsx 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. const allMatches = screen.getAllByText(
  16. textWithMarkupMatcher(/const Sentry = require\("@sentry\/aws-serverless"\);/)
  17. );
  18. allMatches.forEach(match => {
  19. expect(match).toBeInTheDocument();
  20. });
  21. });
  22. it('displays sample rates by default', () => {
  23. renderWithOnboardingLayout(docs, {
  24. selectedProducts: [
  25. ProductSolution.ERROR_MONITORING,
  26. ProductSolution.PERFORMANCE_MONITORING,
  27. ProductSolution.PROFILING,
  28. ],
  29. });
  30. expect(
  31. screen.queryByText(textWithMarkupMatcher(/tracesSampleRate/))
  32. ).toBeInTheDocument();
  33. expect(
  34. screen.queryByText(textWithMarkupMatcher(/profilesSampleRate/))
  35. ).toBeInTheDocument();
  36. });
  37. it('enables performance setting the tracesSampleRate to 1', () => {
  38. renderWithOnboardingLayout(docs, {
  39. selectedProducts: [
  40. ProductSolution.ERROR_MONITORING,
  41. ProductSolution.PERFORMANCE_MONITORING,
  42. ],
  43. });
  44. expect(
  45. screen.getByText(textWithMarkupMatcher(/tracesSampleRate: 1\.0/))
  46. ).toBeInTheDocument();
  47. });
  48. it('enables profiling by setting profiling samplerates', () => {
  49. renderWithOnboardingLayout(docs, {
  50. selectedProducts: [ProductSolution.ERROR_MONITORING, ProductSolution.PROFILING],
  51. });
  52. expect(
  53. screen.getByText(
  54. textWithMarkupMatcher(
  55. /const { nodeProfilingIntegration } = require\("@sentry\/profiling-node"\)/
  56. )
  57. )
  58. ).toBeInTheDocument();
  59. expect(
  60. screen.getByText(textWithMarkupMatcher(/profilesSampleRate: 1\.0/))
  61. ).toBeInTheDocument();
  62. });
  63. });