aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmbroise C <ambroise.christea@sonarsource.com>2024-05-29 15:46:44 +0200
committersonartech <sonartech@sonarsource.com>2024-05-31 20:03:50 +0000
commitc3468f865c135bf4a3df6b2a60919001c2f2e16b (patch)
tree893d65904eff658420ca2da62940c60dc4238f4d
parent75ef118f283cc6611ef4b55a654de97153322777 (diff)
downloadsonarqube-branch-10.5.tar.gz
sonarqube-branch-10.5.zip
SONAR-21218 Split QualityGate test to reduce runtimebranch-10.5
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/components/__tests__/QualityGate-it.tsx24
1 files changed, 23 insertions, 1 deletions
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/__tests__/QualityGate-it.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/__tests__/QualityGate-it.tsx
index a1fac39603b..7d70454a91c 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/components/__tests__/QualityGate-it.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-gates/components/__tests__/QualityGate-it.tsx
@@ -200,7 +200,7 @@ it('should be able to set as default a quality gate which is CaYC compliant', as
expect(await screen.findByRole('button', { name: /Sonar way default/ })).toBeInTheDocument();
});
-it('should be able to add a condition', async () => {
+it('should be able to add a condition on new code', async () => {
const user = userEvent.setup();
qualityGateHandler.setIsAdmin(true);
renderQualityGateApp();
@@ -223,10 +223,20 @@ it('should be able to add a condition', async () => {
const newConditions = byTestId('quality-gates__conditions-new');
expect(await newConditions.byRole('cell', { name: 'Issues' }).find()).toBeInTheDocument();
expect(await newConditions.byRole('cell', { name: '12' }).find()).toBeInTheDocument();
+});
+
+it('should be able to add a condition on overall code', async () => {
+ const user = userEvent.setup();
+ qualityGateHandler.setIsAdmin(true);
+ renderQualityGateApp();
+
+ await user.click(await screen.findByText('SonarSource way - CFamily'));
// On overall code
await user.click(await screen.findByText('quality_gates.add_condition'));
+ const dialog = byRole('dialog');
+
await selectEvent.select(dialog.byRole('combobox').get(), ['Info Issues']);
await user.click(dialog.byRole('radio', { name: 'quality_gates.conditions.overall_code' }).get());
await user.click(dialog.byLabelText('quality_gates.conditions.operator').get());
@@ -242,16 +252,28 @@ it('should be able to add a condition', async () => {
await overallConditions.byRole('cell', { name: 'Info Issues' }).find(),
).toBeInTheDocument();
expect(await overallConditions.byRole('cell', { name: '42' }).find()).toBeInTheDocument();
+});
+
+it('should be able to select a rating', async () => {
+ const user = userEvent.setup();
+ qualityGateHandler.setIsAdmin(true);
+ renderQualityGateApp();
+
+ await user.click(await screen.findByText('SonarSource way - CFamily'));
// Select a rating
await user.click(await screen.findByText('quality_gates.add_condition'));
+ const dialog = byRole('dialog');
+
await user.click(dialog.byRole('radio', { name: 'quality_gates.conditions.overall_code' }).get());
await selectEvent.select(dialog.byRole('combobox').get(), ['Maintainability Rating']);
await user.click(dialog.byLabelText('quality_gates.conditions.value').get());
await user.click(dialog.byText('B').get());
await user.click(dialog.byRole('button', { name: 'quality_gates.add_condition' }).get());
+ const overallConditions = byTestId('quality-gates__conditions-overall');
+
expect(
await overallConditions.byRole('cell', { name: 'Maintainability Rating' }).find(),
).toBeInTheDocument();