Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more options to the filtering menus, and add a "no value" filter for the confidence column #793

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 42 additions & 15 deletions src/__tests__/CompareResults/ResultsTable.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ describe('Results Table', () => {
' - OSX, Improvement, Low',
' - Linux, Regression, Medium',
' - Windows, -, High',
' - Windows, -, ',
' - Windows, -, -',
' - Android, Improvement, Low',
]);

Expand All @@ -150,13 +150,13 @@ describe('Results Table', () => {
' - Android, Improvement, Low',
]);

await clickMenuItem(user, /Platform/, 'Clear filters');
await clickMenuItem(user, /Platform/, 'Select all values');
expect(summarizeVisibleRows()).toEqual([
'a11yr dhtml.html spam opt e10s fission stylo webrender',
' - OSX, Improvement, Low',
' - Linux, Regression, Medium',
' - Windows, -, High',
' - Windows, -, ',
' - Windows, -, -',
' - Android, Improvement, Low',
]);

Expand All @@ -165,7 +165,7 @@ describe('Results Table', () => {
'a11yr dhtml.html spam opt e10s fission stylo webrender',
' - Linux, Regression, Medium',
' - Windows, -, High',
' - Windows, -, ',
' - Windows, -, -',
' - Android, Improvement, Low',
]);

Expand All @@ -174,7 +174,13 @@ describe('Results Table', () => {
'a11yr dhtml.html spam opt e10s fission stylo webrender',
' - Linux, Regression, Medium',
' - Windows, -, High',
' - Windows, -, ',
' - Windows, -, -',
]);

await clickMenuItem(user, /Platform/, /Select only.*Android/);
expect(summarizeVisibleRows()).toEqual([
'a11yr dhtml.html spam opt e10s fission stylo webrender',
' - Android, Improvement, Low',
]);
});

Expand All @@ -188,7 +194,7 @@ describe('Results Table', () => {
' - OSX, Improvement, Low',
' - Linux, Regression, Medium',
' - Windows, -, High',
' - Windows, -, ',
' - Windows, -, -',
]);

const user = userEvent.setup({ delay: null });
Expand All @@ -199,19 +205,26 @@ describe('Results Table', () => {
' - Linux, Regression, Medium',
]);

await clickMenuItem(user, /Status/, /Clear filters/);
await clickMenuItem(user, /Status/, /Select all values/);
await clickMenuItem(user, /Status/, /Improvement/);
expect(summarizeVisibleRows()).toEqual([
'a11yr dhtml.html spam opt e10s fission stylo webrender',
' - Linux, Regression, Medium',
' - Windows, -, High',
' - Windows, -, ',
' - Windows, -, -',
]);

await clickMenuItem(user, /Status/, /Regression/);
expect(summarizeVisibleRows()).toEqual([
'a11yr dhtml.html spam opt e10s fission stylo webrender',
' - Windows, -, High',
' - Windows, -, ',
' - Windows, -, -',
]);

await clickMenuItem(user, /Status/, /Select only.*Regression/);
expect(summarizeVisibleRows()).toEqual([
'a11yr dhtml.html spam opt e10s fission stylo webrender',
' - Linux, Regression, Medium',
]);
});

Expand All @@ -225,7 +238,7 @@ describe('Results Table', () => {
' - OSX, Improvement, Low',
' - Linux, Regression, Medium',
' - Windows, -, High',
' - Windows, -, ',
' - Windows, -, -',
]);

const user = userEvent.setup({ delay: null });
Expand All @@ -234,29 +247,43 @@ describe('Results Table', () => {
'a11yr dhtml.html spam opt e10s fission stylo webrender',
' - Linux, Regression, Medium',
' - Windows, -, High',
' - Windows, -, ',
' - Windows, -, -',
]);

await clickMenuItem(user, /Confidence/, /High/);
expect(summarizeVisibleRows()).toEqual([
'a11yr dhtml.html spam opt e10s fission stylo webrender',
' - Linux, Regression, Medium',
' - Windows, -, ',
' - Windows, -, -',
]);

await clickMenuItem(user, /Confidence/, /Medium/);
expect(summarizeVisibleRows()).toEqual([
'a11yr dhtml.html spam opt e10s fission stylo webrender',
' - Windows, -, ',
' - Windows, -, -',
]);

await clickMenuItem(user, /Confidence/, /Clear filters/);
await clickMenuItem(user, /Confidence/, /Select all values/);
expect(summarizeVisibleRows()).toEqual([
'a11yr dhtml.html spam opt e10s fission stylo webrender',
' - OSX, Improvement, Low',
' - Linux, Regression, Medium',
' - Windows, -, High',
' - Windows, -, ',
' - Windows, -, -',
]);

