creevey 0.7.39 → 0.8.0-beta.1
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 +33 -2
- package/README.md +9 -1
- package/addon/README.md +3 -0
- package/addon/package.json +4 -0
- package/docs/config.md +37 -5
- package/docs/grid.md +2 -1
- package/jest.config.js +6 -0
- package/lib/cjs/client/addon/Manager.js +124 -271
- package/lib/cjs/client/addon/components/Addon.js +17 -38
- package/lib/cjs/client/addon/components/Icons.js +11 -7
- package/lib/cjs/client/addon/components/Panel.js +17 -13
- package/lib/cjs/client/addon/components/TestSelect.js +11 -9
- package/lib/cjs/client/addon/components/Tools.js +21 -40
- package/lib/cjs/client/addon/decorator.js +1 -1
- package/lib/cjs/client/addon/index.js +31 -0
- package/lib/cjs/client/addon/preset.ie11.js +74 -0
- package/lib/cjs/client/addon/preset.js +13 -31
- package/lib/cjs/client/addon/readyForCapture.js +12 -0
- package/lib/cjs/client/addon/register.js +46 -70
- package/lib/cjs/client/addon/utils.js +5 -41
- package/lib/cjs/client/addon/withCreevey.js +221 -155
- package/lib/cjs/client/shared/components/ImagesView/BlendView.js +26 -24
- package/lib/cjs/client/shared/components/ImagesView/ImagesView.js +22 -18
- package/lib/cjs/client/shared/components/ImagesView/SideBySideView.js +44 -66
- package/lib/cjs/client/shared/components/ImagesView/SlideView.js +38 -50
- package/lib/cjs/client/shared/components/ImagesView/SwapView.js +26 -45
- package/lib/cjs/client/shared/components/ImagesView/index.js +9 -9
- package/lib/cjs/client/shared/components/PageFooter/PageFooter.js +12 -8
- package/lib/cjs/client/shared/components/PageFooter/Paging.js +14 -18
- package/lib/cjs/client/shared/components/PageHeader/ImagePreview.js +22 -18
- package/lib/cjs/client/shared/components/PageHeader/PageHeader.js +42 -67
- package/lib/cjs/client/shared/components/ResultsPage.js +39 -69
- package/lib/cjs/client/shared/creeveyClientApi.js +55 -82
- package/lib/cjs/client/shared/helpers.js +140 -211
- package/lib/cjs/client/shared/viewMode.js +5 -5
- package/lib/cjs/client/web/142.js +2 -0
- package/lib/cjs/client/web/142.js.LICENSE.txt +12 -0
- package/lib/cjs/client/web/32.js +1 -0
- package/lib/cjs/client/web/551.js +1 -0
- package/lib/cjs/client/web/566.js +2 -0
- package/lib/cjs/client/web/566.js.LICENSE.txt +31 -0
- package/lib/cjs/client/web/691.js +2 -0
- package/lib/cjs/client/web/691.js.LICENSE.txt +8 -0
- package/lib/cjs/client/web/725.js +1 -0
- package/lib/cjs/client/web/main.js +2 -38
- package/lib/cjs/client/web/main.js.LICENSE.txt +49 -0
- package/lib/cjs/creevey.js +3 -5
- package/lib/cjs/index.js +10 -15
- package/lib/cjs/server/config.js +5 -4
- package/lib/cjs/server/docker.js +3 -7
- package/lib/cjs/server/extract.js +7 -4
- package/lib/cjs/server/index.js +3 -5
- package/lib/cjs/server/loaders/babel/creevey-plugin.js +1 -3
- package/lib/cjs/server/loaders/babel/helpers.js +13 -23
- package/lib/cjs/server/loaders/babel/register.js +3 -4
- package/lib/cjs/server/loaders/webpack/compile.js +33 -50
- package/lib/cjs/server/loaders/webpack/creevey-loader.js +20 -22
- package/lib/cjs/server/loaders/webpack/dummy-hmr.js +2 -7
- package/lib/cjs/server/loaders/webpack/mdx-loader.js +2 -2
- package/lib/cjs/server/loaders/webpack/start.js +1 -1
- package/lib/cjs/server/logger.js +2 -1
- package/lib/cjs/server/master/index.js +4 -4
- package/lib/cjs/server/master/master.js +1 -0
- package/lib/cjs/server/master/pool.js +38 -47
- package/lib/cjs/server/master/runner.js +53 -66
- package/lib/cjs/server/master/server.js +78 -4
- package/lib/cjs/server/messages.js +128 -18
- package/lib/cjs/server/selenium/browser.js +129 -55
- package/lib/cjs/server/selenium/selenoid.js +6 -8
- package/lib/cjs/server/stories.js +58 -84
- package/lib/cjs/server/storybook/entry.js +8 -22
- package/lib/cjs/server/storybook/helpers.js +22 -21
- package/lib/cjs/server/storybook/providers/browser.js +74 -0
- package/lib/cjs/server/storybook/{nodejs-provider.js → providers/nodejs.js} +44 -22
- package/lib/cjs/server/update.js +1 -5
- package/lib/cjs/server/utils.js +36 -15
- package/lib/cjs/server/worker/helpers.js +2 -6
- package/lib/cjs/server/worker/reporter.js +8 -20
- package/lib/cjs/server/worker/worker.js +21 -19
- package/lib/cjs/shared/index.js +101 -0
- package/lib/cjs/shared/serializeRegExp.js +42 -0
- package/lib/cjs/types.js +11 -6
- package/lib/esm/client/addon/Manager.js +124 -272
- package/lib/esm/client/addon/components/Addon.js +15 -34
- package/lib/esm/client/addon/components/Icons.js +10 -6
- package/lib/esm/client/addon/components/Panel.js +17 -13
- package/lib/esm/client/addon/components/TestSelect.js +11 -9
- package/lib/esm/client/addon/components/Tools.js +19 -36
- package/lib/esm/client/addon/decorator.js +1 -1
- package/lib/esm/client/addon/index.js +2 -0
- package/lib/esm/client/addon/preset.ie11.js +59 -0
- package/lib/esm/client/addon/preset.js +12 -26
- package/lib/esm/client/addon/readyForCapture.js +5 -0
- package/lib/esm/client/addon/register.js +42 -66
- package/lib/esm/client/addon/utils.js +3 -34
- package/lib/esm/client/addon/withCreevey.js +209 -156
- package/lib/esm/client/shared/components/ImagesView/BlendView.js +23 -20
- package/lib/esm/client/shared/components/ImagesView/ImagesView.js +21 -17
- package/lib/esm/client/shared/components/ImagesView/SideBySideView.js +42 -63
- package/lib/esm/client/shared/components/ImagesView/SlideView.js +36 -47
- package/lib/esm/client/shared/components/ImagesView/SwapView.js +24 -42
- package/lib/esm/client/shared/components/PageFooter/PageFooter.js +12 -8
- package/lib/esm/client/shared/components/PageFooter/Paging.js +14 -18
- package/lib/esm/client/shared/components/PageHeader/ImagePreview.js +22 -18
- package/lib/esm/client/shared/components/PageHeader/PageHeader.js +37 -60
- package/lib/esm/client/shared/components/ResultsPage.js +36 -64
- package/lib/esm/client/shared/creeveyClientApi.js +57 -84
- package/lib/esm/client/shared/helpers.js +124 -195
- package/lib/esm/client/shared/viewMode.js +4 -4
- package/lib/esm/creevey.js +3 -5
- package/lib/esm/index.js +2 -3
- package/lib/esm/server/config.js +4 -5
- package/lib/esm/server/docker.js +2 -2
- package/lib/esm/server/extract.js +6 -4
- package/lib/esm/server/index.js +3 -4
- package/lib/esm/server/loaders/babel/creevey-plugin.js +1 -3
- package/lib/esm/server/loaders/babel/helpers.js +12 -22
- package/lib/esm/server/loaders/babel/register.js +3 -4
- package/lib/esm/server/loaders/webpack/compile.js +34 -51
- package/lib/esm/server/loaders/webpack/creevey-loader.js +9 -10
- package/lib/esm/server/loaders/webpack/dummy-hmr.js +2 -6
- package/lib/esm/server/loaders/webpack/mdx-loader.js +2 -2
- package/lib/esm/server/loaders/webpack/start.js +1 -1
- package/lib/esm/server/master/index.js +4 -4
- package/lib/esm/server/master/master.js +1 -0
- package/lib/esm/server/master/pool.js +38 -49
- package/lib/esm/server/master/runner.js +53 -66
- package/lib/esm/server/master/server.js +76 -6
- package/lib/esm/server/messages.js +118 -14
- package/lib/esm/server/selenium/browser.js +126 -57
- package/lib/esm/server/selenium/selenoid.js +5 -7
- package/lib/esm/server/stories.js +60 -83
- package/lib/esm/server/storybook/entry.js +7 -24
- package/lib/esm/server/storybook/helpers.js +13 -16
- package/lib/esm/server/storybook/providers/browser.js +60 -0
- package/lib/esm/server/storybook/{nodejs-provider.js → providers/nodejs.js} +42 -21
- package/lib/esm/server/update.js +1 -5
- package/lib/esm/server/utils.js +28 -10
- package/lib/esm/server/worker/helpers.js +2 -6
- package/lib/esm/server/worker/reporter.js +8 -20
- package/lib/esm/server/worker/worker.js +22 -20
- package/lib/esm/shared/index.js +78 -0
- package/lib/esm/shared/serializeRegExp.js +24 -0
- package/lib/esm/types.js +3 -0
- package/lib/types/cli.d.ts +1 -1
- package/lib/types/client/addon/Manager.d.ts +37 -37
- package/lib/types/client/addon/components/Addon.d.ts +8 -8
- package/lib/types/client/addon/components/Icons.d.ts +7 -7
- package/lib/types/client/addon/components/Panel.d.ts +9 -9
- package/lib/types/client/addon/components/TestSelect.d.ts +8 -9
- package/lib/types/client/addon/components/Tools.d.ts +6 -6
- package/lib/types/client/addon/decorator.d.ts +1 -1
- package/lib/types/client/addon/index.d.ts +2 -0
- package/lib/types/client/addon/preset.d.ts +23 -22
- package/lib/types/client/addon/preset.ie11.d.ts +10 -0
- package/lib/types/client/addon/readyForCapture.d.ts +6 -0
- package/lib/types/client/addon/register.d.ts +3 -3
- package/lib/types/client/addon/utils.d.ts +3 -6
- package/lib/types/client/addon/withCreevey.d.ts +24 -13
- package/lib/types/client/shared/components/ImagesView/BlendView.d.ts +3 -3
- package/lib/types/client/shared/components/ImagesView/ImagesView.d.ts +24 -25
- package/lib/types/client/shared/components/ImagesView/SideBySideView.d.ts +3 -3
- package/lib/types/client/shared/components/ImagesView/SlideView.d.ts +3 -3
- package/lib/types/client/shared/components/ImagesView/SwapView.d.ts +3 -3
- package/lib/types/client/shared/components/ImagesView/index.d.ts +5 -5
- package/lib/types/client/shared/components/PageFooter/PageFooter.d.ts +8 -9
- package/lib/types/client/shared/components/PageFooter/Paging.d.ts +7 -8
- package/lib/types/client/shared/components/PageHeader/ImagePreview.d.ts +12 -12
- package/lib/types/client/shared/components/PageHeader/PageHeader.d.ts +16 -17
- package/lib/types/client/shared/components/ResultsPage.d.ts +18 -18
- package/lib/types/client/shared/creeveyClientApi.d.ts +9 -9
- package/lib/types/client/shared/helpers.d.ts +46 -46
- package/lib/types/client/shared/viewMode.d.ts +4 -4
- package/lib/types/client/web/CreeveyApp.d.ts +11 -12
- package/lib/types/client/web/CreeveyContext.d.ts +11 -11
- package/lib/types/client/web/CreeveyLoader.d.ts +2 -3
- package/lib/types/client/web/CreeveyView/SideBar/Checkbox.d.ts +19 -19
- package/lib/types/client/web/CreeveyView/SideBar/Search.d.ts +6 -6
- package/lib/types/client/web/CreeveyView/SideBar/SideBar.d.ts +14 -14
- package/lib/types/client/web/CreeveyView/SideBar/SideBarHeader.d.ts +12 -13
- package/lib/types/client/web/CreeveyView/SideBar/SuiteLink.d.ts +33 -33
- package/lib/types/client/web/CreeveyView/SideBar/TestLink.d.ts +7 -8
- package/lib/types/client/web/CreeveyView/SideBar/TestStatusIcon.d.ts +10 -10
- package/lib/types/client/web/CreeveyView/SideBar/TestsStatus.d.ts +9 -9
- package/lib/types/client/web/CreeveyView/SideBar/Toggle.d.ts +6 -6
- package/lib/types/client/web/CreeveyView/SideBar/index.d.ts +1 -1
- package/lib/types/client/web/KeyboardEventsContext.d.ts +13 -13
- package/lib/types/client/web/index.d.ts +4 -4
- package/lib/types/creevey.d.ts +1 -1
- package/lib/types/index.d.ts +0 -1
- package/lib/types/server/config.d.ts +4 -4
- package/lib/types/server/docker.d.ts +7 -7
- package/lib/types/server/extract.d.ts +2 -2
- package/lib/types/server/index.d.ts +2 -2
- package/lib/types/server/loaders/babel/creevey-plugin.d.ts +1 -1
- package/lib/types/server/loaders/babel/helpers.d.ts +19 -19
- package/lib/types/server/loaders/babel/register.d.ts +5 -5
- package/lib/types/server/loaders/hooks/mdx.d.ts +1 -1
- package/lib/types/server/loaders/hooks/svelte.d.ts +1 -1
- package/lib/types/server/loaders/webpack/compile.d.ts +2 -2
- package/lib/types/server/loaders/webpack/creevey-loader.d.ts +4 -2
- package/lib/types/server/loaders/webpack/dummy-hmr.d.ts +10 -10
- package/lib/types/server/loaders/webpack/mdx-loader.d.ts +6 -6
- package/lib/types/server/loaders/webpack/start.d.ts +1 -1
- package/lib/types/server/logger.d.ts +10 -6
- package/lib/types/server/master/api.d.ts +7 -7
- package/lib/types/server/master/index.d.ts +3 -3
- package/lib/types/server/master/master.d.ts +7 -6
- package/lib/types/server/master/pool.d.ts +31 -30
- package/lib/types/server/master/runner.d.ts +26 -26
- package/lib/types/server/master/server.d.ts +2 -2
- package/lib/types/server/messages.d.ts +29 -18
- package/lib/types/server/selenium/browser.d.ts +17 -14
- package/lib/types/server/selenium/index.d.ts +2 -2
- package/lib/types/server/selenium/selenoid.d.ts +3 -3
- package/lib/types/server/stories.d.ts +8 -9
- package/lib/types/server/storybook/entry.d.ts +17 -14
- package/lib/types/server/storybook/helpers.d.ts +24 -23
- package/lib/types/server/storybook/providers/browser.d.ts +4 -0
- package/lib/types/server/storybook/providers/nodejs.d.ts +9 -0
- package/lib/types/server/update.d.ts +2 -2
- package/lib/types/server/utils.d.ts +19 -18
- package/lib/types/server/worker/chai-image.d.ts +6 -6
- package/lib/types/server/worker/helpers.d.ts +8 -7
- package/lib/types/server/worker/index.d.ts +1 -1
- package/lib/types/server/worker/reporter.d.ts +8 -8
- package/lib/types/server/worker/worker.d.ts +4 -4
- package/lib/types/shared/index.d.ts +7 -0
- package/lib/types/shared/serializeRegExp.d.ts +9 -0
- package/lib/types/types.d.ts +487 -459
- package/package.json +121 -99
- package/preset/ie11.js +5 -0
- package/{preset.js → preset/index.js} +2 -2
- package/types/mdx.d.ts +3 -2
- package/types/mocha.d.ts +1 -0
- package/lib/cjs/client/web/1.js +0 -13
- package/lib/cjs/client/web/2.js +0 -1
- package/lib/types/server/storybook/nodejs-provider.d.ts +0 -5
- package/storybook-static/stories.json +0 -530
@@ -7,6 +7,8 @@ exports.CreeveyManager = void 0;
|
|
7
7
|
|
8
8
|
var _coreEvents = require("@storybook/core-events");
|
9
9
|
|
10
|
+
var _shared = require("../../shared");
|
11
|
+
|
10
12
|
var _types = require("../../types");
|
11
13
|
|
12
14
|
var _creeveyClientApi = require("../shared/creeveyClientApi");
|
@@ -17,43 +19,11 @@ var _register = require("./register");
|
|
17
19
|
|
18
20
|
var _utils = require("./utils");
|
19
21
|
|
20
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
21
|
-
|
22
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
23
|
-
|
24
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
25
|
-
|
26
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
27
|
-
|
28
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
29
|
-
|
30
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
31
|
-
|
32
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
33
|
-
|
34
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
35
|
-
|
36
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
37
|
-
|
38
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
39
|
-
|
40
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
41
|
-
|
42
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
43
|
-
|
44
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
45
|
-
|
46
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
47
|
-
|
48
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
49
|
-
|
50
22
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
51
23
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
_classCallCheck(this, CreeveyManager);
|
24
|
+
class CreeveyManager {
|
25
|
+
constructor(storybookApi) {
|
26
|
+
this.storybookApi = storybookApi;
|
57
27
|
|
58
28
|
_defineProperty(this, "storyId", '');
|
59
29
|
|
@@ -75,60 +45,38 @@ var CreeveyManager = /*#__PURE__*/function () {
|
|
75
45
|
|
76
46
|
_defineProperty(this, "changeTestListeners", []);
|
77
47
|
|
78
|
-
_defineProperty(this, "initAll",
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
_this.storybookApi.on(_coreEvents.SET_STORIES, _this.onSetStories);
|
86
|
-
|
87
|
-
_context.next = 4;
|
88
|
-
return (0, _creeveyClientApi.initCreeveyClientApi)();
|
89
|
-
|
90
|
-
case 4:
|
91
|
-
_this.creeveyApi = _context.sent;
|
92
|
-
|
93
|
-
_this.creeveyApi.onUpdate(_this.handleCreeveyUpdate);
|
94
|
-
|
95
|
-
_context.next = 8;
|
96
|
-
return _this.creeveyApi.status;
|
97
|
-
|
98
|
-
case 8:
|
99
|
-
_this.status = _context.sent;
|
100
|
-
|
101
|
-
case 9:
|
102
|
-
case "end":
|
103
|
-
return _context.stop();
|
104
|
-
}
|
105
|
-
}
|
106
|
-
}, _callee);
|
107
|
-
})));
|
48
|
+
_defineProperty(this, "initAll", async () => {
|
49
|
+
this.storybookApi.on(_coreEvents.STORY_RENDERED, this.onStoryRendered);
|
50
|
+
this.storybookApi.on(_coreEvents.SET_STORIES, this.onSetStories);
|
51
|
+
this.creeveyApi = await (0, _creeveyClientApi.initCreeveyClientApi)();
|
52
|
+
this.creeveyApi.onUpdate(this.handleCreeveyUpdate);
|
53
|
+
this.status = await this.creeveyApi.status;
|
54
|
+
});
|
108
55
|
|
109
|
-
_defineProperty(this, "handleCreeveyUpdate",
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
56
|
+
_defineProperty(this, "handleCreeveyUpdate", update => {
|
57
|
+
const {
|
58
|
+
tests,
|
59
|
+
removedTests = [],
|
60
|
+
isRunning
|
61
|
+
} = update;
|
114
62
|
|
115
63
|
if ((0, _types.isDefined)(isRunning)) {
|
116
|
-
|
64
|
+
this.status.isRunning = isRunning;
|
117
65
|
}
|
118
66
|
|
119
67
|
if ((0, _types.isDefined)(tests)) {
|
120
|
-
|
121
|
-
|
122
|
-
Object.values(tests).filter(_types.isDefined).forEach(
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
68
|
+
const prevTests = this.status.tests;
|
69
|
+
const prevStories = this.stories || {};
|
70
|
+
Object.values(tests).filter(_types.isDefined).forEach(update => {
|
71
|
+
const {
|
72
|
+
id,
|
73
|
+
skip,
|
74
|
+
status,
|
75
|
+
results,
|
76
|
+
approved,
|
77
|
+
storyId
|
78
|
+
} = update;
|
79
|
+
const test = prevTests[id];
|
132
80
|
|
133
81
|
if (!test) {
|
134
82
|
return prevTests[id] = update;
|
@@ -140,272 +88,177 @@ var CreeveyManager = /*#__PURE__*/function () {
|
|
140
88
|
test.status = status;
|
141
89
|
|
142
90
|
if ((0, _types.isDefined)(storyId) && (0, _types.isDefined)(prevStories[storyId])) {
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
var oldStatus = storyStatus.map(function (x) {
|
148
|
-
return x.id === id ? status : x.status;
|
149
|
-
}).reduce(function (oldStatus, newStatus) {
|
150
|
-
return (0, _helpers.calcStatus)(oldStatus, newStatus);
|
151
|
-
}, undefined);
|
152
|
-
story.name = _this.addStatusToStoryName(story.name, (0, _helpers.calcStatus)(oldStatus, status), skip || false);
|
91
|
+
const story = prevStories[storyId];
|
92
|
+
const storyStatus = this.getStoryTests(storyId);
|
93
|
+
const oldStatus = storyStatus.map(x => x.id === id ? status : x.status).reduce((oldStatus, newStatus) => (0, _helpers.calcStatus)(oldStatus, newStatus), undefined);
|
94
|
+
story.name = this.addStatusToStoryName(story.name, (0, _helpers.calcStatus)(oldStatus, status), skip || false);
|
153
95
|
}
|
154
96
|
}
|
155
97
|
|
156
|
-
if ((0, _types.isDefined)(results)) test.results ?
|
98
|
+
if ((0, _types.isDefined)(results)) test.results ? test.results.push(...results) : test.results = results;
|
157
99
|
|
158
100
|
if ((0, _types.isDefined)(approved)) {
|
159
|
-
Object.entries(approved).forEach(
|
160
|
-
|
161
|
-
image = _ref3[0],
|
162
|
-
retry = _ref3[1];
|
163
|
-
|
101
|
+
Object.entries(approved).forEach(_ref => {
|
102
|
+
let [image, retry] = _ref;
|
164
103
|
return retry !== undefined && test && ((test.approved = (test === null || test === void 0 ? void 0 : test.approved) || {})[image] = retry);
|
165
104
|
});
|
166
105
|
}
|
167
106
|
});
|
168
|
-
removedTests.forEach(
|
169
|
-
|
107
|
+
removedTests.forEach(_ref2 => {
|
108
|
+
let {
|
109
|
+
id
|
110
|
+
} = _ref2;
|
170
111
|
return delete prevTests[id];
|
171
112
|
});
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
void _this.storybookApi.setStories(_this.stories);
|
113
|
+
this.status.tests = prevTests;
|
114
|
+
this.stories = prevStories;
|
115
|
+
this.setPanelsTitle();
|
116
|
+
void this.storybookApi.setStories(this.stories);
|
178
117
|
}
|
179
118
|
|
180
|
-
|
181
|
-
return x(update);
|
182
|
-
});
|
119
|
+
this.updateStatusListeners.forEach(x => x(update));
|
183
120
|
});
|
184
121
|
|
185
|
-
_defineProperty(this, "getCurrentTest",
|
186
|
-
return
|
122
|
+
_defineProperty(this, "getCurrentTest", () => {
|
123
|
+
return this.status.tests[this.selectedTestId];
|
187
124
|
});
|
188
125
|
|
189
|
-
_defineProperty(this, "onStoryRendered",
|
190
|
-
if (
|
126
|
+
_defineProperty(this, "onStoryRendered", storyId => {
|
127
|
+
if (this.storyId === '') void this.addStatusesToSideBar();
|
191
128
|
|
192
|
-
if (
|
129
|
+
if (this.storyId !== storyId) {
|
193
130
|
var _this$getTestsByStory, _this$getTestsByStory2;
|
194
131
|
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
_this.changeTestListeners.forEach(function (x) {
|
201
|
-
return x(_this.selectedTestId);
|
202
|
-
});
|
132
|
+
this.storyId = storyId;
|
133
|
+
this.selectedTestId = (_this$getTestsByStory = (_this$getTestsByStory2 = this.getTestsByStoryIdAndBrowser(this.activeBrowser)[0]) === null || _this$getTestsByStory2 === void 0 ? void 0 : _this$getTestsByStory2.id) !== null && _this$getTestsByStory !== void 0 ? _this$getTestsByStory : '';
|
134
|
+
this.setPanelsTitle();
|
135
|
+
this.changeTestListeners.forEach(x => x(this.selectedTestId));
|
203
136
|
}
|
204
137
|
});
|
205
138
|
|
206
|
-
_defineProperty(this, "onStart",
|
139
|
+
_defineProperty(this, "onStart", () => {
|
207
140
|
var _this$creeveyApi;
|
208
141
|
|
209
|
-
(_this$creeveyApi =
|
142
|
+
(_this$creeveyApi = this.creeveyApi) === null || _this$creeveyApi === void 0 ? void 0 : _this$creeveyApi.start([this.selectedTestId]);
|
210
143
|
});
|
211
144
|
|
212
|
-
_defineProperty(this, "onStop",
|
145
|
+
_defineProperty(this, "onStop", () => {
|
213
146
|
var _this$creeveyApi2;
|
214
147
|
|
215
|
-
(_this$creeveyApi2 =
|
148
|
+
(_this$creeveyApi2 = this.creeveyApi) === null || _this$creeveyApi2 === void 0 ? void 0 : _this$creeveyApi2.stop();
|
216
149
|
});
|
217
150
|
|
218
|
-
_defineProperty(this, "onImageApprove",
|
151
|
+
_defineProperty(this, "onImageApprove", (id, retry, image) => {
|
219
152
|
var _this$creeveyApi3;
|
220
153
|
|
221
|
-
return (_this$creeveyApi3 =
|
154
|
+
return (_this$creeveyApi3 = this.creeveyApi) === null || _this$creeveyApi3 === void 0 ? void 0 : _this$creeveyApi3.approve(id, retry, image);
|
222
155
|
});
|
223
156
|
|
224
|
-
_defineProperty(this, "onStartAllStoryTests",
|
157
|
+
_defineProperty(this, "onStartAllStoryTests", () => {
|
225
158
|
var _this$creeveyApi4;
|
226
159
|
|
227
|
-
|
228
|
-
|
229
|
-
}).map(function (x) {
|
230
|
-
return x.id;
|
231
|
-
});
|
232
|
-
(_this$creeveyApi4 = _this.creeveyApi) === null || _this$creeveyApi4 === void 0 ? void 0 : _this$creeveyApi4.start(ids);
|
160
|
+
const ids = Object.values(this.status.tests).filter(_types.isDefined).filter(x => x.storyId === this.storyId).map(x => x.id);
|
161
|
+
(_this$creeveyApi4 = this.creeveyApi) === null || _this$creeveyApi4 === void 0 ? void 0 : _this$creeveyApi4.start(ids);
|
233
162
|
});
|
234
163
|
|
235
|
-
_defineProperty(this, "onStartAllTests",
|
164
|
+
_defineProperty(this, "onStartAllTests", () => {
|
236
165
|
var _this$creeveyApi5;
|
237
166
|
|
238
|
-
|
239
|
-
|
240
|
-
});
|
241
|
-
(_this$creeveyApi5 = _this.creeveyApi) === null || _this$creeveyApi5 === void 0 ? void 0 : _this$creeveyApi5.start(ids);
|
167
|
+
const ids = Object.values(this.status.tests).filter(_types.isDefined).map(x => x.id);
|
168
|
+
(_this$creeveyApi5 = this.creeveyApi) === null || _this$creeveyApi5 === void 0 ? void 0 : _this$creeveyApi5.start(ids);
|
242
169
|
});
|
243
170
|
|
244
|
-
_defineProperty(this, "onSetStories",
|
245
|
-
|
246
|
-
|
247
|
-
_this.stories = stories;
|
171
|
+
_defineProperty(this, "onSetStories", data => {
|
172
|
+
const stories = data.v ? (0, _shared.denormalizeStoryParameters)(data) : data.stories;
|
173
|
+
this.stories = stories;
|
248
174
|
});
|
249
175
|
|
250
|
-
_defineProperty(this, "setActiveBrowser",
|
176
|
+
_defineProperty(this, "setActiveBrowser", browser => {
|
251
177
|
var _this$getTestsByStory3, _this$getTestsByStory4;
|
252
178
|
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
_this.changeTestListeners.forEach(function (x) {
|
257
|
-
return x(_this.selectedTestId);
|
258
|
-
});
|
179
|
+
this.activeBrowser = browser;
|
180
|
+
this.selectedTestId = (_this$getTestsByStory3 = (_this$getTestsByStory4 = this.getTestsByStoryIdAndBrowser(this.activeBrowser)[0]) === null || _this$getTestsByStory4 === void 0 ? void 0 : _this$getTestsByStory4.id) !== null && _this$getTestsByStory3 !== void 0 ? _this$getTestsByStory3 : '';
|
181
|
+
this.changeTestListeners.forEach(x => x(this.selectedTestId));
|
259
182
|
});
|
260
183
|
|
261
|
-
_defineProperty(this, "setSelectedTestId",
|
262
|
-
|
263
|
-
|
264
|
-
_this.changeTestListeners.forEach(function (x) {
|
265
|
-
return x(_this.selectedTestId);
|
266
|
-
});
|
184
|
+
_defineProperty(this, "setSelectedTestId", testId => {
|
185
|
+
this.selectedTestId = testId;
|
186
|
+
this.changeTestListeners.forEach(x => x(this.selectedTestId));
|
267
187
|
});
|
268
188
|
|
269
|
-
_defineProperty(this, "getStoryTests",
|
270
|
-
if (!
|
271
|
-
return Object.values(
|
272
|
-
return (result === null || result === void 0 ? void 0 : result.storyId) === storyId;
|
273
|
-
}).filter(_types.isDefined);
|
189
|
+
_defineProperty(this, "getStoryTests", storyId => {
|
190
|
+
if (!this.status || !this.status.tests) return [];
|
191
|
+
return Object.values(this.status.tests).filter(result => (result === null || result === void 0 ? void 0 : result.storyId) === storyId).filter(_types.isDefined);
|
274
192
|
});
|
275
193
|
|
276
|
-
_defineProperty(this, "getBrowsers",
|
277
|
-
return
|
194
|
+
_defineProperty(this, "getBrowsers", () => {
|
195
|
+
return this.status.browsers;
|
278
196
|
});
|
279
197
|
|
280
|
-
_defineProperty(this, "getTestsByStoryIdAndBrowser",
|
281
|
-
return Object.values(
|
282
|
-
return (x === null || x === void 0 ? void 0 : x.browser) === browser && x.storyId === _this.storyId;
|
283
|
-
}).filter(_types.isDefined);
|
198
|
+
_defineProperty(this, "getTestsByStoryIdAndBrowser", browser => {
|
199
|
+
return Object.values(this.status.tests).filter(x => (x === null || x === void 0 ? void 0 : x.browser) === browser && x.storyId === this.storyId).filter(_types.isDefined);
|
284
200
|
});
|
285
201
|
|
286
|
-
_defineProperty(this, "getTabTitle",
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
}).reduce(function (oldStatus, newStatus) {
|
292
|
-
return (0, _helpers.calcStatus)(oldStatus, newStatus);
|
293
|
-
}, undefined);
|
294
|
-
var browserSkip = tests.length > 0 ? tests.every(function (x) {
|
295
|
-
return x && x.skip;
|
296
|
-
}) : false;
|
297
|
-
var emojiStatus = (0, _utils.getEmojiByTestStatus)(browserStatus, browserSkip);
|
202
|
+
_defineProperty(this, "getTabTitle", browser => {
|
203
|
+
const tests = this.getTestsByStoryIdAndBrowser(browser);
|
204
|
+
const browserStatus = tests.map(x => x && x.status).reduce((oldStatus, newStatus) => (0, _helpers.calcStatus)(oldStatus, newStatus), undefined);
|
205
|
+
const browserSkip = tests.length > 0 ? tests.every(x => x && x.skip) : false;
|
206
|
+
const emojiStatus = (0, _utils.getEmojiByTestStatus)(browserStatus, browserSkip);
|
298
207
|
return "".concat(emojiStatus ? "".concat(emojiStatus, " ") : '', "Creevey/").concat(browser);
|
299
208
|
});
|
300
209
|
|
301
|
-
_defineProperty(this, "setPanelsTitle",
|
210
|
+
_defineProperty(this, "setPanelsTitle", () => {
|
302
211
|
var _this$storybookApi;
|
303
212
|
|
304
|
-
|
213
|
+
const panels = (_this$storybookApi = this.storybookApi) === null || _this$storybookApi === void 0 ? void 0 : _this$storybookApi.getPanels();
|
305
214
|
if (!panels) return;
|
306
|
-
|
215
|
+
let firstPanelBrowser = this.activeBrowser;
|
307
216
|
|
308
|
-
for (
|
217
|
+
for (const p in panels) {
|
309
218
|
var _panel$id;
|
310
219
|
|
311
|
-
|
220
|
+
const panel = panels[p];
|
312
221
|
|
313
222
|
if (((_panel$id = panel.id) === null || _panel$id === void 0 ? void 0 : _panel$id.indexOf(_register.ADDON_ID)) === 0 && panel.paramKey) {
|
314
|
-
panel.title =
|
223
|
+
panel.title = this.getTabTitle(panel.paramKey);
|
315
224
|
if (!firstPanelBrowser) firstPanelBrowser = panel.paramKey;
|
316
225
|
}
|
317
226
|
}
|
318
227
|
|
319
|
-
|
228
|
+
this.storybookApi.setSelectedPanel("".concat(_register.ADDON_ID, "/panel/").concat(firstPanelBrowser));
|
320
229
|
});
|
321
230
|
|
322
231
|
this.storybookApi = storybookApi;
|
323
232
|
}
|
324
233
|
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
this.updateStatusListeners.push(listener);
|
331
|
-
return function () {
|
332
|
-
return void (_this2.updateStatusListeners = _this2.updateStatusListeners.filter(function (x) {
|
333
|
-
return x != listener;
|
334
|
-
}));
|
335
|
-
};
|
336
|
-
}
|
337
|
-
}, {
|
338
|
-
key: "onChangeTest",
|
339
|
-
value: function onChangeTest(listener) {
|
340
|
-
var _this3 = this;
|
341
|
-
|
342
|
-
this.changeTestListeners.push(listener);
|
343
|
-
return function () {
|
344
|
-
return void (_this3.changeTestListeners = _this3.changeTestListeners.filter(function (x) {
|
345
|
-
return x != listener;
|
346
|
-
}));
|
347
|
-
};
|
348
|
-
}
|
349
|
-
}, {
|
350
|
-
key: "addStatusesToSideBar",
|
351
|
-
value: function () {
|
352
|
-
var _addStatusesToSideBar = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
|
353
|
-
var _this4 = this;
|
354
|
-
|
355
|
-
var stories;
|
356
|
-
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
357
|
-
while (1) {
|
358
|
-
switch (_context2.prev = _context2.next) {
|
359
|
-
case 0:
|
360
|
-
if (Object.keys(this.stories).length) {
|
361
|
-
_context2.next = 2;
|
362
|
-
break;
|
363
|
-
}
|
364
|
-
|
365
|
-
return _context2.abrupt("return");
|
366
|
-
|
367
|
-
case 2:
|
368
|
-
stories = this.stories;
|
369
|
-
Object.keys(this.stories).forEach(function (storyId) {
|
370
|
-
var storyStatus = _this4.getStoryTests(storyId);
|
371
|
-
|
372
|
-
var status = storyStatus.map(function (x) {
|
373
|
-
return x.status;
|
374
|
-
}).reduce(function (oldStatus, newStatus) {
|
375
|
-
return (0, _helpers.calcStatus)(oldStatus, newStatus);
|
376
|
-
}, undefined);
|
377
|
-
var skip = storyStatus.length > 0 ? storyStatus.every(function (x) {
|
378
|
-
return x.skip;
|
379
|
-
}) : false;
|
380
|
-
_this4.stories[storyId].name = _this4.addStatusToStoryName(stories[storyId].name, status, skip);
|
381
|
-
});
|
382
|
-
_context2.next = 6;
|
383
|
-
return this.storybookApi.setStories(this.stories);
|
384
|
-
|
385
|
-
case 6:
|
386
|
-
case "end":
|
387
|
-
return _context2.stop();
|
388
|
-
}
|
389
|
-
}
|
390
|
-
}, _callee2, this);
|
391
|
-
}));
|
234
|
+
onUpdateStatus(listener) {
|
235
|
+
this.updateStatusListeners.push(listener);
|
236
|
+
return () => void (this.updateStatusListeners = this.updateStatusListeners.filter(x => x != listener));
|
237
|
+
}
|
392
238
|
|
393
|
-
|
394
|
-
|
395
|
-
|
239
|
+
onChangeTest(listener) {
|
240
|
+
this.changeTestListeners.push(listener);
|
241
|
+
return () => void (this.changeTestListeners = this.changeTestListeners.filter(x => x != listener));
|
242
|
+
}
|
243
|
+
|
244
|
+
async addStatusesToSideBar() {
|
245
|
+
if (!Object.keys(this.stories).length) return;
|
246
|
+
const stories = this.stories;
|
247
|
+
Object.keys(this.stories).forEach(storyId => {
|
248
|
+
const storyStatus = this.getStoryTests(storyId);
|
249
|
+
const status = storyStatus.map(x => x.status).reduce((oldStatus, newStatus) => (0, _helpers.calcStatus)(oldStatus, newStatus), undefined);
|
250
|
+
const skip = storyStatus.length > 0 ? storyStatus.every(x => x.skip) : false;
|
251
|
+
this.stories[storyId].name = this.addStatusToStoryName(stories[storyId].name, status, skip);
|
252
|
+
});
|
253
|
+
await this.storybookApi.setStories(this.stories);
|
254
|
+
}
|
255
|
+
|
256
|
+
addStatusToStoryName(name, status, skip) {
|
257
|
+
name = name.replace(/^(❌|✔|🟡|🕗|⏸) /, '');
|
258
|
+
const emojiStatus = (0, _utils.getEmojiByTestStatus)(status, skip);
|
259
|
+
return "".concat(emojiStatus ? "".concat(emojiStatus, " ") : '', " ").concat(name);
|
260
|
+
}
|
396
261
|
|
397
|
-
|
398
|
-
}()
|
399
|
-
}, {
|
400
|
-
key: "addStatusToStoryName",
|
401
|
-
value: function addStatusToStoryName(name, status, skip) {
|
402
|
-
name = name.replace(/^(❌|✔|🟡|🕗|⏸) /, '');
|
403
|
-
var emojiStatus = (0, _utils.getEmojiByTestStatus)(status, skip);
|
404
|
-
return "".concat(emojiStatus ? "".concat(emojiStatus, " ") : '', " ").concat(name);
|
405
|
-
}
|
406
|
-
}]);
|
407
|
-
|
408
|
-
return CreeveyManager;
|
409
|
-
}();
|
262
|
+
}
|
410
263
|
|
411
264
|
exports.CreeveyManager = CreeveyManager;
|
@@ -1,7 +1,5 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
4
|
-
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
6
4
|
value: true
|
7
5
|
});
|
@@ -13,54 +11,35 @@ var _react = _interopRequireWildcard(require("react"));
|
|
13
11
|
|
14
12
|
var _Panel = require("./Panel");
|
15
13
|
|
16
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function
|
17
|
-
|
18
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
19
|
-
|
20
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
21
|
-
|
22
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
23
|
-
|
24
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
25
|
-
|
26
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
27
|
-
|
28
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
29
|
-
|
30
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
31
|
-
|
32
|
-
var Addon = function Addon(_ref) {
|
33
|
-
var active = _ref.active,
|
34
|
-
browser = _ref.browser,
|
35
|
-
manager = _ref.manager;
|
36
|
-
|
37
|
-
var _useState = (0, _react.useState)([]),
|
38
|
-
_useState2 = _slicedToArray(_useState, 2),
|
39
|
-
tests = _useState2[0],
|
40
|
-
setTests = _useState2[1];
|
14
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
41
15
|
|
42
|
-
|
43
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
44
|
-
selectedTestId = _useState4[0],
|
45
|
-
setSelectedTestId = _useState4[1];
|
16
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
46
17
|
|
47
|
-
|
18
|
+
const Addon = _ref => {
|
19
|
+
let {
|
20
|
+
active,
|
21
|
+
browser,
|
22
|
+
manager
|
23
|
+
} = _ref;
|
24
|
+
const [tests, setTests] = (0, _react.useState)([]);
|
25
|
+
const [selectedTestId, setSelectedTestId] = (0, _react.useState)(manager.selectedTestId);
|
26
|
+
(0, _react.useEffect)(() => {
|
48
27
|
if (active) {
|
49
28
|
manager.setActiveBrowser(browser);
|
50
|
-
|
29
|
+
const browserTests = manager.getTestsByStoryIdAndBrowser(manager.activeBrowser);
|
51
30
|
setTests(browserTests);
|
52
31
|
}
|
53
32
|
}, [active, browser, manager]);
|
54
|
-
(0, _react.useEffect)(
|
55
|
-
|
33
|
+
(0, _react.useEffect)(() => {
|
34
|
+
const unsubscribe = manager.onChangeTest(testId => {
|
56
35
|
setSelectedTestId(testId);
|
57
|
-
|
36
|
+
const status = manager.getTestsByStoryIdAndBrowser(manager.activeBrowser);
|
58
37
|
setTests(status);
|
59
38
|
});
|
60
39
|
return unsubscribe;
|
61
40
|
}, [manager]);
|
62
|
-
(0, _react.useEffect)(
|
63
|
-
|
41
|
+
(0, _react.useEffect)(() => {
|
42
|
+
const unsubscribe = manager.onUpdateStatus(() => {
|
64
43
|
setTests(manager.getTestsByStoryIdAndBrowser(manager.activeBrowser));
|
65
44
|
});
|
66
45
|
return unsubscribe;
|
@@ -3,15 +3,17 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.
|
6
|
+
exports.NextIcon = exports.ForwardIcon = void 0;
|
7
7
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
9
9
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
const NextIcon = _ref => {
|
13
|
+
let {
|
14
|
+
width,
|
15
|
+
height
|
16
|
+
} = _ref;
|
15
17
|
return /*#__PURE__*/_react.default.createElement("svg", {
|
16
18
|
version: "1.1",
|
17
19
|
width: width,
|
@@ -25,9 +27,11 @@ var NextIcon = function NextIcon(_ref) {
|
|
25
27
|
|
26
28
|
exports.NextIcon = NextIcon;
|
27
29
|
|
28
|
-
|
29
|
-
|
30
|
-
|
30
|
+
const ForwardIcon = _ref2 => {
|
31
|
+
let {
|
32
|
+
width,
|
33
|
+
height
|
34
|
+
} = _ref2;
|
31
35
|
return /*#__PURE__*/_react.default.createElement("svg", {
|
32
36
|
version: "1.1",
|
33
37
|
width: width,
|