aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorJeremy Davis <jeremy.davis@sonarsource.com>2023-11-09 17:08:57 +0100
committersonartech <sonartech@sonarsource.com>2023-11-10 20:02:51 +0000
commitfa13c63645bfb1d3a29ed70c2066d2b1076b6631 (patch)
tree56353de99c0433b04e7ede939a75308909b88e38 /server
parentb4d68399cc5a23e8a2d2422c349011d18eef886e (diff)
downloadsonarqube-fa13c63645bfb1d3a29ed70c2066d2b1076b6631.tar.gz
sonarqube-fa13c63645bfb1d3a29ed70c2066d2b1076b6631.zip
SONAR-20998 Improve performance of Code-it
Diffstat (limited to 'server')
-rw-r--r--server/sonar-web/src/main/js/apps/code/__tests__/Code-it.ts18
-rw-r--r--server/sonar-web/src/main/js/apps/code/components/Component.tsx2
2 files changed, 17 insertions, 3 deletions
diff --git a/server/sonar-web/src/main/js/apps/code/__tests__/Code-it.ts b/server/sonar-web/src/main/js/apps/code/__tests__/Code-it.ts
index b432a72abf0..f0f92a72982 100644
--- a/server/sonar-web/src/main/js/apps/code/__tests__/Code-it.ts
+++ b/server/sonar-web/src/main/js/apps/code/__tests__/Code-it.ts
@@ -28,7 +28,7 @@ import { isDiffMetric } from '../../../helpers/measures';
import { mockComponent } from '../../../helpers/mocks/component';
import { mockMeasure } from '../../../helpers/testMocks';
import { renderAppWithComponentContext } from '../../../helpers/testReactTestingUtils';
-import { ReactTestingQuery, byRole, byText } from '../../../helpers/testSelector';
+import { ReactTestingQuery, byLabelText, byRole, byText } from '../../../helpers/testSelector';
import { ComponentQualifier } from '../../../types/component';
import { MetricKey } from '../../../types/metrics';
import { Component } from '../../../types/types';
@@ -44,6 +44,20 @@ jest.mock('../../../components/SourceViewer/helpers/lines', () => {
};
});
+jest.mock('../../../api/branches', () => ({
+ deleteBranch: jest.fn(),
+ deletePullRequest: jest.fn(),
+ excludeBranchFromPurge: jest.fn(),
+ getBranches: jest.fn(),
+ getPullRequests: jest.fn(),
+ renameBranch: jest.fn(),
+ setMainBranch: jest.fn(),
+}));
+
+jest.mock('../../../api/quality-gates', () => ({
+ getQualityGateProjectStatus: jest.fn(),
+}));
+
const DEFAULT_LINES_LOADED = 19;
const originalScrollTo = window.scrollTo;
@@ -385,7 +399,7 @@ function getPageObject(user: UserEvent) {
showingOutOfTxt: (x: number, y: number) => byText(`x_of_y_shown.${x}.${y}`),
newCodeBtn: byRole('radio', { name: 'projects.view.new_code' }),
overallCodeBtn: byRole('radio', { name: 'projects.view.overall_code' }),
- measureRow: (name: string | RegExp) => byRole('row', { name, exact: false }),
+ measureRow: (name: string | RegExp) => byLabelText(name),
measureValueCell: (row: ReactTestingQuery, name: string, value: string) => {
const i = Array.from(screen.getAllByRole('columnheader')).findIndex(
(c) => c.textContent?.includes(name),
diff --git a/server/sonar-web/src/main/js/apps/code/components/Component.tsx b/server/sonar-web/src/main/js/apps/code/components/Component.tsx
index 580a2a58ae4..7a7366244aa 100644
--- a/server/sonar-web/src/main/js/apps/code/components/Component.tsx
+++ b/server/sonar-web/src/main/js/apps/code/components/Component.tsx
@@ -62,7 +62,7 @@ export default function Component(props: Props) {
component.qualifier === ComponentQualifier.TestFile;
return (
- <TableRowInteractive selected={selected}>
+ <TableRowInteractive selected={selected} aria-label={component.name}>
{canBePinned && (
<ContentCell className="sw-py-3">
{isFile && (