groupActivity.spec.tsx 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835
  1. import {GroupFixture} from 'sentry-fixture/group';
  2. import {OrganizationFixture} from 'sentry-fixture/organization';
  3. import {ProjectFixture} from 'sentry-fixture/project';
  4. import {ReleaseFixture} from 'sentry-fixture/release';
  5. import {RepositoryFixture} from 'sentry-fixture/repository';
  6. import {TeamFixture} from 'sentry-fixture/team';
  7. import {UserFixture} from 'sentry-fixture/user';
  8. import {initializeOrg} from 'sentry-test/initializeOrg';
  9. import {
  10. act,
  11. render,
  12. renderGlobalModal,
  13. screen,
  14. userEvent,
  15. waitFor,
  16. } from 'sentry-test/reactTestingLibrary';
  17. import ConfigStore from 'sentry/stores/configStore';
  18. import GroupStore from 'sentry/stores/groupStore';
  19. import OrganizationStore from 'sentry/stores/organizationStore';
  20. import ProjectsStore from 'sentry/stores/projectsStore';
  21. import TeamStore from 'sentry/stores/teamStore';
  22. import type {Group} from 'sentry/types/group';
  23. import {GroupActivityType, PriorityLevel} from 'sentry/types/group';
  24. import type {Organization} from 'sentry/types/organization';
  25. import type {Project} from 'sentry/types/project';
  26. import GroupActivity from 'sentry/views/issueDetails/groupActivity';
  27. describe('GroupActivity', function () {
  28. let project!: Project;
  29. const dateCreated = '2021-10-01T15:31:38.950115Z';
  30. beforeEach(function () {
  31. project = ProjectFixture();
  32. ProjectsStore.loadInitialData([project]);
  33. ConfigStore.init();
  34. ConfigStore.set('user', UserFixture({id: '123'}));
  35. GroupStore.init();
  36. });
  37. afterEach(() => {
  38. MockApiClient.clearMockResponses();
  39. jest.clearAllMocks();
  40. });
  41. function createWrapper({
  42. activity,
  43. organization: additionalOrg,
  44. }: {
  45. activity?: Group['activity'];
  46. organization?: Organization;
  47. } = {}) {
  48. const group = GroupFixture({
  49. id: '1337',
  50. activity: activity ?? [
  51. {
  52. type: GroupActivityType.NOTE,
  53. id: 'note-1',
  54. data: {text: 'Test Note'},
  55. dateCreated: '2020-01-01T00:00:00',
  56. user: UserFixture(),
  57. project,
  58. },
  59. ],
  60. project,
  61. });
  62. const {organization, routerProps, router} = initializeOrg({
  63. organization: additionalOrg,
  64. });
  65. GroupStore.add([group]);
  66. TeamStore.loadInitialData([TeamFixture({id: '999', slug: 'no-team'})]);
  67. OrganizationStore.onUpdate(organization, {replace: true});
  68. return render(
  69. <GroupActivity {...routerProps} params={{orgId: 'org-slug'}} group={group} />,
  70. {router, organization}
  71. );
  72. }
  73. it('renders a NoteInput', function () {
  74. createWrapper();
  75. expect(screen.getByTestId('activity-note-body')).toBeInTheDocument();
  76. });
  77. it('renders a marked reviewed activity', function () {
  78. const user = UserFixture({name: 'Samwise'});
  79. createWrapper({
  80. activity: [
  81. {
  82. type: GroupActivityType.MARK_REVIEWED,
  83. id: 'reviewed-1',
  84. dateCreated: '',
  85. project: ProjectFixture(),
  86. data: {},
  87. user,
  88. },
  89. ],
  90. });
  91. expect(screen.getByText('marked this issue as reviewed')).toBeInTheDocument();
  92. expect(screen.getByText(user.name)).toBeInTheDocument();
  93. });
  94. it('renders a pr activity', function () {
  95. const user = UserFixture({name: 'Test User'});
  96. const repository = RepositoryFixture();
  97. createWrapper({
  98. activity: [
  99. {
  100. dateCreated: '',
  101. project: ProjectFixture(),
  102. type: GroupActivityType.SET_RESOLVED_IN_PULL_REQUEST,
  103. id: 'pr-1',
  104. data: {
  105. pullRequest: {
  106. externalUrl: '',
  107. id: '',
  108. title: '',
  109. repository,
  110. },
  111. },
  112. user,
  113. },
  114. ],
  115. });
  116. expect(screen.getAllByTestId('activity-item').at(-1)).toHaveTextContent(
  117. 'Test User has created a PR for this issue:'
  118. );
  119. });
  120. it('renders a assigned to self activity', function () {
  121. const user = UserFixture({id: '123', name: 'Mark'});
  122. createWrapper({
  123. activity: [
  124. {
  125. data: {
  126. assignee: user.id,
  127. assigneeEmail: user.email,
  128. assigneeType: 'user',
  129. user,
  130. },
  131. user,
  132. dateCreated: '2021-10-01T15:31:38.950115Z',
  133. id: '117',
  134. project: ProjectFixture(),
  135. type: GroupActivityType.ASSIGNED,
  136. },
  137. ],
  138. });
  139. expect(screen.getAllByTestId('activity-item').at(-1)).toHaveTextContent(
  140. /Mark assigned this issue to themselves/
  141. );
  142. });
  143. it('renders an assigned via codeowners activity', function () {
  144. createWrapper({
  145. activity: [
  146. {
  147. data: {
  148. assignee: '123',
  149. assigneeEmail: 'anotheruser@sentry.io',
  150. assigneeType: 'user',
  151. integration: 'codeowners',
  152. rule: 'path:something/*.py #workflow',
  153. user: UserFixture(),
  154. },
  155. project: ProjectFixture(),
  156. dateCreated: '2021-10-01T15:31:38.950115Z',
  157. id: '117',
  158. type: GroupActivityType.ASSIGNED,
  159. user: null,
  160. },
  161. ],
  162. });
  163. expect(screen.getAllByTestId('activity-item').at(-1)).toHaveTextContent(
  164. /Sentry auto-assigned this issue to anotheruser@sentry.io/
  165. );
  166. });
  167. it('renders an assigned via slack activity', function () {
  168. const user = UserFixture({id: '301', name: 'Mark'});
  169. createWrapper({
  170. activity: [
  171. {
  172. data: {
  173. assignee: '123',
  174. assigneeEmail: 'anotheruser@sentry.io',
  175. assigneeType: 'user',
  176. integration: 'slack',
  177. user: UserFixture(),
  178. },
  179. project: ProjectFixture(),
  180. dateCreated: '2021-10-01T15:31:38.950115Z',
  181. id: '117',
  182. type: GroupActivityType.ASSIGNED,
  183. user,
  184. },
  185. ],
  186. });
  187. const item = screen.getAllByTestId('activity-item').at(-1);
  188. expect(item).toHaveTextContent(/Mark assigned this issue to anotheruser@sentry.io/);
  189. expect(item).toHaveTextContent(/Assigned via Slack/);
  190. });
  191. it('renders an assigned via suspect commit activity', function () {
  192. createWrapper({
  193. activity: [
  194. {
  195. data: {
  196. assignee: '123',
  197. assigneeEmail: 'anotheruser@sentry.io',
  198. assigneeType: 'user',
  199. integration: 'suspectCommitter',
  200. user: UserFixture(),
  201. },
  202. project: ProjectFixture(),
  203. dateCreated: '1999-10-01T15:31:38.950115Z',
  204. id: '117',
  205. type: GroupActivityType.ASSIGNED,
  206. user: null,
  207. },
  208. ],
  209. });
  210. const activity = screen.getAllByTestId('activity-item').at(-1);
  211. expect(activity).toHaveTextContent(
  212. /Sentry auto-assigned this issue to anotheruser@sentry.io/
  213. );
  214. expect(activity).toHaveTextContent(/Assigned via Suspect Commit/);
  215. });
  216. it('does not render undefined when integration is not recognized', function () {
  217. createWrapper({
  218. activity: [
  219. // @ts-ignore-next-line -> committing type crimes on `integration`
  220. {
  221. data: {
  222. assignee: '123',
  223. assigneeEmail: 'anotheruser@sentry.io',
  224. assigneeType: 'user',
  225. integration: 'lottery',
  226. user: UserFixture(),
  227. },
  228. project: ProjectFixture(),
  229. dateCreated: '1999-10-01T15:31:38.950115Z',
  230. id: '117',
  231. type: GroupActivityType.ASSIGNED,
  232. user: null,
  233. },
  234. ],
  235. });
  236. const activity = screen.getAllByTestId('activity-item').at(-1);
  237. expect(activity).toHaveTextContent(
  238. /Sentry assigned this issue to anotheruser@sentry.io/
  239. );
  240. expect(activity).not.toHaveTextContent(/Assigned via Suspect Commit/);
  241. });
  242. it('resolved in commit with no releases', function () {
  243. createWrapper({
  244. activity: [
  245. {
  246. type: GroupActivityType.SET_RESOLVED_IN_COMMIT,
  247. id: '123',
  248. project: ProjectFixture(),
  249. dateCreated: '',
  250. data: {
  251. commit: {
  252. dateCreated: '',
  253. message: '',
  254. id: 'komal-commit',
  255. repository: RepositoryFixture(),
  256. releases: [],
  257. },
  258. },
  259. user: UserFixture(),
  260. },
  261. ],
  262. });
  263. expect(screen.getAllByTestId('activity-item').at(-1)).toHaveTextContent(
  264. 'Foo Bar marked this issue as resolved in komal-commit'
  265. );
  266. });
  267. it('resolved in commit with one release', function () {
  268. createWrapper({
  269. activity: [
  270. {
  271. type: GroupActivityType.SET_RESOLVED_IN_COMMIT,
  272. id: '123',
  273. project: ProjectFixture(),
  274. dateCreated: '',
  275. data: {
  276. commit: {
  277. id: 'komal-commit',
  278. dateCreated: '',
  279. message: '',
  280. repository: RepositoryFixture(),
  281. releases: [
  282. ReleaseFixture({
  283. dateCreated: '2022-05-01',
  284. dateReleased: '2022-05-02',
  285. version: 'random',
  286. }),
  287. ],
  288. },
  289. },
  290. user: UserFixture(),
  291. },
  292. ],
  293. });
  294. expect(screen.getAllByTestId('activity-item').at(-1)).toHaveTextContent(
  295. 'Foo Bar marked this issue as resolved in komal-commit This commit was released in random'
  296. );
  297. });
  298. it('resolved in commit with multiple releases', function () {
  299. createWrapper({
  300. activity: [
  301. {
  302. type: GroupActivityType.SET_RESOLVED_IN_COMMIT,
  303. id: '123',
  304. project: ProjectFixture(),
  305. dateCreated: '',
  306. data: {
  307. commit: {
  308. id: 'komal-commit',
  309. dateCreated: '',
  310. message: '',
  311. repository: RepositoryFixture(),
  312. releases: [
  313. ReleaseFixture({
  314. dateCreated: '2022-05-01',
  315. dateReleased: '2022-05-02',
  316. version: 'random',
  317. }),
  318. ReleaseFixture({
  319. dateCreated: '2022-06-01',
  320. dateReleased: '2022-06-02',
  321. version: 'newest',
  322. }),
  323. ReleaseFixture({
  324. dateCreated: '2021-08-03',
  325. dateReleased: '2021-08-03',
  326. version: 'oldest-release',
  327. }),
  328. ReleaseFixture({
  329. dateCreated: '2022-04-21',
  330. dateReleased: '2022-04-21',
  331. version: 'randomTwo',
  332. }),
  333. ],
  334. },
  335. },
  336. user: UserFixture(),
  337. },
  338. ],
  339. });
  340. expect(screen.getAllByTestId('activity-item').at(-1)).toHaveTextContent(
  341. 'Foo Bar marked this issue as resolved in komal-commit This commit was released in oldest-release and 3 others'
  342. );
  343. });
  344. it('requests assignees that are not in the team store', async function () {
  345. const team = TeamFixture({id: '123', name: 'workflow'});
  346. const teamRequest = MockApiClient.addMockResponse({
  347. url: `/organizations/org-slug/teams/`,
  348. body: [team],
  349. });
  350. createWrapper({
  351. activity: [
  352. {
  353. id: '123',
  354. user: null,
  355. type: GroupActivityType.ASSIGNED,
  356. project: ProjectFixture(),
  357. data: {
  358. assignee: team.id,
  359. assigneeType: 'team',
  360. user: UserFixture(),
  361. },
  362. dateCreated: '2021-10-28T13:40:10.634821Z',
  363. },
  364. ],
  365. });
  366. await waitFor(() => expect(teamRequest).toHaveBeenCalledTimes(1));
  367. expect(
  368. await screen.findByText(`assigned this issue to #${team.slug}`)
  369. ).toBeInTheDocument();
  370. expect(screen.getAllByTestId('activity-item').at(-1)).toHaveTextContent(
  371. /Sentry assigned this issue to #team-slug/
  372. );
  373. });
  374. describe('Delete', function () {
  375. let deleteMock;
  376. beforeEach(function () {
  377. deleteMock = MockApiClient.addMockResponse({
  378. url: '/organizations/org-slug/issues/1337/comments/note-1/',
  379. method: 'DELETE',
  380. });
  381. ConfigStore.set('user', UserFixture({id: '123', isSuperuser: true}));
  382. });
  383. it('should do nothing if not present in GroupStore', async function () {
  384. createWrapper();
  385. renderGlobalModal();
  386. act(() => {
  387. // Remove note from group activity
  388. GroupStore.removeActivity('1337', 'note-1');
  389. });
  390. await userEvent.click(screen.getByRole('button', {name: 'Comment Actions'}));
  391. await userEvent.click(screen.getByRole('menuitemradio', {name: 'Remove'}));
  392. expect(
  393. screen.getByText('Are you sure you wish to delete this comment?')
  394. ).toBeInTheDocument();
  395. await userEvent.click(screen.getByRole('button', {name: 'Confirm'}));
  396. expect(deleteMock).not.toHaveBeenCalled();
  397. });
  398. it('should remove remove the item from the GroupStore make a DELETE API request', async function () {
  399. createWrapper();
  400. renderGlobalModal();
  401. await userEvent.click(screen.getByRole('button', {name: 'Comment Actions'}));
  402. await userEvent.click(screen.getByRole('menuitemradio', {name: 'Remove'}));
  403. expect(
  404. screen.getByText('Are you sure you wish to delete this comment?')
  405. ).toBeInTheDocument();
  406. await userEvent.click(screen.getByRole('button', {name: 'Confirm'}));
  407. expect(deleteMock).toHaveBeenCalledTimes(1);
  408. });
  409. });
  410. it('renders archived until escalating', function () {
  411. createWrapper({
  412. activity: [
  413. {
  414. id: '123',
  415. type: GroupActivityType.SET_IGNORED,
  416. project: ProjectFixture(),
  417. data: {
  418. ignoreUntilEscalating: true,
  419. },
  420. user: UserFixture(),
  421. dateCreated,
  422. },
  423. ],
  424. organization: OrganizationFixture(),
  425. });
  426. expect(screen.getAllByTestId('activity-item').at(-1)).toHaveTextContent(
  427. 'Foo Bar archived this issue until it escalates'
  428. );
  429. });
  430. it('renders escalating with forecast and plural events', function () {
  431. createWrapper({
  432. activity: [
  433. {
  434. id: '123',
  435. type: GroupActivityType.SET_UNRESOLVED,
  436. project: ProjectFixture(),
  437. data: {
  438. forecast: 200,
  439. },
  440. user: null,
  441. dateCreated,
  442. },
  443. {
  444. id: '124',
  445. type: GroupActivityType.SET_ESCALATING,
  446. project: ProjectFixture(),
  447. data: {
  448. forecast: 400,
  449. },
  450. user: null,
  451. dateCreated: '2021-10-05T15:31:38.950115Z',
  452. },
  453. ],
  454. organization: OrganizationFixture(),
  455. });
  456. expect(screen.getAllByTestId('activity-item').at(-1)).toHaveTextContent(
  457. 'Sentry flagged this issue as escalating because over 400 events happened in an hour'
  458. );
  459. expect(screen.getAllByTestId('activity-item').at(-2)).toHaveTextContent(
  460. 'Sentry flagged this issue as escalating because over 200 events happened in an hour'
  461. );
  462. });
  463. it('renders escalating with forecast and singular event', function () {
  464. createWrapper({
  465. activity: [
  466. {
  467. id: '123',
  468. type: GroupActivityType.SET_UNRESOLVED,
  469. project: ProjectFixture(),
  470. data: {
  471. forecast: 1,
  472. },
  473. user: null,
  474. dateCreated,
  475. },
  476. ],
  477. organization: OrganizationFixture(),
  478. });
  479. expect(screen.getAllByTestId('activity-item').at(-1)).toHaveTextContent(
  480. 'Sentry flagged this issue as escalating because over 1 event happened in an hour'
  481. );
  482. });
  483. it('renders issue unresvoled via jira', function () {
  484. createWrapper({
  485. activity: [
  486. {
  487. id: '123',
  488. type: GroupActivityType.SET_UNRESOLVED,
  489. project: ProjectFixture(),
  490. data: {
  491. integration_id: '1',
  492. provider_key: 'jira',
  493. provider: 'Jira',
  494. },
  495. user: null,
  496. dateCreated,
  497. },
  498. ],
  499. });
  500. expect(screen.getAllByTestId('activity-item').at(-1)).toHaveTextContent(
  501. 'Sentry marked this issue as unresolved via Jira'
  502. );
  503. });
  504. it('renders issue resolved via jira', function () {
  505. createWrapper({
  506. activity: [
  507. {
  508. id: '123',
  509. type: GroupActivityType.SET_RESOLVED,
  510. project: ProjectFixture(),
  511. data: {
  512. integration_id: '1',
  513. provider_key: 'jira',
  514. provider: 'Jira',
  515. },
  516. user: null,
  517. dateCreated,
  518. },
  519. ],
  520. });
  521. expect(screen.getAllByTestId('activity-item').at(-1)).toHaveTextContent(
  522. 'Sentry marked this issue as resolved via Jira'
  523. );
  524. });
  525. it('renders escalating since it happened x times in time window', function () {
  526. createWrapper({
  527. activity: [
  528. {
  529. id: '123',
  530. type: GroupActivityType.SET_ESCALATING,
  531. project: ProjectFixture(),
  532. data: {
  533. expired_snooze: {
  534. count: 400,
  535. window: 1,
  536. until: null,
  537. user_count: null,
  538. user_window: null,
  539. },
  540. },
  541. dateCreated,
  542. },
  543. ],
  544. });
  545. expect(screen.getAllByTestId('activity-item').at(-1)).toHaveTextContent(
  546. 'Sentry flagged this issue as escalating because 400 events happened in 1 minute'
  547. );
  548. });
  549. it('renders escalating since x users were affected in time window', function () {
  550. createWrapper({
  551. activity: [
  552. {
  553. id: '123',
  554. type: GroupActivityType.SET_ESCALATING,
  555. project: ProjectFixture(),
  556. data: {
  557. expired_snooze: {
  558. user_count: 1,
  559. user_window: 1,
  560. until: null,
  561. count: null,
  562. window: null,
  563. },
  564. },
  565. dateCreated,
  566. },
  567. ],
  568. });
  569. expect(screen.getAllByTestId('activity-item').at(-1)).toHaveTextContent(
  570. 'Sentry flagged this issue as escalating because 1 user was affected in 1 minute'
  571. );
  572. });
  573. it('renders escalating since until date passed', function () {
  574. const date = new Date('2018-10-30');
  575. createWrapper({
  576. activity: [
  577. {
  578. id: '123',
  579. type: GroupActivityType.SET_ESCALATING,
  580. project: ProjectFixture(),
  581. data: {
  582. expired_snooze: {
  583. until: date,
  584. user_count: null,
  585. user_window: null,
  586. count: null,
  587. window: null,
  588. },
  589. },
  590. dateCreated,
  591. },
  592. ],
  593. });
  594. expect(screen.getAllByTestId('activity-item').at(-1)).toHaveTextContent(
  595. 'Sentry flagged this issue as escalating because Oct 30, 2018 12:00 AM passed'
  596. );
  597. });
  598. it('renders archived forever', function () {
  599. createWrapper({
  600. activity: [
  601. {
  602. id: '123',
  603. type: GroupActivityType.SET_IGNORED,
  604. project: ProjectFixture(),
  605. data: {},
  606. user: UserFixture(),
  607. dateCreated,
  608. },
  609. ],
  610. organization: OrganizationFixture(),
  611. });
  612. expect(screen.getAllByTestId('activity-item').at(-1)).toHaveTextContent(
  613. 'Foo Bar archived this issue forever'
  614. );
  615. });
  616. it('renders resolved in release with semver information', function () {
  617. createWrapper({
  618. activity: [
  619. {
  620. id: '123',
  621. type: GroupActivityType.SET_RESOLVED_IN_RELEASE,
  622. project: ProjectFixture(),
  623. data: {
  624. version: 'frontend@1.0.0',
  625. },
  626. user: UserFixture(),
  627. dateCreated,
  628. },
  629. ],
  630. });
  631. expect(screen.getAllByTestId('activity-item').at(-1)).toHaveTextContent(
  632. 'Foo Bar marked this issue as resolved in 1.0.0 (semver)'
  633. );
  634. });
  635. it('renders resolved in next release with semver information', function () {
  636. createWrapper({
  637. activity: [
  638. {
  639. id: '123',
  640. type: GroupActivityType.SET_RESOLVED_IN_RELEASE,
  641. project: ProjectFixture(),
  642. data: {
  643. current_release_version: 'frontend@1.0.0',
  644. },
  645. user: UserFixture(),
  646. dateCreated,
  647. },
  648. ],
  649. });
  650. expect(screen.getAllByTestId('activity-item').at(-1)).toHaveTextContent(
  651. 'Foo Bar marked this issue as resolved in releases greater than 1.0.0 (semver)'
  652. );
  653. });
  654. describe('regression', function () {
  655. it('renders basic regression', function () {
  656. createWrapper({
  657. activity: [
  658. {
  659. id: '123',
  660. type: GroupActivityType.SET_REGRESSION,
  661. project: ProjectFixture(),
  662. data: {},
  663. dateCreated,
  664. },
  665. ],
  666. });
  667. expect(screen.getAllByTestId('activity-item').at(-1)).toHaveTextContent(
  668. 'Sentry marked this issue as a regression'
  669. );
  670. });
  671. it('renders regression with version', function () {
  672. createWrapper({
  673. activity: [
  674. {
  675. id: '123',
  676. type: GroupActivityType.SET_REGRESSION,
  677. project: ProjectFixture(),
  678. data: {
  679. version: 'frontend@1.0.0',
  680. },
  681. dateCreated,
  682. },
  683. ],
  684. });
  685. expect(screen.getAllByTestId('activity-item').at(-1)).toHaveTextContent(
  686. 'Sentry marked this issue as a regression in 1.0.0'
  687. );
  688. });
  689. it('renders regression with semver description', function () {
  690. createWrapper({
  691. activity: [
  692. {
  693. id: '123',
  694. type: GroupActivityType.SET_REGRESSION,
  695. project: ProjectFixture(),
  696. data: {
  697. version: 'frontend@2.0.0',
  698. resolved_in_version: 'frontend@1.0.0',
  699. follows_semver: true,
  700. },
  701. dateCreated,
  702. },
  703. ],
  704. });
  705. const activity = screen.getAllByTestId('activity-item').at(-1);
  706. expect(activity).toHaveTextContent(
  707. 'Sentry marked this issue as a regression in 2.0.0'
  708. );
  709. expect(activity).toHaveTextContent(
  710. '2.0.0 is greater than or equal to 1.0.0 compared via semver'
  711. );
  712. });
  713. it('renders regression with non-semver description', function () {
  714. createWrapper({
  715. activity: [
  716. {
  717. id: '123',
  718. type: GroupActivityType.SET_REGRESSION,
  719. project: ProjectFixture(),
  720. data: {
  721. version: 'frontend@abc1',
  722. resolved_in_version: 'frontend@abc2',
  723. follows_semver: false,
  724. },
  725. dateCreated,
  726. },
  727. ],
  728. });
  729. const activity = screen.getAllByTestId('activity-item').at(-1);
  730. expect(activity).toHaveTextContent(
  731. 'Sentry marked this issue as a regression in abc1'
  732. );
  733. expect(activity).toHaveTextContent(
  734. 'abc1 is greater than or equal to abc2 compared via release date'
  735. );
  736. });
  737. it('renders a set priority activity for escalating issues', function () {
  738. createWrapper({
  739. activity: [
  740. {
  741. id: '123',
  742. type: GroupActivityType.SET_PRIORITY,
  743. project: ProjectFixture(),
  744. data: {
  745. priority: PriorityLevel.HIGH,
  746. reason: 'escalating',
  747. },
  748. dateCreated,
  749. },
  750. ],
  751. });
  752. expect(screen.getAllByTestId('activity-item').at(-1)).toHaveTextContent(
  753. 'Sentry updated the priority value of this issue to be high after it escalated'
  754. );
  755. });
  756. it('renders a set priority activity for ongoing issues', function () {
  757. createWrapper({
  758. activity: [
  759. {
  760. id: '123',
  761. type: GroupActivityType.SET_PRIORITY,
  762. project: ProjectFixture(),
  763. data: {
  764. priority: PriorityLevel.LOW,
  765. reason: 'ongoing',
  766. },
  767. dateCreated,
  768. },
  769. ],
  770. });
  771. expect(screen.getAllByTestId('activity-item').at(-1)).toHaveTextContent(
  772. 'Sentry updated the priority value of this issue to be low after it was marked as ongoing'
  773. );
  774. });
  775. it('renders a deleted attachment activity', function () {
  776. createWrapper({
  777. activity: [
  778. {
  779. id: '123',
  780. type: GroupActivityType.DELETED_ATTACHMENT,
  781. project: ProjectFixture(),
  782. data: {},
  783. dateCreated,
  784. user: UserFixture(),
  785. },
  786. ],
  787. });
  788. expect(screen.getAllByTestId('activity-item').at(-1)).toHaveTextContent(
  789. 'deleted an attachment'
  790. );
  791. });
  792. });
  793. });