cloudflare-workers.spec.tsx 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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/gettingStartedDoc/types';
  5. import docs from './cloudflare-workers';
  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\/cloudflare"/)
  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.getByText(textWithMarkupMatcher(/tracesSampleRate/))
  31. ).toBeInTheDocument();
  32. });
  33. it('enables performance setting the tracesSampleRate to 1', () => {
  34. renderWithOnboardingLayout(docs, {
  35. selectedProducts: [
  36. ProductSolution.ERROR_MONITORING,
  37. ProductSolution.PERFORMANCE_MONITORING,
  38. ],
  39. });
  40. expect(
  41. screen.getByText(textWithMarkupMatcher(/tracesSampleRate: 1\.0/))
  42. ).toBeInTheDocument();
  43. });
  44. });