Skip to content

Commit

Permalink
Merge pull request #439 from gemini-testing/HERMIONE-374
Browse files Browse the repository at this point in the history
Extend test statuses filter
  • Loading branch information
OldSkyTree authored Oct 28, 2022
2 parents d1a0003 + e0b4861 commit 6791d54
Show file tree
Hide file tree
Showing 22 changed files with 128 additions and 144 deletions.
5 changes: 4 additions & 1 deletion lib/constants/view-modes.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@

module.exports = {
ALL: 'all',
FAILED: 'failed'
PASSED: 'passed',
FAILED: 'failed',
RETRIED: 'retried',
SKIPPED: 'skipped'
};
5 changes: 0 additions & 5 deletions lib/static/components/controls/common-controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@ class ControlButtons extends Component {
/>
</div>
<GroupTestsSelect />
<ControlButton
label="Show skipped"
isActive={view.showSkipped}
handler={actions.toggleSkipped}
/>
<ControlSelect
label="Diff mode"
value={view.diffMode}
Expand Down
2 changes: 0 additions & 2 deletions lib/static/components/gui.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {bindActionCreators} from 'redux';
import {ROOT} from '../../constants/extension-points';
import * as actions from '../modules/actions';
import ControlButtons from './controls/gui-controls';
import SkippedList from './skipped-list';
import Loading from './loading';
import ModalContainer from '../containers/modal';
import MainTree from './main-tree';
Expand Down Expand Up @@ -84,7 +83,6 @@ class Gui extends Component {
<FaviconChanger />
<ControlButtons />
<main className="container">
<SkippedList />
<MainTree />
</main>
<Loading active={loading.active} content={loading.content} />
Expand Down
30 changes: 15 additions & 15 deletions lib/static/components/header/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,24 @@ import Summary from './summary';
import './header.css';

class Header extends Component {
static propTypes = {
date: PropTypes.string
};
static propTypes = {
date: PropTypes.string
};

render() {
const {date} = this.props;
render() {
const {date} = this.props;

const dateBlock = date ? (
<div className="header__date">created at {date}</div>
) : null;
const dateBlock = date ? (
<div className="header__date">created at {date}</div>
) : null;

return (
<header className="header container">
<Summary />
{dateBlock}
</header>
);
}
return (
<header className="header container">
<Summary />
{dateBlock}
</header>
);
}
}

export default connect((state) => {
Expand Down
2 changes: 0 additions & 2 deletions lib/static/components/report.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import * as actions from '../modules/actions';
import Loading from './loading';
import Header from './header';
import ControlButtons from './controls/report-controls';
import SkippedList from './skipped-list';
import MainTree from './main-tree';
import CustomScripts from './custom-scripts';
import FaviconChanger from './favicon-changer';
Expand Down Expand Up @@ -55,7 +54,6 @@ class Report extends Component {
<Header/>
<ControlButtons/>
<main className="container">
<SkippedList />
<MainTree />
</main>
<BottomProgressBar />
Expand Down
46 changes: 0 additions & 46 deletions lib/static/components/skipped-list.js

This file was deleted.

4 changes: 2 additions & 2 deletions lib/static/components/suites.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ class Suites extends Component {
msgs.push(`test name should match to "${testNameFilter}" ${strictMatchFilter ? '' : 'not '}strictly;`);
}

if (viewMode === viewModes.FAILED) {
msgs.push(`test should be failed due to selected view mode: "Show only ${viewMode}";`);
if (viewMode !== viewModes.ALL) {
msgs.push(`test should be ${viewMode} due to selected view mode;`);
}

if (filteredBrowsers) {
Expand Down
4 changes: 1 addition & 3 deletions lib/static/modules/action-names.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ export default {
VIEW_EXPAND_ERRORS: 'VIEW_EXPAND_ERRORS',
VIEW_EXPAND_RETRIES: 'VIEW_EXPAND_RETRIES',
VIEW_COLLAPSE_ALL: 'VIEW_COLLAPSE_ALL',
VIEW_SHOW_ALL: 'VIEW_SHOW_ALL',
VIEW_SHOW_FAILED: 'VIEW_SHOW_FAILED',
VIEW_TOGGLE_SKIPPED: 'VIEW_TOGGLE_SKIPPED',
CHANGE_VIEW_MODE: 'CHANGE_VIEW_MODE',
VIEW_UPDATE_BASE_HOST: 'VIEW_UPDATE_BASE_HOST',
VIEW_UPDATE_FILTER_BY_NAME: 'VIEW_UPDATE_FILTER_BY_NAME',
VIEW_SET_STRICT_MATCH_FILTER: 'VIEW_SET_STRICT_MATCH_FILTER',
Expand Down
13 changes: 1 addition & 12 deletions lib/static/modules/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import StaticTestsTreeBuilder from '../../tests-tree-builder/static';
import actionNames from './action-names';
import {types as modalTypes} from '../components/modals';
import {QUEUED} from '../../constants/test-statuses';
import viewModes from '../../constants/view-modes';
import diffModes from '../../constants/diff-modes';
import {getHttpErrorMessage} from './utils';
import {fetchDataFromDatabases, mergeDatabases, connectToDatabase, getMainDatabaseUrl, getSuitesTableRows} from '../../db-utils/client';
Expand Down Expand Up @@ -188,7 +187,6 @@ export const expandAll = () => ({type: actionNames.VIEW_EXPAND_ALL});
export const expandErrors = () => ({type: actionNames.VIEW_EXPAND_ERRORS});
export const expandRetries = () => ({type: actionNames.VIEW_EXPAND_RETRIES});
export const collapseAll = () => ({type: actionNames.VIEW_COLLAPSE_ALL});
export const toggleSkipped = () => ({type: actionNames.VIEW_TOGGLE_SKIPPED});
export const processBegin = () => ({type: actionNames.PROCESS_BEGIN});
export const processEnd = () => ({type: actionNames.PROCESS_END});
export const updateBaseHost = (host) => ({type: actionNames.VIEW_UPDATE_BASE_HOST, host});
Expand All @@ -202,6 +200,7 @@ export const togglePageScreenshot = () => ({type: actionNames.TOGGLE_PAGE_SCREEN
export const updateBottomProgressBar = (payload) => ({type: actionNames.UPDATE_BOTTOM_PROGRESS_BAR, payload});
export const toggleTestsGroup = (payload) => ({type: actionNames.TOGGLE_TESTS_GROUP, payload});
export const groupTestsByKey = (payload) => ({type: actionNames.GROUP_TESTS_BY_KEY, payload});
export const changeViewMode = (payload) => ({type: actionNames.CHANGE_VIEW_MODE, payload});

export const runCustomGuiAction = (payload) => {
return async (dispatch) => {
Expand All @@ -225,16 +224,6 @@ export const setStrictMatchFilter = (strictMatchFilter) => {
return {type: actionNames.VIEW_SET_STRICT_MATCH_FILTER, strictMatchFilter};
};

export function changeViewMode(mode) {
switch (mode) {
case viewModes.FAILED:
return {type: actionNames.VIEW_SHOW_FAILED};
case viewModes.ALL:
default:
return {type: actionNames.VIEW_SHOW_ALL};
}
}

export function changeDiffMode(mode) {
switch (mode) {
case diffModes.ONLY_DIFF.id:
Expand Down
1 change: 0 additions & 1 deletion lib/static/modules/default-state.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ export default Object.assign(defaults, {
viewMode: viewModes.ALL,
diffMode: diffModes.THREE_UP.id,
expand: EXPAND_ERRORS,
showSkipped: false,
baseHost: '',
testNameFilter: '',
strictMatchFilter: false,
Expand Down
1 change: 0 additions & 1 deletion lib/static/modules/middlewares/local-storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export default store => next => action => {
expand: view.expand,
viewMode: view.viewMode,
diffMode: view.diffMode,
showSkipped: view.showSkipped,
strictMatchFilter: view.strictMatchFilter
});
}
Expand Down
4 changes: 1 addition & 3 deletions lib/static/modules/middlewares/metrika.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,11 @@ export default metrikaClass => store => next => action => {
case actionNames.RUN_FAILED_TESTS:
case actionNames.RETRY_SUITE:
case actionNames.RETRY_TEST:
case actionNames.VIEW_SHOW_ALL:
case actionNames.VIEW_SHOW_FAILED:
case actionNames.CHANGE_VIEW_MODE:
case actionNames.VIEW_EXPAND_ALL:
case actionNames.VIEW_COLLAPSE_ALL:
case actionNames.VIEW_EXPAND_ERRORS:
case actionNames.VIEW_EXPAND_RETRIES:
case actionNames.VIEW_TOGGLE_SKIPPED:
case actionNames.VIEW_UPDATE_BASE_HOST:
case actionNames.VIEW_THREE_UP_DIFF:
case actionNames.VIEW_THREE_UP_SCALED_DIFF:
Expand Down
3 changes: 1 addition & 2 deletions lib/static/modules/reducers/grouped-tests/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ export default produce((state, action) => {
case actionNames.BROWSERS_SELECTED:
case actionNames.VIEW_UPDATE_FILTER_BY_NAME:
case actionNames.VIEW_SET_STRICT_MATCH_FILTER:
case actionNames.VIEW_SHOW_ALL:
case actionNames.VIEW_SHOW_FAILED:
case actionNames.CHANGE_VIEW_MODE:
case actionNames.ACCEPT_SCREENSHOT:
case actionNames.ACCEPT_OPENED_SCREENSHOTS: {
const {
Expand Down
3 changes: 1 addition & 2 deletions lib/static/modules/reducers/tree/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,7 @@ export default produce((state, action) => {
break;
}

case actionNames.VIEW_SHOW_ALL:
case actionNames.VIEW_SHOW_FAILED:
case actionNames.CHANGE_VIEW_MODE:
case actionNames.VIEW_UPDATE_FILTER_BY_NAME:
case actionNames.VIEW_SET_STRICT_MATCH_FILTER: {
const {tree, view} = state;
Expand Down
4 changes: 2 additions & 2 deletions lib/static/modules/reducers/tree/nodes/browsers.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {isEmpty, last, initial} from 'lodash';
import {isStatusMatchViewMode, isTestNameMatchFilters, shouldShowBrowser} from '../../../utils';
import {isBrowserMatchViewMode, isTestNameMatchFilters, shouldShowBrowser} from '../../../utils';
import {isNodeFailed} from '../../../utils';
import {changeNodeState, shouldNodeBeOpened} from '../helpers';

Expand Down Expand Up @@ -84,7 +84,7 @@ function calcBrowserOpenness(browser, lastResult, expand, tree) {
function calcBrowserShowness(browser, lastResult, view) {
const {viewMode, filteredBrowsers, testNameFilter, strictMatchFilter} = view;

if (!isStatusMatchViewMode(lastResult.status, viewMode)) {
if (!isBrowserMatchViewMode(browser, lastResult, viewMode)) {
return false;
}

Expand Down
15 changes: 2 additions & 13 deletions lib/static/modules/reducers/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {isEmpty} from 'lodash';
import {getViewQuery} from '../custom-queries';
import * as localStorageWrapper from '../local-storage-wrapper';
import actionNames from '../action-names';
import viewModes from '../../../constants/view-modes';
import diffModes from '../../../constants/diff-modes';
import {EXPAND_ALL, COLLAPSE_ALL, EXPAND_ERRORS, EXPAND_RETRIES} from '../../../constants/expand-modes';

Expand Down Expand Up @@ -45,18 +44,8 @@ export default produce((state, action) => {
break;
}

case actionNames.VIEW_SHOW_ALL: {
state.view.viewMode = viewModes.ALL;
break;
}

case actionNames.VIEW_SHOW_FAILED: {
state.view.viewMode = viewModes.FAILED;
break;
}

case actionNames.VIEW_TOGGLE_SKIPPED: {
state.view.showSkipped = !state.view.showSkipped;
case actionNames.CHANGE_VIEW_MODE: {
state.view.viewMode = action.payload;
break;
}

Expand Down
16 changes: 13 additions & 3 deletions lib/static/modules/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,26 @@ function isTestNameMatchFilters(testName, testNameFilter, strictMatchFilter) {
: testName.includes(testNameFilter);
}

function isStatusMatchViewMode(status, viewMode) {
function isBrowserMatchViewMode(browser, lastResult, viewMode) {
const {status} = lastResult;

if (viewMode === viewModes.ALL) {
return true;
}

if (viewMode === viewModes.PASSED && isSuccessStatus(status)) {
return true;
}

if (viewMode === viewModes.FAILED && (isFailStatus(status) || isErroredStatus(status))) {
return true;
}

return false;
if (viewMode === viewModes.RETRIED) {
return browser.resultIds.length > 1;
}

return status === viewMode;
}

function shouldShowBrowser(browser, filteredBrowsers) {
Expand Down Expand Up @@ -154,7 +164,7 @@ module.exports = {
dateToLocaleString,
getHttpErrorMessage,
isTestNameMatchFilters,
isStatusMatchViewMode,
isBrowserMatchViewMode,
shouldShowBrowser,
iterateSuites,
parseKeyToGroupTestsBy
Expand Down
1 change: 0 additions & 1 deletion test/unit/lib/static/modules/middlewares/local-storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ describe('lib/static/modules/middlewares/local-storage', () => {

assert.calledOnceWith(localStorageWrapper.setItem, 'view', {
expand: EXPAND_ERRORS,
showSkipped: false,
strictMatchFilter: false,
viewMode: viewModes.ALL,
diffMode: diffModes.THREE_UP.id
Expand Down
4 changes: 1 addition & 3 deletions test/unit/lib/static/modules/middlewares/metrika.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,13 +326,11 @@ describe('lib/static/modules/middlewares/metrika', () => {
actionNames.RUN_FAILED_TESTS,
actionNames.RETRY_SUITE,
actionNames.RETRY_TEST,
actionNames.VIEW_SHOW_ALL,
actionNames.VIEW_SHOW_FAILED,
actionNames.CHANGE_VIEW_MODE,
actionNames.VIEW_EXPAND_ALL,
actionNames.VIEW_COLLAPSE_ALL,
actionNames.VIEW_EXPAND_ERRORS,
actionNames.VIEW_EXPAND_RETRIES,
actionNames.VIEW_TOGGLE_SKIPPED,
actionNames.VIEW_UPDATE_BASE_HOST,
actionNames.VIEW_THREE_UP_DIFF,
actionNames.VIEW_THREE_UP_SCALED_DIFF,
Expand Down
3 changes: 1 addition & 2 deletions test/unit/lib/static/modules/reducers/grouped-tests/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ describe('lib/static/modules/reducers/grouped-tests', () => {
actionNames.BROWSERS_SELECTED,
actionNames.VIEW_UPDATE_FILTER_BY_NAME,
actionNames.VIEW_SET_STRICT_MATCH_FILTER,
actionNames.VIEW_SHOW_ALL,
actionNames.VIEW_SHOW_FAILED,
actionNames.CHANGE_VIEW_MODE,
actionNames.ACCEPT_SCREENSHOT,
actionNames.ACCEPT_OPENED_SCREENSHOTS
].forEach((actionName) => {
Expand Down
Loading

0 comments on commit 6791d54

Please sign in to comment.