|
1 | 1 | import {GroupFixture} from 'sentry-fixture/group'; |
| 2 | +import {OrganizationFixture} from 'sentry-fixture/organization'; |
2 | 3 | import {ProjectFixture} from 'sentry-fixture/project'; |
3 | 4 |
|
4 | 5 | import {initializeOrg} from 'sentry-test/initializeOrg'; |
5 | | -import {act, render, screen, userEvent} from 'sentry-test/reactTestingLibrary'; |
| 6 | +import {act, render, screen, userEvent, within} from 'sentry-test/reactTestingLibrary'; |
6 | 7 |
|
7 | 8 | import StreamGroup from 'sentry/components/stream/group'; |
8 | 9 | import GroupStore from 'sentry/stores/groupStore'; |
9 | 10 | import GuideStore from 'sentry/stores/guideStore'; |
10 | 11 | import type {GroupStatusResolution, MarkReviewed} from 'sentry/types'; |
11 | | -import {EventOrGroupType, GroupStatus} from 'sentry/types'; |
| 12 | +import {EventOrGroupType, GroupStatus, PriorityLevel} from 'sentry/types'; |
12 | 13 | import {trackAnalytics} from 'sentry/utils/analytics'; |
13 | 14 |
|
14 | 15 | jest.mock('sentry/utils/analytics'); |
@@ -89,6 +90,32 @@ describe('StreamGroup', function () { |
89 | 90 | expect(screen.getByTestId('resolved-issue')).toBeInTheDocument(); |
90 | 91 | }); |
91 | 92 |
|
| 93 | + it('can change priority', async function () { |
| 94 | + const mockModifyGroup = MockApiClient.addMockResponse({ |
| 95 | + url: '/projects/org-slug/foo-project/issues/', |
| 96 | + method: 'PUT', |
| 97 | + body: {priority: PriorityLevel.HIGH}, |
| 98 | + }); |
| 99 | + |
| 100 | + render(<StreamGroup id="1337" query="is:unresolved" />, { |
| 101 | + organization: OrganizationFixture({features: ['issue-priority-ui']}), |
| 102 | + }); |
| 103 | + |
| 104 | + const priorityDropdown = screen.getByRole('button', {name: 'Modify issue priority'}); |
| 105 | + expect(within(priorityDropdown).getByText('Medium')).toBeInTheDocument(); |
| 106 | + await userEvent.click(priorityDropdown); |
| 107 | + await userEvent.click(screen.getByRole('menuitemradio', {name: 'High'})); |
| 108 | + expect(within(priorityDropdown).getByText('High')).toBeInTheDocument(); |
| 109 | + expect(mockModifyGroup).toHaveBeenCalledWith( |
| 110 | + '/projects/org-slug/foo-project/issues/', |
| 111 | + expect.objectContaining({ |
| 112 | + data: expect.objectContaining({ |
| 113 | + priority: 'high', |
| 114 | + }), |
| 115 | + }) |
| 116 | + ); |
| 117 | + }); |
| 118 | + |
92 | 119 | it('tracks clicks from issues stream', async function () { |
93 | 120 | const {routerContext, organization} = initializeOrg(); |
94 | 121 | render( |
|
0 commit comments