react.spec.tsx 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. const {container} = render(
  8. <GettingStartedWithReact
  9. dsn="test-dsn"
  10. activeProductSelection={[
  11. ProductSolution.PERFORMANCE_MONITORING,
  12. ProductSolution.SESSION_REPLAY,
  13. ]}
  14. />
  15. );
  16. // Steps
  17. for (const step of steps()) {
  18. expect(
  19. screen.getByRole('heading', {name: step.title ?? StepTitle[step.type]})
  20. ).toBeInTheDocument();
  21. }
  22. // Next Steps
  23. const filteredNextStepsLinks = nextSteps.filter(
  24. nextStep =>
  25. ![
  26. ProductSolution.PERFORMANCE_MONITORING,
  27. ProductSolution.SESSION_REPLAY,
  28. ].includes(nextStep.id as ProductSolution)
  29. );
  30. for (const filteredNextStepsLink of filteredNextStepsLinks) {
  31. expect(
  32. screen.getByRole('link', {name: filteredNextStepsLink.name})
  33. ).toBeInTheDocument();
  34. }
  35. expect(container).toSnapshot();
  36. });
  37. it('performance product is not selected', function () {
  38. render(
  39. <GettingStartedWithReact
  40. dsn="test-dsn"
  41. activeProductSelection={[ProductSolution.SESSION_REPLAY]}
  42. />
  43. );
  44. // Next Steps
  45. expect(
  46. screen.getByRole('link', {name: 'Performance Monitoring'})
  47. ).toBeInTheDocument();
  48. });
  49. it('session replay product is not selected', function () {
  50. render(
  51. <GettingStartedWithReact
  52. dsn="test-dsn"
  53. activeProductSelection={[ProductSolution.PERFORMANCE_MONITORING]}
  54. />
  55. );
  56. // Next Steps
  57. expect(screen.getByRole('link', {name: 'Session Replay'})).toBeInTheDocument();
  58. });
  59. });