html-reporter 7.7.1 → 8.1.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,56 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ <a name="8.1.0"></a>
6
+ # [8.1.0](https://github.com/gemini-testing/html-reporter/compare/v8.0.2...v8.1.0) (2022-01-13)
7
+
8
+
9
+ ### Features
10
+
11
+ * implemented progress-bar of scroll ([49d5631](https://github.com/gemini-testing/html-reporter/commit/49d5631))
12
+
13
+
14
+
15
+ <a name="8.0.2"></a>
16
+ ## [8.0.2](https://github.com/gemini-testing/html-reporter/compare/v8.0.1...v8.0.2) (2021-12-28)
17
+
18
+
19
+ ### Bug Fixes
20
+
21
+ * copy link for skipped test ([9d0df96](https://github.com/gemini-testing/html-reporter/commit/9d0df96))
22
+
23
+
24
+
25
+ <a name="8.0.1"></a>
26
+ ## [8.0.1](https://github.com/gemini-testing/html-reporter/compare/v8.0.0...v8.0.1) (2021-12-01)
27
+
28
+
29
+ ### Bug Fixes
30
+
31
+ * **gui:** stop endlessly restarting tests ([#412](https://github.com/gemini-testing/html-reporter/issues/412)) ([fb8a397](https://github.com/gemini-testing/html-reporter/commit/fb8a397))
32
+
33
+
34
+
35
+ <a name="8.0.0"></a>
36
+ # [8.0.0](https://github.com/gemini-testing/html-reporter/compare/v7.7.1...v8.0.0) (2021-11-25)
37
+
38
+
39
+ ### Bug Fixes
40
+
41
+ * update better-sqlite to support Node 16 ([0df4cb5](https://github.com/gemini-testing/html-reporter/commit/0df4cb5))
42
+
43
+
44
+ ### Chores
45
+
46
+ * drop nodejs <= 12 support ([afbc1a5](https://github.com/gemini-testing/html-reporter/commit/afbc1a5))
47
+
48
+
49
+ ### BREAKING CHANGES
50
+
51
+ * drop nodejs <= 12.x support
52
+
53
+
54
+
5
55
  <a name="7.7.1"></a>
6
56
  ## [7.7.1](https://github.com/gemini-testing/html-reporter/compare/v7.7.0...v7.7.1) (2021-11-18)
7
57
 
package/lib/gui/server.js CHANGED
@@ -54,9 +54,10 @@ exports.start = async ({paths, hermione, guiApi, configs}) => {
54
54
  res.json(app.data);
55
55
  });
56
56
 
57
- server.post('/run', async (req, res) => {
57
+ server.post('/run', (req, res) => {
58
58
  try {
59
- await app.run(req.body);
59
+ // do not wait for completion so that response does not hang and browser does not restart it by timeout
60
+ app.run(req.body);
60
61
  res.sendStatus(OK);
61
62
  } catch (e) {
62
63
  res.status(INTERNAL_SERVER_ERROR).send(`Error while trying to run tests: ${e.message}`);
@@ -0,0 +1,38 @@
1
+ 'use strict';
2
+
3
+ import {extend} from 'lodash';
4
+ import React from 'react';
5
+ import {connect} from 'react-redux';
6
+
7
+ import {getVisibleRootSuiteIds} from '../../modules/selectors/tree';
8
+
9
+ const BottomProgressBar = (props) => {
10
+ const {progressBar: {currentRootSuiteId}, visibleRootSuiteIds} = props;
11
+ const suiteIdsIndexMap = React.useMemo(
12
+ () => visibleRootSuiteIds.reduce((map, suiteId, idx) => extend(map, {[suiteId]: idx}), {}),
13
+ [visibleRootSuiteIds]
14
+ );
15
+ const currentRootSuiteIdx = suiteIdsIndexMap[currentRootSuiteId];
16
+ const percent = 100 / (visibleRootSuiteIds.length - 1) * currentRootSuiteIdx;
17
+
18
+ return (
19
+ <div className="bottom-progress-bar">
20
+ <div className='bottom-progress-bar__progress-container'>
21
+ <div className='bottom-progress-bar__progress-bar' style={{width: `${percent}%`}}></div>
22
+ <div className='bottom-progress-bar__counter'>
23
+ {currentRootSuiteId}
24
+ <span>
25
+ {' '}(<strong>{currentRootSuiteIdx + 1}</strong> suite of <strong>{visibleRootSuiteIds.length}</strong>)
26
+ </span>
27
+ </div>
28
+ </div>
29
+ </div>
30
+ );
31
+ };
32
+
33
+ export default connect(
34
+ (state) => ({
35
+ progressBar: state.progressBar,
36
+ visibleRootSuiteIds: getVisibleRootSuiteIds(state)
37
+ }),
38
+ )(BottomProgressBar);
@@ -16,6 +16,7 @@ import CustomScripts from './custom-scripts';
16
16
  import clientEvents from '../../gui/constants/client-events';
17
17
  import FaviconChanger from './favicon-changer';
18
18
  import ExtensionPoint from './extension-point';
19
+ import BottomProgressBar from './bottom-progress-bar';
19
20
 
20
21
  class Gui extends Component {
21
22
  static propTypes = {
@@ -87,6 +88,7 @@ class Gui extends Component {
87
88
  </main>
88
89
  <Loading active={loading.active} content={loading.content} />
89
90
  <ModalContainer />
91
+ <BottomProgressBar />
90
92
  </ExtensionPoint>
91
93
  </Fragment>
92
94
  );
@@ -15,6 +15,7 @@ import MainTree from './main-tree';
15
15
  import CustomScripts from './custom-scripts';
16
16
  import FaviconChanger from './favicon-changer';
17
17
  import ExtensionPoint from './extension-point';
18
+ import BottomProgressBar from './bottom-progress-bar';
18
19
 
19
20
  class Report extends Component {
20
21
  static propTypes = {
@@ -56,6 +57,7 @@ class Report extends Component {
56
57
  <SkippedList />
57
58
  <MainTree />
58
59
  </main>
60
+ <BottomProgressBar />
59
61
  </ExtensionPoint>
60
62
  </Fragment>
61
63
  );
@@ -85,6 +85,7 @@ class SectionBrowser extends Component {
85
85
  <BrowserTitle
86
86
  title={title}
87
87
  browserId={browser.id}
88
+ browserName={browser.name}
88
89
  lastResultId={lastResult.id}
89
90
  handler={this.onToggleSection}
90
91
  />
@@ -14,6 +14,7 @@ class BrowserTitle extends Component {
14
14
  static propTypes = {
15
15
  title: PropTypes.node.isRequired,
16
16
  browserId: PropTypes.string.isRequired,
17
+ browserName: PropTypes.string.isRequired,
17
18
  lastResultId: PropTypes.string.isRequired,
18
19
  handler: PropTypes.func.isRequired,
19
20
  // from store
@@ -30,10 +31,10 @@ class BrowserTitle extends Component {
30
31
  }
31
32
 
32
33
  _getTestUrl() {
33
- const {title, testName, retryIndex} = this.props;
34
+ const {browserName, testName, retryIndex} = this.props;
34
35
 
35
36
  return appendQuery(window.location.href, {
36
- browser: title,
37
+ browser: browserName,
37
38
  testNameFilter: testName,
38
39
  strictMatchFilter: true,
39
40
  retryIndex,
@@ -1,10 +1,12 @@
1
1
  import React, {Component} from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import {connect} from 'react-redux';
4
- import {isEmpty, flatMap} from 'lodash';
4
+ import {isEmpty, flatMap, find, once, throttle} from 'lodash';
5
5
  import {List, AutoSizer, CellMeasurer, CellMeasurerCache, WindowScroller} from 'react-virtualized';
6
6
  import ResizeObserver from 'rc-resize-observer';
7
+ import {bindActionCreators} from 'redux';
7
8
 
9
+ import * as actions from '../modules/actions';
8
10
  import SectionCommon from './section/section-common';
9
11
  import viewModes from '../../constants/view-modes';
10
12
  import {getVisibleRootSuiteIds} from '../modules/selectors/tree';
@@ -18,7 +20,7 @@ class Suites extends Component {
18
20
 
19
21
  _suitesMeasurementCache = new CellMeasurerCache({
20
22
  fixedWidth: true,
21
- defaultHeight: 250
23
+ defaultHeight: 40
22
24
  });
23
25
 
24
26
  _renderRow = ({index, key, style, parent}) => {
@@ -39,7 +41,7 @@ class Suites extends Component {
39
41
  rowIndex={index}
40
42
  >
41
43
  {({measure}) => (
42
- <div key={key} style={style}>
44
+ <div key={key} style={style} className="virtualized__row">
43
45
  <ResizeObserver onResize={measure}>
44
46
  <SectionCommon {...sectionProps} />
45
47
  </ResizeObserver>
@@ -49,6 +51,36 @@ class Suites extends Component {
49
51
  );
50
52
  }
51
53
 
54
+ _recalculateBottomProgressBar = throttle(() => {
55
+ const {actions} = this.props;
56
+ const nodes = Array.from(document.querySelectorAll('.virtualized__row'));
57
+
58
+ let visibleNode = find(nodes.slice().reverse(), (node) => {
59
+ const rect = node.getBoundingClientRect();
60
+ const bottomViewportWindow = document.documentElement.clientHeight - this._suitesMeasurementCache.defaultHeight;
61
+
62
+ return rect.top > 0 && rect.top <= bottomViewportWindow;
63
+ });
64
+
65
+ if (!visibleNode) {
66
+ visibleNode = find(nodes, (node) => {
67
+ const rect = node.getBoundingClientRect();
68
+
69
+ return rect.bottom > 0;
70
+ });
71
+ }
72
+
73
+ if (!visibleNode) {
74
+ return;
75
+ }
76
+
77
+ const suiteId = visibleNode.querySelector('.section__title').textContent;
78
+
79
+ actions.updateBottomProgressBar({currentRootSuiteId: suiteId});
80
+ }, 100)
81
+
82
+ _calculateInitialBottomProgressBar = once(() => setTimeout(this._recalculateBottomProgressBar, 0));
83
+
52
84
  _getSelectedFiltersInfo() {
53
85
  const {viewMode, filteredBrowsers, testNameFilter, strictMatchFilter} = this.props;
54
86
  const msgs = [];
@@ -86,7 +118,7 @@ class Suites extends Component {
86
118
 
87
119
  return (
88
120
  <div className="sections">
89
- <WindowScroller>
121
+ <WindowScroller onScroll={this._recalculateBottomProgressBar}>
90
122
  {({height, isScrolling, onChildScroll, scrollTop}) => (
91
123
  <AutoSizer disableHeight>
92
124
  {({width}) => (
@@ -97,6 +129,7 @@ class Suites extends Component {
97
129
  isScrolling={isScrolling}
98
130
  onScroll={onChildScroll}
99
131
  scrollTop={scrollTop}
132
+ onRowsRendered={this._calculateInitialBottomProgressBar}
100
133
  deferredMeasurementCache={this._suitesMeasurementCache}
101
134
  rowHeight={this._suitesMeasurementCache.rowHeight}
102
135
  rowCount={visibleRootSuiteIds.length}
@@ -119,5 +152,6 @@ export default connect(
119
152
  filteredBrowsers: state.view.filteredBrowsers,
120
153
  testNameFilter: state.view.testNameFilter,
121
154
  strictMatchFilter: state.view.strictMatchFilter
122
- })
155
+ }),
156
+ (dispatch) => ({actions: bindActionCreators(actions, dispatch)})
123
157
  )(Suites);