streamlinedHeader.spec.tsx 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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 {TeamFixture} from 'sentry-fixture/team';
  6. import {UserFixture} from 'sentry-fixture/user';
  7. import {render, screen} from 'sentry-test/reactTestingLibrary';
  8. import {textWithMarkupMatcher} from 'sentry-test/utils';
  9. import type {TeamParticipant, UserParticipant} from 'sentry/types';
  10. import {IssueCategory} from 'sentry/types';
  11. import StreamlinedGroupHeader from 'sentry/views/issueDetails/streamlinedHeader';
  12. import {ReprocessingStatus} from 'sentry/views/issueDetails/utils';
  13. describe('UpdatedGroupHeader', () => {
  14. const baseUrl = 'BASE_URL/';
  15. const organization = OrganizationFixture({features: ['issue-details-streamline']});
  16. const project = ProjectFixture({
  17. platform: 'javascript',
  18. teams: [TeamFixture()],
  19. });
  20. const group = GroupFixture({issueCategory: IssueCategory.ERROR, isUnhandled: true});
  21. describe('JS Project Error Issue', () => {
  22. const defaultProps = {
  23. organization,
  24. baseUrl,
  25. groupReprocessingStatus: ReprocessingStatus.NO_STATUS,
  26. project,
  27. };
  28. const release = ReleaseFixture();
  29. beforeEach(() => {
  30. MockApiClient.addMockResponse({
  31. url: `/organizations/${organization.slug}/issues/${group.id}/first-last-release/`,
  32. method: 'GET',
  33. body: {firstRelease: release, lastRelease: release},
  34. });
  35. MockApiClient.addMockResponse({
  36. url: '/organizations/org-slug/replay-count/',
  37. body: {},
  38. });
  39. MockApiClient.addMockResponse({
  40. url: `/organizations/org-slug/repos/`,
  41. body: {},
  42. });
  43. MockApiClient.addMockResponse({
  44. url: `/projects/org-slug/project-slug/releases/${encodeURIComponent(release.version)}/`,
  45. body: {},
  46. });
  47. MockApiClient.addMockResponse({
  48. url: `/organizations/org-slug/releases/${encodeURIComponent(release.version)}/deploys/`,
  49. body: {},
  50. });
  51. });
  52. it('shows all elements of header', async () => {
  53. const teams: TeamParticipant[] = [{...TeamFixture(), type: 'team'}];
  54. const users: UserParticipant[] = [
  55. {
  56. ...UserFixture({
  57. id: '2',
  58. name: 'John Smith',
  59. email: 'johnsmith@example.com',
  60. }),
  61. type: 'user',
  62. },
  63. {
  64. ...UserFixture({
  65. id: '3',
  66. name: 'Sohn Jmith',
  67. email: 'sohnjmith@example.com',
  68. }),
  69. type: 'user',
  70. },
  71. ];
  72. const participantGroup = {
  73. ...group,
  74. participants: [...teams, ...users],
  75. seenBy: users,
  76. };
  77. render(
  78. <StreamlinedGroupHeader
  79. {...defaultProps}
  80. group={participantGroup}
  81. project={project}
  82. />,
  83. {
  84. organization,
  85. }
  86. );
  87. expect(await screen.findByText('RequestError')).toBeInTheDocument();
  88. expect(await screen.findByText('Warning')).toBeInTheDocument();
  89. expect(await screen.findByText('Unhandled')).toBeInTheDocument();
  90. expect(
  91. await screen.findByText(textWithMarkupMatcher('Releases'))
  92. ).toBeInTheDocument();
  93. expect(
  94. await screen.findByRole('button', {name: 'Modify issue priority'})
  95. ).toBeInTheDocument();
  96. expect(
  97. await screen.findByRole('button', {name: 'Modify issue assignee'})
  98. ).toBeInTheDocument();
  99. expect(await screen.findByText('Participants')).toBeInTheDocument();
  100. expect(await screen.findByText('Viewers')).toBeInTheDocument();
  101. expect(await screen.findByRole('button', {name: 'Resolve'})).toBeInTheDocument();
  102. expect(await screen.findByRole('button', {name: 'Archive'})).toBeInTheDocument();
  103. });
  104. });
  105. });