index.spec.tsx 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722
  1. import {browserHistory} from 'react-router';
  2. import {Location} from 'history';
  3. import {initializeOrg} from 'sentry-test/initializeOrg';
  4. import {
  5. initializeData,
  6. initializeDataSettings,
  7. } from 'sentry-test/performance/initializePerformanceData';
  8. import {
  9. act,
  10. fireEvent,
  11. render,
  12. screen,
  13. userEvent,
  14. waitFor,
  15. within,
  16. } from 'sentry-test/reactTestingLibrary';
  17. import PageFiltersStore from 'sentry/stores/pageFiltersStore';
  18. import ProjectsStore from 'sentry/stores/projectsStore';
  19. import {WebVital} from 'sentry/utils/fields';
  20. import TrendsIndex from 'sentry/views/performance/trends/';
  21. import {defaultTrendsSelectionDate} from 'sentry/views/performance/trends/content';
  22. import {
  23. DEFAULT_MAX_DURATION,
  24. TRENDS_FUNCTIONS,
  25. TRENDS_PARAMETERS,
  26. } from 'sentry/views/performance/trends/utils';
  27. const trendsViewQuery = {
  28. query: `tpm():>0.01 transaction.duration:>0 transaction.duration:<${DEFAULT_MAX_DURATION}`,
  29. };
  30. jest.mock(
  31. 'sentry/utils/getDynamicComponent',
  32. () =>
  33. ({fixed}) =>
  34. fixed
  35. );
  36. jest.mock('moment', () => {
  37. const moment = jest.requireActual('moment');
  38. moment.now = jest.fn().mockReturnValue(1601251200000);
  39. return moment;
  40. });
  41. async function getTrendDropdown() {
  42. const dropdown = await screen.findByRole('button', {name: /Percentile.+/});
  43. expect(dropdown).toBeInTheDocument();
  44. return dropdown;
  45. }
  46. async function getParameterDropdown() {
  47. const dropdown = await screen.findByRole('button', {name: /Parameter.+/});
  48. expect(dropdown).toBeInTheDocument();
  49. return dropdown;
  50. }
  51. async function selectMenuItemFromDropdown(value) {
  52. (browserHistory.push as any).mockReset();
  53. expect(browserHistory.push).not.toHaveBeenCalled();
  54. const option = await screen.findByTestId(value);
  55. expect(option).toBeInTheDocument();
  56. clickEl(option);
  57. await waitFor(() => expect(browserHistory.push).toHaveBeenCalled());
  58. }
  59. async function selectTrendFunction(value) {
  60. const dropdown = await getTrendDropdown();
  61. clickEl(dropdown);
  62. await selectMenuItemFromDropdown(value);
  63. }
  64. async function selectTrendParameter(value) {
  65. const dropdown = await getParameterDropdown();
  66. clickEl(dropdown);
  67. await selectMenuItemFromDropdown(value);
  68. }
  69. async function waitForMockCall(mock: any) {
  70. await waitFor(() => {
  71. expect(mock).toHaveBeenCalled();
  72. });
  73. }
  74. function enterSearch(el, text) {
  75. fireEvent.change(el, {target: {value: text}});
  76. fireEvent.submit(el);
  77. }
  78. // Might swap on/off the skiphover to check perf later.
  79. function clickEl(el) {
  80. userEvent.click(el, undefined, {skipHover: true, skipPointerEventsCheck: true});
  81. }
  82. function _initializeData(
  83. settings: initializeDataSettings,
  84. options?: {selectedProjectId?: string}
  85. ) {
  86. const newSettings = {...settings};
  87. newSettings.projects = settings.projects ?? [
  88. TestStubs.Project({id: '1', firstTransactionEvent: false}),
  89. TestStubs.Project({id: '2', firstTransactionEvent: true}),
  90. ];
  91. if (options?.selectedProjectId) {
  92. const selectedProject = newSettings.projects.find(
  93. p => p.id === options.selectedProjectId
  94. );
  95. if (!selectedProject) {
  96. throw new Error("Test is selecting project that isn't loaded");
  97. } else {
  98. PageFiltersStore.updateProjects(
  99. settings.selectedProject ? [Number(selectedProject)] : [],
  100. []
  101. );
  102. }
  103. newSettings.selectedProject = selectedProject.id;
  104. }
  105. newSettings.selectedProject = settings.selectedProject ?? newSettings.projects[0].id;
  106. const data = initializeData(newSettings);
  107. // Modify page filters store to stop rerendering due to the test harness.
  108. PageFiltersStore.onInitializeUrlState(
  109. {
  110. projects: [],
  111. environments: [],
  112. datetime: {start: null, end: null, period: '24h', utc: null},
  113. },
  114. new Set()
  115. );
  116. PageFiltersStore.updateDateTime(defaultTrendsSelectionDate);
  117. if (!options?.selectedProjectId) {
  118. PageFiltersStore.updateProjects(
  119. settings.selectedProject ? [Number(newSettings.projects[0].id)] : [],
  120. []
  121. );
  122. }
  123. act(() => ProjectsStore.loadInitialData(data.projects));
  124. return data;
  125. }
  126. function initializeTrendsData(
  127. projects: null | any[] = null,
  128. query = {},
  129. includeDefaultQuery = true
  130. ) {
  131. const _projects = Array.isArray(projects)
  132. ? projects
  133. : [
  134. TestStubs.Project({id: '1', firstTransactionEvent: false}),
  135. TestStubs.Project({id: '2', firstTransactionEvent: true}),
  136. ];
  137. const features = ['transaction-event', 'performance-view'];
  138. const organization = TestStubs.Organization({
  139. features,
  140. projects: _projects,
  141. });
  142. const newQuery = {...(includeDefaultQuery ? trendsViewQuery : {}), ...query};
  143. const initialData = initializeOrg({
  144. organization,
  145. router: {
  146. location: {
  147. query: newQuery,
  148. },
  149. },
  150. projects: _projects,
  151. project: projects ? projects[0] : undefined,
  152. });
  153. act(() => ProjectsStore.loadInitialData(initialData.organization.projects));
  154. return initialData;
  155. }
  156. describe('Performance > Trends', function () {
  157. let trendsStatsMock;
  158. beforeEach(function () {
  159. browserHistory.push = jest.fn();
  160. MockApiClient.addMockResponse({
  161. url: '/organizations/org-slug/projects/',
  162. body: [],
  163. });
  164. MockApiClient.addMockResponse({
  165. url: '/organizations/org-slug/tags/',
  166. body: [],
  167. });
  168. MockApiClient.addMockResponse({
  169. url: '/organizations/org-slug/users/',
  170. body: [],
  171. });
  172. MockApiClient.addMockResponse({
  173. url: '/organizations/org-slug/recent-searches/',
  174. body: [],
  175. });
  176. MockApiClient.addMockResponse({
  177. url: '/organizations/org-slug/recent-searches/',
  178. method: 'POST',
  179. body: [],
  180. });
  181. MockApiClient.addMockResponse({
  182. url: '/organizations/org-slug/sdk-updates/',
  183. body: [],
  184. });
  185. MockApiClient.addMockResponse({
  186. url: '/prompts-activity/',
  187. body: {},
  188. });
  189. MockApiClient.addMockResponse({
  190. url: '/organizations/org-slug/releases/stats/',
  191. body: [],
  192. });
  193. MockApiClient.addMockResponse({
  194. url: '/organizations/org-slug/tags/transaction.duration/values/',
  195. body: [],
  196. });
  197. trendsStatsMock = MockApiClient.addMockResponse({
  198. url: '/organizations/org-slug/events-trends-stats/',
  199. body: {
  200. stats: {
  201. 'internal,/organizations/:orgId/performance/': {
  202. data: [[123, []]],
  203. },
  204. order: 0,
  205. },
  206. events: {
  207. meta: {
  208. count_range_1: 'integer',
  209. count_range_2: 'integer',
  210. count_percentage: 'percentage',
  211. trend_percentage: 'percentage',
  212. trend_difference: 'number',
  213. aggregate_range_1: 'duration',
  214. aggregate_range_2: 'duration',
  215. transaction: 'string',
  216. },
  217. data: [
  218. {
  219. count: 8,
  220. project: 'internal',
  221. count_range_1: 2,
  222. count_range_2: 6,
  223. count_percentage: 3,
  224. trend_percentage: 1.9235225955967554,
  225. trend_difference: 797,
  226. aggregate_range_1: 863,
  227. aggregate_range_2: 1660,
  228. transaction: '/organizations/:orgId/performance/',
  229. },
  230. {
  231. count: 60,
  232. project: 'internal',
  233. count_range_1: 20,
  234. count_range_2: 40,
  235. count_percentage: 2,
  236. trend_percentage: 1.204968944099379,
  237. trend_difference: 66,
  238. aggregate_range_1: 322,
  239. aggregate_range_2: 388,
  240. transaction: '/api/0/internal/health/',
  241. },
  242. ],
  243. },
  244. },
  245. });
  246. });
  247. afterEach(function () {
  248. MockApiClient.clearMockResponses();
  249. act(() => ProjectsStore.reset());
  250. });
  251. it('renders basic UI elements', async function () {
  252. const data = _initializeData({});
  253. render(
  254. <TrendsIndex location={data.router.location} organization={data.organization} />,
  255. {
  256. context: data.routerContext,
  257. organization: data.organization,
  258. }
  259. );
  260. expect(await getTrendDropdown()).toBeInTheDocument();
  261. expect(await getParameterDropdown()).toBeInTheDocument();
  262. expect(screen.getAllByTestId('changed-transactions')).toHaveLength(2);
  263. });
  264. it('transaction list items are rendered', async function () {
  265. const data = _initializeData({});
  266. render(
  267. <TrendsIndex location={data.router.location} organization={data.organization} />,
  268. {
  269. context: data.routerContext,
  270. organization: data.organization,
  271. }
  272. );
  273. expect(await screen.findAllByTestId('trends-list-item-regression')).toHaveLength(2);
  274. expect(await screen.findAllByTestId('trends-list-item-improved')).toHaveLength(2);
  275. });
  276. it('view summary menu action links to the correct view', async function () {
  277. const projects = [TestStubs.Project({id: 1, slug: 'internal'}), TestStubs.Project()];
  278. const data = initializeTrendsData(projects, {project: ['1']});
  279. render(
  280. <TrendsIndex location={data.router.location} organization={data.organization} />,
  281. {
  282. context: data.routerContext,
  283. organization: data.organization,
  284. }
  285. );
  286. const transactions = await screen.findAllByTestId('trends-list-item-improved');
  287. expect(transactions).toHaveLength(2);
  288. const firstTransaction = transactions[0];
  289. const summaryLink = within(firstTransaction).getByTestId('item-transaction-name');
  290. expect(summaryLink.closest('a')).toHaveAttribute(
  291. 'href',
  292. '/organizations/org-slug/performance/summary/?display=trend&project=1&query=tpm%28%29%3A%3E0.01%20transaction.duration%3A%3E0%20transaction.duration%3A%3C15min&referrer=performance-transaction-summary&statsPeriod=14d&transaction=%2Forganizations%2F%3AorgId%2Fperformance%2F&trendColumn=transaction.duration&trendFunction=p50&unselectedSeries=p100%28%29'
  293. );
  294. });
  295. it('hide from list menu action modifies query', async function () {
  296. const projects = [TestStubs.Project({id: 1, slug: 'internal'}), TestStubs.Project()];
  297. const data = initializeTrendsData(projects, {project: ['1']});
  298. render(
  299. <TrendsIndex location={data.router.location} organization={data.organization} />,
  300. {
  301. context: data.routerContext,
  302. organization: data.organization,
  303. }
  304. );
  305. const transactions = await screen.findAllByTestId('trends-list-item-improved');
  306. expect(transactions).toHaveLength(2);
  307. const firstTransaction = transactions[0];
  308. const menuActions = within(firstTransaction).getAllByTestId('menu-action');
  309. expect(menuActions).toHaveLength(3);
  310. const menuAction = menuActions[2];
  311. clickEl(menuAction);
  312. expect(browserHistory.push).toHaveBeenCalledWith({
  313. query: expect.objectContaining({
  314. project: expect.anything(),
  315. query: `tpm():>0.01 transaction.duration:>0 transaction.duration:<${DEFAULT_MAX_DURATION} !transaction:/organizations/:orgId/performance/`,
  316. }),
  317. });
  318. });
  319. it('Changing search causes cursors to be reset', async function () {
  320. const projects = [TestStubs.Project({id: 1, slug: 'internal'}), TestStubs.Project()];
  321. const data = initializeTrendsData(projects, {project: ['1']});
  322. render(
  323. <TrendsIndex location={data.router.location} organization={data.organization} />,
  324. {
  325. context: data.routerContext,
  326. organization: data.organization,
  327. }
  328. );
  329. const input = await screen.findByTestId('smart-search-input');
  330. enterSearch(input, 'transaction.duration:>9000');
  331. expect(browserHistory.push).toHaveBeenCalledWith({
  332. pathname: undefined,
  333. query: expect.objectContaining({
  334. project: ['1'],
  335. query: 'transaction.duration:>9000',
  336. improvedCursor: undefined,
  337. regressionCursor: undefined,
  338. }),
  339. });
  340. });
  341. it('exclude greater than list menu action modifies query', async function () {
  342. const projects = [TestStubs.Project({id: 1, slug: 'internal'}), TestStubs.Project()];
  343. const data = initializeTrendsData(projects, {project: ['1']});
  344. render(
  345. <TrendsIndex location={data.router.location} organization={data.organization} />,
  346. {
  347. context: data.routerContext,
  348. organization: data.organization,
  349. }
  350. );
  351. const transactions = await screen.findAllByTestId('trends-list-item-improved');
  352. expect(transactions).toHaveLength(2);
  353. const firstTransaction = transactions[0];
  354. const menuActions = within(firstTransaction).getAllByTestId('menu-action');
  355. expect(menuActions).toHaveLength(3);
  356. const menuAction = menuActions[0];
  357. clickEl(menuAction);
  358. expect(browserHistory.push).toHaveBeenCalledWith({
  359. query: expect.objectContaining({
  360. project: expect.anything(),
  361. query: 'tpm():>0.01 transaction.duration:>0 transaction.duration:<=863',
  362. }),
  363. });
  364. });
  365. it('exclude less than list menu action modifies query', async function () {
  366. const projects = [TestStubs.Project({id: 1, slug: 'internal'}), TestStubs.Project()];
  367. const data = initializeTrendsData(projects, {project: ['1']});
  368. render(
  369. <TrendsIndex location={data.router.location} organization={data.organization} />,
  370. {
  371. context: data.routerContext,
  372. organization: data.organization,
  373. }
  374. );
  375. const transactions = await screen.findAllByTestId('trends-list-item-improved');
  376. expect(transactions).toHaveLength(2);
  377. const firstTransaction = transactions[0];
  378. const menuActions = within(firstTransaction).getAllByTestId('menu-action');
  379. expect(menuActions).toHaveLength(3);
  380. const menuAction = menuActions[1];
  381. clickEl(menuAction);
  382. expect(browserHistory.push).toHaveBeenCalledWith({
  383. query: expect.objectContaining({
  384. project: expect.anything(),
  385. query: 'tpm():>0.01 transaction.duration:<15min transaction.duration:>=863',
  386. }),
  387. });
  388. });
  389. it('choosing a trend function changes location', async function () {
  390. const projects = [TestStubs.Project()];
  391. const data = initializeTrendsData(projects, {project: ['-1']});
  392. render(
  393. <TrendsIndex location={data.router.location} organization={data.organization} />,
  394. {
  395. context: data.routerContext,
  396. organization: data.organization,
  397. }
  398. );
  399. for (const trendFunction of TRENDS_FUNCTIONS) {
  400. await selectTrendFunction(trendFunction.field);
  401. expect(browserHistory.push).toHaveBeenCalledWith({
  402. query: expect.objectContaining({
  403. regressionCursor: undefined,
  404. improvedCursor: undefined,
  405. trendFunction: trendFunction.field,
  406. }),
  407. });
  408. }
  409. });
  410. it('sets LCP as a default trend parameter for frontend project if query does not specify trend parameter', async function () {
  411. const projects = [TestStubs.Project({id: 1, platform: 'javascript'})];
  412. const data = initializeTrendsData(projects, {project: [1]});
  413. render(
  414. <TrendsIndex location={data.router.location} organization={data.organization} />,
  415. {
  416. context: data.routerContext,
  417. organization: data.organization,
  418. }
  419. );
  420. const trendDropdownButton = await getTrendDropdown();
  421. expect(trendDropdownButton).toHaveTextContent('Percentilep50');
  422. });
  423. it('sets duration as a default trend parameter for backend project if query does not specify trend parameter', async function () {
  424. const projects = [TestStubs.Project({id: 1, platform: 'python'})];
  425. const data = initializeTrendsData(projects, {project: [1]});
  426. render(
  427. <TrendsIndex location={data.router.location} organization={data.organization} />,
  428. {
  429. context: data.routerContext,
  430. organization: data.organization,
  431. }
  432. );
  433. const parameterDropdownButton = await getParameterDropdown();
  434. expect(parameterDropdownButton).toHaveTextContent('ParameterDuration');
  435. });
  436. it('sets trend parameter from query and ignores default trend parameter', async function () {
  437. const projects = [TestStubs.Project({id: 1, platform: 'javascript'})];
  438. const data = initializeTrendsData(projects, {project: [1], trendParameter: 'FCP'});
  439. render(
  440. <TrendsIndex location={data.router.location} organization={data.organization} />,
  441. {
  442. context: data.routerContext,
  443. organization: data.organization,
  444. }
  445. );
  446. const parameterDropdownButton = await getParameterDropdown();
  447. expect(parameterDropdownButton).toHaveTextContent('ParameterFCP');
  448. });
  449. it('choosing a parameter changes location', async function () {
  450. const projects = [TestStubs.Project()];
  451. const data = initializeTrendsData(projects, {project: ['-1']});
  452. render(
  453. <TrendsIndex location={data.router.location} organization={data.organization} />,
  454. {
  455. context: data.routerContext,
  456. organization: data.organization,
  457. }
  458. );
  459. for (const parameter of TRENDS_PARAMETERS) {
  460. await selectTrendParameter(parameter.label);
  461. expect(browserHistory.push).toHaveBeenCalledWith({
  462. query: expect.objectContaining({
  463. trendParameter: parameter.label,
  464. }),
  465. });
  466. }
  467. });
  468. it('choosing a web vitals parameter adds it as an additional condition to the query', async function () {
  469. const projects = [TestStubs.Project()];
  470. const data = initializeTrendsData(projects, {project: ['-1']});
  471. const {rerender} = render(
  472. <TrendsIndex location={data.router.location} organization={data.organization} />,
  473. {
  474. context: data.routerContext,
  475. organization: data.organization,
  476. }
  477. );
  478. for (const parameter of TRENDS_PARAMETERS) {
  479. if (Object.values(WebVital).includes(parameter.column as WebVital)) {
  480. trendsStatsMock.mockReset();
  481. const newLocation = {
  482. query: {...trendsViewQuery, trendParameter: parameter.label},
  483. };
  484. rerender(
  485. <TrendsIndex
  486. location={newLocation as unknown as Location}
  487. organization={data.organization}
  488. />
  489. );
  490. await waitForMockCall(trendsStatsMock);
  491. expect(trendsStatsMock).toHaveBeenCalledTimes(2);
  492. // Improved transactions call
  493. expect(trendsStatsMock).toHaveBeenNthCalledWith(
  494. 1,
  495. expect.anything(),
  496. expect.objectContaining({
  497. query: expect.objectContaining({
  498. query: expect.stringContaining(`has:${parameter.column}`),
  499. }),
  500. })
  501. );
  502. // Regression transactions call
  503. expect(trendsStatsMock).toHaveBeenNthCalledWith(
  504. 2,
  505. expect.anything(),
  506. expect.objectContaining({
  507. query: expect.objectContaining({
  508. query: expect.stringContaining(`has:${parameter.column}`),
  509. }),
  510. })
  511. );
  512. }
  513. }
  514. });
  515. it('trend functions in location make api calls', async function () {
  516. const projects = [TestStubs.Project(), TestStubs.Project()];
  517. const data = initializeTrendsData(projects, {project: ['-1']});
  518. const {rerender} = render(
  519. <TrendsIndex location={data.router.location} organization={data.organization} />,
  520. {
  521. context: data.routerContext,
  522. organization: data.organization,
  523. }
  524. );
  525. for (const trendFunction of TRENDS_FUNCTIONS) {
  526. trendsStatsMock.mockReset();
  527. const newLocation = {
  528. query: {...trendsViewQuery, trendFunction: trendFunction.field},
  529. };
  530. rerender(
  531. <TrendsIndex
  532. location={newLocation as unknown as Location}
  533. organization={data.organization}
  534. />
  535. );
  536. await waitForMockCall(trendsStatsMock);
  537. expect(trendsStatsMock).toHaveBeenCalledTimes(2);
  538. const sort = 'trend_percentage()';
  539. const defaultTrendsFields = ['project'];
  540. const transactionFields = ['transaction', ...defaultTrendsFields];
  541. const projectFields = [...defaultTrendsFields];
  542. expect(transactionFields).toHaveLength(2);
  543. expect(projectFields).toHaveLength(transactionFields.length - 1);
  544. // Improved transactions call
  545. expect(trendsStatsMock).toHaveBeenNthCalledWith(
  546. 1,
  547. expect.anything(),
  548. expect.objectContaining({
  549. query: expect.objectContaining({
  550. trendFunction: `${trendFunction.field}(transaction.duration)`,
  551. sort,
  552. query: expect.stringContaining('trend_percentage():>0%'),
  553. interval: '30m',
  554. field: transactionFields,
  555. statsPeriod: '14d',
  556. }),
  557. })
  558. );
  559. // Regression transactions call
  560. expect(trendsStatsMock).toHaveBeenNthCalledWith(
  561. 2,
  562. expect.anything(),
  563. expect.objectContaining({
  564. query: expect.objectContaining({
  565. trendFunction: `${trendFunction.field}(transaction.duration)`,
  566. sort: '-' + sort,
  567. query: expect.stringContaining('trend_percentage():>0%'),
  568. interval: '30m',
  569. field: transactionFields,
  570. statsPeriod: '14d',
  571. }),
  572. })
  573. );
  574. }
  575. });
  576. it('Visiting trends with trends feature will update filters if none are set', function () {
  577. const data = initializeTrendsData(undefined, {}, false);
  578. render(
  579. <TrendsIndex location={data.router.location} organization={data.organization} />,
  580. {
  581. context: data.routerContext,
  582. organization: data.organization,
  583. }
  584. );
  585. expect(browserHistory.push).toHaveBeenNthCalledWith(
  586. 1,
  587. expect.objectContaining({
  588. query: {
  589. query: `tpm():>0.01 transaction.duration:>0 transaction.duration:<${DEFAULT_MAX_DURATION}`,
  590. },
  591. })
  592. );
  593. });
  594. it('Navigating away from trends will remove extra tags from query', async function () {
  595. const data = initializeTrendsData(
  596. undefined,
  597. {
  598. query: `device.family:Mac tpm():>0.01 transaction.duration:>0 transaction.duration:<${DEFAULT_MAX_DURATION}`,
  599. },
  600. false
  601. );
  602. render(
  603. <TrendsIndex location={data.router.location} organization={data.organization} />,
  604. {
  605. context: data.routerContext,
  606. organization: data.organization,
  607. }
  608. );
  609. (browserHistory.push as any).mockReset();
  610. const byTransactionLink = await screen.findByTestId('breadcrumb-link');
  611. expect(byTransactionLink.closest('a')).toHaveAttribute(
  612. 'href',
  613. '/organizations/org-slug/performance/?query=device.family%3AMac'
  614. );
  615. });
  616. });