creevey 0.9.0-beta.13 → 0.9.0-beta.14

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.
Files changed (216) hide show
  1. package/.yarn/install-state.gz +0 -0
  2. package/.yarnrc.yml +1 -0
  3. package/lib/cjs/cli.js +1 -0
  4. package/lib/cjs/client/addon/Manager.js +151 -223
  5. package/lib/cjs/client/addon/components/Addon.js +2 -9
  6. package/lib/cjs/client/addon/components/Icons.js +1 -7
  7. package/lib/cjs/client/addon/components/Panel.js +5 -18
  8. package/lib/cjs/client/addon/components/TestSelect.js +12 -25
  9. package/lib/cjs/client/addon/components/Tools.js +17 -28
  10. package/lib/cjs/client/addon/decorator.js +1 -4
  11. package/lib/cjs/client/addon/index.js +0 -4
  12. package/lib/cjs/client/addon/preset.js +3 -12
  13. package/lib/cjs/client/addon/preview.js +1 -4
  14. package/lib/cjs/client/addon/readyForCapture.js +1 -4
  15. package/lib/cjs/client/addon/register.js +11 -26
  16. package/lib/cjs/client/addon/utils.js +1 -9
  17. package/lib/cjs/client/addon/withCreevey.js +55 -134
  18. package/lib/cjs/client/shared/components/ImagesView/BlendView.js +5 -17
  19. package/lib/cjs/client/shared/components/ImagesView/ImagesView.js +8 -24
  20. package/lib/cjs/client/shared/components/ImagesView/SideBySideView.js +7 -23
  21. package/lib/cjs/client/shared/components/ImagesView/SlideView.js +7 -22
  22. package/lib/cjs/client/shared/components/ImagesView/SwapView.js +5 -17
  23. package/lib/cjs/client/shared/components/ImagesView/index.js +0 -5
  24. package/lib/cjs/client/shared/components/PageFooter/PageFooter.js +1 -8
  25. package/lib/cjs/client/shared/components/PageFooter/Paging.js +2 -19
  26. package/lib/cjs/client/shared/components/PageHeader/ImagePreview.js +21 -17
  27. package/lib/cjs/client/shared/components/PageHeader/PageHeader.js +5 -24
  28. package/lib/cjs/client/shared/components/ResultsPage.js +9 -37
  29. package/lib/cjs/client/shared/creeveyClientApi.js +3 -13
  30. package/lib/cjs/client/shared/helpers.js +21 -75
  31. package/lib/cjs/client/shared/viewMode.js +2 -6
  32. package/lib/cjs/client/web/192.js +1 -0
  33. package/lib/cjs/client/web/632.js +43 -0
  34. package/lib/cjs/client/web/794.js +1 -0
  35. package/lib/cjs/client/web/main.js +78 -1
  36. package/lib/cjs/client/web/main.js.LICENSE.txt +0 -15
  37. package/lib/cjs/creevey.js +5 -21
  38. package/lib/cjs/index.js +0 -15
  39. package/lib/cjs/server/config.js +13 -33
  40. package/lib/cjs/server/docker.js +5 -27
  41. package/lib/cjs/server/index.js +8 -33
  42. package/lib/cjs/server/logger.js +5 -19
  43. package/lib/cjs/server/master/api.js +1 -14
  44. package/lib/cjs/server/master/index.js +15 -46
  45. package/lib/cjs/server/master/master.js +6 -21
  46. package/lib/cjs/server/master/pool.js +2 -37
  47. package/lib/cjs/server/master/runner.js +15 -42
  48. package/lib/cjs/server/master/server.js +5 -27
  49. package/lib/cjs/server/messages.js +7 -53
  50. package/lib/cjs/server/selenium/browser.js +51 -136
  51. package/lib/cjs/server/selenium/index.js +0 -4
  52. package/lib/cjs/server/selenium/selenoid.js +7 -33
  53. package/lib/cjs/server/stories.js +25 -30
  54. package/lib/cjs/server/storybook/providers/browser.js +5 -18
  55. package/lib/cjs/server/storybook/providers/hybrid.js +9 -29
  56. package/lib/cjs/server/testsFiles/parser.js +3 -19
  57. package/lib/cjs/server/testsFiles/register.js +7 -9
  58. package/lib/cjs/server/update.js +3 -20
  59. package/lib/cjs/server/utils.js +9 -41
  60. package/lib/cjs/server/worker/chai-image.js +1 -27
  61. package/lib/cjs/server/worker/helpers.js +2 -12
  62. package/lib/cjs/server/worker/index.js +1 -3
  63. package/lib/cjs/server/worker/reporter.js +8 -24
  64. package/lib/cjs/server/worker/worker.js +5 -49
  65. package/lib/cjs/shared/index.js +22 -36
  66. package/lib/cjs/shared/serializeRegExp.js +0 -8
  67. package/lib/cjs/types.js +4 -14
  68. package/lib/esm/cli.js +1 -1
  69. package/lib/esm/client/addon/Manager.js +151 -214
  70. package/lib/esm/client/addon/components/Panel.js +4 -6
  71. package/lib/esm/client/addon/components/TestSelect.js +11 -17
  72. package/lib/esm/client/addon/components/Tools.js +15 -14
  73. package/lib/esm/client/addon/preset.js +2 -8
  74. package/lib/esm/client/addon/readyForCapture.js +1 -3
  75. package/lib/esm/client/addon/register.js +6 -8
  76. package/lib/esm/client/addon/utils.js +0 -5
  77. package/lib/esm/client/addon/withCreevey.js +54 -116
  78. package/lib/esm/client/shared/components/ImagesView/BlendView.js +1 -1
  79. package/lib/esm/client/shared/components/ImagesView/ImagesView.js +6 -8
  80. package/lib/esm/client/shared/components/ImagesView/SideBySideView.js +3 -4
  81. package/lib/esm/client/shared/components/ImagesView/SlideView.js +3 -3
  82. package/lib/esm/client/shared/components/ImagesView/SwapView.js +1 -1
  83. package/lib/esm/client/shared/components/PageFooter/Paging.js +1 -11
  84. package/lib/esm/client/shared/components/PageHeader/ImagePreview.js +18 -7
  85. package/lib/esm/client/shared/components/PageHeader/PageHeader.js +3 -8
  86. package/lib/esm/client/shared/components/ResultsPage.js +6 -15
  87. package/lib/esm/client/shared/creeveyClientApi.js +3 -10
  88. package/lib/esm/client/shared/helpers.js +21 -47
  89. package/lib/esm/client/web/192.js +1 -0
  90. package/lib/esm/client/web/632.js +43 -0
  91. package/lib/esm/client/web/794.js +1 -0
  92. package/lib/esm/client/web/index.html +19 -0
  93. package/lib/esm/client/web/main.js +79 -0
  94. package/lib/esm/client/web/main.js.LICENSE.txt +34 -0
  95. package/lib/esm/creevey.js +4 -8
  96. package/lib/esm/index.js +0 -1
  97. package/lib/esm/server/config.js +7 -14
  98. package/lib/esm/server/docker.js +4 -12
  99. package/lib/esm/server/index.js +7 -21
  100. package/lib/esm/server/logger.js +0 -1
  101. package/lib/esm/server/master/api.js +0 -9
  102. package/lib/esm/server/master/index.js +15 -32
  103. package/lib/esm/server/master/master.js +2 -7
  104. package/lib/esm/server/master/pool.js +0 -23
  105. package/lib/esm/server/master/runner.js +14 -27
  106. package/lib/esm/server/master/server.js +4 -9
  107. package/lib/esm/server/messages.js +6 -38
  108. package/lib/esm/server/selenium/browser.js +50 -114
  109. package/lib/esm/server/selenium/selenoid.js +6 -17
  110. package/lib/esm/server/stories.js +24 -20
  111. package/lib/esm/server/storybook/providers/browser.js +4 -8
  112. package/lib/esm/server/storybook/providers/hybrid.js +6 -14
  113. package/lib/esm/server/testsFiles/parser.js +0 -6
  114. package/lib/esm/server/testsFiles/register.js +5 -2
  115. package/lib/esm/server/update.js +0 -8
  116. package/lib/esm/server/utils.js +3 -11
  117. package/lib/esm/server/worker/chai-image.js +0 -21
  118. package/lib/esm/server/worker/helpers.js +2 -9
  119. package/lib/esm/server/worker/reporter.js +7 -10
  120. package/lib/esm/server/worker/worker.js +4 -25
  121. package/lib/esm/shared/index.js +24 -25
  122. package/lib/esm/types.js +4 -1
  123. package/lib/types/client/addon/Manager.d.ts +1 -1
  124. package/lib/types/client/addon/components/Addon.d.ts +1 -0
  125. package/lib/types/client/addon/components/Icons.d.ts +1 -0
  126. package/lib/types/client/addon/components/Panel.d.ts +1 -0
  127. package/lib/types/client/addon/components/TestSelect.d.ts +1 -0
  128. package/lib/types/client/addon/components/Tools.d.ts +1 -0
  129. package/lib/types/client/addon/decorator.d.ts +1 -1
  130. package/lib/types/client/addon/preset.d.ts +2 -2
  131. package/lib/types/client/addon/preview.d.ts +1 -1
  132. package/lib/types/client/addon/withCreevey.d.ts +3 -2
  133. package/lib/types/client/shared/components/ImagesView/BlendView.d.ts +3 -1
  134. package/lib/types/client/shared/components/ImagesView/ImagesView.d.ts +1 -0
  135. package/lib/types/client/shared/components/ImagesView/SideBySideView.d.ts +3 -1
  136. package/lib/types/client/shared/components/ImagesView/SlideView.d.ts +3 -1
  137. package/lib/types/client/shared/components/ImagesView/SwapView.d.ts +3 -1
  138. package/lib/types/client/shared/components/PageFooter/PageFooter.d.ts +1 -0
  139. package/lib/types/client/shared/components/PageFooter/Paging.d.ts +1 -0
  140. package/lib/types/client/shared/components/PageHeader/ImagePreview.d.ts +3 -1
  141. package/lib/types/client/shared/components/PageHeader/PageHeader.d.ts +1 -0
  142. package/lib/types/client/shared/components/ResultsPage.d.ts +3 -1
  143. package/lib/types/client/web/CreeveyApp.d.ts +1 -0
  144. package/lib/types/client/web/CreeveyLoader.d.ts +2 -1
  145. package/lib/types/client/web/CreeveyView/SideBar/Checkbox.d.ts +4 -1
  146. package/lib/types/client/web/CreeveyView/SideBar/Search.d.ts +1 -0
  147. package/lib/types/client/web/CreeveyView/SideBar/SideBarHeader.d.ts +1 -0
  148. package/lib/types/client/web/CreeveyView/SideBar/SuiteLink.d.ts +19 -14
  149. package/lib/types/client/web/CreeveyView/SideBar/TestLink.d.ts +1 -0
  150. package/lib/types/client/web/CreeveyView/SideBar/TestStatusIcon.d.ts +3 -1
  151. package/lib/types/client/web/CreeveyView/SideBar/TestsStatus.d.ts +3 -1
  152. package/lib/types/client/web/CreeveyView/SideBar/Toggle.d.ts +1 -0
  153. package/lib/types/shared/index.d.ts +1 -1
  154. package/lib/types/types.d.ts +7 -28
  155. package/package.json +60 -78
  156. package/lib/cjs/client/addon/preset.ie11.js +0 -74
  157. package/lib/cjs/client/addon/preset.sb7.js +0 -19
  158. package/lib/cjs/client/web/142.js +0 -2
  159. package/lib/cjs/client/web/142.js.LICENSE.txt +0 -12
  160. package/lib/cjs/client/web/32.js +0 -1
  161. package/lib/cjs/client/web/551.js +0 -1
  162. package/lib/cjs/client/web/566.js +0 -2
  163. package/lib/cjs/client/web/566.js.LICENSE.txt +0 -31
  164. package/lib/cjs/client/web/691.js +0 -2
  165. package/lib/cjs/client/web/691.js.LICENSE.txt +0 -8
  166. package/lib/cjs/client/web/725.js +0 -1
  167. package/lib/cjs/server/extract.js +0 -46
  168. package/lib/cjs/server/loaders/babel/creevey-plugin.js +0 -86
  169. package/lib/cjs/server/loaders/babel/helpers.js +0 -469
  170. package/lib/cjs/server/loaders/babel/register.js +0 -124
  171. package/lib/cjs/server/loaders/hooks/mdx.js +0 -30
  172. package/lib/cjs/server/loaders/hooks/svelte.js +0 -65
  173. package/lib/cjs/server/loaders/webpack/compile.js +0 -269
  174. package/lib/cjs/server/loaders/webpack/creevey-loader.js +0 -172
  175. package/lib/cjs/server/loaders/webpack/dummy-hmr.js +0 -39
  176. package/lib/cjs/server/loaders/webpack/mdx-loader.js +0 -72
  177. package/lib/cjs/server/loaders/webpack/start.js +0 -41
  178. package/lib/cjs/server/storybook/entry.js +0 -53
  179. package/lib/cjs/server/storybook/helpers.js +0 -158
  180. package/lib/cjs/server/storybook/providers/nodejs.js +0 -239
  181. package/lib/esm/client/addon/preset.ie11.js +0 -59
  182. package/lib/esm/client/addon/preset.sb7.js +0 -8
  183. package/lib/esm/server/extract.js +0 -32
  184. package/lib/esm/server/loaders/babel/creevey-plugin.js +0 -72
  185. package/lib/esm/server/loaders/babel/helpers.js +0 -452
  186. package/lib/esm/server/loaders/babel/register.js +0 -103
  187. package/lib/esm/server/loaders/hooks/mdx.js +0 -15
  188. package/lib/esm/server/loaders/hooks/svelte.js +0 -49
  189. package/lib/esm/server/loaders/webpack/compile.js +0 -246
  190. package/lib/esm/server/loaders/webpack/creevey-loader.js +0 -152
  191. package/lib/esm/server/loaders/webpack/dummy-hmr.js +0 -32
  192. package/lib/esm/server/loaders/webpack/mdx-loader.js +0 -58
  193. package/lib/esm/server/loaders/webpack/start.js +0 -27
  194. package/lib/esm/server/storybook/entry.js +0 -27
  195. package/lib/esm/server/storybook/helpers.js +0 -97
  196. package/lib/esm/server/storybook/providers/nodejs.js +0 -216
  197. package/lib/types/client/addon/preset.ie11.d.ts +0 -10
  198. package/lib/types/client/addon/preset.sb7.d.ts +0 -2
  199. package/lib/types/server/extract.d.ts +0 -2
  200. package/lib/types/server/loaders/babel/creevey-plugin.d.ts +0 -1
  201. package/lib/types/server/loaders/babel/helpers.d.ts +0 -19
  202. package/lib/types/server/loaders/babel/register.d.ts +0 -5
  203. package/lib/types/server/loaders/hooks/mdx.d.ts +0 -1
  204. package/lib/types/server/loaders/hooks/svelte.d.ts +0 -1
  205. package/lib/types/server/loaders/webpack/compile.d.ts +0 -2
  206. package/lib/types/server/loaders/webpack/creevey-loader.d.ts +0 -4
  207. package/lib/types/server/loaders/webpack/dummy-hmr.d.ts +0 -10
  208. package/lib/types/server/loaders/webpack/mdx-loader.d.ts +0 -6
  209. package/lib/types/server/loaders/webpack/start.d.ts +0 -1
  210. package/lib/types/server/storybook/entry.d.ts +0 -17
  211. package/lib/types/server/storybook/helpers.d.ts +0 -24
  212. package/lib/types/server/storybook/providers/nodejs.d.ts +0 -9
  213. package/preset/ie11.js +0 -5
  214. package/preset/index.js +0 -9
  215. package/preset/sb7.js +0 -5
  216. package/types/mdx.d.ts +0 -7
