overview.spec.tsx 43 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487
  1. import {browserHistory} from 'react-router';
  2. import merge from 'lodash/merge';
  3. import {GroupStats} from 'sentry-fixture/groupStats';
  4. import {Organization} from 'sentry-fixture/organization';
  5. import {Search} from 'sentry-fixture/search';
  6. import {Tags} from 'sentry-fixture/tags';
  7. import {initializeOrg} from 'sentry-test/initializeOrg';
  8. import {
  9. act,
  10. render,
  11. screen,
  12. userEvent,
  13. waitFor,
  14. waitForElementToBeRemoved,
  15. } from 'sentry-test/reactTestingLibrary';
  16. import {textWithMarkupMatcher} from 'sentry-test/utils';
  17. import StreamGroup from 'sentry/components/stream/group';
  18. import ProjectsStore from 'sentry/stores/projectsStore';
  19. import TagStore from 'sentry/stores/tagStore';
  20. import {SavedSearchVisibility} from 'sentry/types';
  21. import localStorageWrapper from 'sentry/utils/localStorage';
  22. import * as parseLinkHeader from 'sentry/utils/parseLinkHeader';
  23. import IssueListWithStores, {IssueListOverview} from 'sentry/views/issueList/overview';
  24. // Mock <IssueListActions>
  25. jest.mock('sentry/views/issueList/actions', () => jest.fn(() => null));
  26. jest.mock('sentry/components/stream/group', () => jest.fn(() => null));
  27. const DEFAULT_LINKS_HEADER =
  28. '<http://127.0.0.1:8000/api/0/organizations/org-slug/issues/?cursor=1443575731:0:1>; rel="previous"; results="false"; cursor="1443575731:0:1", ' +
  29. '<http://127.0.0.1:8000/api/0/organizations/org-slug/issues/?cursor=1443575000:0:0>; rel="next"; results="true"; cursor="1443575000:0:0"';
  30. const project = TestStubs.Project({
  31. id: '3559',
  32. name: 'Foo Project',
  33. slug: 'project-slug',
  34. firstEvent: true,
  35. });
  36. const {organization, router, routerContext} = initializeOrg({
  37. organization: {
  38. id: '1337',
  39. slug: 'org-slug',
  40. features: ['global-views'],
  41. access: [],
  42. },
  43. router: {
  44. location: {query: {}, search: ''},
  45. params: {},
  46. },
  47. project,
  48. });
  49. const routerProps = {
  50. params: router.params,
  51. location: router.location,
  52. };
  53. describe('IssueList', function () {
  54. let props;
  55. const tags = Tags();
  56. const group = TestStubs.Group({project});
  57. const groupStats = GroupStats();
  58. const savedSearch = Search({
  59. id: '789',
  60. query: 'is:unresolved TypeError',
  61. sort: 'date',
  62. name: 'Unresolved TypeErrors',
  63. });
  64. let fetchTagsRequest: jest.Mock;
  65. let fetchMembersRequest: jest.Mock;
  66. const api = new MockApiClient();
  67. const parseLinkHeaderSpy = jest.spyOn(parseLinkHeader, 'default');
  68. beforeEach(function () {
  69. // The tests fail because we have a "component update was not wrapped in act" error.
  70. // It should be safe to ignore this error, but we should remove the mock once we move to react testing library
  71. // eslint-disable-next-line no-console
  72. jest.spyOn(console, 'error').mockImplementation(jest.fn());
  73. MockApiClient.addMockResponse({
  74. url: '/organizations/org-slug/issues/',
  75. body: [group],
  76. headers: {
  77. Link: DEFAULT_LINKS_HEADER,
  78. },
  79. });
  80. MockApiClient.addMockResponse({
  81. url: '/organizations/org-slug/issues-stats/',
  82. body: [groupStats],
  83. });
  84. MockApiClient.addMockResponse({
  85. url: '/organizations/org-slug/searches/',
  86. body: [savedSearch],
  87. });
  88. MockApiClient.addMockResponse({
  89. url: '/organizations/org-slug/recent-searches/',
  90. body: [],
  91. });
  92. MockApiClient.addMockResponse({
  93. url: '/organizations/org-slug/recent-searches/',
  94. method: 'POST',
  95. body: [],
  96. });
  97. MockApiClient.addMockResponse({
  98. url: '/organizations/org-slug/issues-count/',
  99. method: 'GET',
  100. body: [{}],
  101. });
  102. MockApiClient.addMockResponse({
  103. url: '/organizations/org-slug/processingissues/',
  104. method: 'GET',
  105. body: [
  106. {
  107. project: 'test-project',
  108. numIssues: 1,
  109. hasIssues: true,
  110. lastSeen: '2019-01-16T15:39:11.081Z',
  111. },
  112. ],
  113. });
  114. fetchTagsRequest = MockApiClient.addMockResponse({
  115. url: '/organizations/org-slug/tags/',
  116. method: 'GET',
  117. body: tags,
  118. });
  119. fetchMembersRequest = MockApiClient.addMockResponse({
  120. url: '/organizations/org-slug/users/',
  121. method: 'GET',
  122. body: [TestStubs.Member({projects: [project.slug]})],
  123. });
  124. MockApiClient.addMockResponse({
  125. url: '/organizations/org-slug/sent-first-event/',
  126. body: {sentFirstEvent: true},
  127. });
  128. MockApiClient.addMockResponse({
  129. url: '/organizations/org-slug/projects/',
  130. body: [project],
  131. });
  132. TagStore.init?.();
  133. props = {
  134. api,
  135. savedSearchLoading: false,
  136. savedSearches: [savedSearch],
  137. useOrgSavedSearches: true,
  138. selection: {
  139. projects: [parseInt(organization.projects[0].id, 10)],
  140. environments: [],
  141. datetime: {period: '14d'},
  142. },
  143. location: {query: {query: 'is:unresolved'}, search: 'query=is:unresolved'},
  144. params: {},
  145. organization,
  146. tags: tags.reduce((acc, tag) => {
  147. acc[tag.key] = tag;
  148. return acc;
  149. }),
  150. };
  151. });
  152. afterEach(function () {
  153. jest.clearAllMocks();
  154. MockApiClient.clearMockResponses();
  155. localStorageWrapper.clear();
  156. });
  157. describe('withStores and feature flags', function () {
  158. let savedSearchesRequest: jest.Mock;
  159. let recentSearchesRequest: jest.Mock;
  160. let issuesRequest: jest.Mock;
  161. beforeEach(function () {
  162. jest.mocked(StreamGroup).mockClear();
  163. recentSearchesRequest = MockApiClient.addMockResponse({
  164. url: '/organizations/org-slug/recent-searches/',
  165. method: 'GET',
  166. body: [],
  167. });
  168. savedSearchesRequest = MockApiClient.addMockResponse({
  169. url: '/organizations/org-slug/searches/',
  170. body: [savedSearch],
  171. });
  172. issuesRequest = MockApiClient.addMockResponse({
  173. url: '/organizations/org-slug/issues/',
  174. body: [group],
  175. headers: {
  176. Link: DEFAULT_LINKS_HEADER,
  177. },
  178. });
  179. });
  180. it('loads group rows with default query (no pinned queries, async and no query in URL)', async function () {
  181. render(<IssueListWithStores {...routerProps} />, {
  182. context: routerContext,
  183. });
  184. // Loading saved searches
  185. await waitForElementToBeRemoved(() => screen.getByTestId('loading-indicator'));
  186. expect(savedSearchesRequest).toHaveBeenCalledTimes(1);
  187. await userEvent.click(await screen.findByDisplayValue('is:unresolved'));
  188. // auxillary requests being made
  189. expect(recentSearchesRequest).toHaveBeenCalledTimes(1);
  190. expect(fetchTagsRequest).toHaveBeenCalledTimes(1);
  191. expect(fetchMembersRequest).toHaveBeenCalledTimes(1);
  192. // primary /issues/ request
  193. expect(issuesRequest).toHaveBeenCalledWith(
  194. expect.anything(),
  195. expect.objectContaining({
  196. // Should be called with default query
  197. data: expect.stringContaining('is%3Aunresolved'),
  198. })
  199. );
  200. expect(screen.getByDisplayValue('is:unresolved')).toBeInTheDocument();
  201. expect(screen.getByRole('button', {name: /custom search/i})).toBeInTheDocument();
  202. });
  203. it('loads with query in URL and pinned queries', async function () {
  204. savedSearchesRequest = MockApiClient.addMockResponse({
  205. url: '/organizations/org-slug/searches/',
  206. body: [
  207. savedSearch,
  208. Search({
  209. id: '123',
  210. name: 'My Pinned Search',
  211. isPinned: true,
  212. query: 'is:resolved',
  213. }),
  214. ],
  215. });
  216. const location = TestStubs.location({query: {query: 'level:foo'}});
  217. render(<IssueListWithStores {...merge({}, routerProps, {location})} />, {
  218. context: routerContext,
  219. router: {location},
  220. });
  221. await waitFor(() => {
  222. // Main /issues/ request
  223. expect(issuesRequest).toHaveBeenCalledWith(
  224. expect.anything(),
  225. expect.objectContaining({
  226. // Should be called with default query
  227. data: expect.stringContaining('level%3Afoo'),
  228. })
  229. );
  230. });
  231. expect(screen.getByDisplayValue('level:foo')).toBeInTheDocument();
  232. // Tab shows "custom search"
  233. expect(screen.getByRole('button', {name: 'Custom Search'})).toBeInTheDocument();
  234. });
  235. it('loads with a pinned custom query', async function () {
  236. savedSearchesRequest = MockApiClient.addMockResponse({
  237. url: '/organizations/org-slug/searches/',
  238. body: [
  239. savedSearch,
  240. Search({
  241. id: '123',
  242. name: 'My Pinned Search',
  243. isPinned: true,
  244. isGlobal: false,
  245. query: 'is:resolved',
  246. }),
  247. ],
  248. });
  249. render(<IssueListWithStores {...routerProps} />, {
  250. context: routerContext,
  251. });
  252. await waitFor(() => {
  253. expect(issuesRequest).toHaveBeenCalledWith(
  254. expect.anything(),
  255. expect.objectContaining({
  256. // Should be called with default query
  257. data: expect.stringContaining('is%3Aresolved'),
  258. })
  259. );
  260. });
  261. expect(screen.getByDisplayValue('is:resolved')).toBeInTheDocument();
  262. // Organization saved search selector should have default saved search selected
  263. expect(screen.getByRole('button', {name: 'My Default Search'})).toBeInTheDocument();
  264. });
  265. it('shows archived tab', async function () {
  266. render(
  267. <IssueListWithStores
  268. {...routerProps}
  269. organization={{...organization, features: ['escalating-issues']}}
  270. />,
  271. {
  272. context: routerContext,
  273. }
  274. );
  275. await waitFor(() => {
  276. expect(issuesRequest).toHaveBeenCalled();
  277. });
  278. expect(screen.getByDisplayValue('is:unresolved')).toBeInTheDocument();
  279. // TODO(workflow): remove this test when we remove the feature flag
  280. expect(screen.getByRole('tab', {name: 'Archived'})).toBeInTheDocument();
  281. });
  282. it('loads with a saved query', async function () {
  283. savedSearchesRequest = MockApiClient.addMockResponse({
  284. url: '/organizations/org-slug/searches/',
  285. body: [
  286. Search({
  287. id: '123',
  288. name: 'Assigned to Me',
  289. isPinned: false,
  290. isGlobal: true,
  291. query: 'assigned:me',
  292. sort: 'priority',
  293. type: 0,
  294. }),
  295. ],
  296. });
  297. const localRouter = {params: {searchId: '123'}};
  298. render(<IssueListWithStores {...merge({}, routerProps, localRouter)} />, {
  299. context: routerContext,
  300. router: localRouter,
  301. });
  302. await waitFor(() => {
  303. expect(issuesRequest).toHaveBeenCalledWith(
  304. expect.anything(),
  305. expect.objectContaining({
  306. // Should be called with default query
  307. data:
  308. expect.stringContaining('assigned%3Ame') &&
  309. expect.stringContaining('sort=priority'),
  310. })
  311. );
  312. });
  313. expect(screen.getByDisplayValue('assigned:me')).toBeInTheDocument();
  314. // Organization saved search selector should have default saved search selected
  315. expect(screen.getByRole('button', {name: 'Assigned to Me'})).toBeInTheDocument();
  316. });
  317. it('loads with a query in URL', async function () {
  318. savedSearchesRequest = MockApiClient.addMockResponse({
  319. url: '/organizations/org-slug/searches/',
  320. body: [
  321. Search({
  322. id: '123',
  323. name: 'Assigned to Me',
  324. isPinned: false,
  325. isGlobal: true,
  326. query: 'assigned:me',
  327. type: 0,
  328. }),
  329. ],
  330. });
  331. const localRouter = {location: {query: {query: 'level:error'}}};
  332. render(<IssueListWithStores {...merge({}, routerProps, localRouter)} />, {
  333. context: routerContext,
  334. });
  335. await waitFor(() => {
  336. expect(issuesRequest).toHaveBeenCalledWith(
  337. expect.anything(),
  338. expect.objectContaining({
  339. // Should be called with default query
  340. data: expect.stringContaining('level%3Aerror'),
  341. })
  342. );
  343. });
  344. expect(screen.getByDisplayValue('level:error')).toBeInTheDocument();
  345. // Organization saved search selector should have default saved search selected
  346. expect(screen.getByRole('button', {name: 'Custom Search'})).toBeInTheDocument();
  347. });
  348. it('loads with an empty query in URL', async function () {
  349. savedSearchesRequest = MockApiClient.addMockResponse({
  350. url: '/organizations/org-slug/searches/',
  351. body: [
  352. Search({
  353. id: '123',
  354. name: 'My Pinned Search',
  355. isPinned: true,
  356. isGlobal: false,
  357. query: 'is:resolved',
  358. }),
  359. ],
  360. });
  361. render(
  362. <IssueListWithStores
  363. {...merge({}, routerProps, {location: {query: {query: undefined}}})}
  364. />,
  365. {context: routerContext}
  366. );
  367. await waitFor(() => {
  368. expect(issuesRequest).toHaveBeenCalledWith(
  369. expect.anything(),
  370. expect.objectContaining({
  371. // Should be called with empty query
  372. data: expect.stringContaining(''),
  373. })
  374. );
  375. });
  376. expect(screen.getByDisplayValue('is:resolved')).toBeInTheDocument();
  377. // Organization saved search selector should have default saved search selected
  378. expect(screen.getByRole('button', {name: 'My Default Search'})).toBeInTheDocument();
  379. });
  380. it('caches the search results', async function () {
  381. issuesRequest = MockApiClient.addMockResponse({
  382. url: '/organizations/org-slug/issues/',
  383. body: [...new Array(25)].map((_, i) => ({id: i})),
  384. headers: {
  385. Link: DEFAULT_LINKS_HEADER,
  386. 'X-Hits': '500',
  387. 'X-Max-Hits': '1000',
  388. },
  389. });
  390. const defaultProps = {
  391. ...props,
  392. ...routerProps,
  393. useOrgSavedSearches: true,
  394. selection: {
  395. projects: [],
  396. environments: [],
  397. datetime: {period: '14d'},
  398. },
  399. organization: Organization({
  400. features: ['issue-stream-performance', 'issue-stream-performance-cache'],
  401. projects: [],
  402. }),
  403. };
  404. const {unmount} = render(<IssueListWithStores {...defaultProps} />, {
  405. context: routerContext,
  406. organization: defaultProps.organization,
  407. });
  408. expect(
  409. await screen.findByText(textWithMarkupMatcher('1-25 of 500'))
  410. ).toBeInTheDocument();
  411. expect(issuesRequest).toHaveBeenCalledTimes(1);
  412. unmount();
  413. // Mount component again, getting from cache
  414. render(<IssueListWithStores {...defaultProps} />, {
  415. context: routerContext,
  416. organization: defaultProps.organization,
  417. });
  418. expect(
  419. await screen.findByText(textWithMarkupMatcher('1-25 of 500'))
  420. ).toBeInTheDocument();
  421. expect(issuesRequest).toHaveBeenCalledTimes(1);
  422. });
  423. it('1 search', async function () {
  424. const localSavedSearch = {...savedSearch, projectId: null};
  425. savedSearchesRequest = MockApiClient.addMockResponse({
  426. url: '/organizations/org-slug/searches/',
  427. body: [localSavedSearch],
  428. });
  429. render(<IssueListWithStores {...routerProps} />, {
  430. context: routerContext,
  431. });
  432. await waitForElementToBeRemoved(() => screen.getByTestId('loading-indicator'));
  433. await userEvent.click(screen.getByRole('button', {name: /custom search/i}));
  434. await userEvent.click(screen.getByRole('button', {name: localSavedSearch.name}));
  435. expect(browserHistory.push).toHaveBeenLastCalledWith(
  436. expect.objectContaining({
  437. pathname: '/organizations/org-slug/issues/searches/789/',
  438. })
  439. );
  440. });
  441. it('clears a saved search when a custom one is entered', async function () {
  442. savedSearchesRequest = MockApiClient.addMockResponse({
  443. url: '/organizations/org-slug/searches/',
  444. body: [
  445. savedSearch,
  446. Search({
  447. id: '123',
  448. name: 'Pinned search',
  449. isPinned: true,
  450. isGlobal: false,
  451. query: 'is:resolved',
  452. }),
  453. ],
  454. });
  455. render(<IssueListWithStores {...routerProps} />, {
  456. context: routerContext,
  457. });
  458. await waitForElementToBeRemoved(() => screen.getByTestId('loading-indicator'));
  459. const queryInput = screen.getByDisplayValue('is:resolved');
  460. await userEvent.clear(queryInput);
  461. await userEvent.type(queryInput, 'dogs{enter}');
  462. expect(browserHistory.push).toHaveBeenLastCalledWith(
  463. expect.objectContaining({
  464. pathname: '/organizations/org-slug/issues/',
  465. query: {
  466. environment: [],
  467. project: [],
  468. referrer: 'issue-list',
  469. sort: '',
  470. query: 'dogs',
  471. statsPeriod: '14d',
  472. },
  473. })
  474. );
  475. });
  476. it('pins a custom query', async function () {
  477. const pinnedSearch = {
  478. id: '666',
  479. name: 'My Pinned Search',
  480. query: 'assigned:me level:fatal',
  481. sort: 'date',
  482. isPinned: true,
  483. visibility: SavedSearchVisibility.ORGANIZATION,
  484. };
  485. savedSearchesRequest = MockApiClient.addMockResponse({
  486. url: '/organizations/org-slug/searches/',
  487. body: [savedSearch],
  488. });
  489. const {rerender} = render(<IssueListWithStores {...routerProps} />, {
  490. context: routerContext,
  491. });
  492. await waitForElementToBeRemoved(() => screen.getByTestId('loading-indicator'));
  493. const queryInput = screen.getByDisplayValue('is:unresolved');
  494. await userEvent.clear(queryInput);
  495. await userEvent.type(queryInput, 'assigned:me level:fatal{enter}');
  496. expect((browserHistory.push as jest.Mock).mock.calls[0][0]).toEqual(
  497. expect.objectContaining({
  498. query: expect.objectContaining({
  499. query: 'assigned:me level:fatal',
  500. }),
  501. })
  502. );
  503. await tick();
  504. const routerWithQuery = {location: {query: {query: 'assigned:me level:fatal'}}};
  505. rerender(<IssueListWithStores {...merge({}, routerProps, routerWithQuery)} />);
  506. expect(screen.getByRole('button', {name: 'Custom Search'})).toBeInTheDocument();
  507. MockApiClient.clearMockResponses();
  508. const createPin = MockApiClient.addMockResponse({
  509. url: '/organizations/org-slug/pinned-searches/',
  510. method: 'PUT',
  511. body: pinnedSearch,
  512. });
  513. MockApiClient.addMockResponse({
  514. url: '/organizations/org-slug/searches/',
  515. body: [savedSearch, pinnedSearch],
  516. });
  517. await userEvent.click(screen.getByLabelText(/Set as Default/i));
  518. await waitFor(() => {
  519. expect(createPin).toHaveBeenCalled();
  520. expect(browserHistory.replace).toHaveBeenLastCalledWith(
  521. expect.objectContaining({
  522. pathname: '/organizations/org-slug/issues/searches/666/',
  523. query: {
  524. referrer: 'search-bar',
  525. },
  526. search: '',
  527. })
  528. );
  529. });
  530. });
  531. it('unpins a custom query', async function () {
  532. const pinnedSearch = Search({
  533. id: '666',
  534. name: 'My Pinned Search',
  535. query: 'assigned:me level:fatal',
  536. sort: 'date',
  537. isPinned: true,
  538. visibility: SavedSearchVisibility.ORGANIZATION,
  539. });
  540. savedSearchesRequest = MockApiClient.addMockResponse({
  541. url: '/organizations/org-slug/searches/',
  542. body: [pinnedSearch],
  543. });
  544. const deletePin = MockApiClient.addMockResponse({
  545. url: '/organizations/org-slug/pinned-searches/',
  546. method: 'DELETE',
  547. });
  548. const routerWithSavedSearch = {
  549. params: {searchId: pinnedSearch.id},
  550. };
  551. render(<IssueListWithStores {...merge({}, routerProps, routerWithSavedSearch)} />, {
  552. context: routerContext,
  553. router: routerWithSavedSearch,
  554. });
  555. await waitForElementToBeRemoved(() => screen.getByTestId('loading-indicator'));
  556. expect(screen.getByRole('button', {name: 'My Default Search'})).toBeInTheDocument();
  557. await userEvent.click(screen.getByLabelText(/Remove Default/i));
  558. await waitFor(() => {
  559. expect(deletePin).toHaveBeenCalled();
  560. });
  561. await waitFor(() => {
  562. expect(browserHistory.replace).toHaveBeenLastCalledWith(
  563. expect.objectContaining({
  564. pathname: '/organizations/org-slug/issues/',
  565. })
  566. );
  567. });
  568. });
  569. it('pins a saved query', async function () {
  570. const assignedToMe = Search({
  571. id: '234',
  572. name: 'Assigned to Me',
  573. isPinned: false,
  574. isGlobal: true,
  575. query: 'assigned:me',
  576. sort: 'date',
  577. type: 0,
  578. });
  579. savedSearchesRequest = MockApiClient.addMockResponse({
  580. url: '/organizations/org-slug/searches/',
  581. body: [savedSearch, assignedToMe],
  582. });
  583. const createPin = MockApiClient.addMockResponse({
  584. url: '/organizations/org-slug/pinned-searches/',
  585. method: 'PUT',
  586. body: {
  587. ...savedSearch,
  588. isPinned: true,
  589. },
  590. });
  591. const routerWithSavedSearch = {params: {searchId: '789'}};
  592. render(<IssueListWithStores {...merge({}, routerProps, routerWithSavedSearch)} />, {
  593. context: routerContext,
  594. router: routerWithSavedSearch,
  595. });
  596. await waitForElementToBeRemoved(() => screen.getByTestId('loading-indicator'));
  597. expect(screen.getByRole('button', {name: savedSearch.name})).toBeInTheDocument();
  598. await userEvent.click(screen.getByLabelText(/set as default/i));
  599. await waitFor(() => {
  600. expect(createPin).toHaveBeenCalled();
  601. expect(browserHistory.replace).toHaveBeenLastCalledWith(
  602. expect.objectContaining({
  603. pathname: '/organizations/org-slug/issues/searches/789/',
  604. })
  605. );
  606. });
  607. });
  608. it('pinning search should keep project selected', async function () {
  609. savedSearchesRequest = MockApiClient.addMockResponse({
  610. url: '/organizations/org-slug/searches/',
  611. body: [savedSearch],
  612. });
  613. const {routerContext: newRouterContext, router: newRouter} = initializeOrg({
  614. router: {
  615. location: {
  616. query: {
  617. project: ['123'],
  618. environment: ['prod'],
  619. query: 'assigned:me level:fatal',
  620. },
  621. },
  622. },
  623. });
  624. render(
  625. <IssueListWithStores
  626. {...newRouter}
  627. selection={{
  628. projects: [123],
  629. environments: ['prod'],
  630. datetime: {
  631. end: null,
  632. period: null,
  633. start: null,
  634. utc: null,
  635. },
  636. }}
  637. />,
  638. {context: newRouterContext}
  639. );
  640. await waitForElementToBeRemoved(() => screen.getByTestId('loading-indicator'));
  641. const createPin = MockApiClient.addMockResponse({
  642. url: '/organizations/org-slug/pinned-searches/',
  643. method: 'PUT',
  644. body: {
  645. ...savedSearch,
  646. id: '666',
  647. name: 'My Pinned Search',
  648. query: 'assigned:me level:fatal',
  649. sort: 'date',
  650. isPinned: true,
  651. },
  652. });
  653. await userEvent.click(screen.getByLabelText(/set as default/i));
  654. await waitFor(() => {
  655. expect(createPin).toHaveBeenCalled();
  656. expect(browserHistory.replace).toHaveBeenLastCalledWith(
  657. expect.objectContaining({
  658. pathname: '/organizations/org-slug/issues/searches/666/',
  659. query: expect.objectContaining({
  660. project: ['123'],
  661. environment: ['prod'],
  662. query: 'assigned:me level:fatal',
  663. referrer: 'search-bar',
  664. }),
  665. })
  666. );
  667. });
  668. });
  669. it('unpinning search should keep project selected', async function () {
  670. const localSavedSearch = {
  671. ...savedSearch,
  672. id: '666',
  673. isPinned: true,
  674. query: 'assigned:me level:fatal',
  675. };
  676. savedSearchesRequest = MockApiClient.addMockResponse({
  677. url: '/organizations/org-slug/searches/',
  678. body: [localSavedSearch],
  679. });
  680. const deletePin = MockApiClient.addMockResponse({
  681. url: '/organizations/org-slug/pinned-searches/',
  682. method: 'DELETE',
  683. });
  684. const {routerContext: newRouterContext, router: newRouter} = initializeOrg(
  685. merge({}, router, {
  686. router: {
  687. location: {
  688. query: {
  689. project: ['123'],
  690. environment: ['prod'],
  691. query: 'assigned:me level:fatal',
  692. },
  693. },
  694. params: {searchId: '666'},
  695. },
  696. })
  697. );
  698. render(
  699. <IssueListWithStores
  700. {...newRouter}
  701. selection={{
  702. projects: [123],
  703. environments: ['prod'],
  704. datetime: {
  705. end: null,
  706. period: null,
  707. start: null,
  708. utc: null,
  709. },
  710. }}
  711. savedSearch={localSavedSearch}
  712. />,
  713. {context: newRouterContext}
  714. );
  715. await waitForElementToBeRemoved(() => screen.getByTestId('loading-indicator'));
  716. await userEvent.click(screen.getByLabelText(/Remove Default/i));
  717. await waitFor(() => {
  718. expect(deletePin).toHaveBeenCalled();
  719. expect(browserHistory.replace).toHaveBeenLastCalledWith(
  720. expect.objectContaining({
  721. pathname: '/organizations/org-slug/issues/',
  722. query: expect.objectContaining({
  723. project: ['123'],
  724. environment: ['prod'],
  725. query: 'assigned:me level:fatal',
  726. referrer: 'search-bar',
  727. }),
  728. })
  729. );
  730. });
  731. });
  732. it('does not allow pagination to "previous" while on first page and resets cursors when navigating back to initial page', async function () {
  733. const {rerender} = render(<IssueListWithStores {...routerProps} />, {
  734. context: routerContext,
  735. });
  736. await waitForElementToBeRemoved(() => screen.getByTestId('loading-indicator'));
  737. expect(screen.getByRole('button', {name: 'Previous'})).toBeDisabled();
  738. issuesRequest = MockApiClient.addMockResponse({
  739. url: '/organizations/org-slug/issues/',
  740. body: [group],
  741. headers: {
  742. Link: '<http://127.0.0.1:8000/api/0/organizations/org-slug/issues/?cursor=1443575000:0:0>; rel="previous"; results="true"; cursor="1443575000:0:1", <http://127.0.0.1:8000/api/0/organizations/org-slug/issues/?cursor=1443574000:0:0>; rel="next"; results="true"; cursor="1443574000:0:0"',
  743. },
  744. });
  745. await userEvent.click(screen.getByRole('button', {name: 'Next'}));
  746. let pushArgs = {
  747. pathname: '/organizations/org-slug/issues/',
  748. query: {
  749. cursor: '1443575000:0:0',
  750. page: 1,
  751. environment: [],
  752. project: [],
  753. query: 'is:unresolved',
  754. statsPeriod: '14d',
  755. referrer: 'issue-list',
  756. },
  757. };
  758. await waitFor(() => {
  759. expect(browserHistory.push).toHaveBeenLastCalledWith(pushArgs);
  760. });
  761. rerender(<IssueListWithStores {...merge({}, routerProps, {location: pushArgs})} />);
  762. expect(screen.getByRole('button', {name: 'Previous'})).toBeEnabled();
  763. // Click next again
  764. await userEvent.click(screen.getByRole('button', {name: 'Next'}));
  765. pushArgs = {
  766. pathname: '/organizations/org-slug/issues/',
  767. query: {
  768. cursor: '1443574000:0:0',
  769. page: 2,
  770. environment: [],
  771. project: [],
  772. query: 'is:unresolved',
  773. statsPeriod: '14d',
  774. referrer: 'issue-list',
  775. },
  776. };
  777. await waitFor(() => {
  778. expect(browserHistory.push).toHaveBeenLastCalledWith(pushArgs);
  779. });
  780. rerender(<IssueListWithStores {...merge({}, routerProps, {location: pushArgs})} />);
  781. // Click previous
  782. await userEvent.click(screen.getByRole('button', {name: 'Previous'}));
  783. pushArgs = {
  784. pathname: '/organizations/org-slug/issues/',
  785. query: {
  786. cursor: '1443575000:0:1',
  787. page: 1,
  788. environment: [],
  789. project: [],
  790. query: 'is:unresolved',
  791. statsPeriod: '14d',
  792. referrer: 'issue-list',
  793. },
  794. };
  795. await waitFor(() => {
  796. expect(browserHistory.push).toHaveBeenLastCalledWith(pushArgs);
  797. });
  798. rerender(<IssueListWithStores {...merge({}, routerProps, {location: pushArgs})} />);
  799. // Click previous back to initial page
  800. await userEvent.click(screen.getByRole('button', {name: 'Previous'}));
  801. await waitFor(() => {
  802. // cursor is undefined because "prev" cursor is === initial "next" cursor
  803. expect(browserHistory.push).toHaveBeenLastCalledWith({
  804. pathname: '/organizations/org-slug/issues/',
  805. query: {
  806. cursor: undefined,
  807. environment: [],
  808. page: undefined,
  809. project: [],
  810. query: 'is:unresolved',
  811. statsPeriod: '14d',
  812. referrer: 'issue-list',
  813. },
  814. });
  815. });
  816. });
  817. });
  818. describe('transitionTo', function () {
  819. it('pushes to history when query is updated', async function () {
  820. MockApiClient.addMockResponse({
  821. url: '/organizations/org-slug/issues/',
  822. body: [],
  823. headers: {
  824. Link: DEFAULT_LINKS_HEADER,
  825. },
  826. });
  827. render(<IssueListOverview {...props} />, {
  828. context: routerContext,
  829. });
  830. const queryInput = screen.getByDisplayValue('is:unresolved');
  831. await userEvent.clear(queryInput);
  832. await userEvent.type(queryInput, 'is:ignored{enter}');
  833. expect(browserHistory.push).toHaveBeenCalledWith({
  834. pathname: '/organizations/org-slug/issues/',
  835. query: {
  836. environment: [],
  837. project: [parseInt(project.id, 10)],
  838. query: 'is:ignored',
  839. statsPeriod: '14d',
  840. referrer: 'issue-list',
  841. },
  842. });
  843. });
  844. });
  845. it('fetches tags and members', async function () {
  846. render(<IssueListOverview {...routerProps} {...props} />, {context: routerContext});
  847. await waitFor(() => {
  848. expect(fetchTagsRequest).toHaveBeenCalled();
  849. expect(fetchMembersRequest).toHaveBeenCalled();
  850. });
  851. });
  852. describe('componentDidUpdate fetching groups', function () {
  853. let fetchDataMock;
  854. beforeEach(function () {
  855. fetchDataMock = MockApiClient.addMockResponse({
  856. url: '/organizations/org-slug/issues/',
  857. body: [group],
  858. headers: {
  859. Link: DEFAULT_LINKS_HEADER,
  860. },
  861. });
  862. fetchDataMock.mockReset();
  863. });
  864. it('fetches data on selection change', function () {
  865. const {rerender} = render(<IssueListOverview {...routerProps} {...props} />, {
  866. context: routerContext,
  867. });
  868. rerender(
  869. <IssueListOverview
  870. {...routerProps}
  871. {...props}
  872. selection={{projects: [99], environments: [], datetime: {period: '24h'}}}
  873. />
  874. );
  875. expect(fetchDataMock).toHaveBeenCalled();
  876. });
  877. it('fetches data on savedSearch change', function () {
  878. const {rerender} = render(<IssueListOverview {...routerProps} {...props} />, {
  879. context: routerContext,
  880. });
  881. rerender(
  882. <IssueListOverview
  883. {...routerProps}
  884. {...props}
  885. savedSearch={{id: '1', query: 'is:resolved'}}
  886. />
  887. );
  888. expect(fetchDataMock).toHaveBeenCalled();
  889. });
  890. it('uses correct statsPeriod when fetching issues list and no datetime given', function () {
  891. const {rerender} = render(<IssueListOverview {...routerProps} {...props} />, {
  892. context: routerContext,
  893. });
  894. const selection = {projects: [99], environments: [], datetime: {}};
  895. rerender(<IssueListOverview {...routerProps} {...props} selection={selection} />);
  896. expect(fetchDataMock).toHaveBeenLastCalledWith(
  897. '/organizations/org-slug/issues/',
  898. expect.objectContaining({
  899. data: 'collapse=stats&collapse=unhandled&expand=owners&expand=inbox&limit=25&project=99&query=is%3Aunresolved&savedSearch=1&shortIdLookup=1&statsPeriod=14d',
  900. })
  901. );
  902. });
  903. });
  904. describe('componentDidUpdate fetching members', function () {
  905. it('fetches memberlist and tags list on project change', function () {
  906. const {rerender} = render(<IssueListOverview {...routerProps} {...props} />, {
  907. context: routerContext,
  908. });
  909. // Called during componentDidMount
  910. expect(fetchMembersRequest).toHaveBeenCalledTimes(1);
  911. expect(fetchTagsRequest).toHaveBeenCalledTimes(1);
  912. const selection = {
  913. projects: [99],
  914. environments: [],
  915. datetime: {period: '24h'},
  916. };
  917. rerender(<IssueListOverview {...routerProps} {...props} selection={selection} />);
  918. expect(fetchMembersRequest).toHaveBeenCalledTimes(2);
  919. expect(fetchTagsRequest).toHaveBeenCalledTimes(2);
  920. });
  921. });
  922. describe('render states', function () {
  923. it('displays the loading icon when saved searches are loading', function () {
  924. render(<IssueListOverview {...routerProps} {...props} savedSearchLoading />, {
  925. context: routerContext,
  926. });
  927. expect(screen.getByTestId('loading-indicator')).toBeInTheDocument();
  928. });
  929. it('displays an error when issues fail to load', async function () {
  930. MockApiClient.addMockResponse({
  931. url: '/organizations/org-slug/issues/',
  932. status: 500,
  933. statusCode: 500,
  934. });
  935. render(<IssueListOverview {...routerProps} {...props} />, {
  936. context: routerContext,
  937. });
  938. expect(await screen.findByTestId('loading-error')).toBeInTheDocument();
  939. });
  940. it('displays congrats robots animation with only is:unresolved query', async function () {
  941. MockApiClient.addMockResponse({
  942. url: '/organizations/org-slug/issues/',
  943. body: [],
  944. headers: {
  945. Link: DEFAULT_LINKS_HEADER,
  946. },
  947. });
  948. render(<IssueListOverview {...routerProps} {...props} />, {context: routerContext});
  949. expect(
  950. await screen.findByText(/We couldn't find any issues that matched your filters/i)
  951. ).toBeInTheDocument();
  952. });
  953. it('displays an empty resultset with a non-default query', async function () {
  954. MockApiClient.addMockResponse({
  955. url: '/organizations/org-slug/issues/',
  956. body: [],
  957. headers: {
  958. Link: DEFAULT_LINKS_HEADER,
  959. },
  960. });
  961. render(<IssueListOverview {...routerProps} {...props} />, {context: routerContext});
  962. await userEvent.type(
  963. screen.getByDisplayValue('is:unresolved'),
  964. ' level:error{enter}'
  965. );
  966. expect(
  967. await screen.findByText(/We couldn't find any issues that matched your filters/i)
  968. ).toBeInTheDocument();
  969. });
  970. });
  971. describe('Error Robot', function () {
  972. const createWrapper = async moreProps => {
  973. MockApiClient.addMockResponse({
  974. url: '/organizations/org-slug/issues/',
  975. body: [],
  976. headers: {
  977. Link: DEFAULT_LINKS_HEADER,
  978. },
  979. });
  980. const defaultProps = {
  981. ...props,
  982. useOrgSavedSearches: true,
  983. selection: {
  984. projects: [],
  985. environments: [],
  986. datetime: {period: '14d'},
  987. },
  988. ...merge({}, routerProps, {
  989. params: {},
  990. location: {query: {query: 'is:unresolved'}, search: 'query=is:unresolved'},
  991. }),
  992. organization: Organization({
  993. projects: [],
  994. }),
  995. ...moreProps,
  996. };
  997. render(<IssueListOverview {...defaultProps} />, {
  998. context: routerContext,
  999. });
  1000. await waitForElementToBeRemoved(() => screen.getByTestId('loading-indicator'));
  1001. };
  1002. it('displays when no projects selected and all projects user is member of, async does not have first event', async function () {
  1003. const projects = [
  1004. TestStubs.Project({
  1005. id: '1',
  1006. slug: 'foo',
  1007. isMember: true,
  1008. firstEvent: false,
  1009. }),
  1010. TestStubs.Project({
  1011. id: '2',
  1012. slug: 'bar',
  1013. isMember: true,
  1014. firstEvent: false,
  1015. }),
  1016. TestStubs.Project({
  1017. id: '3',
  1018. slug: 'baz',
  1019. isMember: true,
  1020. firstEvent: false,
  1021. }),
  1022. ];
  1023. MockApiClient.addMockResponse({
  1024. url: '/organizations/org-slug/sent-first-event/',
  1025. query: {
  1026. is_member: true,
  1027. },
  1028. body: {sentFirstEvent: false},
  1029. });
  1030. MockApiClient.addMockResponse({
  1031. url: '/organizations/org-slug/projects/',
  1032. body: projects,
  1033. });
  1034. MockApiClient.addMockResponse({
  1035. url: '/projects/org-slug/foo/issues/',
  1036. body: [],
  1037. });
  1038. await createWrapper({
  1039. organization: Organization({
  1040. projects,
  1041. }),
  1042. });
  1043. expect(screen.getByTestId('awaiting-events')).toBeInTheDocument();
  1044. });
  1045. it('does not display when no projects selected and any projects have a first event', async function () {
  1046. const projects = [
  1047. TestStubs.Project({
  1048. id: '1',
  1049. slug: 'foo',
  1050. isMember: true,
  1051. firstEvent: false,
  1052. }),
  1053. TestStubs.Project({
  1054. id: '2',
  1055. slug: 'bar',
  1056. isMember: true,
  1057. firstEvent: true,
  1058. }),
  1059. TestStubs.Project({
  1060. id: '3',
  1061. slug: 'baz',
  1062. isMember: true,
  1063. firstEvent: false,
  1064. }),
  1065. ];
  1066. MockApiClient.addMockResponse({
  1067. url: '/organizations/org-slug/sent-first-event/',
  1068. query: {
  1069. is_member: true,
  1070. },
  1071. body: {sentFirstEvent: true},
  1072. });
  1073. MockApiClient.addMockResponse({
  1074. url: '/organizations/org-slug/projects/',
  1075. body: projects,
  1076. });
  1077. await createWrapper({
  1078. organization: Organization({
  1079. projects,
  1080. }),
  1081. });
  1082. expect(screen.queryByTestId('awaiting-events')).not.toBeInTheDocument();
  1083. });
  1084. it('displays when all selected projects do not have first event', async function () {
  1085. const projects = [
  1086. TestStubs.Project({
  1087. id: '1',
  1088. slug: 'foo',
  1089. isMember: true,
  1090. firstEvent: false,
  1091. }),
  1092. TestStubs.Project({
  1093. id: '2',
  1094. slug: 'bar',
  1095. isMember: true,
  1096. firstEvent: false,
  1097. }),
  1098. TestStubs.Project({
  1099. id: '3',
  1100. slug: 'baz',
  1101. isMember: true,
  1102. firstEvent: false,
  1103. }),
  1104. ];
  1105. MockApiClient.addMockResponse({
  1106. url: '/organizations/org-slug/sent-first-event/',
  1107. query: {
  1108. project: [1, 2],
  1109. },
  1110. body: {sentFirstEvent: false},
  1111. });
  1112. MockApiClient.addMockResponse({
  1113. url: '/organizations/org-slug/projects/',
  1114. body: projects,
  1115. });
  1116. MockApiClient.addMockResponse({
  1117. url: '/projects/org-slug/foo/issues/',
  1118. body: [],
  1119. });
  1120. await createWrapper({
  1121. selection: {
  1122. projects: [1, 2],
  1123. environments: [],
  1124. datetime: {period: '14d'},
  1125. },
  1126. organization: Organization({
  1127. projects,
  1128. }),
  1129. });
  1130. expect(await screen.findByTestId('awaiting-events')).toBeInTheDocument();
  1131. });
  1132. it('does not display when any selected projects have first event', async function () {
  1133. const projects = [
  1134. TestStubs.Project({
  1135. id: '1',
  1136. slug: 'foo',
  1137. isMember: true,
  1138. firstEvent: false,
  1139. }),
  1140. TestStubs.Project({
  1141. id: '2',
  1142. slug: 'bar',
  1143. isMember: true,
  1144. firstEvent: true,
  1145. }),
  1146. TestStubs.Project({
  1147. id: '3',
  1148. slug: 'baz',
  1149. isMember: true,
  1150. firstEvent: true,
  1151. }),
  1152. ];
  1153. MockApiClient.addMockResponse({
  1154. url: '/organizations/org-slug/sent-first-event/',
  1155. query: {
  1156. project: [1, 2],
  1157. },
  1158. body: {sentFirstEvent: true},
  1159. });
  1160. MockApiClient.addMockResponse({
  1161. url: '/organizations/org-slug/projects/',
  1162. body: projects,
  1163. });
  1164. await createWrapper({
  1165. selection: {
  1166. projects: [1, 2],
  1167. environments: [],
  1168. datetime: {period: '14d'},
  1169. },
  1170. organization: Organization({
  1171. projects,
  1172. }),
  1173. });
  1174. expect(screen.queryByTestId('awaiting-events')).not.toBeInTheDocument();
  1175. });
  1176. });
  1177. it('displays a count that represents the current page', function () {
  1178. MockApiClient.addMockResponse({
  1179. url: '/organizations/org-slug/issues/',
  1180. body: [...new Array(25)].map((_, i) => ({id: i})),
  1181. headers: {
  1182. Link: DEFAULT_LINKS_HEADER,
  1183. 'X-Hits': '500',
  1184. 'X-Max-Hits': '1000',
  1185. },
  1186. });
  1187. parseLinkHeaderSpy.mockReturnValue({
  1188. next: {
  1189. results: true,
  1190. cursor: '',
  1191. href: '',
  1192. },
  1193. previous: {
  1194. results: false,
  1195. cursor: '',
  1196. href: '',
  1197. },
  1198. });
  1199. props = {
  1200. ...props,
  1201. location: {
  1202. query: {
  1203. cursor: 'some cursor',
  1204. page: 1,
  1205. },
  1206. },
  1207. };
  1208. const {routerContext: newRouterContext} = initializeOrg();
  1209. const {rerender} = render(<IssueListOverview {...props} />, {
  1210. context: newRouterContext,
  1211. });
  1212. expect(screen.getByText(textWithMarkupMatcher('1-25 of 500'))).toBeInTheDocument();
  1213. parseLinkHeaderSpy.mockReturnValue({
  1214. next: {
  1215. results: true,
  1216. cursor: '',
  1217. href: '',
  1218. },
  1219. previous: {
  1220. results: true,
  1221. cursor: '',
  1222. href: '',
  1223. },
  1224. });
  1225. rerender(<IssueListOverview {...props} />);
  1226. expect(screen.getByText(textWithMarkupMatcher('26-50 of 500'))).toBeInTheDocument();
  1227. });
  1228. describe('project low priority queue alert', function () {
  1229. const {routerContext: newRouterContext} = initializeOrg();
  1230. beforeEach(function () {
  1231. act(() => ProjectsStore.reset());
  1232. });
  1233. it('does not render event processing alert', function () {
  1234. act(() => ProjectsStore.loadInitialData([project]));
  1235. render(<IssueListOverview {...props} />, {
  1236. context: newRouterContext,
  1237. });
  1238. expect(screen.queryByText(/event processing/i)).not.toBeInTheDocument();
  1239. });
  1240. describe('renders alert', function () {
  1241. it('for one project', function () {
  1242. act(() =>
  1243. ProjectsStore.loadInitialData([
  1244. {...project, eventProcessing: {symbolicationDegraded: true}},
  1245. ])
  1246. );
  1247. render(<IssueListOverview {...props} />, {
  1248. context: routerContext,
  1249. });
  1250. expect(
  1251. screen.getByText(/Event Processing for this project is currently degraded/i)
  1252. ).toBeInTheDocument();
  1253. });
  1254. it('for multiple projects', function () {
  1255. const projectBar = TestStubs.Project({
  1256. id: '3560',
  1257. name: 'Bar Project',
  1258. slug: 'project-slug-bar',
  1259. });
  1260. act(() =>
  1261. ProjectsStore.loadInitialData([
  1262. {
  1263. ...project,
  1264. slug: 'project-slug',
  1265. eventProcessing: {symbolicationDegraded: true},
  1266. },
  1267. {
  1268. ...projectBar,
  1269. slug: 'project-slug-bar',
  1270. eventProcessing: {symbolicationDegraded: true},
  1271. },
  1272. ])
  1273. );
  1274. render(
  1275. <IssueListOverview
  1276. {...props}
  1277. selection={{
  1278. ...props.selection,
  1279. projects: [Number(project.id), Number(projectBar.id)],
  1280. }}
  1281. />,
  1282. {
  1283. context: newRouterContext,
  1284. }
  1285. );
  1286. expect(
  1287. screen.getByText(
  1288. textWithMarkupMatcher(
  1289. 'Event Processing for the project-slug, project-slug-bar projects is currently degraded.'
  1290. )
  1291. )
  1292. ).toBeInTheDocument();
  1293. });
  1294. });
  1295. });
  1296. });