await user.click(ui.activateButton.get());
await user.click(ui.prioritizedSwitch.get());
- await user.click(ui.mqrSwitch.get());
await user.click(ui.newSeveritySelect(SoftwareQuality.Maintainability).get());
await user.click(byRole('option', { name: 'severity_impact.LOW' }).get());
await user.click(ui.activateButton.get(ui.activateQPDialog.get()));
await user.click(ui.changeButton('QP FooBaz').get());
await user.clear(ui.paramInput('1').get());
await user.type(ui.paramInput('1').get(), 'New');
- await user.click(ui.mqrSwitch.get());
await user.click(ui.newSeveritySelect(SoftwareQuality.Maintainability).get());
await user.click(byRole('option', { name: 'severity_impact.BLOCKER' }).get());
await user.click(ui.saveButton.get(ui.changeQPDialog.get()));
);
await user.click(ui.changeButton('QP Bar').get());
- await user.click(ui.mqrSwitch.get());
await user.click(ui.newSeveritySelect(SoftwareQuality.Reliability).get());
await user.click(
byRole('option', { name: /coding_rules.custom_severity.severity_with_recommended/ }).get(),
});
describe('old severity', () => {
+ beforeEach(() => {
+ settingsHandler.set(SettingsKey.MQRMode, 'false');
+ });
+
it('can activate/change/deactivate specific rule for quality profile', async () => {
const { ui, user } = getPageObjects();
rulesHandler.setIsAdmin();
// Activate Rule for qp
await user.click(ui.activateButton.getAll()[1]);
- await user.click(ui.mqrSwitch.get(ui.activateQPDialog.get()));
-
expect(ui.newSeveritySelect(SoftwareQuality.Maintainability).get()).toHaveValue(
'coding_rules.custom_severity.severity_with_recommended.severity_impact.MEDIUM',
);
expect(ui.deactivateButton.getAll()).toHaveLength(1);
await user.click(ui.changeButton('QP Bar').get());
- expect(ui.oldSeveritySelect.get(ui.changeQPDialog.get())).toHaveValue('severity.MINOR');
- expect(ui.notRecommendedSeverity.get()).toBeInTheDocument();
- expect(ui.notRecommendedSeverity.get()).toHaveTextContent('severity.MAJOR');
- await user.click(ui.mqrSwitch.get());
expect(ui.newSeveritySelect(SoftwareQuality.Maintainability).get()).toHaveValue(
'severity_impact.LOW',
// Check that new severity is saved
await user.click(ui.changeButton('QP Bar').get());
- await user.click(ui.mqrSwitch.get());
- expect(ui.oldSeveritySelect.get(ui.changeQPDialog.get())).toHaveValue('severity.MINOR');
- expect(ui.notRecommendedSeverity.get()).toBeInTheDocument();
- expect(ui.notRecommendedSeverity.get()).toHaveTextContent('severity.MAJOR');
- await user.click(ui.mqrSwitch.get());
expect(ui.newSeveritySelect(SoftwareQuality.Maintainability).get()).toHaveValue(
'severity_impact.LOW',
// Check that severity is reflected correctly
await user.click(ui.changeButton('QP Bar').get());
- await user.click(ui.mqrSwitch.get(ui.changeQPDialog.get()));
expect(ui.newSeveritySelect(SoftwareQuality.Maintainability).get()).toHaveValue(
'severity_impact.MEDIUM',
);
// Check that severity is reflected correctly
await user.click(ui.changeButton('QP Bar').get());
- await user.click(ui.mqrSwitch.get(ui.changeQPDialog.get()));
expect(ui.newSeveritySelect(SoftwareQuality.Reliability).get()).toHaveValue(
'severity_impact.MEDIUM',
);
expect(ui.changeButton('QP Bar').get()).toBeInTheDocument();
await user.click(ui.changeButton('QP Bar').get());
- await user.click(ui.mqrSwitch.get(ui.changeQPDialog.get()));
expect(ui.newSeveritySelect(SoftwareQuality.Maintainability).get()).toHaveValue(
'severity_impact.MEDIUM',
);
Note,
SafeHTMLInjection,
SanitizeLevel,
- Switch,
} from 'design-system';
import * as React from 'react';
import { FormattedMessage, useIntl } from 'react-intl';
import DocumentationLink from '../../../components/common/DocumentationLink';
import { DocLink } from '../../../helpers/doc-links';
import { useActivateRuleMutation } from '../../../queries/quality-profiles';
+import { useStandardExperienceMode } from '../../../queries/settings';
import { SoftwareImpactSeverity, SoftwareQuality } from '../../../types/clean-code-taxonomy';
import { Feature } from '../../../types/features';
import { IssueSeverity } from '../../../types/issues';
const [changedImpactSeveritiesMap, setChangedImpactSeverities] = React.useState<
Map<SoftwareQuality, SoftwareImpactSeverity>
>(new Map());
- const [isMQRMode, setIsMQRMode] = React.useState<boolean>(false);
+ const { data: isStandardMode } = useStandardExperienceMode();
const profilesWithDepth = React.useMemo(() => {
return getQualityProfilesWithDepth(profiles, rule.lang);
key: profile?.key ?? '',
params,
rule: rule.key,
- severity: !isMQRMode ? severity : undefined,
+ severity: isStandardMode ? severity : undefined,
prioritizedRule,
- impacts: isMQRMode
+ impacts: !isStandardMode
? (Object.fromEntries(impacts) as Record<SoftwareQuality, SoftwareImpactSeverity>)
: undefined,
};
</FormField>
)}
- <FormField label="MQR Mode">
- <Switch value={isMQRMode} onChange={setIsMQRMode} />
- </FormField>
-
- {!isMQRMode && (
+ {isStandardMode && (
<>
<FormField label={intl.formatMessage({ id: 'coding_rules.custom_severity.title' })}>
<Text>
</>
)}
- {isMQRMode && (
+ {!isStandardMode && (
<>
<FormField label={intl.formatMessage({ id: 'coding_rules.custom_severity.title' })}>
<Text>
</>
)}
{!isStandardMode &&
- activation.impacts &&
+ Boolean(activation.impacts?.length) &&
!isEqual(
[...activation.impacts].sort(sortImpacts),
[...ruleDetails.impacts].sort(sortImpacts),
}),
qualityProfileSelect: byRole('combobox', { name: 'coding_rules.quality_profile' }),
oldSeveritySelect: byRole('combobox', { name: 'coding_rules.custom_severity.choose_severity' }),
- mqrSwitch: byRole('switch'),
newSeveritySelect: (quality: SoftwareQuality) =>
byRole('combobox', { name: `software_quality.${quality}` }),
notRecommendedSeverity: byText('coding_rules.custom_severity.not_recommended'),