@@ -13,10 +13,9 @@ export function Paging(props) {
13
13
  {
14
14
  return /*#__PURE__*/React.createElement(StyledButton, {
15
15
  disabled: true,
16
- key: "dots".concat(index < 5 ? 'Left' : 'Right')
16
+ key: `dots${index < 5 ? 'Left' : 'Right'}`
17
17
  }, '...');
18
18
  }
19
-
20
19
  case 'forward':
21
20
  {
22
21
  const disabled = props.activePage === props.pagesCount;
@@ -29,7 +28,6 @@ export function Paging(props) {
29
28
  icon: "arrowright"
30
29
  })));
31
30
  }
32
-
33
31
  default:
34
32
  {
35
33
  return /*#__PURE__*/React.createElement(StyledButton, {
@@ -41,16 +39,13 @@ export function Paging(props) {
41
39
  }
42
40
  }
43
41
  };
44
-
45
42
  const goToPage = pageNumber => {
46
43
  if (1 <= pageNumber && pageNumber !== props.activePage && pageNumber <= props.pagesCount) {
47
44
  props.onPageChange(pageNumber);
48
45
  }
49
46
  };
50
-
51
47
  return /*#__PURE__*/React.createElement("div", null, getItems(props.activePage, props.pagesCount).map(renderItem));
52
48
  }
