react.spec.tsx 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. 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. });
  36. it('performance product is not selected', function () {
  37. render(
  38. <GettingStartedWithReact
  39. dsn="test-dsn"
  40. activeProductSelection={[ProductSolution.SESSION_REPLAY]}
  41. />
  42. );
  43. // Next Steps
  44. expect(
  45. screen.getByRole('link', {name: 'Performance Monitoring'})
  46. ).toBeInTheDocument();
  47. });
  48. it('session replay product is not selected', function () {
  49. render(
  50. <GettingStartedWithReact
  51. dsn="test-dsn"
  52. activeProductSelection={[ProductSolution.PERFORMANCE_MONITORING]}
  53. />
  54. );
  55. // Next Steps
  56. expect(screen.getByRole('link', {name: 'Session Replay'})).toBeInTheDocument();
  57. });
  58. });