astro.spec.tsx 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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 './astro';
  6. describe('javascript-astro 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: 'Verify'})).toBeInTheDocument();
  13. // Includes minimum required Astro version
  14. expect(screen.getByText(textWithMarkupMatcher(/Astro 3.0.0/))).toBeInTheDocument();
  15. // Includes import statement
  16. expect(
  17. screen.getByText(textWithMarkupMatcher(/import sentry from "@sentry\/astro"/))
  18. ).toBeInTheDocument();
  19. });
  20. it("doesn't display any sample rates by default", () => {
  21. renderWithOnboardingLayout(docs, {
  22. selectedProducts: [
  23. ProductSolution.ERROR_MONITORING,
  24. ProductSolution.PERFORMANCE_MONITORING,
  25. ProductSolution.SESSION_REPLAY,
  26. ],
  27. });
  28. expect(
  29. screen.queryByText(textWithMarkupMatcher(/tracesSampleRate/))
  30. ).not.toBeInTheDocument();
  31. expect(
  32. screen.queryByText(textWithMarkupMatcher(/replaysSessionSampleRate/))
  33. ).not.toBeInTheDocument();
  34. expect(
  35. screen.queryByText(textWithMarkupMatcher(/replaysOnErrorSampleRate/))
  36. ).not.toBeInTheDocument();
  37. });
  38. it('disables performance setting the tracesSampleRate to 0', () => {
  39. renderWithOnboardingLayout(docs, {
  40. selectedProducts: [
  41. ProductSolution.ERROR_MONITORING,
  42. ProductSolution.SESSION_REPLAY,
  43. ],
  44. });
  45. expect(
  46. screen.getByText(textWithMarkupMatcher(/tracesSampleRate: 0/))
  47. ).toBeInTheDocument();
  48. });
  49. it('disables replay by setting replay samplerates set to 0', () => {
  50. renderWithOnboardingLayout(docs, {
  51. selectedProducts: [
  52. ProductSolution.ERROR_MONITORING,
  53. ProductSolution.PERFORMANCE_MONITORING,
  54. ],
  55. });
  56. expect(
  57. screen.getByText(textWithMarkupMatcher(/replaysSessionSampleRate: 0/))
  58. ).toBeInTheDocument();
  59. expect(
  60. screen.getByText(textWithMarkupMatcher(/replaysOnErrorSampleRate: 0/))
  61. ).toBeInTheDocument();
  62. });
  63. });