@midscene/visualizer 1.0.3-beta-20251223004639.0 → 1.0.3

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.
@@ -731,7 +731,7 @@ function Player(props) {
731
731
  onClick: statusOnClick,
732
732
  children: statusIconElement
733
733
  }),
734
- (null == props ? void 0 : props.reportFileContent) ? /*#__PURE__*/ jsx(Tooltip, {
734
+ (null == props ? void 0 : props.reportFileContent) && (null == props ? void 0 : props.canDownloadReport) !== false ? /*#__PURE__*/ jsx(Tooltip, {
735
735
  title: "Download Report",
736
736
  children: /*#__PURE__*/ jsx("div", {
737
737
  className: "status-icon",
@@ -6,7 +6,7 @@ import { emptyResultTip, serverLaunchTip } from "../misc/index.mjs";
6
6
  import { Player } from "../player/index.mjs";
7
7
  import shiny_text from "../shiny-text/index.mjs";
8
8
  import "./index.css";
9
- const PlaygroundResultView = ({ result, loading, serverValid, serviceMode, replayScriptsInfo, replayCounter, loadingProgressText, verticalMode = false, notReadyMessage, fitMode, autoZoom, actionType })=>{
9
+ const PlaygroundResultView = ({ result, loading, serverValid, serviceMode, replayScriptsInfo, replayCounter, loadingProgressText, verticalMode = false, notReadyMessage, fitMode, autoZoom, actionType, canDownloadReport })=>{
10
10
  let resultWrapperClassName = 'result-wrapper';
11
11
  if (verticalMode) resultWrapperClassName += ' vertical-mode-result';
12
12
  if (replayScriptsInfo && verticalMode) resultWrapperClassName += ' result-wrapper-compact';
@@ -31,10 +31,66 @@ const PlaygroundResultView = ({ result, loading, serverValid, serviceMode, repla
31
31
  })
32
32
  ]
33
33
  });
34
- else if (null == result ? void 0 : result.error) resultDataToShow = /*#__PURE__*/ jsx("pre", {
35
- children: null == result ? void 0 : result.error
36
- });
37
- else if (shouldPrioritizeResult && (null == result ? void 0 : result.result) !== void 0 && replayScriptsInfo) {
34
+ else if (null == result ? void 0 : result.error) {
35
+ const errorNode = /*#__PURE__*/ jsx("pre", {
36
+ style: {
37
+ color: '#ff4d4f',
38
+ whiteSpace: 'pre-wrap'
39
+ },
40
+ children: null == result ? void 0 : result.error
41
+ });
42
+ resultDataToShow = result.reportHTML || replayScriptsInfo ? /*#__PURE__*/ jsxs("div", {
43
+ style: {
44
+ display: 'flex',
45
+ flexDirection: 'column',
46
+ gap: '16px',
47
+ height: '100%'
48
+ },
49
+ children: [
50
+ /*#__PURE__*/ jsxs("div", {
51
+ style: {
52
+ flex: '0 0 auto',
53
+ maxHeight: '40%',
54
+ overflow: 'auto'
55
+ },
56
+ children: [
57
+ /*#__PURE__*/ jsx("div", {
58
+ style: {
59
+ fontWeight: 'bold',
60
+ marginBottom: '8px'
61
+ },
62
+ children: "Error:"
63
+ }),
64
+ errorNode
65
+ ]
66
+ }),
67
+ /*#__PURE__*/ jsxs("div", {
68
+ style: {
69
+ flex: '1 1 auto',
70
+ minHeight: 0
71
+ },
72
+ children: [
73
+ /*#__PURE__*/ jsx("div", {
74
+ style: {
75
+ fontWeight: 'bold',
76
+ marginBottom: '8px'
77
+ },
78
+ children: "Report:"
79
+ }),
80
+ /*#__PURE__*/ jsx(Player, {
81
+ replayScripts: null == replayScriptsInfo ? void 0 : replayScriptsInfo.scripts,
82
+ imageWidth: null == replayScriptsInfo ? void 0 : replayScriptsInfo.width,
83
+ imageHeight: null == replayScriptsInfo ? void 0 : replayScriptsInfo.height,
84
+ reportFileContent: result.reportHTML || null,
85
+ fitMode: fitMode,
86
+ autoZoom: autoZoom,
87
+ canDownloadReport: null != canDownloadReport ? canDownloadReport : 'In-Browser' !== serviceMode
88
+ }, replayCounter)
89
+ ]
90
+ })
91
+ ]
92
+ }) : errorNode;
93
+ } else if (shouldPrioritizeResult && (null == result ? void 0 : result.result) !== void 0 && replayScriptsInfo) {
38
94
  const resultOutput = 'string' == typeof (null == result ? void 0 : result.result) ? /*#__PURE__*/ jsx("pre", {
39
95
  children: null == result ? void 0 : result.result
40
96
  }) : /*#__PURE__*/ jsx("pre", {
@@ -83,7 +139,8 @@ const PlaygroundResultView = ({ result, loading, serverValid, serviceMode, repla
83
139
  imageHeight: replayScriptsInfo.height,
84
140
  reportFileContent: reportContent,
85
141
  fitMode: fitMode,
86
- autoZoom: autoZoom
142
+ autoZoom: autoZoom,
143
+ canDownloadReport: null != canDownloadReport ? canDownloadReport : 'In-Browser' !== serviceMode
87
144
  }, replayCounter)
88
145
  ]
89
146
  })
@@ -97,7 +154,8 @@ const PlaygroundResultView = ({ result, loading, serverValid, serviceMode, repla
97
154
  imageHeight: replayScriptsInfo.height,
98
155
  reportFileContent: reportContent,
99
156
  fitMode: fitMode,
100
- autoZoom: autoZoom
157
+ autoZoom: autoZoom,
158
+ canDownloadReport: null != canDownloadReport ? canDownloadReport : 'In-Browser' !== serviceMode
101
159
  }, replayCounter);
102
160
  } else if (shouldPrioritizeResult && (null == result ? void 0 : result.result) !== void 0 && (null == result ? void 0 : result.reportHTML)) {
103
161
  const resultOutput = 'string' == typeof (null == result ? void 0 : result.result) ? /*#__PURE__*/ jsx("pre", {
@@ -144,7 +202,8 @@ const PlaygroundResultView = ({ result, loading, serverValid, serviceMode, repla
144
202
  /*#__PURE__*/ jsx(Player, {
145
203
  reportFileContent: result.reportHTML,
146
204
  fitMode: fitMode,
147
- autoZoom: autoZoom
205
+ autoZoom: autoZoom,
206
+ canDownloadReport: null != canDownloadReport ? canDownloadReport : 'In-Browser' !== serviceMode
148
207
  }, replayCounter)
149
208
  ]
150
209
  })
@@ -158,7 +217,8 @@ const PlaygroundResultView = ({ result, loading, serverValid, serviceMode, repla
158
217
  else if (null == result ? void 0 : result.reportHTML) resultDataToShow = /*#__PURE__*/ jsx(Player, {
159
218
  reportFileContent: result.reportHTML,
160
219
  fitMode: fitMode,
161
- autoZoom: autoZoom
220
+ autoZoom: autoZoom,
221
+ canDownloadReport: null != canDownloadReport ? canDownloadReport : 'In-Browser' !== serviceMode
162
222
  }, replayCounter);
163
223
  else if ((null == result ? void 0 : result.result) !== void 0) resultDataToShow = 'string' == typeof (null == result ? void 0 : result.result) ? /*#__PURE__*/ jsx("pre", {
164
224
  children: null == result ? void 0 : result.result
@@ -770,7 +770,7 @@ function Player(props) {
770
770
  onClick: statusOnClick,
771
771
  children: statusIconElement
772
772
  }),
773
- (null == props ? void 0 : props.reportFileContent) ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Tooltip, {
773
+ (null == props ? void 0 : props.reportFileContent) && (null == props ? void 0 : props.canDownloadReport) !== false ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Tooltip, {
774
774
  title: "Download Report",
775
775
  children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
776
776
  className: "status-icon",
@@ -44,7 +44,7 @@ const external_player_index_js_namespaceObject = require("../player/index.js");
44
44
  const external_shiny_text_index_js_namespaceObject = require("../shiny-text/index.js");
45
45
  var external_shiny_text_index_js_default = /*#__PURE__*/ __webpack_require__.n(external_shiny_text_index_js_namespaceObject);
46
46
  require("./index.css");
47
- const PlaygroundResultView = ({ result, loading, serverValid, serviceMode, replayScriptsInfo, replayCounter, loadingProgressText, verticalMode = false, notReadyMessage, fitMode, autoZoom, actionType })=>{
47
+ const PlaygroundResultView = ({ result, loading, serverValid, serviceMode, replayScriptsInfo, replayCounter, loadingProgressText, verticalMode = false, notReadyMessage, fitMode, autoZoom, actionType, canDownloadReport })=>{
48
48
  let resultWrapperClassName = 'result-wrapper';
49
49
  if (verticalMode) resultWrapperClassName += ' vertical-mode-result';
50
50
  if (replayScriptsInfo && verticalMode) resultWrapperClassName += ' result-wrapper-compact';
@@ -69,10 +69,66 @@ const PlaygroundResultView = ({ result, loading, serverValid, serviceMode, repla
69
69
  })
70
70
  ]
71
71
  });
72
- else if (null == result ? void 0 : result.error) resultDataToShow = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("pre", {
73
- children: null == result ? void 0 : result.error
74
- });
75
- else if (shouldPrioritizeResult && (null == result ? void 0 : result.result) !== void 0 && replayScriptsInfo) {
72
+ else if (null == result ? void 0 : result.error) {
73
+ const errorNode = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("pre", {
74
+ style: {
75
+ color: '#ff4d4f',
76
+ whiteSpace: 'pre-wrap'
77
+ },
78
+ children: null == result ? void 0 : result.error
79
+ });
80
+ resultDataToShow = result.reportHTML || replayScriptsInfo ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
81
+ style: {
82
+ display: 'flex',
83
+ flexDirection: 'column',
84
+ gap: '16px',
85
+ height: '100%'
86
+ },
87
+ children: [
88
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
89
+ style: {
90
+ flex: '0 0 auto',
91
+ maxHeight: '40%',
92
+ overflow: 'auto'
93
+ },
94
+ children: [
95
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
96
+ style: {
97
+ fontWeight: 'bold',
98
+ marginBottom: '8px'
99
+ },
100
+ children: "Error:"
101
+ }),
102
+ errorNode
103
+ ]
104
+ }),
105
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
106
+ style: {
107
+ flex: '1 1 auto',
108
+ minHeight: 0
109
+ },
110
+ children: [
111
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
112
+ style: {
113
+ fontWeight: 'bold',
114
+ marginBottom: '8px'
115
+ },
116
+ children: "Report:"
117
+ }),
118
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_player_index_js_namespaceObject.Player, {
119
+ replayScripts: null == replayScriptsInfo ? void 0 : replayScriptsInfo.scripts,
120
+ imageWidth: null == replayScriptsInfo ? void 0 : replayScriptsInfo.width,
121
+ imageHeight: null == replayScriptsInfo ? void 0 : replayScriptsInfo.height,
122
+ reportFileContent: result.reportHTML || null,
123
+ fitMode: fitMode,
124
+ autoZoom: autoZoom,
125
+ canDownloadReport: null != canDownloadReport ? canDownloadReport : 'In-Browser' !== serviceMode
126
+ }, replayCounter)
127
+ ]
128
+ })
129
+ ]
130
+ }) : errorNode;
131
+ } else if (shouldPrioritizeResult && (null == result ? void 0 : result.result) !== void 0 && replayScriptsInfo) {
76
132
  const resultOutput = 'string' == typeof (null == result ? void 0 : result.result) ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("pre", {
77
133
  children: null == result ? void 0 : result.result
78
134
  }) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("pre", {
@@ -121,7 +177,8 @@ const PlaygroundResultView = ({ result, loading, serverValid, serviceMode, repla
121
177
  imageHeight: replayScriptsInfo.height,
122
178
  reportFileContent: reportContent,
123
179
  fitMode: fitMode,
124
- autoZoom: autoZoom
180
+ autoZoom: autoZoom,
181
+ canDownloadReport: null != canDownloadReport ? canDownloadReport : 'In-Browser' !== serviceMode
125
182
  }, replayCounter)
126
183
  ]
127
184
  })
@@ -135,7 +192,8 @@ const PlaygroundResultView = ({ result, loading, serverValid, serviceMode, repla
135
192
  imageHeight: replayScriptsInfo.height,
136
193
  reportFileContent: reportContent,
137
194
  fitMode: fitMode,
138
- autoZoom: autoZoom
195
+ autoZoom: autoZoom,
196
+ canDownloadReport: null != canDownloadReport ? canDownloadReport : 'In-Browser' !== serviceMode
139
197
  }, replayCounter);
140
198
  } else if (shouldPrioritizeResult && (null == result ? void 0 : result.result) !== void 0 && (null == result ? void 0 : result.reportHTML)) {
141
199
  const resultOutput = 'string' == typeof (null == result ? void 0 : result.result) ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("pre", {
@@ -182,7 +240,8 @@ const PlaygroundResultView = ({ result, loading, serverValid, serviceMode, repla
182
240
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_player_index_js_namespaceObject.Player, {
183
241
  reportFileContent: result.reportHTML,
184
242
  fitMode: fitMode,
185
- autoZoom: autoZoom
243
+ autoZoom: autoZoom,
244
+ canDownloadReport: null != canDownloadReport ? canDownloadReport : 'In-Browser' !== serviceMode
186
245
  }, replayCounter)
187
246
  ]
188
247
  })
@@ -196,7 +255,8 @@ const PlaygroundResultView = ({ result, loading, serverValid, serviceMode, repla
196
255
  else if (null == result ? void 0 : result.reportHTML) resultDataToShow = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_player_index_js_namespaceObject.Player, {
197
256
  reportFileContent: result.reportHTML,
198
257
  fitMode: fitMode,
199
- autoZoom: autoZoom
258
+ autoZoom: autoZoom,
259
+ canDownloadReport: null != canDownloadReport ? canDownloadReport : 'In-Browser' !== serviceMode
200
260
  }, replayCounter);
201
261
  else if ((null == result ? void 0 : result.result) !== void 0) resultDataToShow = 'string' == typeof (null == result ? void 0 : result.result) ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("pre", {
202
262
  children: null == result ? void 0 : result.result
@@ -9,4 +9,5 @@ export declare function Player(props?: {
9
9
  key?: string | number;
10
10
  fitMode?: 'width' | 'height';
11
11
  autoZoom?: boolean;
12
+ canDownloadReport?: boolean;
12
13
  }): import("react").JSX.Element;
@@ -16,6 +16,7 @@ interface PlaygroundResultProps {
16
16
  fitMode?: 'width' | 'height';
17
17
  autoZoom?: boolean;
18
18
  actionType?: string;
19
+ canDownloadReport?: boolean;
19
20
  }
20
21
  export declare const PlaygroundResultView: React.FC<PlaygroundResultProps>;
21
22
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midscene/visualizer",
3
- "version": "1.0.3-beta-20251223004639.0",
3
+ "version": "1.0.3",
4
4
  "repository": "https://github.com/web-infra-dev/midscene",
5
5
  "homepage": "https://midscenejs.com/",
6
6
  "types": "./dist/types/index.d.ts",
@@ -60,10 +60,10 @@
60
60
  "antd": "^5.21.6",
61
61
  "buffer": "6.0.3",
62
62
  "dayjs": "^1.11.11",
63
- "@midscene/core": "1.0.3-beta-20251223004639.0",
64
- "@midscene/shared": "1.0.3-beta-20251223004639.0",
65
- "@midscene/playground": "1.0.3-beta-20251223004639.0",
66
- "@midscene/web": "1.0.3-beta-20251223004639.0"
63
+ "@midscene/core": "1.0.3",
64
+ "@midscene/shared": "1.0.3",
65
+ "@midscene/playground": "1.0.3",
66
+ "@midscene/web": "1.0.3"
67
67
  },
68
68
  "license": "MIT",
69
69
  "scripts": {