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