vue.spec.tsx 2.4 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 './vue';
  6. describe('javascript-vue 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\/vue"/))
  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.SESSION_REPLAY,
  25. ],
  26. });
  27. expect(
  28. screen.queryByText(textWithMarkupMatcher(/tracesSampleRate/))
  29. ).toBeInTheDocument();
  30. expect(
  31. screen.queryByText(textWithMarkupMatcher(/replaysSessionSampleRate/))
  32. ).toBeInTheDocument();
  33. expect(
  34. screen.queryByText(textWithMarkupMatcher(/replaysOnErrorSampleRate/))
  35. ).toBeInTheDocument();
  36. });
  37. it('enables performance setting the tracesSampleRate to 1', () => {
  38. renderWithOnboardingLayout(docs, {
  39. selectedProducts: [
  40. ProductSolution.ERROR_MONITORING,
  41. ProductSolution.PERFORMANCE_MONITORING,
  42. ],
  43. });
  44. expect(
  45. screen.getByText(textWithMarkupMatcher(/tracesSampleRate: 1\.0/))
  46. ).toBeInTheDocument();
  47. });
  48. it('enables replay by setting replay samplerates', () => {
  49. renderWithOnboardingLayout(docs, {
  50. selectedProducts: [
  51. ProductSolution.ERROR_MONITORING,
  52. ProductSolution.SESSION_REPLAY,
  53. ],
  54. });
  55. expect(
  56. screen.getByText(textWithMarkupMatcher(/replaysSessionSampleRate: 0\.1/))
  57. ).toBeInTheDocument();
  58. expect(
  59. screen.getByText(textWithMarkupMatcher(/replaysOnErrorSampleRate: 1\.0/))
  60. ).toBeInTheDocument();
  61. });
  62. });