macos.spec.tsx 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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 from './macos';
  7. describe('apple-macos onboarding docs', function () {
  8. it('renders docs correctly', async function () {
  9. renderWithOnboardingLayout(docs, {
  10. releaseRegistry: {
  11. 'sentry.cocoa': {
  12. version: '1.99.9',
  13. },
  14. },
  15. });
  16. // Renders main headings
  17. expect(screen.getByRole('heading', {name: 'Install'})).toBeInTheDocument();
  18. expect(screen.getByRole('heading', {name: 'Configure SDK'})).toBeInTheDocument();
  19. expect(screen.getByRole('heading', {name: 'Verify'})).toBeInTheDocument();
  20. // Renders SDK version from registry
  21. expect(
  22. await screen.findByText(
  23. textWithMarkupMatcher(
  24. /\.package\(url: "https:\/\/github.com\/getsentry\/sentry-cocoa", from: "1\.99\.9"\),/
  25. )
  26. )
  27. ).toBeInTheDocument();
  28. });
  29. it('renders performance onboarding docs correctly', async function () {
  30. renderWithOnboardingLayout(docs, {
  31. selectedProducts: [ProductSolution.PERFORMANCE_MONITORING],
  32. });
  33. expect(
  34. await screen.findAllByText(textWithMarkupMatcher(/options.tracesSampleRate/))
  35. ).toHaveLength(2);
  36. });
  37. it('renders transaction profiling', async function () {
  38. renderWithOnboardingLayout(docs);
  39. // Does not render continuous profiling config
  40. expect(
  41. screen.queryByText(textWithMarkupMatcher(/SentrySDK.startProfiler\(\)/))
  42. ).not.toBeInTheDocument();
  43. expect(
  44. screen.queryByText(textWithMarkupMatcher(/SentrySDK.stopProfiler\(\)/))
  45. ).not.toBeInTheDocument();
  46. // Does render transaction profiling config
  47. expect(
  48. await screen.findAllByText(textWithMarkupMatcher(/options.profilesSampleRate/))
  49. ).toHaveLength(2);
  50. });
  51. it('renders continuous profiling', function () {
  52. const organization = OrganizationFixture({
  53. features: ['continuous-profiling'],
  54. });
  55. renderWithOnboardingLayout(
  56. docs,
  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. });