diff options
author | Revanshu Paliwal <revanshu.paliwal@sonarsource.com> | 2024-09-06 15:12:08 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2024-09-24 20:03:05 +0000 |
commit | fa0ab44c86980c6ae26bb6e0832f1db02161fa58 (patch) | |
tree | 0ab48baceff408f0cb5606f44404180b818f6934 /server/sonar-web/src/main/js/apps/issues | |
parent | 502956b75fa6797e1a82d0d8ddb192e50683e92d (diff) | |
download | sonarqube-fa0ab44c86980c6ae26bb6e0832f1db02161fa58.tar.gz sonarqube-fa0ab44c86980c6ae26bb6e0832f1db02161fa58.zip |
CODEFIX-32 Creating admin section for code fix suggestions
Diffstat (limited to 'server/sonar-web/src/main/js/apps/issues')
-rw-r--r-- | server/sonar-web/src/main/js/apps/issues/__tests__/IssueApp-it.tsx | 12 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/apps/issues/test-utils.tsx | 2 |
2 files changed, 7 insertions, 7 deletions
diff --git a/server/sonar-web/src/main/js/apps/issues/__tests__/IssueApp-it.tsx b/server/sonar-web/src/main/js/apps/issues/__tests__/IssueApp-it.tsx index 4082b39f2a3..292d906e2e1 100644 --- a/server/sonar-web/src/main/js/apps/issues/__tests__/IssueApp-it.tsx +++ b/server/sonar-web/src/main/js/apps/issues/__tests__/IssueApp-it.tsx @@ -34,6 +34,7 @@ import { issuesHandler, renderIssueApp, renderProjectIssuesApp, + settingsHandler, sourcesHandler, ui, usersHandler, @@ -68,6 +69,7 @@ beforeEach(() => { componentsHandler.reset(); branchHandler.reset(); usersHandler.reset(); + settingsHandler.reset(); usersHandler.users = [mockLoggedInUser() as unknown as RestUserDetailed]; window.scrollTo = jest.fn(); window.HTMLElement.prototype.scrollTo = jest.fn(); @@ -83,6 +85,7 @@ describe('issue app', () => { }); it('should be able to trigger a fix when feature is available', async () => { + settingsHandler.set('sonar.ai.suggestions.enabled', 'true'); sourcesHandler.setSource( range(0, 20) .map((n) => `line: ${n}`) @@ -96,7 +99,7 @@ describe('issue app', () => { [Feature.BranchSupport, Feature.FixSuggestions], ); - expect(await ui.getFixSuggestion.find(undefined, { timeout: 5000 })).toBeInTheDocument(); + expect(await ui.getFixSuggestion.find(undefined, { timeout: 4000 })).toBeInTheDocument(); await user.click(ui.getFixSuggestion.get()); expect(await ui.suggestedExplanation.find()).toBeInTheDocument(); @@ -131,6 +134,7 @@ describe('issue app', () => { }); it('should show error when no fix is available', async () => { + settingsHandler.set('sonar.ai.suggestions.enabled', 'true'); const user = userEvent.setup(); renderProjectIssuesApp( `project/issues?issueStatuses=CONFIRMED&open=${ISSUE_101}&id=myproject`, @@ -233,8 +237,6 @@ describe('issue app', () => { await screen.findByRole('tab', { name: 'coding_rules.description_section.title.root_cause' }), ); - await user.click(screen.getByRole('radio', { name: 'coding_rules.description_context.other' })); - expect(await screen.findByRole('heading', { name: 'CVE-2021-12345' })).toBeInTheDocument(); const rows = byRole('row').getAll(ui.cveTable.get()); @@ -259,10 +261,6 @@ describe('issue app', () => { await screen.findByRole('tab', { name: 'coding_rules.description_section.title.root_cause' }), ); - await user.click( - await screen.findByRole('radio', { name: 'coding_rules.description_context.other' }), - ); - expect(await screen.findByRole('heading', { name: 'CVE-2021-12345' })).toBeInTheDocument(); const rows = byRole('row').getAll(ui.cveTable.get()); diff --git a/server/sonar-web/src/main/js/apps/issues/test-utils.tsx b/server/sonar-web/src/main/js/apps/issues/test-utils.tsx index aca69041755..434746fb0da 100644 --- a/server/sonar-web/src/main/js/apps/issues/test-utils.tsx +++ b/server/sonar-web/src/main/js/apps/issues/test-utils.tsx @@ -26,6 +26,7 @@ import ComponentsServiceMock from '../../api/mocks/ComponentsServiceMock'; import CveServiceMock from '../../api/mocks/CveServiceMock'; import FixIssueServiceMock from '../../api/mocks/FixIssueServiceMock'; import IssuesServiceMock from '../../api/mocks/IssuesServiceMock'; +import SettingsServiceMock from '../../api/mocks/SettingsServiceMock'; import SourcesServiceMock from '../../api/mocks/SourcesServiceMock'; import UsersServiceMock from '../../api/mocks/UsersServiceMock'; import { mockComponent } from '../../helpers/mocks/component'; @@ -49,6 +50,7 @@ export const componentsHandler = new ComponentsServiceMock(); export const sourcesHandler = new SourcesServiceMock(); export const branchHandler = new BranchesServiceMock(); export const fixIssueHanlder = new FixIssueServiceMock(); +export const settingsHandler = new SettingsServiceMock(); export const ui = { loading: byText('issues.loading_issues'), |