awslambda.spec.tsx 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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(textWithMarkupMatcher(/profilesSampleRate: 1\.0/))
  54. ).toBeInTheDocument();
  55. });
  56. });