setupReplaysCTA.spec.tsx 1.5 KB

123456789101112131415161718192021222324252627282930313233
  1. import {render, screen, userEvent, waitFor} from 'sentry-test/reactTestingLibrary';
  2. import {SetupReplaysCTA} from 'sentry/views/replays/list/replayOnboardingPanel';
  3. describe('SetupReplaysCTA', () => {
  4. it('renders setup replay', () => {
  5. render(<SetupReplaysCTA primaryAction="setup" orgSlug="foo" />);
  6. expect(screen.getByTestId('setup-replays-btn')).toBeInTheDocument();
  7. });
  8. it('renders setup replay w/ disabled state including tooltip', async () => {
  9. render(<SetupReplaysCTA primaryAction="setup" orgSlug="foo" disabled />);
  10. const setupBtn = screen.getByTestId('setup-replays-btn');
  11. await userEvent.hover(setupBtn);
  12. await waitFor(() => screen.getByTestId('setup-replays-tooltip'));
  13. expect(screen.getByTestId('setup-replays-tooltip')).toBeInTheDocument();
  14. });
  15. it('create project', () => {
  16. render(<SetupReplaysCTA primaryAction="create" orgSlug="foo" />);
  17. const createBtn = screen.getByTestId('create-project-btn');
  18. expect(createBtn).toBeInTheDocument();
  19. expect(createBtn).toHaveAttribute('href', `/organizations/foo/projects/new/`);
  20. });
  21. it('create project w/ disabled state including tooltip', async () => {
  22. render(<SetupReplaysCTA primaryAction="create" orgSlug="foo" disabled />);
  23. const createBtn = screen.getByTestId('create-project-btn');
  24. await userEvent.hover(createBtn);
  25. await waitFor(() => screen.getByTestId('create-project-tooltip'));
  26. expect(screen.getByTestId('create-project-tooltip')).toBeInTheDocument();
  27. });
  28. });