react.spec.tsx 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. import {render, screen} from 'sentry-test/reactTestingLibrary';
  2. import {StepTitle} from 'sentry/components/onboarding/gettingStartedDoc/step';
  3. import {ProductSolution} from 'sentry/components/onboarding/productSelection';
  4. import GettingStartedWithReact, {nextSteps, steps} from './react';
  5. describe('GettingStartedWithReact', function () {
  6. it('all products are selected', function () {
  7. render(
  8. <GettingStartedWithReact
  9. dsn="test-dsn"
  10. projectSlug="test-project"
  11. activeProductSelection={[
  12. ProductSolution.PERFORMANCE_MONITORING,
  13. ProductSolution.SESSION_REPLAY,
  14. ]}
  15. />
  16. );
  17. // Steps
  18. for (const step of steps()) {
  19. expect(
  20. screen.getByRole('heading', {name: step.title ?? StepTitle[step.type]})
  21. ).toBeInTheDocument();
  22. }
  23. // Next Steps
  24. const filteredNextStepsLinks = nextSteps.filter(
  25. nextStep =>
  26. ![
  27. ProductSolution.PERFORMANCE_MONITORING,
  28. ProductSolution.SESSION_REPLAY,
  29. ].includes(nextStep.id as ProductSolution)
  30. );
  31. for (const filteredNextStepsLink of filteredNextStepsLinks) {
  32. expect(
  33. screen.getByRole('link', {name: filteredNextStepsLink.name})
  34. ).toBeInTheDocument();
  35. }
  36. });
  37. it('performance product is not selected', function () {
  38. render(
  39. <GettingStartedWithReact
  40. dsn="test-dsn"
  41. projectSlug="test-project"
  42. activeProductSelection={[ProductSolution.SESSION_REPLAY]}
  43. />
  44. );
  45. // Next Steps
  46. expect(
  47. screen.getByRole('link', {name: 'Performance Monitoring'})
  48. ).toBeInTheDocument();
  49. });
  50. it('session replay product is not selected', function () {
  51. render(
  52. <GettingStartedWithReact
  53. dsn="test-dsn"
  54. projectSlug="test-project"
  55. activeProductSelection={[ProductSolution.PERFORMANCE_MONITORING]}
  56. />
  57. );
  58. // Next Steps
  59. expect(screen.getByRole('link', {name: 'Session Replay'})).toBeInTheDocument();
  60. });
  61. });