azurefunctions.spec.tsx 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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 './azurefunctions';
  6. describe('express 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. const allMatches = screen.getAllByText(
  15. textWithMarkupMatcher(/import \* as Sentry from "@sentry\/node"/)
  16. );
  17. allMatches.forEach(match => {
  18. expect(match).toBeInTheDocument();
  19. });
  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(
  53. textWithMarkupMatcher(
  54. /const { nodeProfilingIntegration } = require\("@sentry\/profiling-node"\)/
  55. )
  56. )
  57. ).toBeInTheDocument();
  58. expect(
  59. screen.getByText(textWithMarkupMatcher(/profilesSampleRate: 1\.0/))
  60. ).toBeInTheDocument();
  61. });
  62. });