ios.spec.tsx 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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/gettingStartedDoc/types';
  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. });
  15. it('renders performance onboarding docs correctly', async function () {
  16. renderWithOnboardingLayout(docs, {
  17. selectedProducts: [ProductSolution.PERFORMANCE_MONITORING],
  18. selectedOptions: {
  19. installationMode: InstallationMode.MANUAL,
  20. },
  21. });
  22. expect(
  23. await screen.findAllByText(textWithMarkupMatcher(/options.tracesSampleRate/))
  24. ).toHaveLength(2);
  25. });
  26. it('renders transaction profiling', async function () {
  27. renderWithOnboardingLayout(docs, {
  28. selectedOptions: {
  29. installationMode: InstallationMode.MANUAL,
  30. },
  31. });
  32. // Does not render continuous profiling config
  33. expect(
  34. screen.queryByText(textWithMarkupMatcher(/SentrySDK.startProfiler\(\)/))
  35. ).not.toBeInTheDocument();
  36. expect(
  37. screen.queryByText(textWithMarkupMatcher(/SentrySDK.stopProfiler\(\)/))
  38. ).not.toBeInTheDocument();
  39. // Does render transaction profiling config
  40. expect(
  41. await screen.findAllByText(textWithMarkupMatcher(/options.profilesSampleRate/))
  42. ).toHaveLength(2);
  43. });
  44. it('renders continuous profiling', function () {
  45. const organization = OrganizationFixture({
  46. features: ['continuous-profiling'],
  47. });
  48. renderWithOnboardingLayout(
  49. docs,
  50. {
  51. selectedOptions: {
  52. installationMode: InstallationMode.MANUAL,
  53. },
  54. },
  55. {
  56. organization,
  57. }
  58. );
  59. // Does not render transaction profiling config
  60. expect(
  61. screen.queryByText(textWithMarkupMatcher(/options.profilesSampleRate/))
  62. ).not.toBeInTheDocument();
  63. // Does render continuous profiling config
  64. const startMatches = screen.queryAllByText(
  65. textWithMarkupMatcher(/SentrySDK.startProfiler\(\)/)
  66. );
  67. expect(startMatches.length).toBeGreaterThan(0);
  68. startMatches.forEach(match => expect(match).toBeInTheDocument());
  69. const stopMatches = screen.queryAllByText(
  70. textWithMarkupMatcher(/SentrySDK.stopProfiler\(\)/)
  71. );
  72. expect(stopMatches.length).toBeGreaterThan(0);
  73. stopMatches.forEach(match => expect(match).toBeInTheDocument());
  74. });
  75. });