-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
feat(sentry-apps): Add disable/enable toggle to _admin sentry app details #114910
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Christinarlong
merged 9 commits into
master
from
Christinarlong/sentry-app-admin-disable
May 7, 2026
+102
−23
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
a15bf1d
feat(sentry-apps): Add disable/enable toggle to _admin sentry app det…
Christinarlong d7a1556
feat(sentry-apps): Add disable/enable toggle to _admin sentry app det…
Christinarlong dbe802f
fix(sentry-apps): Open dropdown before asserting on action items in t…
Christinarlong ed78853
fix(sentry-apps): Use role selector to click CompactSelect option in …
Christinarlong 5105110
fix(sentry-apps): Replace flaky confirm modal test with detail label …
Christinarlong 6a84de2
fix(sentry-apps): Match DetailLabel title with colon in test
Christinarlong 3681585
fix(sentry-apps): Address PR feedback - rename label, extract test he…
Christinarlong 3fd707f
fix(sentry-apps): Address PR feedback - rename label, extract test he…
Christinarlong ead4de9
fix(sentry-apps): Fix multiple 'no' elements in disabled app test
Christinarlong File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,39 +1,102 @@ | ||
| import {SentryAppFixture} from 'sentry-fixture/sentryApp'; | ||
|
|
||
| import {render, screen} from 'sentry-test/reactTestingLibrary'; | ||
| import { | ||
| render, | ||
| renderGlobalModal, | ||
| screen, | ||
| userEvent, | ||
| waitFor, | ||
| } from 'sentry-test/reactTestingLibrary'; | ||
|
|
||
| import {SentryAppDetails} from 'admin/views/sentryAppDetails'; | ||
|
|
||
| function renderSentryAppDetails(overrides: Record<string, any> = {}) { | ||
| const sentryApp = { | ||
| ...SentryAppFixture({slug: 'test-app', status: 'unpublished'}), | ||
| owner: {slug: 'test-org'}, | ||
| isDisabled: false, | ||
| ...overrides, | ||
| }; | ||
|
|
||
| MockApiClient.addMockResponse({ | ||
| url: `/sentry-apps/${sentryApp.slug}/`, | ||
| method: 'GET', | ||
| body: sentryApp, | ||
| }); | ||
|
|
||
| render(<SentryAppDetails />, { | ||
| initialRouterConfig: { | ||
| location: {pathname: `/_admin/sentry-apps/${sentryApp.slug}/`}, | ||
| route: '/_admin/sentry-apps/:sentryAppSlug/', | ||
| }, | ||
| }); | ||
|
|
||
| return sentryApp; | ||
| } | ||
|
|
||
| describe('SentryAppDetails', () => { | ||
| beforeEach(() => { | ||
| MockApiClient.clearMockResponses(); | ||
| }); | ||
|
|
||
| it('renders an unpublished app without crashing', async () => { | ||
| const sentryApp = { | ||
| ...SentryAppFixture({ | ||
| slug: 'cursor-staging', | ||
| status: 'unpublished', | ||
| }), | ||
| owner: {slug: 'cursor'}, | ||
| }; | ||
|
|
||
| MockApiClient.addMockResponse({ | ||
| renderSentryAppDetails(); | ||
|
|
||
| expect(await screen.findByRole('heading', {name: 'Sentry Apps'})).toBeInTheDocument(); | ||
| expect(screen.getAllByText('unpublished')).not.toHaveLength(0); | ||
| }); | ||
|
|
||
| it('shows disable action for a non-disabled app', async () => { | ||
| renderSentryAppDetails({isDisabled: false}); | ||
|
|
||
| await userEvent.click(await screen.findByTestId('detail-actions')); | ||
| expect(await screen.findByText('Disable App')).toBeInTheDocument(); | ||
| expect(screen.queryByText('disabled')).not.toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it('shows enable action and disabled badge for a disabled app', async () => { | ||
| renderSentryAppDetails({isDisabled: true}); | ||
|
|
||
| expect(await screen.findByText('disabled')).toBeInTheDocument(); | ||
| await userEvent.click(screen.getByTestId('detail-actions')); | ||
| expect(await screen.findByText('Enable App')).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it('shows Enabled: yes for a non-disabled app', async () => { | ||
| renderSentryAppDetails({isDisabled: false}); | ||
|
|
||
| expect(await screen.findByText('Enabled:')).toBeInTheDocument(); | ||
| expect(screen.getByText('yes')).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it('shows Enabled: no for a disabled app', async () => { | ||
| renderSentryAppDetails({isDisabled: true}); | ||
|
|
||
| expect(await screen.findByText('Enabled:')).toBeInTheDocument(); | ||
| expect(screen.getAllByText('no')).toHaveLength(2); | ||
| }); | ||
|
|
||
| it('sends PUT with isDisabled when disable action is confirmed', async () => { | ||
| const sentryApp = renderSentryAppDetails({isDisabled: false}); | ||
| renderGlobalModal(); | ||
|
|
||
| const putMock = MockApiClient.addMockResponse({ | ||
| url: `/sentry-apps/${sentryApp.slug}/`, | ||
| method: 'GET', | ||
| body: sentryApp, | ||
| method: 'PUT', | ||
| body: {...sentryApp, isDisabled: true}, | ||
| }); | ||
|
|
||
| render(<SentryAppDetails />, { | ||
| initialRouterConfig: { | ||
| location: { | ||
| pathname: `/_admin/sentry-apps/${sentryApp.slug}/`, | ||
| }, | ||
| route: '/_admin/sentry-apps/:sentryAppSlug/', | ||
| }, | ||
| await userEvent.click(await screen.findByTestId('detail-actions')); | ||
| await userEvent.click(await screen.findByRole('option', {name: /Disable App/})); | ||
| await userEvent.click(await screen.findByRole('button', {name: 'Confirm'})); | ||
|
|
||
| await waitFor(() => { | ||
| expect(putMock).toHaveBeenCalledWith( | ||
| expect.anything(), | ||
| expect.objectContaining({data: {isDisabled: true}}) | ||
| ); | ||
| }); | ||
|
|
||
| expect(await screen.findByRole('heading', {name: 'Sentry Apps'})).toBeInTheDocument(); | ||
| expect(screen.getAllByText('unpublished')).not.toHaveLength(0); | ||
| expect(await screen.findByText('disabled')).toBeInTheDocument(); | ||
| }); | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.