react-native.spec.tsx 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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, {
  6. InstallationMode,
  7. } from 'sentry/gettingStartedDocs/react-native/react-native';
  8. describe('getting started with react-native', function () {
  9. it('renders manual installation docs correctly', function () {
  10. renderWithOnboardingLayout(docs, {
  11. selectedOptions: {
  12. installationMode: InstallationMode.MANUAL,
  13. },
  14. });
  15. // For manual install, we should see "Install SDK Package" instead of "Install"
  16. expect(
  17. screen.getByRole('heading', {name: 'Install SDK Package'})
  18. ).toBeInTheDocument();
  19. expect(screen.getByRole('heading', {name: 'Configure SDK'})).toBeInTheDocument();
  20. expect(screen.getByRole('heading', {name: 'Verify'})).toBeInTheDocument();
  21. });
  22. it('renders auto installation docs correctly', function () {
  23. renderWithOnboardingLayout(docs, {
  24. selectedOptions: {
  25. installationMode: InstallationMode.AUTO,
  26. },
  27. });
  28. // For auto install, we should see "Install" and no configure/verify sections
  29. expect(screen.getByRole('heading', {name: 'Install'})).toBeInTheDocument();
  30. expect(
  31. screen.queryByRole('heading', {name: 'Configure SDK'})
  32. ).not.toBeInTheDocument();
  33. expect(screen.queryByRole('heading', {name: 'Verify'})).not.toBeInTheDocument();
  34. });
  35. it('renders errors onboarding docs correctly', function () {
  36. renderWithOnboardingLayout(docs, {
  37. selectedOptions: {
  38. installationMode: InstallationMode.MANUAL,
  39. },
  40. selectedProducts: [ProductSolution.PERFORMANCE_MONITORING],
  41. });
  42. // Renders main headings
  43. expect(
  44. screen.getByRole('heading', {name: 'Install SDK Package'})
  45. ).toBeInTheDocument();
  46. expect(screen.getByRole('heading', {name: 'Configure SDK'})).toBeInTheDocument();
  47. expect(screen.getByRole('heading', {name: 'Verify'})).toBeInTheDocument();
  48. expect(screen.getByRole('heading', {name: 'Tracing'})).toBeInTheDocument();
  49. expect(screen.getByRole('heading', {name: 'Debug Symbols'})).toBeInTheDocument();
  50. expect(screen.getByRole('heading', {name: 'Source Context'})).toBeInTheDocument();
  51. });
  52. it('renders performance onboarding docs correctly', function () {
  53. renderWithOnboardingLayout(docs, {
  54. selectedProducts: [ProductSolution.PERFORMANCE_MONITORING],
  55. selectedOptions: {
  56. installationMode: InstallationMode.MANUAL,
  57. },
  58. });
  59. expect(
  60. screen.getByText(textWithMarkupMatcher(/tracesSampleRate/))
  61. ).toBeInTheDocument();
  62. });
  63. it('renders profiling onboarding docs correctly', function () {
  64. renderWithOnboardingLayout(docs, {
  65. selectedProducts: [
  66. ProductSolution.PERFORMANCE_MONITORING,
  67. ProductSolution.PROFILING,
  68. ],
  69. selectedOptions: {
  70. installationMode: InstallationMode.MANUAL,
  71. },
  72. });
  73. expect(
  74. screen.getByText(textWithMarkupMatcher(/profilesSampleRate/))
  75. ).toBeInTheDocument();
  76. });
  77. });