nuxt.spec.tsx 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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 './nuxt';
  6. describe('javascript-nuxt 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 2 import statements
  15. expect(
  16. screen.getAllByText(
  17. textWithMarkupMatcher(/import \* as Sentry from "@sentry\/nuxt"/)
  18. )
  19. ).toHaveLength(2);
  20. });
  21. it('displays 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(screen.getAllByText(textWithMarkupMatcher(/tracesSampleRate/))).toHaveLength(
  30. 2
  31. ); // client and server
  32. expect(
  33. screen.getByText(textWithMarkupMatcher(/replaysSessionSampleRate/))
  34. ).toBeInTheDocument(); // only client
  35. expect(
  36. screen.getByText(textWithMarkupMatcher(/replaysOnErrorSampleRate/))
  37. ).toBeInTheDocument(); // only client
  38. });
  39. it('enables performance setting the tracesSampleRate to 1', () => {
  40. renderWithOnboardingLayout(docs, {
  41. selectedProducts: [
  42. ProductSolution.ERROR_MONITORING,
  43. ProductSolution.PERFORMANCE_MONITORING,
  44. ],
  45. });
  46. expect(
  47. screen.getAllByText(textWithMarkupMatcher(/tracesSampleRate: 1\.0/))
  48. ).toHaveLength(2);
  49. });
  50. it('enables replay by setting replay samplerates', () => {
  51. renderWithOnboardingLayout(docs, {
  52. selectedProducts: [
  53. ProductSolution.ERROR_MONITORING,
  54. ProductSolution.SESSION_REPLAY,
  55. ],
  56. });
  57. expect(
  58. screen.getByText(textWithMarkupMatcher(/replaysSessionSampleRate: 0\.1/))
  59. ).toBeInTheDocument();
  60. expect(
  61. screen.getByText(textWithMarkupMatcher(/replaysOnErrorSampleRate: 1\.0/))
  62. ).toBeInTheDocument();
  63. });
  64. it('enables profiling by setting profiling sample rates', () => {
  65. renderWithOnboardingLayout(docs, {
  66. selectedProducts: [ProductSolution.ERROR_MONITORING, ProductSolution.PROFILING],
  67. });
  68. expect(
  69. screen.getAllByText(textWithMarkupMatcher(/profilesSampleRate: 1\.0/))
  70. ).toHaveLength(2);
  71. });
  72. });