groupActivity.spec.tsx 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826
  1. import {GroupFixture} from 'sentry-fixture/group';
  2. import {ProjectFixture} from 'sentry-fixture/project';
  3. import {ReleaseFixture} from 'sentry-fixture/release';
  4. import {RepositoryFixture} from 'sentry-fixture/repository';
  5. import {TeamFixture} from 'sentry-fixture/team';
  6. import {UserFixture} from 'sentry-fixture/user';
  7. import {initializeOrg} from 'sentry-test/initializeOrg';
  8. import {
  9. render,
  10. renderGlobalModal,
  11. screen,
  12. userEvent,
  13. waitFor,
  14. } from 'sentry-test/reactTestingLibrary';
  15. import ConfigStore from 'sentry/stores/configStore';
  16. import GroupStore from 'sentry/stores/groupStore';
  17. import OrganizationStore from 'sentry/stores/organizationStore';
  18. import ProjectsStore from 'sentry/stores/projectsStore';
  19. import TeamStore from 'sentry/stores/teamStore';
  20. import type {Group} from 'sentry/types/group';
  21. import {GroupActivityType, PriorityLevel} from 'sentry/types/group';
  22. import type {Project} from 'sentry/types/project';
  23. import GroupActivity from 'sentry/views/issueDetails/groupActivity';
  24. describe('GroupActivity', function () {
  25. let project!: Project;
  26. const dateCreated = '2021-10-01T15:31:38.950115Z';
  27. beforeEach(function () {
  28. project = ProjectFixture();
  29. ProjectsStore.loadInitialData([project]);
  30. ConfigStore.init();
  31. ConfigStore.set('user', UserFixture({id: '123'}));
  32. GroupStore.init();
  33. });
  34. afterEach(() => {
  35. MockApiClient.clearMockResponses();
  36. jest.clearAllMocks();
  37. });
  38. function createWrapper({
  39. activity,
  40. }: {
  41. activity?: Group['activity'];
  42. } = {}) {
  43. const group = GroupFixture({
  44. id: '1337',
  45. activity: activity ?? [
  46. {
  47. type: GroupActivityType.NOTE,
  48. id: 'note-1',
  49. data: {text: 'Test Note'},
  50. dateCreated: '2020-01-01T00:00:00',
  51. user: UserFixture(),
  52. project,
  53. },
  54. ],
  55. project,
  56. });
  57. GroupStore.add([group]);
  58. const {organization, router} = initializeOrg({
  59. router: {
  60. params: {orgId: 'org-slug', groupId: group.id},
  61. },
  62. });
  63. MockApiClient.addMockResponse({
  64. url: `/organizations/${organization.slug}/issues/${group.id}/`,
  65. body: group,
  66. });
  67. TeamStore.loadInitialData([TeamFixture({id: '999', slug: 'no-team'})]);
  68. OrganizationStore.onUpdate(organization, {replace: true});
  69. return render(<GroupActivity />, {router, organization});
  70. }
  71. it('renders a NoteInput', async function () {
  72. createWrapper();
  73. expect(await screen.findByTestId('activity-note-body')).toBeInTheDocument();
  74. });
  75. it('renders a marked reviewed activity', async 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(await screen.findByText('marked this issue as reviewed')).toBeInTheDocument();
  90. expect(screen.getByText(user.name)).toBeInTheDocument();
  91. });
  92. it('renders a pr activity', async 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((await screen.findAllByTestId('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', async 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((await screen.findAllByTestId('activity-item')).at(-1)).toHaveTextContent(
  138. /Mark assigned this issue to themselves/
  139. );
  140. });
  141. it('renders an assigned via codeowners activity', async 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((await screen.findAllByTestId('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', async 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 = (await screen.findAllByTestId('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', async 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 = (await screen.findAllByTestId('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', async 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 = (await screen.findAllByTestId('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', async 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. const activity = (await screen.findAllByTestId('activity-item')).at(-1);
  262. expect(activity).toHaveTextContent(
  263. 'Foo Bar marked this issue as resolved in komal-commit'
  264. );
  265. });
  266. it('resolved in commit with one release', async function () {
  267. createWrapper({
  268. activity: [
  269. {
  270. type: GroupActivityType.SET_RESOLVED_IN_COMMIT,
  271. id: '123',
  272. project: ProjectFixture(),
  273. dateCreated: '',
  274. data: {
  275. commit: {
  276. id: 'komal-commit',
  277. dateCreated: '',
  278. message: '',
  279. repository: RepositoryFixture(),
  280. releases: [
  281. ReleaseFixture({
  282. dateCreated: '2022-05-01',
  283. dateReleased: '2022-05-02',
  284. version: 'random',
  285. }),
  286. ],
  287. },
  288. },
  289. user: UserFixture(),
  290. },
  291. ],
  292. });
  293. const activity = (await screen.findAllByTestId('activity-item')).at(-1);
  294. expect(activity).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', async 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. const activity = (await screen.findAllByTestId('activity-item')).at(-1);
  341. expect(activity).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: jest.Mock;
  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 remove remove the item from the GroupStore make a DELETE API request', async function () {
  385. createWrapper();
  386. renderGlobalModal();
  387. const commentActions = await screen.findByRole('button', {name: 'Comment Actions'});
  388. await userEvent.click(commentActions);
  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).toHaveBeenCalledTimes(1);
  395. });
  396. });
  397. it('renders archived until escalating', async function () {
  398. createWrapper({
  399. activity: [
  400. {
  401. id: '123',
  402. type: GroupActivityType.SET_IGNORED,
  403. project: ProjectFixture(),
  404. data: {
  405. ignoreUntilEscalating: true,
  406. },
  407. user: UserFixture(),
  408. dateCreated,
  409. },
  410. ],
  411. });
  412. const activity = (await screen.findAllByTestId('activity-item')).at(-1);
  413. expect(activity).toHaveTextContent('Foo Bar archived this issue until it escalates');
  414. });
  415. it('renders escalating with forecast and plural events', async function () {
  416. createWrapper({
  417. activity: [
  418. {
  419. id: '123',
  420. type: GroupActivityType.SET_UNRESOLVED,
  421. project: ProjectFixture(),
  422. data: {
  423. forecast: 200,
  424. },
  425. user: null,
  426. dateCreated,
  427. },
  428. {
  429. id: '124',
  430. type: GroupActivityType.SET_ESCALATING,
  431. project: ProjectFixture(),
  432. data: {
  433. forecast: 400,
  434. },
  435. user: null,
  436. dateCreated: '2021-10-05T15:31:38.950115Z',
  437. },
  438. ],
  439. });
  440. const activities = await screen.findAllByTestId('activity-item');
  441. expect(activities.at(-1)).toHaveTextContent(
  442. 'Sentry flagged this issue as escalating because over 400 events happened in an hour'
  443. );
  444. expect(activities.at(-2)).toHaveTextContent(
  445. 'Sentry flagged this issue as escalating because over 200 events happened in an hour'
  446. );
  447. });
  448. it('renders escalating with forecast and singular event', async function () {
  449. createWrapper({
  450. activity: [
  451. {
  452. id: '123',
  453. type: GroupActivityType.SET_UNRESOLVED,
  454. project: ProjectFixture(),
  455. data: {
  456. forecast: 1,
  457. },
  458. user: null,
  459. dateCreated,
  460. },
  461. ],
  462. });
  463. const activity = (await screen.findAllByTestId('activity-item')).at(-1);
  464. expect(activity).toHaveTextContent(
  465. 'Sentry flagged this issue as escalating because over 1 event happened in an hour'
  466. );
  467. });
  468. it('renders issue unresvoled via jira', async function () {
  469. createWrapper({
  470. activity: [
  471. {
  472. id: '123',
  473. type: GroupActivityType.SET_UNRESOLVED,
  474. project: ProjectFixture(),
  475. data: {
  476. integration_id: '1',
  477. provider_key: 'jira',
  478. provider: 'Jira',
  479. },
  480. user: null,
  481. dateCreated,
  482. },
  483. ],
  484. });
  485. const activity = (await screen.findAllByTestId('activity-item')).at(-1);
  486. expect(activity).toHaveTextContent('Sentry marked this issue as unresolved via Jira');
  487. });
  488. it('renders issue resolved via jira', async function () {
  489. createWrapper({
  490. activity: [
  491. {
  492. id: '123',
  493. type: GroupActivityType.SET_RESOLVED,
  494. project: ProjectFixture(),
  495. data: {
  496. integration_id: '1',
  497. provider_key: 'jira',
  498. provider: 'Jira',
  499. },
  500. user: null,
  501. dateCreated,
  502. },
  503. ],
  504. });
  505. const activity = (await screen.findAllByTestId('activity-item')).at(-1);
  506. expect(activity).toHaveTextContent('Sentry marked this issue as resolved via Jira');
  507. });
  508. it('renders escalating since it happened x times in time window', async function () {
  509. createWrapper({
  510. activity: [
  511. {
  512. id: '123',
  513. type: GroupActivityType.SET_ESCALATING,
  514. project: ProjectFixture(),
  515. data: {
  516. expired_snooze: {
  517. count: 400,
  518. window: 1,
  519. until: null,
  520. user_count: null,
  521. user_window: null,
  522. },
  523. },
  524. dateCreated,
  525. },
  526. ],
  527. });
  528. const activity = (await screen.findAllByTestId('activity-item')).at(-1);
  529. expect(activity).toHaveTextContent(
  530. 'Sentry flagged this issue as escalating because 400 events happened in 1 minute'
  531. );
  532. });
  533. it('renders escalating since x users were affected in time window', async function () {
  534. createWrapper({
  535. activity: [
  536. {
  537. id: '123',
  538. type: GroupActivityType.SET_ESCALATING,
  539. project: ProjectFixture(),
  540. data: {
  541. expired_snooze: {
  542. user_count: 1,
  543. user_window: 1,
  544. until: null,
  545. count: null,
  546. window: null,
  547. },
  548. },
  549. dateCreated,
  550. },
  551. ],
  552. });
  553. const activity = (await screen.findAllByTestId('activity-item')).at(-1);
  554. expect(activity).toHaveTextContent(
  555. 'Sentry flagged this issue as escalating because 1 user was affected in 1 minute'
  556. );
  557. });
  558. it('renders escalating since until date passed', async function () {
  559. const date = new Date('2018-10-30');
  560. createWrapper({
  561. activity: [
  562. {
  563. id: '123',
  564. type: GroupActivityType.SET_ESCALATING,
  565. project: ProjectFixture(),
  566. data: {
  567. expired_snooze: {
  568. until: date,
  569. user_count: null,
  570. user_window: null,
  571. count: null,
  572. window: null,
  573. },
  574. },
  575. dateCreated,
  576. },
  577. ],
  578. });
  579. const activity = (await screen.findAllByTestId('activity-item')).at(-1);
  580. expect(activity).toHaveTextContent(
  581. 'Sentry flagged this issue as escalating because Oct 30, 2018 12:00 AM passed'
  582. );
  583. });
  584. it('renders archived forever', async function () {
  585. createWrapper({
  586. activity: [
  587. {
  588. id: '123',
  589. type: GroupActivityType.SET_IGNORED,
  590. project: ProjectFixture(),
  591. data: {},
  592. user: UserFixture(),
  593. dateCreated,
  594. },
  595. ],
  596. });
  597. const activity = (await screen.findAllByTestId('activity-item')).at(-1);
  598. expect(activity).toHaveTextContent('Foo Bar archived this issue forever');
  599. });
  600. it('renders resolved in release with semver information', async function () {
  601. createWrapper({
  602. activity: [
  603. {
  604. id: '123',
  605. type: GroupActivityType.SET_RESOLVED_IN_RELEASE,
  606. project: ProjectFixture(),
  607. data: {
  608. version: 'frontend@1.0.0',
  609. },
  610. user: UserFixture(),
  611. dateCreated,
  612. },
  613. ],
  614. });
  615. const activity = (await screen.findAllByTestId('activity-item')).at(-1);
  616. expect(activity).toHaveTextContent(
  617. 'Foo Bar marked this issue as resolved in 1.0.0 (semver)'
  618. );
  619. });
  620. it('renders resolved in next release with semver information', async function () {
  621. createWrapper({
  622. activity: [
  623. {
  624. id: '123',
  625. type: GroupActivityType.SET_RESOLVED_IN_RELEASE,
  626. project: ProjectFixture(),
  627. data: {
  628. current_release_version: 'frontend@1.0.0',
  629. },
  630. user: UserFixture(),
  631. dateCreated,
  632. },
  633. ],
  634. });
  635. const activity = (await screen.findAllByTestId('activity-item')).at(-1);
  636. expect(activity).toHaveTextContent(
  637. 'Foo Bar marked this issue as resolved in releases greater than 1.0.0 (semver)'
  638. );
  639. });
  640. describe('regression', function () {
  641. it('renders basic regression', async function () {
  642. createWrapper({
  643. activity: [
  644. {
  645. id: '123',
  646. type: GroupActivityType.SET_REGRESSION,
  647. project: ProjectFixture(),
  648. data: {},
  649. dateCreated,
  650. },
  651. ],
  652. });
  653. const activity = (await screen.findAllByTestId('activity-item')).at(-1);
  654. expect(activity).toHaveTextContent('Sentry marked this issue as a regression');
  655. });
  656. it('renders regression with version', async function () {
  657. createWrapper({
  658. activity: [
  659. {
  660. id: '123',
  661. type: GroupActivityType.SET_REGRESSION,
  662. project: ProjectFixture(),
  663. data: {
  664. version: 'frontend@1.0.0',
  665. },
  666. dateCreated,
  667. },
  668. ],
  669. });
  670. const activity = (await screen.findAllByTestId('activity-item')).at(-1);
  671. expect(activity).toHaveTextContent(
  672. 'Sentry marked this issue as a regression in 1.0.0'
  673. );
  674. });
  675. it('renders regression with semver description', async function () {
  676. createWrapper({
  677. activity: [
  678. {
  679. id: '123',
  680. type: GroupActivityType.SET_REGRESSION,
  681. project: ProjectFixture(),
  682. data: {
  683. version: 'frontend@2.0.0',
  684. resolved_in_version: 'frontend@1.0.0',
  685. follows_semver: true,
  686. },
  687. dateCreated,
  688. },
  689. ],
  690. });
  691. const activity = (await screen.findAllByTestId('activity-item')).at(-1);
  692. expect(activity).toHaveTextContent(
  693. 'Sentry marked this issue as a regression in 2.0.0'
  694. );
  695. expect(activity).toHaveTextContent(
  696. '2.0.0 is greater than or equal to 1.0.0 compared via semver'
  697. );
  698. });
  699. it('renders regression with non-semver description', async function () {
  700. createWrapper({
  701. activity: [
  702. {
  703. id: '123',
  704. type: GroupActivityType.SET_REGRESSION,
  705. project: ProjectFixture(),
  706. data: {
  707. version: 'frontend@abc1',
  708. resolved_in_version: 'frontend@abc2',
  709. follows_semver: false,
  710. },
  711. dateCreated,
  712. },
  713. ],
  714. });
  715. const activity = (await screen.findAllByTestId('activity-item')).at(-1);
  716. expect(activity).toHaveTextContent(
  717. 'Sentry marked this issue as a regression in abc1'
  718. );
  719. expect(activity).toHaveTextContent(
  720. 'abc1 is greater than or equal to abc2 compared via release date'
  721. );
  722. });
  723. it('renders a set priority activity for escalating issues', async function () {
  724. createWrapper({
  725. activity: [
  726. {
  727. id: '123',
  728. type: GroupActivityType.SET_PRIORITY,
  729. project: ProjectFixture(),
  730. data: {
  731. priority: PriorityLevel.HIGH,
  732. reason: 'escalating',
  733. },
  734. dateCreated,
  735. },
  736. ],
  737. });
  738. const activity = (await screen.findAllByTestId('activity-item')).at(-1);
  739. expect(activity).toHaveTextContent(
  740. 'Sentry updated the priority value of this issue to be high after it escalated'
  741. );
  742. });
  743. it('renders a set priority activity for ongoing issues', async function () {
  744. createWrapper({
  745. activity: [
  746. {
  747. id: '123',
  748. type: GroupActivityType.SET_PRIORITY,
  749. project: ProjectFixture(),
  750. data: {
  751. priority: PriorityLevel.LOW,
  752. reason: 'ongoing',
  753. },
  754. dateCreated,
  755. },
  756. ],
  757. });
  758. const activity = (await screen.findAllByTestId('activity-item')).at(-1);
  759. expect(activity).toHaveTextContent(
  760. 'Sentry updated the priority value of this issue to be low after it was marked as ongoing'
  761. );
  762. });
  763. it('renders a deleted attachment activity', async function () {
  764. createWrapper({
  765. activity: [
  766. {
  767. id: '123',
  768. type: GroupActivityType.DELETED_ATTACHMENT,
  769. project: ProjectFixture(),
  770. data: {},
  771. dateCreated,
  772. user: UserFixture(),
  773. },
  774. ],
  775. });
  776. const activity = (await screen.findAllByTestId('activity-item')).at(-1);
  777. expect(activity).toHaveTextContent('deleted an attachment');
  778. });
  779. });
  780. });