53
-
54
49
  function getItems(active, total) {
55
50
  const result = [];
56
51
  const left = Math.max(Math.min(active - 2, total - 4), 1);
@@ -59,22 +54,17 @@ function getItems(active, total) {
59
54
  const from = hasLeftDots ? left : 1;
60
55
  const hasRightDots = right < total - 2;
61
56
  const to = hasRightDots ? right : total;
62
-
63
57
  if (hasLeftDots) {
64
58
  result.push(1, '.');
65
59
  }
66
-
67
60
  for (let i = from; i <= to; ++i) {
68
61
  result.push(i);
69
62
  }
70
-
71
63
  if (hasRightDots) {
72
64
  result.push('.');
73
65
  }
74
-
75
66
  if (hasRightDots && isFinite(total)) {
76
67
  result.push(total);
77
68
  }
78
-
79
69
  return result.concat('forward');
80
70
  }
@@ -29,18 +29,31 @@ const Image = withTheme(styled.img(_ref2 => {
29
29
  theme
30
30
  } = _ref2;
31
31
  return {
32
- maxHeight: "".concat(IMG_SIZE, "px"),
33
- width: "".concat(IMG_SIZE, "px"),
32
+ maxHeight: `${IMG_SIZE}px`,
33
+ width: `${IMG_SIZE}px`,
34
34
  overflow: 'hidden',
35
35
  transform: hasBorder ? 'translateY(2px)' : undefined,
36
36
  '&::before': {
37
37
  content: "' '",
38
38
  display: 'block',
39
- height: "".concat(IMG_SIZE - 8, "px"),
40
- width: "".concat(IMG_SIZE - 8, "px"),
39
+ height: `${IMG_SIZE - 8}px`,
40
+ width: `${IMG_SIZE - 8}px`,
41
41
  margin: '4px',
42
42
  backgroundColor: backgroundColor,
43
- backgroundImage: "linear-gradient(\n 45deg,\n rgba(0, 0, 0, 0) ".concat(DIAG_LENGTH / 2 - 0.5, "px,\n ").concat(theme.color.medium, " ").concat(DIAG_LENGTH / 2 - 0.5, "px,\n ").concat(theme.color.medium, " ").concat(DIAG_LENGTH / 2 + 0.5, "px,\n rgba(0, 0, 0, 0) ").concat(DIAG_LENGTH / 2 + 0.5, "px\n ),\n linear-gradient(\n 315deg,\n rgba(0, 0, 0, 0) ").concat(DIAG_LENGTH / 2 + 0.2, "px,\n ").concat(theme.color.medium, " ").concat(DIAG_LENGTH / 2 + 0.2, "px,\n ").concat(theme.color.medium, " ").concat(DIAG_LENGTH / 2 + 1.2, "px,\n rgba(0, 0, 0, 0) ").concat(DIAG_LENGTH / 2 + 1.2, "px\n )")
43
+ backgroundImage: `linear-gradient(
44
+ 45deg,
45
+ rgba(0, 0, 0, 0) ${DIAG_LENGTH / 2 - 0.5}px,
46
+ ${theme.color.medium} ${DIAG_LENGTH / 2 - 0.5}px,
47
+ ${theme.color.medium} ${DIAG_LENGTH / 2 + 0.5}px,
48
+ rgba(0, 0, 0, 0) ${DIAG_LENGTH / 2 + 0.5}px
49
+ ),
50
+ linear-gradient(
51
+ 315deg,
52
+ rgba(0, 0, 0, 0) ${DIAG_LENGTH / 2 + 0.2}px,
53
+ ${theme.color.medium} ${DIAG_LENGTH / 2 + 0.2}px,
54
+ ${theme.color.medium} ${DIAG_LENGTH / 2 + 1.2}px,
55
+ rgba(0, 0, 0, 0) ${DIAG_LENGTH / 2 + 1.2}px
56
+ )`
44
57
  }
45
58
  };
46
59
  }));
