eventEntries.spec.tsx 1.7 KB

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