Repository navigation
feat(automations): add config list page with API wiring and mock data #128707
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
+1,990
−1,398
Merged
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
b190242
feat(seer): Add Automations and Runs tabs to the Automations page
aliu39 61dac97
test(seer): Cover Automations page tabs and runs route
aliu39 13a5c27
feat(seer): Add placeholder automation cards to the Automations tab
aliu39 3d4bdef
ref(seer): Use small tabs and bold the active tab on the Automations …
aliu39 a14c4f5
feat(automations): Populate automation cards from workflow configs
aliu39 04296f7
ref(automations): Show sample projects on the Breached Metrics placeh…
aliu39 d91f280
ref(automations): List project slugs next to the project avatars
aliu39 11c1114
ref(automations): Adjust automation card spacing
aliu39 146f1ed
rename index components
aliu39 8bc6dc8
ref(automations): Make automation cards non-links and label the next-…
aliu39 b5334f5
ref(automations): Add Sentry icon after automation card titles
aliu39 747c5b0
test(automations): Cover the automation config list and next run times
aliu39 5423a78
Update index.spec.tsx
aliu39 ccb48d2
chore(codeowners): Assign owners for Seer workflows
aliu39 73b3cc7
Merge branch 'aliu/auto-ui0.2' of github.com:getsentry/sentry into al…
aliu39 090316a
test(automations): Flush pending timers in the runs spec teardown
aliu39 f75ff25
:hammer_and_wrench: apply pre-commit fixes
getsantry[bot] cf2c1b3
Merge branch 'aliu/auto-ui0.2' of github.com:getsentry/sentry into al…
aliu39 098afef
test(automations): Remove resolved runs spec suppression
aliu39 e8e921a
feat(automations): Show a Paused tag on disabled automation cards
aliu39 d574554
feat(automations): Highlight automation cards on hover
aliu39 7c98629
Merge branch 'master' into aliu/auto-ui0.2
aliu39 f5f95e5
rename dir
aliu39 3c4e647
fix import
aliu39 70431f4
Update index.spec.tsx
aliu39 45c77ba
Change AutomationsList to default export
aliu39 1a695af
feat(seer): Limit project slugs shown on automation cards
aliu39 2f126c9
Merge branch 'aliu/auto-ui0.2' of github.com:getsentry/sentry into al…
aliu39 f762374
ref(seer): Group usage line with automation card details
aliu39 1fd6f48
ref(automations): Pass a config to automation cards
aliu39 5f5b3e7
fix(seer-workflows): Translate run source labels
aliu39 7076a4a
Update index.tsx
aliu39 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
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
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
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
166 changes: 166 additions & 0 deletions
166
static/app/views/seerWorkflows/automations/index.spec.tsx
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 |
|---|---|---|
| @@ -0,0 +1,166 @@ | ||
| import {OrganizationFixture} from 'sentry-fixture/organization'; | ||
| import {ProjectFixture} from 'sentry-fixture/project'; | ||
|
|
||
| import {render, screen, within} from 'sentry-test/reactTestingLibrary'; | ||
|
|
||
| import {ProjectsStore} from 'sentry/stores/projectsStore'; | ||
| import AutomationsList, {getNextUpdate} from 'sentry/views/seerWorkflows/automations'; | ||
| import type {SeerWorkflowConfigsResponse} from 'sentry/views/seerWorkflows/types'; | ||
|
|
||
| type Config = SeerWorkflowConfigsResponse['configs'][number]; | ||
|
|
||
| function makeConfig(overrides: Partial<Config>): Config { | ||
| return { | ||
| id: '1', | ||
| strategy: 'custom_strategy', | ||
| enabled: true, | ||
| schedule: 'weekly', | ||
| version: 1, | ||
| projects: [], | ||
| environments: [], | ||
| filters: {}, | ||
| outputPolicy: {}, | ||
| seededDefault: null, | ||
| dateAdded: '2026-10-01T00:00:00Z', | ||
| dateUpdated: '2026-10-01T00:00:00Z', | ||
| ...overrides, | ||
| }; | ||
| } | ||
|
|
||
| function getCard(title: string) { | ||
| return within(screen.getByRole('heading', {name: title}).closest('li')!); | ||
| } | ||
|
|
||
| describe('AutomationsList', () => { | ||
| const organization = OrganizationFixture({features: ['seer-automations']}); | ||
| const configsUrl = `/organizations/${organization.slug}/seer/workflows/configs/`; | ||
|
|
||
| beforeEach(() => { | ||
| MockApiClient.clearMockResponses(); | ||
| MockApiClient.addMockResponse({ | ||
| url: `/organizations/${organization.slug}/projects/`, | ||
| body: [], | ||
| }); | ||
| ProjectsStore.loadInitialData([ | ||
| ProjectFixture({id: '1', slug: 'frontend'}), | ||
| ProjectFixture({id: '2', slug: 'backend'}), | ||
| ]); | ||
| }); | ||
|
|
||
| function mockConfigs(configs: Config[]) { | ||
| return MockApiClient.addMockResponse({url: configsUrl, body: {configs}}); | ||
| } | ||
|
|
||
| it('only renders placeholders without seer-automations', async () => { | ||
| const request = mockConfigs([makeConfig({id: '1'})]); | ||
|
|
||
| render(<AutomationsList />, {organization: OrganizationFixture()}); | ||
|
|
||
| expect(await screen.findAllByRole('listitem')).toHaveLength(2); | ||
| expect(request).not.toHaveBeenCalled(); | ||
| }); | ||
|
|
||
| it('renders a card per config after the placeholders', async () => { | ||
| mockConfigs([ | ||
| makeConfig({id: '1', strategy: 'agentic_triage'}), | ||
| makeConfig({id: '2', strategy: 'custom_strategy'}), | ||
| ]); | ||
|
|
||
| render(<AutomationsList />, {organization}); | ||
|
|
||
| expect( | ||
| await screen.findByRole('heading', {name: 'Agentic triage'}) | ||
| ).toBeInTheDocument(); | ||
| expect(screen.getAllByRole('listitem')).toHaveLength(4); | ||
| expect( | ||
| getCard('Agentic triage').getByText( | ||
| 'Automatically triage and fix the most fixable Issues' | ||
| ) | ||
| ).toBeInTheDocument(); | ||
| expect(getCard('custom_strategy').getByText('No description')).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it('shows which projects each config covers', async () => { | ||
| mockConfigs([ | ||
| makeConfig({id: '1', strategy: 'all_strategy', projects: [-1]}), | ||
| makeConfig({id: '2', strategy: 'none_strategy', projects: []}), | ||
| makeConfig({id: '3', strategy: 'some_strategy', projects: [2, 99, 1]}), | ||
| ]); | ||
|
|
||
| render(<AutomationsList />, {organization}); | ||
|
|
||
| await screen.findByRole('heading', {name: 'some_strategy'}); | ||
| expect(getCard('all_strategy').getByText('All projects')).toBeInTheDocument(); | ||
| expect(getCard('none_strategy').getByText('No projects')).toBeInTheDocument(); | ||
| expect(getCard('some_strategy').getByText('backend, frontend')).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it('shows a next run tag only for daily configs', async () => { | ||
| mockConfigs([ | ||
| makeConfig({id: '1', strategy: 'daily_strategy', schedule: 'daily'}), | ||
| makeConfig({id: '2', strategy: 'weekly_strategy', schedule: 'weekly'}), | ||
| ]); | ||
|
|
||
| render(<AutomationsList />, {organization}); | ||
|
|
||
| await screen.findByRole('heading', {name: 'daily_strategy'}); | ||
| expect(getCard('daily_strategy').getByText(/Next run/)).toBeInTheDocument(); | ||
| expect(getCard('weekly_strategy').queryByText(/Next run/)).not.toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it('shows a paused tag in place of the schedule for disabled configs', async () => { | ||
| mockConfigs([ | ||
| makeConfig({ | ||
| id: '1', | ||
| strategy: 'paused_strategy', | ||
| schedule: 'daily', | ||
| enabled: false, | ||
| }), | ||
| ]); | ||
|
|
||
| render(<AutomationsList />, {organization}); | ||
|
|
||
| await screen.findByRole('heading', {name: 'paused_strategy'}); | ||
| expect(getCard('paused_strategy').getByText('Paused')).toBeInTheDocument(); | ||
| expect(getCard('paused_strategy').queryByText(/Next run/)).not.toBeInTheDocument(); | ||
| }); | ||
| }); | ||
|
|
||
| describe('getNextUpdate', () => { | ||
| afterEach(() => { | ||
| try { | ||
| jest.runOnlyPendingTimers(); | ||
| } finally { | ||
| jest.useRealTimers(); | ||
| } | ||
| }); | ||
|
|
||
| it('returns undefined for schedules other than daily', () => { | ||
| jest.useFakeTimers({now: new Date('2026-10-23T09:00:00Z')}); | ||
|
|
||
| expect(getNextUpdate('weekly')).toBeUndefined(); | ||
| expect(getNextUpdate('')).toBeUndefined(); | ||
| }); | ||
|
|
||
| it.each([ | ||
| ['before 10:00', '2026-10-23T09:59:59Z', '2026-10-23T10:00:00.000Z'], | ||
| ['at 10:00', '2026-10-23T10:00:00Z', '2026-10-23T22:00:00.000Z'], | ||
| ['between 10:00 and 22:00', '2026-10-23T15:30:00Z', '2026-10-23T22:00:00.000Z'], | ||
| ['at 22:00', '2026-10-23T22:00:00Z', '2026-10-24T10:00:00.000Z'], | ||
| ['after 22:00', '2026-10-23T23:15:00Z', '2026-10-24T10:00:00.000Z'], | ||
| [ | ||
| 'after 22:00 at the end of a month', | ||
| '2026-10-31T23:00:00Z', | ||
| '2026-11-01T10:00:00.000Z', | ||
| ], | ||
| [ | ||
| 'after 22:00 at the end of a year', | ||
| '2026-12-31T23:00:00Z', | ||
| '2027-01-01T10:00:00.000Z', | ||
| ], | ||
| ])('picks the next daily run %s UTC', (_, now, expected) => { | ||
| jest.useFakeTimers({now: new Date(now)}); | ||
|
|
||
| expect(getNextUpdate('daily')?.toISOString()).toBe(expected); | ||
| }); | ||
| }); |
Oops, something went wrong.
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.