groupActivity.spec.tsx 24 KB

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