flutter.spec.tsx 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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, {InstallationMode} from './flutter';
  6. describe('flutter onboarding docs', function () {
  7. it('renders manual installation docs correctly', async function () {
  8. renderWithOnboardingLayout(docs, {
  9. releaseRegistry: {
  10. 'sentry.dart.flutter': {
  11. version: '1.99.9',
  12. },
  13. },
  14. selectedOptions: {
  15. installationMode: InstallationMode.MANUAL,
  16. },
  17. });
  18. // Renders main headings
  19. expect(screen.getByRole('heading', {name: 'Install'})).toBeInTheDocument();
  20. expect(screen.getByRole('heading', {name: 'Configure SDK'})).toBeInTheDocument();
  21. expect(screen.getByRole('heading', {name: 'Verify'})).toBeInTheDocument();
  22. // Renders SDK version from registry
  23. expect(
  24. await screen.findByText(textWithMarkupMatcher(/sentry_flutter: \^1\.99\.9/))
  25. ).toBeInTheDocument();
  26. });
  27. it('renders wizard docs correctly', async function () {
  28. renderWithOnboardingLayout(docs, {
  29. releaseRegistry: {
  30. 'sentry.dart.flutter': {
  31. version: '1.99.9',
  32. },
  33. },
  34. selectedOptions: {
  35. installationMode: InstallationMode.AUTO,
  36. },
  37. });
  38. // Renders install heading only
  39. expect(screen.getByRole('heading', {name: 'Install'})).toBeInTheDocument();
  40. expect(
  41. screen.queryByRole('heading', {name: 'Configure SDK'})
  42. ).not.toBeInTheDocument();
  43. expect(screen.queryByRole('heading', {name: 'Verify'})).not.toBeInTheDocument();
  44. // Renders wizard text
  45. expect(
  46. await screen.findByText(
  47. textWithMarkupMatcher(
  48. /Add Sentry automatically to your app with the Sentry wizard/
  49. )
  50. )
  51. ).toBeInTheDocument();
  52. });
  53. it('renders performance onboarding docs correctly', async function () {
  54. renderWithOnboardingLayout(docs, {
  55. releaseRegistry: {
  56. 'sentry.dart.flutter': {
  57. version: '1.99.9',
  58. },
  59. },
  60. selectedProducts: [ProductSolution.PERFORMANCE_MONITORING],
  61. selectedOptions: {
  62. installationMode: InstallationMode.MANUAL,
  63. },
  64. });
  65. expect(
  66. await screen.findByText(textWithMarkupMatcher(/options.tracesSampleRate/))
  67. ).toBeInTheDocument();
  68. expect(
  69. await screen.findByText(
  70. textWithMarkupMatcher(
  71. /You'll be able to monitor the performance of your app using the SDK./
  72. )
  73. )
  74. ).toBeInTheDocument();
  75. });
  76. it('renders profiling onboarding docs correctly', async function () {
  77. renderWithOnboardingLayout(docs, {
  78. releaseRegistry: {
  79. 'sentry.dart.flutter': {
  80. version: '1.99.9',
  81. },
  82. },
  83. selectedProducts: [
  84. ProductSolution.PERFORMANCE_MONITORING,
  85. ProductSolution.PROFILING,
  86. ],
  87. selectedOptions: {
  88. installationMode: InstallationMode.MANUAL,
  89. },
  90. });
  91. expect(
  92. await screen.findByText(textWithMarkupMatcher(/options.profilesSampleRate/))
  93. ).toBeInTheDocument();
  94. expect(
  95. await screen.findByText(
  96. textWithMarkupMatcher(/Flutter Profiling alpha is available/)
  97. )
  98. ).toBeInTheDocument();
  99. });
  100. });