overview.spec.tsx 42 KB

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