@@ -53,9 +66,7 @@ export const ImagePreview = withTheme(_ref3 => {
53
66
  theme,
54
67
  error
55
68
  } = _ref3;
56
-
57
69
  const handleClick = () => onClick(imageName);
58
-
59
70
  return /*#__PURE__*/React.createElement(Button, {
60
71
  onClick: handleClick,
61
72
  borderColor: isActive ? theme.barSelectedColor : error ? theme.color.negative : undefined
@@ -49,8 +49,6 @@ const ImagesEntriesContainer = styled.div({
49
49
  margin: '16px 0 8px'
50
50
  });
51
51
  export function PageHeader(_ref3) {
52
- var _, _imageEntires$, _images$imageName;
53
-
54
52
  let {
55
53
  title,
56
54
  images = {},
@@ -63,13 +61,10 @@ export function PageHeader(_ref3) {
63
61
  onViewModeChange
64
62
  } = _ref3;
65
63
  const imageEntires = Object.entries(images);
66
- const [imageName, setImageName] = useState((_ = ((_imageEntires$ = imageEntires[0]) !== null && _imageEntires$ !== void 0 ? _imageEntires$ : [])[0]) !== null && _ !== void 0 ? _ : '');
67
-
64
+ const [imageName, setImageName] = useState((imageEntires[0] ?? [])[0] ?? '');
68
65
  const handleImageChange = name => (setImageName(name), onImageChange(name));
69
-
70
66
  const handleViewModeChange = mode => onViewModeChange(mode);
71
-
72
- const error = errorMessage || imagesWithError.includes(imageName) ? ((_images$imageName = images[imageName]) === null || _images$imageName === void 0 ? void 0 : _images$imageName.error) || errorMessage : null;
67
+ const error = errorMessage || imagesWithError.includes(imageName) ? images[imageName]?.error || errorMessage : null;
73
68
  return showTitle || error || imageEntires.length > 1 || showViewModes ? /*#__PURE__*/React.createElement(Container, null, showTitle && /*#__PURE__*/React.createElement(H1, null, title.flatMap(token => [token, /*#__PURE__*/React.createElement(HeaderDivider, {
74
69
  key: token
75
70
  }, "/")]).slice(0, -1)), error && /*#__PURE__*/React.createElement(ErrorContainer, null, /*#__PURE__*/React.createElement(Icons, {
@@ -79,7 +74,7 @@ export function PageHeader(_ref3) {
79
74
  return /*#__PURE__*/React.createElement(ImagePreview, {
80
75
  key: name,
81
76
  imageName: name,
82
- url: "".concat(getImageUrl(title, name), "/").concat(image.actual),
77
+ url: `${getImageUrl(title, name)}/${image.actual}`,
83
78
  isActive: name === imageName,
84
79
  onClick: handleImageChange,
85
80
  error: imagesWithError.includes(name)
@@ -49,8 +49,6 @@ const Container = styled.div(_ref2 => {
49
49
  };
50
50
  });
51
51
  export function ResultsPageInternal(_ref3) {
52
- var _results, _Object$keys$, _result$images, _result$images2;
53
-
54
52
  let {
55
53
  id,
56
54
  path,
@@ -62,27 +60,20 @@ export function ResultsPageInternal(_ref3) {
62
60
  height
63
61
  } = _ref3;
64
62
  const [retry, setRetry] = useState(results.length);
65
- const result = (_results = results[retry - 1]) !== null && _results !== void 0 ? _results : {};
66
- const [imageName, setImageName] = useState((_Object$keys$ = Object.keys((_result$images = result.images) !== null && _result$images !== void 0 ? _result$images : {})[0]) !== null && _Object$keys$ !== void 0 ? _Object$keys$ : '');
63
+ const result = results[retry - 1] ?? {};
64
+ const [imageName, setImageName] = useState(Object.keys(result.images ?? {})[0] ?? '');
67
65
  const [viewMode, setViewMode] = useState(getViewMode());
68
66
  useEffect(() => setRetry(results.length), [results.length]);
69
67
  const url = getImageUrl(path, imageName);
70
- const image = (_result$images2 = result.images) === null || _result$images2 === void 0 ? void 0 : _result$images2[imageName];
68
+ const image = result.images?.[imageName];
71
69
  const canApprove = Boolean(image && approved[imageName] != retry - 1 && result.status != 'success');
72
- const hasDiffAndExpect = canApprove && Boolean((image === null || image === void 0 ? void 0 : image.diff) && image.expect);
73
- const imagesWithError = result.images ? Object.keys(result.images).filter(imageName => {
74
- var _imageName;
75
-
76
- return result.status != 'success' && approved[imageName] != retry - 1 && ((_imageName = (result.images || {})[imageName]) === null || _imageName === void 0 ? void 0 : _imageName.error) != null;
77
- }) : [];
78
-
70
+ const hasDiffAndExpect = canApprove && Boolean(image?.diff && image.expect);
71
+ const imagesWithError = result.images ? Object.keys(result.images).filter(imageName => result.status != 'success' && approved[imageName] != retry - 1 && (result.images || {})[imageName]?.error != null) : [];
79
72
  const handleApprove = () => onImageApprove(id, retry - 1, imageName);
80
-
81
73
  const handleChangeViewMode = mode => {
82
74
  localStorage.setItem(VIEW_MODE_KEY, mode);
83
75
  setViewMode(mode);
84
76
  };
85
-
86
77
  return /*#__PURE__*/React.createElement(Container, {
87
78
  height: height
88
79
  }, /*#__PURE__*/React.createElement(HeaderContainer, null, /*#__PURE__*/React.createElement(PageHeader, {
@@ -104,7 +95,7 @@ export function ResultsPageInternal(_ref3) {
104
95
  image: image,
105
96
  canApprove: canApprove,
106
97
  mode: viewMode
107
- }) : /*#__PURE__*/React.createElement(Placeholder, null, "Image ".concat(imageName, " not found")))))), results.length ? /*#__PURE__*/React.createElement(FooterContainer, null, /*#__PURE__*/React.createElement(PageFooter, {
98
+ }) : /*#__PURE__*/React.createElement(Placeholder, null, `Image ${imageName} not found`))))), results.length ? /*#__PURE__*/React.createElement(FooterContainer, null, /*#__PURE__*/React.createElement(PageFooter, {
108
99
  canApprove: canApprove,
109
100
  retry: retry,
110
101
  retriesCount: results.length,
@@ -5,12 +5,10 @@ export async function initCreeveyClientApi() {
5
5
  const updateListeners = new Set();
6
6
  let statusRequest = null;
7
7
  let statusResolver = noop;
8
- const ws = new WebSocket("ws://".concat(getConnectionUrl()));
9
-
8
+ const ws = new WebSocket(`ws://${getConnectionUrl()}`);
10
9
  function send(request) {
11
10
  ws.send(JSON.stringify(request));
12
11
  }
13
-
14
12
  ws.addEventListener('open', () => {
15
13
  clientApiResolver({
16
14
  start(ids) {
@@ -19,13 +17,11 @@ export async function initCreeveyClientApi() {
19
17
  payload: ids
20
18
  });
21
19
  },
22
-
23
20
  stop() {
24
21
  send({
25
22
  type: 'stop'
26
23
  });
27
24
  },
28
-
29
25
  approve(id, retry, image) {
30
26
  send({
31
27
  type: 'approve',
@@ -36,12 +32,10 @@ export async function initCreeveyClientApi() {
36
32
  }
37
33
  });
38
34
  },
39
-
40
35
  onUpdate(fn) {
41
36
  updateListeners.add(fn);
42
37
  return () => updateListeners.delete(fn);
43
38
  },
44
-
45
39
  get status() {
46
40
  if (statusRequest) return statusRequest;
47
41
  send({
@@ -49,19 +43,18 @@ export async function initCreeveyClientApi() {
49
43
  });
50
44
  return statusRequest = new Promise(resolve => statusResolver = resolve);
51
45
  }
52
-
53
46
  });
54
47
  });
55
48
  ws.addEventListener('message', message => {
56
49
  const data = JSON.parse(message.data);
57
50
  if (data.type == 'update') updateListeners.forEach(fn => fn(data.payload));
58
-
59
51
  if (data.type == 'status') {
60
52
  statusResolver(data.payload);
61
53
  statusResolver = noop;
62
54
  statusRequest = null;
63
55
  }
64
- }); // TODO Reconnect
56
+ });
57
+ // TODO Reconnect
65
58
 
66
59
  return new Promise(resolve => clientApiResolver = resolve);
67
60
  }
@@ -3,7 +3,6 @@ import { parse, stringify } from 'qs';
3
3
  import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';
4
4
  import { isTest, isDefined } from '../../types';
5
5
  const statusUpdatesMap = new Map([[undefined, /(unknown|success|failed|pending|running)/], ['unknown', /(success|failed|pending|running)/], ['success', /(failed|pending|running)/], ['failed', /(pending|running)/], ['pending', /running/]]);
6
-
7
6
  function makeEmptySuiteNode() {
8
7
  let path = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
9
8
  return {
@@ -15,11 +14,8 @@ function makeEmptySuiteNode() {
15
14
  children: {}
16
15
  };
17
16
  }
18
-
19
17
  export function calcStatus(oldStatus, newStatus) {
20
- var _statusUpdatesMap$get;
21
-
22
- return newStatus && (_statusUpdatesMap$get = statusUpdatesMap.get(oldStatus)) !== null && _statusUpdatesMap$get !== void 0 && _statusUpdatesMap$get.test(newStatus) ? newStatus : oldStatus;
18
+ return newStatus && statusUpdatesMap.get(oldStatus)?.test(newStatus) ? newStatus : oldStatus;
23
19
  }
24
20
  export function getTestPath(test) {
25
21
  const {
@@ -30,12 +26,10 @@ export function getTestPath(test) {
30
26
  return [...storyPath, testName, browser].filter(isDefined);
31
27
  }
32
28
  export function getSuiteByPath(suite, path) {
33
- return path.reduce((suiteOrTest, pathToken) => isTest(suiteOrTest) ? suiteOrTest : suiteOrTest === null || suiteOrTest === void 0 ? void 0 : suiteOrTest.children[pathToken], suite);
29
+ return path.reduce((suiteOrTest, pathToken) => isTest(suiteOrTest) ? suiteOrTest : suiteOrTest?.children[pathToken], suite);
34
30
  }
35
31
  export function getTestByPath(suite, path) {
36
- var _getSuiteByPath;
37
-
38
- const test = (_getSuiteByPath = getSuiteByPath(suite, path)) !== null && _getSuiteByPath !== void 0 ? _getSuiteByPath : suite;
32
+ const test = getSuiteByPath(suite, path) ?? suite;
39
33
  return isTest(test) ? test : null;
40
34
  }
41
35
  export function getTestsByStoryId(suite, storyId) {
@@ -44,16 +38,13 @@ export function getTestsByStoryId(suite, storyId) {
44
38
  return getTestsByStoryId(suiteOrTest, storyId);
45
39
  }).filter(isDefined);
46
40
  }
47
-
48
41
  function checkTests(suiteOrTest, checked) {
49
42
  suiteOrTest.checked = checked;
50
-
51
43
  if (!isTest(suiteOrTest)) {
52
44
  suiteOrTest.indeterminate = false;
53
45
  Object.values(suiteOrTest.children).filter(isDefined).forEach(child => checkTests(child, checked));
54
46
  }
55
47
  }
56
-
57
48
  function updateChecked(suite) {
58
49
  const children = Object.values(suite.children).filter(isDefined).filter(child => !child.skip);
59
50
  const checkedEvery = children.every(test => test.checked);
@@ -63,7 +54,6 @@ function updateChecked(suite) {
63
54
  suite.checked = checked;
64
55
  suite.indeterminate = indeterminate;
65
56
  }
66
-
67
57
  export function checkSuite(suite, path, checked) {
68
58
  const subSuite = getSuiteByPath(suite, path);
69
59
  if (subSuite) checkTests(subSuite, checked);
@@ -87,14 +77,13 @@ export function treeifyTests(testsById) {
87
77
  if (!subSuite.skip) suite.skip = false;
88
78
  suite.children[token] = subSuite;
89
79
  suite.status = calcStatus(suite.status, subSuite.status);
90
-
91
80
  if (isTest(subSuite)) {
92
- throw new Error("Suite and Test should not have same path '".concat(JSON.stringify(getTestPath(subSuite)), "'"));
81
+ throw new Error(`Suite and Test should not have same path '${JSON.stringify(getTestPath(subSuite))}'`);
93
82
  }
94
-
95
83
  return subSuite;
96
84
  }, rootSuite);
97
- lastSuite.children[browser] = { ...test,
85
+ lastSuite.children[browser] = {
86
+ ...test,
98
87
  checked: true
99
88
  };
100
89
  });
@@ -108,14 +97,12 @@ export function getCheckedTests(suite) {
108
97
  });
109
98
  }
110
99
  export function updateTestStatus(suite, path, update) {
111
- var _suite$children$title;
112
-
113
100
  const title = path.shift();
114
101
  if (!title) return;
115
- const suiteOrTest = (_suite$children$title = suite.children[title]) !== null && _suite$children$title !== void 0 ? _suite$children$title : suite.children[title] = { ...(path.length == 0 ? update : makeEmptySuiteNode([...suite.path, title])),
102
+ const suiteOrTest = suite.children[title] ?? (suite.children[title] = {
103
+ ...(path.length == 0 ? update : makeEmptySuiteNode([...suite.path, title])),
116
104
  checked: suite.checked
117
- };
118
-
105
+ });
119
106
  if (isTest(suiteOrTest)) {
120
107
  const test = suiteOrTest;
121
108
  const {
@@ -135,7 +122,6 @@ export function updateTestStatus(suite, path, update) {
135
122
  const subSuite = suiteOrTest;
136
123
  updateTestStatus(subSuite, path, update);
137
124
  }
138
-
139
125
  suite.skip = Object.values(suite.children).filter(isDefined).map(_ref2 => {
140
126
  let {
141
127
  skip
@@ -150,13 +136,11 @@ export function updateTestStatus(suite, path, update) {
150
136
  }).reduce(calcStatus);
151
137
  }
152
138
  export function removeTests(suite, path) {
153
- var _suiteOrTest$children;
154
-
155
139
  const title = path.shift();
156
140
  if (!title) return;
157
141
  const suiteOrTest = suite.children[title];
158
142
  if (suiteOrTest && !isTest(suiteOrTest)) removeTests(suiteOrTest, path);
159
- if (isTest(suiteOrTest) || Object.keys((_suiteOrTest$children = suiteOrTest === null || suiteOrTest === void 0 ? void 0 : suiteOrTest.children) !== null && _suiteOrTest$children !== void 0 ? _suiteOrTest$children : {}).length == 0) delete suite.children[title];
143
+ if (isTest(suiteOrTest) || Object.keys(suiteOrTest?.children ?? {}).length == 0) delete suite.children[title];
160
144
  if (Object.keys(suite.children).length == 0) return;
161
145
  updateChecked(suite);
162
146
  suite.skip = Object.values(suite.children).filter(isDefined).map(_ref4 => {
@@ -178,13 +162,13 @@ export function filterTests(suite, filter) {
178
162
  subStrings
179
163
  } = filter;
180
164
  if (!status && !subStrings.length) return suite;
181
- const filteredSuite = { ...suite,
165
+ const filteredSuite = {
166
+ ...suite,
182
167
  children: {}
183
168
  };
184
169
  Object.entries(suite.children).forEach(_ref6 => {
185
170
  let [title, suiteOrTest] = _ref6;
186
171
  if (!suiteOrTest || suiteOrTest.skip) return;
187
-
188
172
  if (!status && subStrings.some(subString => title.toLowerCase().includes(subString))) {
189
173
  filteredSuite.children[title] = suiteOrTest;
190
174
  } else if (isTest(suiteOrTest)) {
@@ -223,7 +207,6 @@ export function countTestsStatus(suite) {
223
207
  let pendingCount = 0;
224
208
  const cases = Object.values(suite.children).filter(isDefined);
225
209
  let suiteOrTest;
226
-
227
210
  while (suiteOrTest = cases.pop()) {
228
211
  if (isTest(suiteOrTest)) {
229
212
  if (suiteOrTest.skip) skippedCount++;
@@ -234,7 +217,6 @@ export function countTestsStatus(suite) {
234
217
  cases.push(...Object.values(suiteOrTest.children).filter(isDefined));
235
218
  }
236
219
  }
237
-
238
220
  return {
239
221
  successCount,
240
222
  failedCount,
@@ -248,8 +230,8 @@ export function getConnectionUrl() {
248
230
  export function getImageUrl(path, imageName) {
249
231
  // path => [kind, story, test, browser]
250
232
  const browser = path.slice(-1)[0];
251
- const imagesUrl = window.location.host ? "".concat(window.location.protocol, "//").concat(getConnectionUrl()).concat(window.location.pathname == '/' ? '/report' : window.location.pathname.split('/').slice(0, -1).join('/'), "/").concat(encodeURI(path.slice(0, -1).join('/'))) : encodeURI(path.slice(0, -1).join('/'));
252
- return imageName == browser ? imagesUrl : "".concat(imagesUrl, "/").concat(encodeURI(browser));
233
+ const imagesUrl = window.location.host ? `${window.location.protocol}//${getConnectionUrl()}${window.location.pathname == '/' ? '/report' : window.location.pathname.split('/').slice(0, -1).join('/')}/${encodeURI(path.slice(0, -1).join('/'))}` : encodeURI(path.slice(0, -1).join('/'));
234
+ return imageName == browser ? imagesUrl : `${imagesUrl}/${encodeURI(browser)}`;
253
235
  }
254
236
  export function getBorderSize(element) {
255
237
  // NOTE Firefox returns empty string for `borderWidth` prop
@@ -269,12 +251,12 @@ export function useLoadImages(s1, s2, s3) {
269
251
  }, [s1, s2, s3]);
270
252
  return loaded;
271
253
  }
254
+
272
255
  /**
273
256
  * Uses the ResizeObserver API to observe changes within the given HTML Element DOM Rect.
274
257
  *
275
258
  * @returns dimensions of element's content box (which means without paddings and border width)
276
259
  */
277
-
278
260
  export function useResizeObserver(elementRef, onResize) {
279
261
  let debounceTimeout = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 16;
280
262
  const observerRef = useRef(null);
@@ -282,11 +264,7 @@ export function useResizeObserver(elementRef, onResize) {
282
264
  if (!elementRef.current) return;
283
265
  observerRef.current = new ResizeObserver(onResize);
284
266
  observerRef.current.observe(elementRef.current);
285
- return () => {
286
- var _observerRef$current;
287
-
288
- return (_observerRef$current = observerRef.current) === null || _observerRef$current === void 0 ? void 0 : _observerRef$current.disconnect();
289
- };
267
+ return () => observerRef.current?.disconnect();
290
268
  }, [debounceTimeout, elementRef, onResize]);
291
269
  }
292
270
  export function useApplyScale(imageRef, scale, dependency) {
@@ -294,7 +272,7 @@ export function useApplyScale(imageRef, scale, dependency) {
294
272
  if (!imageRef.current) return;
295
273
  const image = imageRef.current;
296
274
  const borderSize = getBorderSize(image);
297
- image.style.height = "".concat(image.naturalHeight * scale + borderSize * 2, "px");
275
+ image.style.height = `${image.naturalHeight * scale + borderSize * 2}px`;
298
276
  }, [imageRef, scale, dependency]);
299
277
  }
300
278
  export function useCalcScale(diffImageRef, loaded) {
@@ -311,16 +289,13 @@ export function useCalcScale(diffImageRef, loaded) {
311
289
  return scale;
312
290
  }
313
291
  const CREEVEY_THEME = 'Creevey_theme';
314
-
315
292
  function isTheme(theme) {
316
293
  return isDefined(theme) && Object.prototype.hasOwnProperty.call(themes, theme);
317
294
  }
318
-
319
295
  function initialTheme() {
320
296
  const theme = localStorage.getItem(CREEVEY_THEME);
321
297
  return isTheme(theme) ? theme : 'light';
322
298
  }
323
-
324
299
  export function useTheme() {
325
300
  const [theme, setTheme] = useState(initialTheme());
326
301
  useEffect(() => {
@@ -329,9 +304,9 @@ export function useTheme() {
329
304
  return [theme, setTheme];
330
305
  }
331
306
  export function setSearchParams(testPath) {
332
- const pageUrl = "?".concat(stringify({
307
+ const pageUrl = `?${stringify({
333
308
  testPath
334
- }));
309
+ })}`;
335
310
  window.history.pushState({
336
311
  testPath
337
312
  }, '', pageUrl);
@@ -339,12 +314,11 @@ export function setSearchParams(testPath) {
339
314
  export function getTestPathFromSearch() {
340
315
  const {
341
316
  testPath
342
- } = parse(window.location.search.slice(1)); //@ts-expect-error: This expression is not callable.
343
-
317
+ } = parse(window.location.search.slice(1));
318
+ //@ts-expect-error: This expression is not callable.
344
319
  if (Array.isArray(testPath) && testPath.every(token => typeof token == 'string')) {
345
320
  return testPath;
346
321
  }
347
-
348
322
  return [];
349
323
  }
350
324
  export function useForceUpdate() {
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkcreevey=self.webpackChunkcreevey||[]).push([[192],{8192:(e,r,a)=>{a.r(r),a.d(r,{SyntaxHighlighter:()=>c.d3,createCopyToClipboardFunction:()=>c.xV,default:()=>c.qG});var c=a(23809)}}]);