groupEventDetails.spec.tsx 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716
  1. import type {InjectedRouter} from 'react-router';
  2. import type {Location} from 'history';
  3. import {CommitFixture} from 'sentry-fixture/commit';
  4. import {CommitAuthorFixture} from 'sentry-fixture/commitAuthor';
  5. import {EventFixture} from 'sentry-fixture/event';
  6. import {GroupFixture} from 'sentry-fixture/group';
  7. import {LocationFixture} from 'sentry-fixture/locationFixture';
  8. import {OrganizationFixture} from 'sentry-fixture/organization';
  9. import {ProjectFixture} from 'sentry-fixture/project';
  10. import {RouterContextFixture} from 'sentry-fixture/routerContextFixture';
  11. import {RouterFixture} from 'sentry-fixture/routerFixture';
  12. import {SentryAppFixture} from 'sentry-fixture/sentryApp';
  13. import {SentryAppComponentFixture} from 'sentry-fixture/sentryAppComponent';
  14. import {SentryAppInstallationFixture} from 'sentry-fixture/sentryAppInstallation';
  15. import {initializeOrg} from 'sentry-test/initializeOrg';
  16. import {render, screen, waitFor, within} from 'sentry-test/reactTestingLibrary';
  17. import type {Event, Group} from 'sentry/types';
  18. import {EntryType, IssueCategory, IssueType} from 'sentry/types';
  19. import type {Organization} from 'sentry/types/organization';
  20. import type {Project} from 'sentry/types/project';
  21. import {browserHistory} from 'sentry/utils/browserHistory';
  22. import type {QuickTraceEvent} from 'sentry/utils/performance/quickTrace/types';
  23. import type {GroupEventDetailsProps} from 'sentry/views/issueDetails/groupEventDetails/groupEventDetails';
  24. import GroupEventDetails from 'sentry/views/issueDetails/groupEventDetails/groupEventDetails';
  25. import {ReprocessingStatus} from 'sentry/views/issueDetails/utils';
  26. import {RouteContext} from 'sentry/views/routeContext';
  27. const TRACE_ID = '797cda4e24844bdc90e0efe741616047';
  28. const makeDefaultMockData = (
  29. organization?: Organization,
  30. project?: Project,
  31. query?: Record<string, string | string[]>
  32. ): {
  33. event: Event;
  34. group: Group;
  35. organization: Organization;
  36. project: Project;
  37. router: InjectedRouter;
  38. } => {
  39. return {
  40. organization: organization ?? initializeOrg().organization,
  41. project: project ?? initializeOrg().project,
  42. group: GroupFixture(),
  43. router: RouterFixture({
  44. location: LocationFixture({
  45. query: query ?? {},
  46. }),
  47. }),
  48. event: EventFixture({
  49. size: 1,
  50. dateCreated: '2019-03-20T00:00:00.000Z',
  51. errors: [],
  52. entries: [],
  53. tags: [
  54. {key: 'environment', value: 'dev'},
  55. {key: 'mechanism', value: 'ANR'},
  56. ],
  57. contexts: {
  58. app: {
  59. app_start_time: '2021-08-31T15:14:21Z',
  60. device_app_hash: '0b77c3f2567d65fe816e1fa7013779fbe3b51633',
  61. build_type: 'test',
  62. app_identifier: 'io.sentry.sample.iOS-Swift',
  63. app_name: 'iOS-Swift',
  64. app_version: '7.2.3',
  65. app_build: '390',
  66. app_id: 'B2690307-FDD1-3D34-AA1E-E280A9C2406C',
  67. type: 'app',
  68. },
  69. device: {
  70. family: 'iOS',
  71. model: 'iPhone13,4',
  72. model_id: 'D54pAP',
  73. memory_size: 5987008512,
  74. free_memory: 154435584,
  75. usable_memory: 4706893824,
  76. storage_size: 127881465856,
  77. boot_time: '2021-08-29T06:05:51Z',
  78. timezone: 'CEST',
  79. type: 'device',
  80. },
  81. os: {
  82. name: 'iOS',
  83. version: '14.7.1',
  84. build: '18G82',
  85. kernel_version:
  86. 'Darwin Kernel Version 20.6.0: Mon Jun 21 21:23:35 PDT 2021; root:xnu-7195.140.42~10/RELEASE_ARM64_T8101',
  87. rooted: false,
  88. type: 'os',
  89. },
  90. trace: {
  91. trace_id: TRACE_ID,
  92. span_id: 'b0e6f15b45c36b12',
  93. op: 'ui.action.click',
  94. type: 'trace',
  95. },
  96. },
  97. }),
  98. };
  99. };
  100. function TestComponent(
  101. props: Partial<GroupEventDetailsProps> & {query?: Record<string, string | string[]>}
  102. ) {
  103. const {organization, project, group, event, router} = makeDefaultMockData(
  104. props.organization,
  105. props.project,
  106. props.query ?? {environment: ['dev']}
  107. );
  108. const mergedProps: GroupEventDetailsProps = {
  109. group,
  110. event,
  111. project,
  112. organization,
  113. params: {groupId: group.id, eventId: '1'},
  114. router,
  115. location: {} as Location<any>,
  116. route: {},
  117. eventError: props.eventError ?? false,
  118. groupReprocessingStatus:
  119. props.groupReprocessingStatus ?? ReprocessingStatus.NO_STATUS,
  120. onRetry: props?.onRetry ?? jest.fn(),
  121. loadingEvent: props.loadingEvent ?? false,
  122. routes: [],
  123. routeParams: {},
  124. ...props,
  125. };
  126. return (
  127. <RouteContext.Provider
  128. value={{
  129. router,
  130. location: router.location,
  131. params: router.params,
  132. routes: router.routes,
  133. }}
  134. >
  135. <GroupEventDetails {...mergedProps} />;
  136. </RouteContext.Provider>
  137. );
  138. }
  139. const mockedTrace = (project: Project) => {
  140. return {
  141. event_id: '8806ea4691c24fc7b1c77ecd78df574f',
  142. span_id: 'b0e6f15b45c36b12',
  143. transaction: 'MainActivity.add_attachment',
  144. 'transaction.duration': 1000,
  145. 'transaction.op': 'navigation',
  146. project_id: parseInt(project.id, 10),
  147. project_slug: project.slug,
  148. parent_span_id: null,
  149. parent_event_id: null,
  150. generation: 0,
  151. errors: [
  152. {
  153. event_id: 'c6971a73454646338bc3ec80c70f8891',
  154. issue_id: 104,
  155. span: 'b0e6f15b45c36b12',
  156. project_id: parseInt(project.id, 10),
  157. project_slug: project.slug,
  158. title: 'ApplicationNotResponding: ANR for at least 5000 ms.',
  159. message: 'ANR for at least 5000 ms.',
  160. level: 'error',
  161. issue: '',
  162. },
  163. ],
  164. performance_issues: [
  165. {
  166. event_id: '8806ea4691c24fc7b1c77ecd78df574f',
  167. issue_id: 110,
  168. issue_short_id: 'SENTRY-ANDROID-1R',
  169. span: ['b0e6f15b45c36b12'],
  170. suspect_spans: ['89930aab9a0314d4'],
  171. project_id: parseInt(project.id, 10),
  172. project_slug: project.slug,
  173. title: 'File IO on Main Thread',
  174. message: 'File IO on Main Thread',
  175. level: 'info',
  176. culprit: 'MainActivity.add_attachment',
  177. type: 1008,
  178. end: 1678290375.15056,
  179. start: 1678290374.150562,
  180. },
  181. ],
  182. timestamp: 1678290375.150561,
  183. start_timestamp: 1678290374.150561,
  184. children: [],
  185. } as QuickTraceEvent;
  186. };
  187. const mockGroupApis = (
  188. organization: Organization,
  189. project: Project,
  190. group: Group,
  191. event: Event,
  192. trace?: QuickTraceEvent
  193. ) => {
  194. MockApiClient.addMockResponse({
  195. url: `/organizations/${organization.slug}/issues/${group.id}/`,
  196. body: group,
  197. });
  198. MockApiClient.addMockResponse({
  199. url: `/projects/${organization.slug}/${project.slug}/issues/`,
  200. method: 'PUT',
  201. });
  202. MockApiClient.addMockResponse({
  203. url: `/projects/${organization.slug}/${project.slug}/events/${event.id}/committers/`,
  204. body: {committers: []},
  205. });
  206. MockApiClient.addMockResponse({
  207. url: `/projects/${organization.slug}/${project.slug}/events/${event.id}/owners/`,
  208. body: {owners: [], rules: []},
  209. });
  210. MockApiClient.addMockResponse({
  211. url: `/organizations/${organization.slug}/issues/${group.id}/tags/`,
  212. body: [],
  213. });
  214. MockApiClient.addMockResponse({
  215. url: `/organizations/${organization.slug}/events-trace/${TRACE_ID}/`,
  216. body: trace
  217. ? {transactions: [trace], orphan_errors: []}
  218. : {transactions: [], orphan_errors: []},
  219. });
  220. MockApiClient.addMockResponse({
  221. url: `/organizations/${organization.slug}/events-trace-light/${TRACE_ID}/`,
  222. body: trace
  223. ? {transactions: [trace], orphan_errors: []}
  224. : {transactions: [], orphan_errors: []},
  225. });
  226. MockApiClient.addMockResponse({
  227. url: `/organizations/${organization.slug}/issues/${group.id}/integrations/`,
  228. body: [],
  229. });
  230. MockApiClient.addMockResponse({
  231. url: `/organizations/${organization.slug}/issues/${group.id}/external-issues/`,
  232. });
  233. MockApiClient.addMockResponse({
  234. url: `/organizations/${organization.slug}/issues/${group.id}/current-release/`,
  235. body: {currentRelease: null},
  236. });
  237. MockApiClient.addMockResponse({
  238. url: `/organizations/${organization.slug}/prompts-activity/`,
  239. body: undefined,
  240. });
  241. MockApiClient.addMockResponse({
  242. url: `/organizations/${organization.slug}/has-mobile-app-events/`,
  243. body: null,
  244. });
  245. MockApiClient.addMockResponse({
  246. url: `/projects/${organization.slug}/${project.slug}/events/${event.id}/grouping-info/`,
  247. body: {},
  248. });
  249. MockApiClient.addMockResponse({
  250. url: `/projects/${organization.slug}/${project.slug}/codeowners/`,
  251. body: [],
  252. });
  253. MockApiClient.addMockResponse({
  254. url: `/organizations/${organization.slug}/code-mappings/`,
  255. method: 'GET',
  256. body: [],
  257. });
  258. MockApiClient.addMockResponse({
  259. url: `/projects/${organization.slug}/${project.slug}/events/${event.id}/actionable-items/`,
  260. body: {
  261. errors: [],
  262. },
  263. });
  264. // Sentry related mocks
  265. MockApiClient.addMockResponse({
  266. url: '/sentry-apps/',
  267. body: [],
  268. });
  269. MockApiClient.addMockResponse({
  270. url: `/organizations/${organization.slug}/sentry-apps/`,
  271. body: [],
  272. });
  273. MockApiClient.addMockResponse({
  274. url: `/organizations/${organization.slug}/sentry-app-installations/`,
  275. body: [],
  276. });
  277. MockApiClient.addMockResponse({
  278. url: `/organizations/${organization.slug}/sentry-app-components/`,
  279. body: [],
  280. match: [MockApiClient.matchQuery({projectId: project.id})],
  281. });
  282. MockApiClient.addMockResponse({
  283. url: '/projects/org-slug/project-slug/',
  284. body: project,
  285. });
  286. MockApiClient.addMockResponse({
  287. url: '/organizations/org-slug/users/',
  288. body: [],
  289. });
  290. MockApiClient.addMockResponse({
  291. url: '/organizations/org-slug/projects/',
  292. body: [project],
  293. });
  294. MockApiClient.addMockResponse({
  295. url: `/customers/org-slug/policies/`,
  296. body: {},
  297. });
  298. MockApiClient.addMockResponse({
  299. url: `/organizations/${organization.slug}/issues/${group.id}/first-last-release/`,
  300. method: 'GET',
  301. });
  302. MockApiClient.addMockResponse({
  303. url: `/organizations/${organization.slug}/events/`,
  304. body: {
  305. data: [],
  306. meta: {fields: {}, units: {}},
  307. },
  308. });
  309. };
  310. describe('groupEventDetails', () => {
  311. beforeEach(() => {
  312. MockApiClient.clearMockResponses();
  313. });
  314. afterEach(function () {
  315. MockApiClient.clearMockResponses();
  316. jest.mocked(browserHistory.replace).mockClear();
  317. });
  318. it('redirects on switching to an invalid environment selection for event', async function () {
  319. const props = makeDefaultMockData();
  320. mockGroupApis(props.organization, props.project, props.group, props.event);
  321. const {rerender} = render(<TestComponent {...props} />, {
  322. organization: props.organization,
  323. });
  324. expect(browserHistory.replace).not.toHaveBeenCalled();
  325. rerender(<TestComponent query={{environment: ['prod']}} />);
  326. await waitFor(() => expect(browserHistory.replace).toHaveBeenCalled());
  327. });
  328. it('does not redirect when switching to a valid environment selection for event', async function () {
  329. const props = makeDefaultMockData();
  330. mockGroupApis(props.organization, props.project, props.group, props.event);
  331. const {rerender} = render(<TestComponent {...props} />, {
  332. organization: props.organization,
  333. });
  334. expect(browserHistory.replace).not.toHaveBeenCalled();
  335. rerender(<TestComponent query={{environment: []}} />);
  336. expect(await screen.findByTestId('group-event-details')).toBeInTheDocument();
  337. expect(browserHistory.replace).not.toHaveBeenCalled();
  338. });
  339. it('displays error on event error', async function () {
  340. const props = makeDefaultMockData();
  341. mockGroupApis(
  342. props.organization,
  343. props.project,
  344. props.group,
  345. EventFixture({
  346. size: 1,
  347. dateCreated: '2019-03-20T00:00:00.000Z',
  348. errors: [],
  349. entries: [],
  350. tags: [{key: 'environment', value: 'dev'}],
  351. previousEventID: 'prev-event-id',
  352. nextEventID: 'next-event-id',
  353. })
  354. );
  355. render(<TestComponent event={undefined} eventError />, {
  356. organization: props.organization,
  357. });
  358. expect(
  359. await screen.findByText(/events for this issue could not be found/)
  360. ).toBeInTheDocument();
  361. });
  362. it('renders the Span Evidence and Resources section for Performance Issues', async function () {
  363. const props = makeDefaultMockData();
  364. const group: Group = GroupFixture({
  365. issueCategory: IssueCategory.PERFORMANCE,
  366. issueType: IssueType.PERFORMANCE_N_PLUS_ONE_DB_QUERIES,
  367. });
  368. const transaction = EventFixture({
  369. entries: [{type: EntryType.SPANS, data: []}],
  370. });
  371. mockGroupApis(
  372. props.organization,
  373. props.project,
  374. props.group,
  375. EventFixture({
  376. size: 1,
  377. dateCreated: '2019-03-20T00:00:00.000Z',
  378. errors: [],
  379. entries: [],
  380. tags: [{key: 'environment', value: 'dev'}],
  381. previousEventID: 'prev-event-id',
  382. nextEventID: 'next-event-id',
  383. })
  384. );
  385. const routerContext = RouterContextFixture();
  386. render(<TestComponent group={group} event={transaction} />, {
  387. organization: props.organization,
  388. context: routerContext,
  389. });
  390. expect(
  391. await screen.findByRole('heading', {
  392. name: /span evidence/i,
  393. })
  394. ).toBeInTheDocument();
  395. expect(
  396. screen.getByRole('heading', {
  397. name: /resources/i,
  398. })
  399. ).toBeInTheDocument();
  400. });
  401. it('renders the Function Evidence and Resources section for Profile Issues', async function () {
  402. const props = makeDefaultMockData();
  403. const group: Group = GroupFixture({
  404. issueCategory: IssueCategory.PERFORMANCE,
  405. issueType: IssueType.PROFILE_FILE_IO_MAIN_THREAD,
  406. });
  407. const transaction = EventFixture({
  408. entries: [],
  409. occurrence: {
  410. evidenceDisplay: [],
  411. evidenceData: {
  412. templateName: 'profile',
  413. },
  414. type: 2001,
  415. },
  416. });
  417. mockGroupApis(
  418. props.organization,
  419. props.project,
  420. props.group,
  421. EventFixture({
  422. size: 1,
  423. dateCreated: '2019-03-20T00:00:00.000Z',
  424. errors: [],
  425. entries: [],
  426. tags: [{key: 'environment', value: 'dev'}],
  427. previousEventID: 'prev-event-id',
  428. nextEventID: 'next-event-id',
  429. })
  430. );
  431. const routerContext = RouterContextFixture();
  432. render(<TestComponent group={group} event={transaction} />, {
  433. organization: props.organization,
  434. context: routerContext,
  435. });
  436. expect(
  437. await screen.findByRole('heading', {
  438. name: /function evidence/i,
  439. })
  440. ).toBeInTheDocument();
  441. expect(
  442. screen.getByRole('heading', {
  443. name: /resources/i,
  444. })
  445. ).toBeInTheDocument();
  446. });
  447. describe('changes to event tags ui', () => {
  448. async function assertNewTagsView() {
  449. expect(await screen.findByText('Event ID:')).toBeInTheDocument();
  450. expect(screen.queryByTestId('context-summary')).not.toBeInTheDocument();
  451. expect(screen.getByTestId('event-tags')).toBeInTheDocument();
  452. const highlights = screen.getByTestId('event-highlights');
  453. expect(
  454. within(highlights).getByRole('button', {name: 'View All'})
  455. ).toBeInTheDocument();
  456. expect(within(highlights).getByRole('button', {name: 'Edit'})).toBeInTheDocument();
  457. // No highlights setup
  458. expect(
  459. within(highlights).getByRole('button', {name: 'Add Highlights'})
  460. ).toBeInTheDocument();
  461. expect(screen.getByText("There's nothing here...")).toBeInTheDocument();
  462. }
  463. it('works with the feature flag', async function () {
  464. const props = makeDefaultMockData();
  465. mockGroupApis(props.organization, props.project, props.group, props.event);
  466. const organization = OrganizationFixture({
  467. features: ['event-tags-tree-ui'],
  468. });
  469. render(<TestComponent group={props.group} event={props.event} />, {
  470. organization,
  471. });
  472. await assertNewTagsView();
  473. });
  474. it('works with the query param', async function () {
  475. const props = makeDefaultMockData();
  476. mockGroupApis(props.organization, props.project, props.group, props.event);
  477. const {organization} = initializeOrg();
  478. render(
  479. <TestComponent group={props.group} event={props.event} query={{tagsTree: '1'}} />,
  480. {organization}
  481. );
  482. await assertNewTagsView();
  483. });
  484. });
  485. });
  486. describe('EventCause', () => {
  487. beforeEach(() => {
  488. MockApiClient.clearMockResponses();
  489. });
  490. afterEach(function () {
  491. MockApiClient.clearMockResponses();
  492. jest.mocked(browserHistory.replace).mockClear();
  493. });
  494. it('renders suspect commit', async function () {
  495. const props = makeDefaultMockData(
  496. undefined,
  497. ProjectFixture({firstEvent: EventFixture().dateCreated})
  498. );
  499. mockGroupApis(
  500. props.organization,
  501. props.project,
  502. props.group,
  503. EventFixture({
  504. size: 1,
  505. dateCreated: '2019-03-20T00:00:00.000Z',
  506. errors: [],
  507. entries: [],
  508. tags: [{key: 'environment', value: 'dev'}],
  509. previousEventID: 'prev-event-id',
  510. nextEventID: 'next-event-id',
  511. })
  512. );
  513. MockApiClient.addMockResponse({
  514. url: `/projects/${props.organization.slug}/${props.project.slug}/events/${props.event.id}/committers/`,
  515. body: {
  516. committers: [
  517. {
  518. commits: [CommitFixture({author: CommitAuthorFixture()})],
  519. author: CommitAuthorFixture(),
  520. },
  521. ],
  522. },
  523. });
  524. render(<TestComponent project={props.project} />, {organization: props.organization});
  525. expect(await screen.findByTestId(/suspect-commit/)).toBeInTheDocument();
  526. });
  527. });
  528. describe('Platform Integrations', () => {
  529. let componentsRequest;
  530. beforeEach(() => {
  531. MockApiClient.clearMockResponses();
  532. });
  533. it('loads Integration UI components', async () => {
  534. const props = makeDefaultMockData();
  535. const unpublishedIntegration = SentryAppFixture({status: 'unpublished'});
  536. const internalIntegration = SentryAppFixture({status: 'internal'});
  537. const unpublishedInstall = SentryAppInstallationFixture({
  538. app: {
  539. slug: unpublishedIntegration.slug,
  540. uuid: unpublishedIntegration.uuid,
  541. },
  542. });
  543. const internalInstall = SentryAppInstallationFixture({
  544. app: {
  545. slug: internalIntegration.slug,
  546. uuid: internalIntegration.uuid,
  547. },
  548. });
  549. mockGroupApis(
  550. props.organization,
  551. props.project,
  552. props.group,
  553. EventFixture({
  554. size: 1,
  555. dateCreated: '2019-03-20T00:00:00.000Z',
  556. errors: [],
  557. entries: [],
  558. tags: [{key: 'environment', value: 'dev'}],
  559. previousEventID: 'prev-event-id',
  560. nextEventID: 'next-event-id',
  561. })
  562. );
  563. const component = SentryAppComponentFixture({
  564. sentryApp: {
  565. uuid: unpublishedIntegration.uuid,
  566. slug: unpublishedIntegration.slug,
  567. name: unpublishedIntegration.name,
  568. },
  569. });
  570. MockApiClient.addMockResponse({
  571. url: `/organizations/${props.organization.slug}/sentry-app-installations/`,
  572. body: [unpublishedInstall, internalInstall],
  573. });
  574. componentsRequest = MockApiClient.addMockResponse({
  575. url: `/organizations/${props.organization.slug}/sentry-app-components/`,
  576. body: [component],
  577. match: [MockApiClient.matchQuery({projectId: props.project.id})],
  578. });
  579. render(<TestComponent />, {organization: props.organization});
  580. expect(await screen.findByText('Sample App Issue')).toBeInTheDocument();
  581. expect(componentsRequest).toHaveBeenCalled();
  582. });
  583. describe('ANR Root Cause', () => {
  584. beforeEach(() => {
  585. MockApiClient.clearMockResponses();
  586. });
  587. it('shows anr root cause', async () => {
  588. const {organization} = initializeOrg();
  589. const props = makeDefaultMockData({
  590. ...organization,
  591. features: ['anr-improvements'],
  592. });
  593. mockGroupApis(
  594. props.organization,
  595. props.project,
  596. props.group,
  597. props.event,
  598. mockedTrace(props.project)
  599. );
  600. const routerContext = RouterContextFixture();
  601. render(<TestComponent group={props.group} event={props.event} />, {
  602. organization: props.organization,
  603. context: routerContext,
  604. });
  605. expect(
  606. await screen.findByRole('heading', {
  607. name: /suspect root cause/i,
  608. })
  609. ).toBeInTheDocument();
  610. expect(screen.getByText('File IO on Main Thread')).toBeInTheDocument();
  611. });
  612. it('does not render root issues section if related perf issues do not exist', async () => {
  613. const {organization} = initializeOrg();
  614. const props = makeDefaultMockData({
  615. ...organization,
  616. features: ['anr-improvements'],
  617. });
  618. const trace = mockedTrace(props.project);
  619. mockGroupApis(props.organization, props.project, props.group, props.event, {
  620. ...trace,
  621. performance_issues: [],
  622. });
  623. const routerContext = RouterContextFixture();
  624. render(<TestComponent group={props.group} event={props.event} />, {
  625. organization: props.organization,
  626. context: routerContext,
  627. });
  628. // mechanism: ANR
  629. expect(await screen.findByText('ANR')).toBeInTheDocument();
  630. expect(
  631. screen.queryByRole('heading', {
  632. name: /suspect root issues/i,
  633. })
  634. ).not.toBeInTheDocument();
  635. expect(screen.queryByText('File IO on Main Thread')).not.toBeInTheDocument();
  636. });
  637. });
  638. });