nextjs.spec.tsx 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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 './nextjs';
  6. describe('javascript-nextjs 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. // Includes configure statement
  12. expect(
  13. screen.getByText(textWithMarkupMatcher(/npx @sentry\/wizard@latest -i nextjs/))
  14. ).toBeInTheDocument();
  15. });
  16. it('displays the configure instructions', () => {
  17. renderWithOnboardingLayout(docs, {
  18. selectedProducts: [
  19. ProductSolution.ERROR_MONITORING,
  20. ProductSolution.PERFORMANCE_MONITORING,
  21. ProductSolution.SESSION_REPLAY,
  22. ],
  23. });
  24. expect(
  25. screen.queryByText(textWithMarkupMatcher(/sentry.client.config.js/))
  26. ).toBeInTheDocument();
  27. expect(screen.queryByText(textWithMarkupMatcher(/Sentry.init/))).toBeInTheDocument();
  28. expect(
  29. screen.queryByText(textWithMarkupMatcher(/.env.sentry-build-plugin/))
  30. ).toBeInTheDocument();
  31. expect(
  32. screen.queryByText(textWithMarkupMatcher(/instrumentation.ts/))
  33. ).toBeInTheDocument();
  34. });
  35. });