astro.spec.tsx 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. /* The Astro SDK adds `browserTrackingIntegration` per default - it does not have to be explicitly added. */
  21. it("doesn't display any sample rates by default", () => {
  22. renderWithOnboardingLayout(docs, {
  23. selectedProducts: [
  24. ProductSolution.ERROR_MONITORING,
  25. ProductSolution.PERFORMANCE_MONITORING,
  26. ProductSolution.SESSION_REPLAY,
  27. ],
  28. });
  29. expect(
  30. screen.queryByText(textWithMarkupMatcher(/tracesSampleRate/))
  31. ).not.toBeInTheDocument();
  32. expect(
  33. screen.queryByText(textWithMarkupMatcher(/replaysSessionSampleRate/))
  34. ).not.toBeInTheDocument();
  35. expect(
  36. screen.queryByText(textWithMarkupMatcher(/replaysOnErrorSampleRate/))
  37. ).not.toBeInTheDocument();
  38. });
  39. it('disables performance setting the tracesSampleRate to 0', () => {
  40. renderWithOnboardingLayout(docs, {
  41. selectedProducts: [
  42. ProductSolution.ERROR_MONITORING,
  43. ProductSolution.SESSION_REPLAY,
  44. ],
  45. });
  46. expect(
  47. screen.getByText(textWithMarkupMatcher(/tracesSampleRate: 0/))
  48. ).toBeInTheDocument();
  49. });
  50. it('disables replay by setting replay samplerates set to 0', () => {
  51. renderWithOnboardingLayout(docs, {
  52. selectedProducts: [
  53. ProductSolution.ERROR_MONITORING,
  54. ProductSolution.PERFORMANCE_MONITORING,
  55. ],
  56. });
  57. expect(
  58. screen.getByText(textWithMarkupMatcher(/replaysSessionSampleRate: 0/))
  59. ).toBeInTheDocument();
  60. expect(
  61. screen.getByText(textWithMarkupMatcher(/replaysOnErrorSampleRate: 0/))
  62. ).toBeInTheDocument();
  63. });
  64. });