express.spec.tsx 2.1 KB

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