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