ios.spec.tsx 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. import {OrganizationFixture} from 'sentry-fixture/organization';
  2. import {renderWithOnboardingLayout} from 'sentry-test/onboarding/renderWithOnboardingLayout';
  3. import {screen} from 'sentry-test/reactTestingLibrary';
  4. import {textWithMarkupMatcher} from 'sentry-test/utils';
  5. import {ProductSolution} from 'sentry/components/onboarding/productSelection';
  6. import docs, {InstallationMode} from './ios';
  7. describe('apple-ios onboarding docs', function () {
  8. it('renders docs correctly', function () {
  9. renderWithOnboardingLayout(docs);
  10. // Renders main headings
  11. expect(screen.getByRole('heading', {name: 'Install'})).toBeInTheDocument();
  12. expect(screen.getByRole('heading', {name: 'Configure SDK'})).toBeInTheDocument();
  13. expect(screen.getByRole('heading', {name: 'Verify'})).toBeInTheDocument();
  14. expect(
  15. screen.getByRole('heading', {name: 'Experimental Features'})
  16. ).toBeInTheDocument();
  17. });
  18. it('renders performance onboarding docs correctly', async function () {
  19. renderWithOnboardingLayout(docs, {
  20. selectedProducts: [ProductSolution.PERFORMANCE_MONITORING],
  21. selectedOptions: {
  22. installationMode: InstallationMode.MANUAL,
  23. },
  24. });
  25. expect(
  26. await screen.findAllByText(textWithMarkupMatcher(/options.tracesSampleRate/))
  27. ).toHaveLength(2);
  28. });
  29. it('renders transaction profiling', async function () {
  30. renderWithOnboardingLayout(docs, {
  31. selectedOptions: {
  32. installationMode: InstallationMode.MANUAL,
  33. },
  34. });
  35. // Does not render continuous profiling config
  36. expect(
  37. screen.queryByText(textWithMarkupMatcher(/SentrySDK.startProfiler\(\)/))
  38. ).not.toBeInTheDocument();
  39. expect(
  40. screen.queryByText(textWithMarkupMatcher(/SentrySDK.stopProfiler\(\)/))
  41. ).not.toBeInTheDocument();
  42. // Does render transaction profiling config
  43. expect(
  44. await screen.findAllByText(textWithMarkupMatcher(/options.profilesSampleRate/))
  45. ).toHaveLength(2);
  46. });
  47. it('renders continuous profiling', function () {
  48. const organization = OrganizationFixture({
  49. features: ['continuous-profiling'],
  50. });
  51. renderWithOnboardingLayout(
  52. docs,
  53. {
  54. selectedOptions: {
  55. installationMode: InstallationMode.MANUAL,
  56. },
  57. },
  58. {
  59. organization,
  60. }
  61. );
  62. // Does not render transaction profiling config
  63. expect(
  64. screen.queryByText(textWithMarkupMatcher(/options.profilesSampleRate/))
  65. ).not.toBeInTheDocument();
  66. // Does render continuous profiling config
  67. const startMatches = screen.queryAllByText(
  68. textWithMarkupMatcher(/SentrySDK.startProfiler\(\)/)
  69. );
  70. expect(startMatches.length).toBeGreaterThan(0);
  71. startMatches.forEach(match => expect(match).toBeInTheDocument());
  72. const stopMatches = screen.queryAllByText(
  73. textWithMarkupMatcher(/SentrySDK.stopProfiler\(\)/)
  74. );
  75. expect(stopMatches.length).toBeGreaterThan(0);
  76. stopMatches.forEach(match => expect(match).toBeInTheDocument());
  77. });
  78. });