eventEntries.spec.tsx 1.6 KB

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