await clickMenuItem(user, /Confidence/, /No value/);
expect(summarizeVisibleRows()).toEqual([
'a11yr dhtml.html spam opt e10s fission stylo webrender',
' - OSX, Improvement, Low',
' - Linux, Regression, Medium',
' - Windows, -, High',
]);

await clickMenuItem(user, /Confidence/, /Select only.*High/);
expect(summarizeVisibleRows()).toEqual([
'a11yr dhtml.html spam opt e10s fission stylo webrender',
' - Windows, -, High',
]);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -1200,7 +1200,9 @@ exports[`Results View The table should match snapshot and other elements should
<div
class="confidence cell"
role="cell"
/>
>
-
</div>
<div
class="total-runs cell"
role="cell"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1973,7 +1973,9 @@ exports[`Results Table Should match snapshot 1`] = `
<div
class="confidence cell"
role="cell"
/>
>
-
</div>
<div
class="total-runs cell"
role="cell"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1863,7 +1863,9 @@ exports[`Results View The table should match snapshot and other elements should
<div
class="confidence cell"
role="cell"
/>
>
-
</div>
<div
class="total-runs cell"
role="cell"
Expand Down
12 changes: 9 additions & 3 deletions src/components/CompareResults/ResultsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,15 @@ const cellsConfiguration: CompareResultsTableConfig[] = [
filter: true,
key: 'confidence',
gridWidth: '1fr',
possibleValues: ['Low', 'Medium', 'High'],
matchesFunction: (result: CompareResultsItem, value: string) =>
result.confidence_text === value,
possibleValues: ['No value', 'Low', 'Medium', 'High'],
matchesFunction: (result: CompareResultsItem, value: string) => {
switch (value) {
case 'No value':
return !result.confidence_text;
default:
return result.confidence_text === value;
}
},
},
{
name: 'Total Runs',
Expand Down
2 changes: 1 addition & 1 deletion src/components/CompareResults/RevisionRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ function RevisionRow(props: RevisionRowProps) {
</div>
<div className='confidence cell' role='cell'>
{confidenceText && confidenceIcons[confidenceText]}
{confidenceText}
{confidenceText || '-'}
</div>
<div className='total-runs cell' role='cell'>
<span>
Expand Down
21 changes: 20 additions & 1 deletion src/components/CompareResults/TableHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import CheckIcon from '@mui/icons-material/Check';
import FilterListIcon from '@mui/icons-material/FilterList';
import Button from '@mui/material/Button';
import Divider from '@mui/material/Divider';
import Menu from '@mui/material/Menu';
import MenuItem from '@mui/material/MenuItem';
import {
Expand Down Expand Up @@ -43,6 +44,13 @@ function FilterableColumn({
onToggle(newUncheckedValues);
};

const onClickOnlyFilter = (value: string) => {
const newUncheckedValues = new Set(
possibleValues.filter((possibleValue) => possibleValue !== value),
);
onToggle(newUncheckedValues);
};

const hasFilteredValues = uncheckedValues && uncheckedValues.size;
const buttonAriaLabel = hasFilteredValues
? `${name} (Click to filter values. Some filters are active.)`
Expand Down Expand Up @@ -75,8 +83,19 @@ function FilterableColumn({
</Button>
<Menu {...bindMenu(popupState)}>
<MenuItem dense={true} onClick={onClear}>
Clear filters
Select all values
</MenuItem>
<Divider />
{possibleValues.map((possibleValue) => (
<MenuItem
dense={true}
key={possibleValue}
onClick={() => onClickOnlyFilter(possibleValue)}
>
Select only “{possibleValue}”
</MenuItem>
))}
<Divider />
{possibleValues.map((possibleValue) => {
const isChecked =
!uncheckedValues || !uncheckedValues.has(possibleValue);
Expand Down
2 changes: 1 addition & 1 deletion src/types/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export type CompareResultsItem = {
is_regression: boolean;
is_meaningful: boolean;
more_runs_are_needed: boolean;
/*
/*
Each test has a signature and each signature may or may not have a parent_signature.
If a signature has a parent_signature then we are looking at a subtest. For regular tests this field will be null.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export type CompareResultsTableConfig =
matchesFunction: (result: CompareResultsItem, value: string) => boolean;
};

export type ConfidenceText = 'High' | 'Medium' | 'Low';
export type ConfidenceText = 'High' | 'Medium' | 'Low' | '';

export type MeasurementUnit =
| 'W'
Expand Down