html-reporter 9.3.1 → 9.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -26,9 +26,7 @@ export default {
26
26
  VIEW_EXPAND_ERRORS: 'VIEW_EXPAND_ERRORS',
27
27
  VIEW_EXPAND_RETRIES: 'VIEW_EXPAND_RETRIES',
28
28
  VIEW_COLLAPSE_ALL: 'VIEW_COLLAPSE_ALL',
29
- VIEW_SHOW_ALL: 'VIEW_SHOW_ALL',
30
- VIEW_SHOW_FAILED: 'VIEW_SHOW_FAILED',
31
- VIEW_TOGGLE_SKIPPED: 'VIEW_TOGGLE_SKIPPED',
29
+ CHANGE_VIEW_MODE: 'CHANGE_VIEW_MODE',
32
30
  VIEW_UPDATE_BASE_HOST: 'VIEW_UPDATE_BASE_HOST',
33
31
  VIEW_UPDATE_FILTER_BY_NAME: 'VIEW_UPDATE_FILTER_BY_NAME',
34
32
  VIEW_SET_STRICT_MATCH_FILTER: 'VIEW_SET_STRICT_MATCH_FILTER',
@@ -5,7 +5,6 @@ import StaticTestsTreeBuilder from '../../tests-tree-builder/static';
5
5
  import actionNames from './action-names';
6
6
  import {types as modalTypes} from '../components/modals';
7
7
  import {QUEUED} from '../../constants/test-statuses';
8
- import viewModes from '../../constants/view-modes';
9
8
  import diffModes from '../../constants/diff-modes';
10
9
  import {getHttpErrorMessage} from './utils';
11
10
  import {fetchDataFromDatabases, mergeDatabases, connectToDatabase, getMainDatabaseUrl, getSuitesTableRows} from '../../db-utils/client';
@@ -188,7 +187,6 @@ export const expandAll = () => ({type: actionNames.VIEW_EXPAND_ALL});
188
187
  export const expandErrors = () => ({type: actionNames.VIEW_EXPAND_ERRORS});
189
188
  export const expandRetries = () => ({type: actionNames.VIEW_EXPAND_RETRIES});
190
189
  export const collapseAll = () => ({type: actionNames.VIEW_COLLAPSE_ALL});
191
- export const toggleSkipped = () => ({type: actionNames.VIEW_TOGGLE_SKIPPED});
192
190
  export const processBegin = () => ({type: actionNames.PROCESS_BEGIN});
193
191
  export const processEnd = () => ({type: actionNames.PROCESS_END});
194
192
  export const updateBaseHost = (host) => ({type: actionNames.VIEW_UPDATE_BASE_HOST, host});
@@ -202,6 +200,7 @@ export const togglePageScreenshot = () => ({type: actionNames.TOGGLE_PAGE_SCREEN
202
200
  export const updateBottomProgressBar = (payload) => ({type: actionNames.UPDATE_BOTTOM_PROGRESS_BAR, payload});
203
201
  export const toggleTestsGroup = (payload) => ({type: actionNames.TOGGLE_TESTS_GROUP, payload});
204
202
  export const groupTestsByKey = (payload) => ({type: actionNames.GROUP_TESTS_BY_KEY, payload});
203
+ export const changeViewMode = (payload) => ({type: actionNames.CHANGE_VIEW_MODE, payload});
205
204
 
206
205
  export const runCustomGuiAction = (payload) => {
207
206
  return async (dispatch) => {
@@ -225,16 +224,6 @@ export const setStrictMatchFilter = (strictMatchFilter) => {
225
224
  return {type: actionNames.VIEW_SET_STRICT_MATCH_FILTER, strictMatchFilter};
226
225
  };
227
226
 
228
- export function changeViewMode(mode) {
229
- switch (mode) {
230
- case viewModes.FAILED:
231
- return {type: actionNames.VIEW_SHOW_FAILED};
232
- case viewModes.ALL:
233
- default:
234
- return {type: actionNames.VIEW_SHOW_ALL};
235
- }
236
- }
237
-
238
227
  export function changeDiffMode(mode) {
239
228
  switch (mode) {
240
229
  case diffModes.ONLY_DIFF.id:
@@ -69,7 +69,6 @@ export default Object.assign(defaults, {
69
69
  viewMode: viewModes.ALL,
70
70
  diffMode: diffModes.THREE_UP.id,
71
71
  expand: EXPAND_ERRORS,
72
- showSkipped: false,
73
72
  baseHost: '',
74
73
  testNameFilter: '',
75
74
  strictMatchFilter: false,
@@ -13,7 +13,6 @@ export default store => next => action => {
13
13
  expand: view.expand,
14
14
  viewMode: view.viewMode,
15
15
  diffMode: view.diffMode,
16
- showSkipped: view.showSkipped,
17
16
  strictMatchFilter: view.strictMatchFilter
18
17
  });
19
18
  }
@@ -61,13 +61,11 @@ export default metrikaClass => store => next => action => {
61
61
  case actionNames.RUN_FAILED_TESTS:
62
62
  case actionNames.RETRY_SUITE:
63
63
  case actionNames.RETRY_TEST:
64
- case actionNames.VIEW_SHOW_ALL:
65
- case actionNames.VIEW_SHOW_FAILED:
64
+ case actionNames.CHANGE_VIEW_MODE:
66
65
  case actionNames.VIEW_EXPAND_ALL:
67
66
  case actionNames.VIEW_COLLAPSE_ALL:
68
67
  case actionNames.VIEW_EXPAND_ERRORS:
69
68
  case actionNames.VIEW_EXPAND_RETRIES:
70
- case actionNames.VIEW_TOGGLE_SKIPPED:
71
69
  case actionNames.VIEW_UPDATE_BASE_HOST:
72
70
  case actionNames.VIEW_THREE_UP_DIFF:
73
71
  case actionNames.VIEW_THREE_UP_SCALED_DIFF:
@@ -14,8 +14,7 @@ export default produce((state, action) => {
14
14
  case actionNames.BROWSERS_SELECTED:
15
15
  case actionNames.VIEW_UPDATE_FILTER_BY_NAME:
16
16
  case actionNames.VIEW_SET_STRICT_MATCH_FILTER:
17
- case actionNames.VIEW_SHOW_ALL:
18
- case actionNames.VIEW_SHOW_FAILED:
17
+ case actionNames.CHANGE_VIEW_MODE:
19
18
  case actionNames.ACCEPT_SCREENSHOT:
20
19
  case actionNames.ACCEPT_OPENED_SCREENSHOTS: {
21
20
  const {
@@ -112,8 +112,7 @@ export default produce((state, action) => {
112
112
  break;
113
113
  }
114
114
 
115
- case actionNames.VIEW_SHOW_ALL:
116
- case actionNames.VIEW_SHOW_FAILED:
115
+ case actionNames.CHANGE_VIEW_MODE:
117
116
  case actionNames.VIEW_UPDATE_FILTER_BY_NAME:
118
117
  case actionNames.VIEW_SET_STRICT_MATCH_FILTER: {
119
118
  const {tree, view} = state;
@@ -1,5 +1,5 @@
1
1
  import {isEmpty, last, initial} from 'lodash';
2
- import {isStatusMatchViewMode, isTestNameMatchFilters, shouldShowBrowser} from '../../../utils';
2
+ import {isBrowserMatchViewMode, isTestNameMatchFilters, shouldShowBrowser} from '../../../utils';
3
3
  import {isNodeFailed} from '../../../utils';
4
4
  import {changeNodeState, shouldNodeBeOpened} from '../helpers';
5
5
 
@@ -84,7 +84,7 @@ function calcBrowserOpenness(browser, lastResult, expand, tree) {
84
84
  function calcBrowserShowness(browser, lastResult, view) {
85
85
  const {viewMode, filteredBrowsers, testNameFilter, strictMatchFilter} = view;
86
86
 
87
- if (!isStatusMatchViewMode(lastResult.status, viewMode)) {
87
+ if (!isBrowserMatchViewMode(browser, lastResult, viewMode)) {
88
88
  return false;
89
89
  }
90
90
 
@@ -4,7 +4,6 @@ import {isEmpty} from 'lodash';
4
4
  import {getViewQuery} from '../custom-queries';
5
5
  import * as localStorageWrapper from '../local-storage-wrapper';
6
6
  import actionNames from '../action-names';
7
- import viewModes from '../../../constants/view-modes';
8
7
  import diffModes from '../../../constants/diff-modes';
9
8
  import {EXPAND_ALL, COLLAPSE_ALL, EXPAND_ERRORS, EXPAND_RETRIES} from '../../../constants/expand-modes';
10
9
 
@@ -45,18 +44,8 @@ export default produce((state, action) => {
45
44
  break;
46
45
  }
47
46
 
48
- case actionNames.VIEW_SHOW_ALL: {
49
- state.view.viewMode = viewModes.ALL;
50
- break;
51
- }
52
-
53
- case actionNames.VIEW_SHOW_FAILED: {
54
- state.view.viewMode = viewModes.FAILED;
55
- break;
56
- }
57
-
58
- case actionNames.VIEW_TOGGLE_SKIPPED: {
59
- state.view.showSkipped = !state.view.showSkipped;
47
+ case actionNames.CHANGE_VIEW_MODE: {
48
+ state.view.viewMode = action.payload;
60
49
  break;
61
50
  }
62
51
 
@@ -77,16 +77,26 @@ function isTestNameMatchFilters(testName, testNameFilter, strictMatchFilter) {
77
77
  : testName.includes(testNameFilter);
78
78
  }
79
79
 
80
- function isStatusMatchViewMode(status, viewMode) {
80
+ function isBrowserMatchViewMode(browser, lastResult, viewMode) {
81
+ const {status} = lastResult;
82
+
81
83
  if (viewMode === viewModes.ALL) {
82
84
  return true;
83
85
  }
84
86
 
87
+ if (viewMode === viewModes.PASSED && isSuccessStatus(status)) {
88
+ return true;
89
+ }
90
+
85
91
  if (viewMode === viewModes.FAILED && (isFailStatus(status) || isErroredStatus(status))) {
86
92
  return true;
87
93
  }
88
94
 
89
- return false;
95
+ if (viewMode === viewModes.RETRIED) {
96
+ return browser.resultIds.length > 1;
97
+ }
98
+
99
+ return status === viewMode;
90
100
  }
91
101
 
92
102
  function shouldShowBrowser(browser, filteredBrowsers) {
@@ -154,7 +164,7 @@ module.exports = {
154
164
  dateToLocaleString,
155
165
  getHttpErrorMessage,
156
166
  isTestNameMatchFilters,
157
- isStatusMatchViewMode,
167
+ isBrowserMatchViewMode,
158
168
  shouldShowBrowser,
159
169
  iterateSuites,
160
170
  parseKeyToGroupTestsBy