index.spec.tsx 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723
  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. // const originalHook = window._legacyStoreHookUpdate;
  159. beforeEach(function () {
  160. browserHistory.push = jest.fn();
  161. MockApiClient.addMockResponse({
  162. url: '/organizations/org-slug/projects/',
  163. body: [],
  164. });
  165. MockApiClient.addMockResponse({
  166. url: '/organizations/org-slug/tags/',
  167. body: [],
  168. });
  169. MockApiClient.addMockResponse({
  170. url: '/organizations/org-slug/users/',
  171. body: [],
  172. });
  173. MockApiClient.addMockResponse({
  174. url: '/organizations/org-slug/recent-searches/',
  175. body: [],
  176. });
  177. MockApiClient.addMockResponse({
  178. url: '/organizations/org-slug/recent-searches/',
  179. method: 'POST',
  180. body: [],
  181. });
  182. MockApiClient.addMockResponse({
  183. url: '/organizations/org-slug/sdk-updates/',
  184. body: [],
  185. });
  186. MockApiClient.addMockResponse({
  187. url: '/prompts-activity/',
  188. body: {},
  189. });
  190. MockApiClient.addMockResponse({
  191. url: '/organizations/org-slug/releases/stats/',
  192. body: [],
  193. });
  194. MockApiClient.addMockResponse({
  195. url: '/organizations/org-slug/tags/transaction.duration/values/',
  196. body: [],
  197. });
  198. trendsStatsMock = MockApiClient.addMockResponse({
  199. url: '/organizations/org-slug/events-trends-stats/',
  200. body: {
  201. stats: {
  202. 'internal,/organizations/:orgId/performance/': {
  203. data: [[123, []]],
  204. },
  205. order: 0,
  206. },
  207. events: {
  208. meta: {
  209. count_range_1: 'integer',
  210. count_range_2: 'integer',
  211. count_percentage: 'percentage',
  212. trend_percentage: 'percentage',
  213. trend_difference: 'number',
  214. aggregate_range_1: 'duration',
  215. aggregate_range_2: 'duration',
  216. transaction: 'string',
  217. },
  218. data: [
  219. {
  220. count: 8,
  221. project: 'internal',
  222. count_range_1: 2,
  223. count_range_2: 6,
  224. count_percentage: 3,
  225. trend_percentage: 1.9235225955967554,
  226. trend_difference: 797,
  227. aggregate_range_1: 863,
  228. aggregate_range_2: 1660,
  229. transaction: '/organizations/:orgId/performance/',
  230. },
  231. {
  232. count: 60,
  233. project: 'internal',
  234. count_range_1: 20,
  235. count_range_2: 40,
  236. count_percentage: 2,
  237. trend_percentage: 1.204968944099379,
  238. trend_difference: 66,
  239. aggregate_range_1: 322,
  240. aggregate_range_2: 388,
  241. transaction: '/api/0/internal/health/',
  242. },
  243. ],
  244. },
  245. },
  246. });
  247. });
  248. afterEach(function () {
  249. MockApiClient.clearMockResponses();
  250. act(() => ProjectsStore.reset());
  251. });
  252. it('renders basic UI elements', async function () {
  253. const data = _initializeData({});
  254. render(
  255. <TrendsIndex location={data.router.location} organization={data.organization} />,
  256. {
  257. context: data.routerContext,
  258. organization: data.organization,
  259. }
  260. );
  261. expect(await getTrendDropdown()).toBeInTheDocument();
  262. expect(await getParameterDropdown()).toBeInTheDocument();
  263. expect(screen.getAllByTestId('changed-transactions')).toHaveLength(2);
  264. });
  265. it('transaction list items are rendered', async function () {
  266. const data = _initializeData({});
  267. render(
  268. <TrendsIndex location={data.router.location} organization={data.organization} />,
  269. {
  270. context: data.routerContext,
  271. organization: data.organization,
  272. }
  273. );
  274. expect(await screen.findAllByTestId('trends-list-item-regression')).toHaveLength(2);
  275. expect(await screen.findAllByTestId('trends-list-item-improved')).toHaveLength(2);
  276. });
  277. it('view summary menu action links to the correct view', async function () {
  278. const projects = [TestStubs.Project({id: 1, slug: 'internal'}), TestStubs.Project()];
  279. const data = initializeTrendsData(projects, {project: ['1']});
  280. render(
  281. <TrendsIndex location={data.router.location} organization={data.organization} />,
  282. {
  283. context: data.routerContext,
  284. organization: data.organization,
  285. }
  286. );
  287. const transactions = await screen.findAllByTestId('trends-list-item-improved');
  288. expect(transactions).toHaveLength(2);
  289. const firstTransaction = transactions[0];
  290. const summaryLink = within(firstTransaction).getByTestId('item-transaction-name');
  291. expect(summaryLink.closest('a')).toHaveAttribute(
  292. 'href',
  293. '/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'
  294. );
  295. });
  296. it('hide from list menu action modifies query', async function () {
  297. const projects = [TestStubs.Project({id: 1, slug: 'internal'}), TestStubs.Project()];
  298. const data = initializeTrendsData(projects, {project: ['1']});
  299. render(
  300. <TrendsIndex location={data.router.location} organization={data.organization} />,
  301. {
  302. context: data.routerContext,
  303. organization: data.organization,
  304. }
  305. );
  306. const transactions = await screen.findAllByTestId('trends-list-item-improved');
  307. expect(transactions).toHaveLength(2);
  308. const firstTransaction = transactions[0];
  309. const menuActions = within(firstTransaction).getAllByTestId('menu-action');
  310. expect(menuActions).toHaveLength(3);
  311. const menuAction = menuActions[2];
  312. clickEl(menuAction);
  313. expect(browserHistory.push).toHaveBeenCalledWith({
  314. query: expect.objectContaining({
  315. project: expect.anything(),
  316. query: `tpm():>0.01 transaction.duration:>0 transaction.duration:<${DEFAULT_MAX_DURATION} !transaction:/organizations/:orgId/performance/`,
  317. }),
  318. });
  319. });
  320. it('Changing search causes cursors to be reset', async function () {
  321. const projects = [TestStubs.Project({id: 1, slug: 'internal'}), TestStubs.Project()];
  322. const data = initializeTrendsData(projects, {project: ['1']});
  323. render(
  324. <TrendsIndex location={data.router.location} organization={data.organization} />,
  325. {
  326. context: data.routerContext,
  327. organization: data.organization,
  328. }
  329. );
  330. const input = await screen.findByTestId('smart-search-input');
  331. enterSearch(input, 'transaction.duration:>9000');
  332. expect(browserHistory.push).toHaveBeenCalledWith({
  333. pathname: undefined,
  334. query: expect.objectContaining({
  335. project: ['1'],
  336. query: 'transaction.duration:>9000',
  337. improvedCursor: undefined,
  338. regressionCursor: undefined,
  339. }),
  340. });
  341. });
  342. it('exclude greater than list menu action modifies query', async function () {
  343. const projects = [TestStubs.Project({id: 1, slug: 'internal'}), TestStubs.Project()];
  344. const data = initializeTrendsData(projects, {project: ['1']});
  345. render(
  346. <TrendsIndex location={data.router.location} organization={data.organization} />,
  347. {
  348. context: data.routerContext,
  349. organization: data.organization,
  350. }
  351. );
  352. const transactions = await screen.findAllByTestId('trends-list-item-improved');
  353. expect(transactions).toHaveLength(2);
  354. const firstTransaction = transactions[0];
  355. const menuActions = within(firstTransaction).getAllByTestId('menu-action');
  356. expect(menuActions).toHaveLength(3);
  357. const menuAction = menuActions[0];
  358. clickEl(menuAction);
  359. expect(browserHistory.push).toHaveBeenCalledWith({
  360. query: expect.objectContaining({
  361. project: expect.anything(),
  362. query: 'tpm():>0.01 transaction.duration:>0 transaction.duration:<=863',
  363. }),
  364. });
  365. });
  366. it('exclude less than list menu action modifies query', async function () {
  367. const projects = [TestStubs.Project({id: 1, slug: 'internal'}), TestStubs.Project()];
  368. const data = initializeTrendsData(projects, {project: ['1']});
  369. render(
  370. <TrendsIndex location={data.router.location} organization={data.organization} />,
  371. {
  372. context: data.routerContext,
  373. organization: data.organization,
  374. }
  375. );
  376. const transactions = await screen.findAllByTestId('trends-list-item-improved');
  377. expect(transactions).toHaveLength(2);
  378. const firstTransaction = transactions[0];
  379. const menuActions = within(firstTransaction).getAllByTestId('menu-action');
  380. expect(menuActions).toHaveLength(3);
  381. const menuAction = menuActions[1];
  382. clickEl(menuAction);
  383. expect(browserHistory.push).toHaveBeenCalledWith({
  384. query: expect.objectContaining({
  385. project: expect.anything(),
  386. query: 'tpm():>0.01 transaction.duration:<15min transaction.duration:>=863',
  387. }),
  388. });
  389. });
  390. it('choosing a trend function changes location', async function () {
  391. const projects = [TestStubs.Project()];
  392. const data = initializeTrendsData(projects, {project: ['-1']});
  393. render(
  394. <TrendsIndex location={data.router.location} organization={data.organization} />,
  395. {
  396. context: data.routerContext,
  397. organization: data.organization,
  398. }
  399. );
  400. for (const trendFunction of TRENDS_FUNCTIONS) {
  401. await selectTrendFunction(trendFunction.field);
  402. expect(browserHistory.push).toHaveBeenCalledWith({
  403. query: expect.objectContaining({
  404. regressionCursor: undefined,
  405. improvedCursor: undefined,
  406. trendFunction: trendFunction.field,
  407. }),
  408. });
  409. }
  410. });
  411. it('sets LCP as a default trend parameter for frontend project if query does not specify trend parameter', async function () {
  412. const projects = [TestStubs.Project({id: 1, platform: 'javascript'})];
  413. const data = initializeTrendsData(projects, {project: [1]});
  414. render(
  415. <TrendsIndex location={data.router.location} organization={data.organization} />,
  416. {
  417. context: data.routerContext,
  418. organization: data.organization,
  419. }
  420. );
  421. const trendDropdownButton = await getTrendDropdown();
  422. expect(trendDropdownButton).toHaveTextContent('Percentilep50');
  423. });
  424. it('sets duration as a default trend parameter for backend project if query does not specify trend parameter', async function () {
  425. const projects = [TestStubs.Project({id: 1, platform: 'python'})];
  426. const data = initializeTrendsData(projects, {project: [1]});
  427. render(
  428. <TrendsIndex location={data.router.location} organization={data.organization} />,
  429. {
  430. context: data.routerContext,
  431. organization: data.organization,
  432. }
  433. );
  434. const parameterDropdownButton = await getParameterDropdown();
  435. expect(parameterDropdownButton).toHaveTextContent('ParameterDuration');
  436. });
  437. it('sets trend parameter from query and ignores default trend parameter', async function () {
  438. const projects = [TestStubs.Project({id: 1, platform: 'javascript'})];
  439. const data = initializeTrendsData(projects, {project: [1], trendParameter: 'FCP'});
  440. render(
  441. <TrendsIndex location={data.router.location} organization={data.organization} />,
  442. {
  443. context: data.routerContext,
  444. organization: data.organization,
  445. }
  446. );
  447. const parameterDropdownButton = await getParameterDropdown();
  448. expect(parameterDropdownButton).toHaveTextContent('ParameterFCP');
  449. });
  450. it('choosing a parameter changes location', async function () {
  451. const projects = [TestStubs.Project()];
  452. const data = initializeTrendsData(projects, {project: ['-1']});
  453. render(
  454. <TrendsIndex location={data.router.location} organization={data.organization} />,
  455. {
  456. context: data.routerContext,
  457. organization: data.organization,
  458. }
  459. );
  460. for (const parameter of TRENDS_PARAMETERS) {
  461. await selectTrendParameter(parameter.label);
  462. expect(browserHistory.push).toHaveBeenCalledWith({
  463. query: expect.objectContaining({
  464. trendParameter: parameter.label,
  465. }),
  466. });
  467. }
  468. });
  469. it('choosing a web vitals parameter adds it as an additional condition to the query', async function () {
  470. const projects = [TestStubs.Project()];
  471. const data = initializeTrendsData(projects, {project: ['-1']});
  472. const {rerender} = render(
  473. <TrendsIndex location={data.router.location} organization={data.organization} />,
  474. {
  475. context: data.routerContext,
  476. organization: data.organization,
  477. }
  478. );
  479. for (const parameter of TRENDS_PARAMETERS) {
  480. if (Object.values(WebVital).includes(parameter.column as WebVital)) {
  481. trendsStatsMock.mockReset();
  482. const newLocation = {
  483. query: {...trendsViewQuery, trendParameter: parameter.label},
  484. };
  485. rerender(
  486. <TrendsIndex
  487. location={newLocation as unknown as Location}
  488. organization={data.organization}
  489. />
  490. );
  491. await waitForMockCall(trendsStatsMock);
  492. expect(trendsStatsMock).toHaveBeenCalledTimes(2);
  493. // Improved transactions call
  494. expect(trendsStatsMock).toHaveBeenNthCalledWith(
  495. 1,
  496. expect.anything(),
  497. expect.objectContaining({
  498. query: expect.objectContaining({
  499. query: expect.stringContaining(`has:${parameter.column}`),
  500. }),
  501. })
  502. );
  503. // Regression transactions call
  504. expect(trendsStatsMock).toHaveBeenNthCalledWith(
  505. 2,
  506. expect.anything(),
  507. expect.objectContaining({
  508. query: expect.objectContaining({
  509. query: expect.stringContaining(`has:${parameter.column}`),
  510. }),
  511. })
  512. );
  513. }
  514. }
  515. });
  516. it('trend functions in location make api calls', async function () {
  517. const projects = [TestStubs.Project(), TestStubs.Project()];
  518. const data = initializeTrendsData(projects, {project: ['-1']});
  519. const {rerender} = render(
  520. <TrendsIndex location={data.router.location} organization={data.organization} />,
  521. {
  522. context: data.routerContext,
  523. organization: data.organization,
  524. }
  525. );
  526. for (const trendFunction of TRENDS_FUNCTIONS) {
  527. trendsStatsMock.mockReset();
  528. const newLocation = {
  529. query: {...trendsViewQuery, trendFunction: trendFunction.field},
  530. };
  531. rerender(
  532. <TrendsIndex
  533. location={newLocation as unknown as Location}
  534. organization={data.organization}
  535. />
  536. );
  537. await waitForMockCall(trendsStatsMock);
  538. expect(trendsStatsMock).toHaveBeenCalledTimes(2);
  539. const sort = 'trend_percentage()';
  540. const defaultTrendsFields = ['project'];
  541. const transactionFields = ['transaction', ...defaultTrendsFields];
  542. const projectFields = [...defaultTrendsFields];
  543. expect(transactionFields).toHaveLength(2);
  544. expect(projectFields).toHaveLength(transactionFields.length - 1);
  545. // Improved transactions call
  546. expect(trendsStatsMock).toHaveBeenNthCalledWith(
  547. 1,
  548. expect.anything(),
  549. expect.objectContaining({
  550. query: expect.objectContaining({
  551. trendFunction: `${trendFunction.field}(transaction.duration)`,
  552. sort,
  553. query: expect.stringContaining('trend_percentage():>0%'),
  554. interval: '30m',
  555. field: transactionFields,
  556. statsPeriod: '14d',
  557. }),
  558. })
  559. );
  560. // Regression transactions call
  561. expect(trendsStatsMock).toHaveBeenNthCalledWith(
  562. 2,
  563. expect.anything(),
  564. expect.objectContaining({
  565. query: expect.objectContaining({
  566. trendFunction: `${trendFunction.field}(transaction.duration)`,
  567. sort: '-' + sort,
  568. query: expect.stringContaining('trend_percentage():>0%'),
  569. interval: '30m',
  570. field: transactionFields,
  571. statsPeriod: '14d',
  572. }),
  573. })
  574. );
  575. }
  576. });
  577. it('Visiting trends with trends feature will update filters if none are set', function () {
  578. const data = initializeTrendsData(undefined, {}, false);
  579. render(
  580. <TrendsIndex location={data.router.location} organization={data.organization} />,
  581. {
  582. context: data.routerContext,
  583. organization: data.organization,
  584. }
  585. );
  586. expect(browserHistory.push).toHaveBeenNthCalledWith(
  587. 1,
  588. expect.objectContaining({
  589. query: {
  590. query: `tpm():>0.01 transaction.duration:>0 transaction.duration:<${DEFAULT_MAX_DURATION}`,
  591. },
  592. })
  593. );
  594. });
  595. it('Navigating away from trends will remove extra tags from query', async function () {
  596. const data = initializeTrendsData(
  597. undefined,
  598. {
  599. query: `device.family:Mac tpm():>0.01 transaction.duration:>0 transaction.duration:<${DEFAULT_MAX_DURATION}`,
  600. },
  601. false
  602. );
  603. render(
  604. <TrendsIndex location={data.router.location} organization={data.organization} />,
  605. {
  606. context: data.routerContext,
  607. organization: data.organization,
  608. }
  609. );
  610. (browserHistory.push as any).mockReset();
  611. const byTransactionLink = await screen.findByTestId('breadcrumb-link');
  612. expect(byTransactionLink.closest('a')).toHaveAttribute(
  613. 'href',
  614. '/organizations/org-slug/performance/?query=device.family%3AMac'
  615. );
  616. });
  617. });