eventEntries.spec.tsx 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import {EventFixture} from 'sentry-fixture/event';
  2. import {EntryDebugMetaFixture, EventEntryFixture} from 'sentry-fixture/eventEntry';
  3. import {LocationFixture} from 'sentry-fixture/locationFixture';
  4. import {OrganizationFixture} from 'sentry-fixture/organization';
  5. import {ProjectFixture} from 'sentry-fixture/project';
  6. import {render, screen} from 'sentry-test/reactTestingLibrary';
  7. import {EventEntries} from 'sentry/components/events/eventEntries';
  8. describe('EventEntries', function () {
  9. const defaultProps = {
  10. organization: OrganizationFixture(),
  11. project: ProjectFixture(),
  12. event: EventFixture(),
  13. location: LocationFixture(),
  14. };
  15. beforeEach(function () {
  16. const project = ProjectFixture({platform: 'javascript'});
  17. MockApiClient.addMockResponse({
  18. url: '/projects/org-slug/project-slug/events/1/grouping-info/',
  19. });
  20. MockApiClient.addMockResponse({
  21. url: '/projects/org-slug/project-slug/events/1/committers/',
  22. body: [],
  23. });
  24. MockApiClient.addMockResponse({
  25. url: '/organizations/org-slug/projects/',
  26. body: [project],
  27. });
  28. MockApiClient.addMockResponse({
  29. url: '/projects/org-slug/project-slug/events/1/actionable-items/',
  30. });
  31. });
  32. it('renders the replay section in the correct place', async function () {
  33. render(
  34. <EventEntries
  35. {...defaultProps}
  36. event={EventFixture({
  37. entries: [EventEntryFixture(), EntryDebugMetaFixture()],
  38. contexts: {
  39. replay_id: 1,
  40. },
  41. })}
  42. />,
  43. {organization: OrganizationFixture({features: ['session-replay']})}
  44. );
  45. await screen.findByText(/message/i);
  46. const sections = screen.getAllByTestId(/event-section/);
  47. expect(sections).toHaveLength(5); // event tags + 3 entries + event grouping
  48. // Replay should be after message but before images loaded
  49. expect(sections[1]).toHaveTextContent(/message/i);
  50. expect(sections[2]).toHaveTextContent(/replay/i);
  51. expect(sections[3]).toHaveTextContent(/images loaded/i);
  52. });
  53. });