gcpfunctions.spec.tsx 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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/productSelection';
  5. import docs from './gcpfunctions';
  6. describe('gcpfunctions onboarding docs', function () {
  7. it('renders onboarding docs correctly', () => {
  8. renderWithOnboardingLayout(docs);
  9. // Renders main headings
  10. expect(screen.getByRole('heading', {name: 'Install'})).toBeInTheDocument();
  11. expect(screen.getByRole('heading', {name: 'Configure SDK'})).toBeInTheDocument();
  12. expect(screen.getByRole('heading', {name: 'Upload Source Maps'})).toBeInTheDocument();
  13. expect(screen.getByRole('heading', {name: 'Verify'})).toBeInTheDocument();
  14. // Includes import statement
  15. const allMatches = screen.getAllByText(
  16. textWithMarkupMatcher(
  17. /const Sentry = require\("@sentry\/google-cloud-serverless"\);/
  18. )
  19. );
  20. allMatches.forEach(match => {
  21. expect(match).toBeInTheDocument();
  22. });
  23. });
  24. it('displays sample rates by default', () => {
  25. renderWithOnboardingLayout(docs, {
  26. selectedProducts: [
  27. ProductSolution.ERROR_MONITORING,
  28. ProductSolution.PERFORMANCE_MONITORING,
  29. ProductSolution.PROFILING,
  30. ],
  31. });
  32. expect(
  33. screen.queryByText(textWithMarkupMatcher(/tracesSampleRate/))
  34. ).toBeInTheDocument();
  35. expect(
  36. screen.queryByText(textWithMarkupMatcher(/profilesSampleRate/))
  37. ).toBeInTheDocument();
  38. });
  39. it('enables performance setting the tracesSampleRate to 1', () => {
  40. renderWithOnboardingLayout(docs, {
  41. selectedProducts: [
  42. ProductSolution.ERROR_MONITORING,
  43. ProductSolution.PERFORMANCE_MONITORING,
  44. ],
  45. });
  46. expect(
  47. screen.getByText(textWithMarkupMatcher(/tracesSampleRate: 1\.0/))
  48. ).toBeInTheDocument();
  49. });
  50. it('enables profiling by setting profiling samplerates', () => {
  51. renderWithOnboardingLayout(docs, {
  52. selectedProducts: [ProductSolution.ERROR_MONITORING, ProductSolution.PROFILING],
  53. });
  54. expect(
  55. screen.getByText(
  56. textWithMarkupMatcher(
  57. /const { nodeProfilingIntegration } = require\("@sentry\/profiling-node"\)/
  58. )
  59. )
  60. ).toBeInTheDocument();
  61. expect(
  62. screen.getByText(textWithMarkupMatcher(/profilesSampleRate: 1\.0/))
  63. ).toBeInTheDocument();
  64. });
  65. });