index.spec.tsx 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import {Fragment} from 'react';
  2. import {initializeOrg} from 'sentry-test/initializeOrg';
  3. import {render, screen, userEvent} from 'sentry-test/reactTestingLibrary';
  4. import {DebugMeta} from 'sentry/components/events/interfaces/debugMeta';
  5. import {getFileName} from 'sentry/components/events/interfaces/debugMeta/utils';
  6. import GlobalModal from 'sentry/components/globalModal';
  7. describe('DebugMeta', function () {
  8. it('opens details modal', async function () {
  9. const eventEntryDebugMeta = TestStubs.EventEntryDebugMeta();
  10. const event = TestStubs.Event({entries: [eventEntryDebugMeta]});
  11. const {organization, project, router} = initializeOrg();
  12. const routerProps = {router, location: router.location};
  13. render(
  14. <Fragment>
  15. <GlobalModal />
  16. <DebugMeta
  17. organization={organization}
  18. projectId={project.id}
  19. event={event}
  20. data={eventEntryDebugMeta.data}
  21. {...routerProps}
  22. />
  23. </Fragment>
  24. );
  25. await screen.findByRole('heading', {name: 'Images Loaded'});
  26. userEvent.click(screen.getByRole('button', {name: 'Show Details'}));
  27. userEvent.click(screen.getByRole('button', {name: 'View'}));
  28. expect(
  29. await screen.findByText(getFileName(eventEntryDebugMeta.data.images[0].code_file)!)
  30. ).toBeInTheDocument();
  31. });
  32. });