streamlinedHeader.spec.tsx 3.2 KB

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