Skip to content

Commit

Permalink
added the last test-ids
Browse files Browse the repository at this point in the history
  • Loading branch information
christianpiske committed Dec 11, 2024
1 parent 667ab25 commit b73f023
Show file tree
Hide file tree
Showing 14 changed files with 34 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/web/components/powerfilter/applyoverridesgroup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const ApplyOverridesGroup = ({
noValue={0}
convert={parseInt}
onChange={onChange}
data-testid="apply-overrides-yesnoradio"
/>
</FormGroup>
);
Expand Down
1 change: 1 addition & 0 deletions src/web/components/powerfilter/booleanfiltergroup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const BooleanFilterGroup = ({filter, name, title, onChange}) => {
noValue={0}
convert={parseInt}
onChange={onChange}
data-testid="boolean-filter-yesnoradio"
/>
</FormGroup>
);
Expand Down
4 changes: 4 additions & 0 deletions src/web/components/powerfilter/compliancelevelsgroup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,24 +67,28 @@ const ComplianceLevelsFilterGroup = ({
checked={complianceLevels.includes('y')}
name="y"
onChange={handleComplianceChange}
data-testid="compliance-checkbox-yes"
/>
<ComplianceStateLabels.Yes />
<Checkbox
checked={complianceLevels.includes('n')}
name="n"
onChange={handleComplianceChange}
data-testid="compliance-checkbox-no"
/>
<ComplianceStateLabels.No />
<Checkbox
checked={complianceLevels.includes('i')}
name="i"
onChange={handleComplianceChange}
data-testid="compliance-checkbox-incomplete"
/>
<ComplianceStateLabels.Incomplete />
<Checkbox
checked={complianceLevels.includes('u')}
name="u"
onChange={handleComplianceChange}
data-testid="compliance-checkbox-undefined"
/>
<ComplianceStateLabels.Undefined />
</IconDivider>
Expand Down
1 change: 1 addition & 0 deletions src/web/components/powerfilter/minqodgroup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const MinQodGroup = ({qod, onChange, filter, name = 'min_qod'}) => {
step="1"
value={qod}
onChange={onChange}
data-testid="min-qod"
/>
<span>%</span>
</FormGroup>
Expand Down
7 changes: 7 additions & 0 deletions src/web/components/powerfilter/powerfilter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,14 @@ class PowerFilter extends React.Component {
value={userFilterString}
onKeyDown={this.handleUserFilterKeyPress}
onChange={this.handleValueChange}
data-testid="powerfilter-text"
/>
</Layout>
<IconDivider align={['start', 'center']}>
<RefreshIcon
title={_('Update Filter')}
onClick={this.handleUpdateFilter}
data-testid="powerfiler-refresh"
/>

{onRemoveClick && (
Expand All @@ -207,6 +209,7 @@ class PowerFilter extends React.Component {
onClick={
isDefined(filter) ? this.handleRemoveClick : undefined
}
data-testid="powefilter-delete"
/>
)}
{onResetClick && (
Expand All @@ -216,20 +219,23 @@ class PowerFilter extends React.Component {
onClick={
isDefined(filter) ? this.handleResetClick : undefined
}
data-testid="powerfilter-reset"
/>
)}

<ManualIcon
title={_('Help: Powerfilter')}
page="web-interface"
anchor="filtering-the-page-content"
data-testid="powerfilter-help"
/>

{onEditClick && (
<EditIcon
title={_('Edit Filter')}
disabled={!isDefined(filter) || isLoading}
onClick={isDefined(filter) ? onEditClick : undefined}
data-testid="powerfilter-edit"
/>
)}
</IconDivider>
Expand All @@ -245,6 +251,7 @@ class PowerFilter extends React.Component {
: DEFAULT_FILTER_ID
}
onChange={this.handleNamedFilterChange}
data-testid="powefilter-select"
/>
)}
</Layout>
Expand Down
1 change: 1 addition & 0 deletions src/web/components/powerfilter/relationselector.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const RelationSelector = ({relation, onChange}) => {
const [_] = useTranslation();
return (
<Select
data-testid="relationselector"
value={relation}
onChange={onChange}
items={[
Expand Down
2 changes: 1 addition & 1 deletion src/web/components/powerfilter/resultsperpagegroup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const ResultsPerPageGroup = ({rows, filter, onChange, name = 'rows'}) => {
}

return (
<FormGroup title={_('Results per page')}>
<FormGroup title={_('Results per page')} data-testid="results-per-page">
<Spinner type="int" name={name} value={rows} onChange={onChange} />
</FormGroup>
);
Expand Down
5 changes: 5 additions & 0 deletions src/web/components/powerfilter/severitylevelsgroup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,30 +60,35 @@ const SeverityLevelsFilterGroup = ({filter, onChange, onRemove}) => {
checked={levels.includes('h')}
name="h"
onChange={handleLevelChange}
data-testid="severity-filter-high"
/>
<SeverityClassLabel.High />
<Checkbox
checked={levels.includes('m')}
name="m"
onChange={handleLevelChange}
data-testid="severity-filter-medium"
/>
<SeverityClassLabel.Medium />
<Checkbox
checked={levels.includes('l')}
name="l"
onChange={handleLevelChange}
data-testid="severity-filter-low"
/>
<SeverityClassLabel.Low />
<Checkbox
checked={levels.includes('g')}
name="g"
onChange={handleLevelChange}
data-testid="severity-filter-log"
/>
<SeverityClassLabel.Log />
<Checkbox
checked={levels.includes('f')}
name="f"
onChange={handleLevelChange}
data-testid="severity-filter-false-positive"
/>
<SeverityClassLabel.FalsePositive />
</IconDivider>
Expand Down
1 change: 1 addition & 0 deletions src/web/components/powerfilter/severityvaluesgroup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const SeverityValuesGroup = ({filter, name, title, onChange}) => {
}}
/>
<NumberField
data-testid="severity-value-filter"
name={keyword}
type="int"
min={0}
Expand Down
6 changes: 6 additions & 0 deletions src/web/components/powerfilter/solutiontypegroup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ const SolutionTypesFilterGroup = ({filter, onChange}) => {
checked={!isDefined(solutionType) || solutionType === 'All'}
name="All"
onChange={handleSolutionTypeChange}
data-testid="filter-solution-all"
></Radio>
<span>{_('All')}</span>
</Row>
Expand All @@ -67,6 +68,7 @@ const SolutionTypesFilterGroup = ({filter, onChange}) => {
checked={solutionType === 'Workaround'}
name="Workaround"
onChange={handleSolutionTypeChange}
data-testid="filter-solution-workaround"
/>
<SolutionTypeIcon type="Workaround" />
<span>{_('Workaround')}</span>
Expand All @@ -78,6 +80,7 @@ const SolutionTypesFilterGroup = ({filter, onChange}) => {
checked={solutionType === 'Mitigation'}
name="Mitigation"
onChange={handleSolutionTypeChange}
data-testid="filter-solution-mitigation"
/>
<SolutionTypeIcon type="Mitigation" />
<span>{_('Mitigation')}</span>
Expand All @@ -91,6 +94,7 @@ const SolutionTypesFilterGroup = ({filter, onChange}) => {
checked={solutionType === 'VendorFix'}
name="VendorFix"
onChange={handleSolutionTypeChange}
data-testid="filter-solution-vendor-fix"
/>
<SolutionTypeIcon type="VendorFix" />
<span>{_('Vendor fix')}</span>
Expand All @@ -102,6 +106,7 @@ const SolutionTypesFilterGroup = ({filter, onChange}) => {
checked={solutionType === 'NoneAvailable'}
name="NoneAvailable"
onChange={handleSolutionTypeChange}
data-testid="filter-solution-none-available"
/>
<SolutionTypeIcon type="NoneAvailable" />
<span>{_('None available')}</span>
Expand All @@ -113,6 +118,7 @@ const SolutionTypesFilterGroup = ({filter, onChange}) => {
checked={solutionType === 'WillNotFix'}
name="WillNotFix"
onChange={handleSolutionTypeChange}
data-testid="filter-solution-will-not-fix"
/>
<SolutionTypeIcon type="WillNotFix" />
<span>{_('Will not fix')}</span>{' '}
Expand Down
3 changes: 3 additions & 0 deletions src/web/components/powerfilter/sortbygroup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,23 @@ const SortByGroup = ({
value={by}
items={renderSortFieldItems()}
onChange={onSortByChange}
data-testid="sort-by"
/>
<Radio
name="sort_order"
value="sort"
checked={order === 'sort'}
title={_('Ascending')}
onChange={onSortOrderChange}
data-testid="sort-order"
/>
<Radio
name="sort_order"
value="sort-reverse"
checked={order === 'sort-reverse'}
title={_('Descending')}
onChange={onSortOrderChange}
data-testid="sort-reverse"
/>
</FormGroup>
);
Expand Down
1 change: 1 addition & 0 deletions src/web/components/powerfilter/tasktrendgroup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const TaskTrendGroup = ({trend, name = 'trend', filter, onChange}) => {
name={name}
value={trend}
onChange={onChange}
data-testid="filter-trend"
items={[
{label: _('Severity increased'), value: 'up'},
{label: _('Severity decreased'), value: 'down'},
Expand Down
1 change: 1 addition & 0 deletions src/web/components/powerfilter/ticketstatusgroup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const TicketStatusFilterGroup = ({
name={name}
value={status}
onChange={onChange}
data-testid="filter-status"
items={[
{label: _('Open'), value: 'Open'},
{label: _('Fixed'), value: 'Fixed'},
Expand Down
2 changes: 1 addition & 1 deletion src/web/components/qod/qod.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const Span = styled.span`
white-space: nowrap;
`;

const Qod = ({value}) => <Span>{value} %</Span>;
const Qod = ({value}) => <Span data-testid="qod">{value} %</Span>;

Qod.propTypes = {
value: PropTypes.numberOrNumberString.isRequired,
Expand Down

0 comments on commit b73f023

Please sign in to comment.