creevey 0.9.0-beta.2 → 0.9.0-non-webpack.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/AUTHORS +15 -15
- package/CHANGELOG.md +1275 -1275
- package/LICENSE +21 -21
- package/README.md +7 -0
- package/addon/README.md +3 -0
- package/addon/package.json +4 -0
- package/docs/config.md +212 -212
- package/docs/grid.md +10 -10
- package/docs/tests.md +63 -63
- package/jest.config.js +6 -0
- package/lib/cjs/client/addon/Manager.js +123 -271
- package/lib/cjs/client/addon/components/Addon.js +17 -38
- package/lib/cjs/client/addon/components/Icons.js +12 -8
- 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.js +13 -32
- package/lib/cjs/client/addon/register.js +46 -70
- package/lib/cjs/client/addon/utils.js +1 -1
- package/lib/cjs/client/addon/withCreevey.js +164 -344
- package/lib/cjs/client/shared/components/ImagesView/BlendView.js +23 -21
- package/lib/cjs/client/shared/components/ImagesView/ImagesView.js +22 -18
- package/lib/cjs/client/shared/components/ImagesView/SideBySideView.js +42 -64
- package/lib/cjs/client/shared/components/ImagesView/SlideView.js +35 -48
- package/lib/cjs/client/shared/components/ImagesView/SwapView.js +24 -43
- 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 +143 -214
- 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/index.html +19 -19
- 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 +4 -4
- package/lib/cjs/server/config.js +1 -1
- package/lib/cjs/server/docker.js +3 -7
- package/lib/cjs/server/index.js +1 -1
- 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 +1 -3
- package/lib/cjs/server/loaders/webpack/compile.js +31 -24
- package/lib/cjs/server/loaders/webpack/creevey-loader.js +10 -5
- package/lib/cjs/server/loaders/webpack/dummy-hmr.js +2 -7
- package/lib/cjs/server/loaders/webpack/mdx-loader.js +1 -1
- 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 +2 -2
- package/lib/cjs/server/master/pool.js +9 -18
- package/lib/cjs/server/master/runner.js +53 -66
- package/lib/cjs/server/master/server.js +2 -2
- package/lib/cjs/server/messages.js +8 -10
- package/lib/cjs/server/selenium/browser.js +23 -31
- package/lib/cjs/server/selenium/selenoid.js +5 -7
- package/lib/cjs/server/stories.js +9 -20
- package/lib/cjs/server/storybook/entry.js +5 -3
- package/lib/cjs/server/storybook/helpers.js +15 -21
- package/lib/cjs/server/storybook/providers/browser.js +5 -9
- package/lib/cjs/server/storybook/providers/nodejs.js +4 -4
- package/lib/cjs/server/update.js +1 -5
- package/lib/cjs/server/utils.js +13 -15
- package/lib/cjs/server/worker/reporter.js +8 -20
- package/lib/cjs/server/worker/worker.js +6 -16
- package/lib/cjs/shared/index.js +101 -0
- package/lib/cjs/shared/serializeRegExp.js +42 -0
- package/lib/cjs/types.js +6 -6
- package/lib/esm/client/addon/Manager.js +123 -271
- package/lib/esm/client/addon/components/Addon.js +15 -34
- package/lib/esm/client/addon/components/Icons.js +11 -7
- 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.js +10 -25
- package/lib/esm/client/addon/register.js +42 -66
- package/lib/esm/client/addon/utils.js +1 -1
- package/lib/esm/client/addon/withCreevey.js +157 -341
- package/lib/esm/client/shared/components/ImagesView/BlendView.js +21 -17
- package/lib/esm/client/shared/components/ImagesView/ImagesView.js +21 -17
- package/lib/esm/client/shared/components/ImagesView/SideBySideView.js +40 -60
- package/lib/esm/client/shared/components/ImagesView/SlideView.js +33 -44
- package/lib/esm/client/shared/components/ImagesView/SwapView.js +22 -39
- 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 +127 -198
- package/lib/esm/client/shared/viewMode.js +4 -4
- package/lib/esm/creevey.js +3 -5
- package/lib/esm/index.js +1 -3
- package/lib/esm/server/docker.js +2 -2
- package/lib/esm/server/index.js +1 -1
- 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 +1 -3
- package/lib/esm/server/loaders/webpack/compile.js +31 -24
- package/lib/esm/server/loaders/webpack/creevey-loader.js +9 -4
- package/lib/esm/server/loaders/webpack/dummy-hmr.js +2 -6
- package/lib/esm/server/loaders/webpack/start.js +1 -1
- package/lib/esm/server/master/index.js +2 -2
- package/lib/esm/server/master/pool.js +7 -18
- package/lib/esm/server/master/runner.js +53 -66
- package/lib/esm/server/master/server.js +2 -2
- package/lib/esm/server/messages.js +3 -5
- package/lib/esm/server/selenium/browser.js +20 -28
- package/lib/esm/server/selenium/selenoid.js +4 -6
- package/lib/esm/server/stories.js +9 -20
- package/lib/esm/server/storybook/entry.js +4 -2
- package/lib/esm/server/storybook/helpers.js +7 -15
- package/lib/esm/server/storybook/providers/browser.js +4 -5
- package/lib/esm/server/storybook/providers/nodejs.js +3 -3
- package/lib/esm/server/update.js +1 -5
- package/lib/esm/server/utils.js +5 -9
- package/lib/esm/server/worker/reporter.js +8 -20
- package/lib/esm/server/worker/worker.js +6 -16
- package/lib/esm/shared/index.js +78 -0
- package/lib/esm/shared/serializeRegExp.js +24 -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 -24
- package/lib/types/client/addon/readyForCapture.d.ts +6 -6
- package/lib/types/client/addon/register.d.ts +3 -3
- package/lib/types/client/addon/utils.d.ts +2 -2
- package/lib/types/client/addon/withCreevey.d.ts +24 -24
- 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 -7
- package/lib/types/server/master/pool.d.ts +31 -31
- 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 +27 -27
- package/lib/types/server/selenium/browser.d.ts +17 -17
- 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 -8
- package/lib/types/server/storybook/entry.d.ts +18 -18
- package/lib/types/server/storybook/helpers.d.ts +24 -24
- package/lib/types/server/storybook/providers/browser.d.ts +4 -4
- package/lib/types/server/storybook/providers/hybrid.d.ts +4 -4
- package/lib/types/server/storybook/providers/nodejs.d.ts +9 -9
- package/lib/types/server/testsFiles/parser.d.ts +12 -12
- package/lib/types/server/testsFiles/register.d.ts +2 -2
- package/lib/types/server/update.d.ts +2 -2
- package/lib/types/server/utils.d.ts +20 -20
- package/lib/types/server/worker/chai-image.d.ts +6 -6
- package/lib/types/server/worker/helpers.d.ts +8 -8
- 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.d.ts → shared/index.d.ts} +7 -16
- package/lib/types/shared/serializeRegExp.d.ts +9 -0
- package/lib/types/types.d.ts +490 -489
- package/package.json +115 -102
- package/preset.js +9 -9
- package/types/babel__register.d.ts +1 -1
- package/types/chai.d.ts +12 -12
- package/types/event-source-polyfill.d.ts +6 -6
- package/types/mdx.d.ts +3 -2
- package/types/mocha.d.ts +20 -20
- package/types/png.d.ts +4 -4
- package/lib/cjs/client/web/1.js +0 -13
- package/lib/cjs/client/web/2.js +0 -1
- package/lib/cjs/shared.js +0 -124
- package/lib/esm/shared.js +0 -93
- package/storybook-static/stories.json +0 -21
@@ -19,44 +19,10 @@ var _register = require("./register");
|
|
19
19
|
|
20
20
|
var _utils = require("./utils");
|
21
21
|
|
22
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
23
|
-
|
24
|
-
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."); }
|
25
|
-
|
26
|
-
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; }
|
27
|
-
|
28
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
29
|
-
|
30
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
31
|
-
|
32
|
-
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."); }
|
33
|
-
|
34
|
-
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); }
|
35
|
-
|
36
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
37
|
-
|
38
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
39
|
-
|
40
|
-
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; }
|
41
|
-
|
42
|
-
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); } }
|
43
|
-
|
44
|
-
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); }); }; }
|
45
|
-
|
46
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
47
|
-
|
48
|
-
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); } }
|
49
|
-
|
50
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
51
|
-
|
52
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; }
|
53
23
|
|
54
|
-
|
55
|
-
|
56
|
-
var _this = this;
|
57
|
-
|
58
|
-
_classCallCheck(this, CreeveyManager);
|
59
|
-
|
24
|
+
class CreeveyManager {
|
25
|
+
constructor(storybookApi) {
|
60
26
|
_defineProperty(this, "storyId", '');
|
61
27
|
|
62
28
|
_defineProperty(this, "activeBrowser", '');
|
@@ -71,66 +37,46 @@ var CreeveyManager = /*#__PURE__*/function () {
|
|
71
37
|
|
72
38
|
_defineProperty(this, "creeveyApi", null);
|
73
39
|
|
40
|
+
_defineProperty(this, "storybookApi", void 0);
|
41
|
+
|
74
42
|
_defineProperty(this, "stories", {});
|
75
43
|
|
76
44
|
_defineProperty(this, "updateStatusListeners", []);
|
77
45
|
|
78
46
|
_defineProperty(this, "changeTestListeners", []);
|
79
47
|
|
80
|
-
_defineProperty(this, "initAll",
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
_this.storybookApi.on(_coreEvents.SET_STORIES, _this.onSetStories);
|
88
|
-
|
89
|
-
_context.next = 4;
|
90
|
-
return (0, _creeveyClientApi.initCreeveyClientApi)();
|
91
|
-
|
92
|
-
case 4:
|
93
|
-
_this.creeveyApi = _context.sent;
|
94
|
-
|
95
|
-
_this.creeveyApi.onUpdate(_this.handleCreeveyUpdate);
|
96
|
-
|
97
|
-
_context.next = 8;
|
98
|
-
return _this.creeveyApi.status;
|
99
|
-
|
100
|
-
case 8:
|
101
|
-
_this.status = _context.sent;
|
102
|
-
|
103
|
-
case 9:
|
104
|
-
case "end":
|
105
|
-
return _context.stop();
|
106
|
-
}
|
107
|
-
}
|
108
|
-
}, _callee);
|
109
|
-
})));
|
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
|
+
});
|
110
55
|
|
111
|
-
_defineProperty(this, "handleCreeveyUpdate",
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
56
|
+
_defineProperty(this, "handleCreeveyUpdate", update => {
|
57
|
+
const {
|
58
|
+
tests,
|
59
|
+
removedTests = [],
|
60
|
+
isRunning
|
61
|
+
} = update;
|
116
62
|
|
117
63
|
if ((0, _types.isDefined)(isRunning)) {
|
118
|
-
|
64
|
+
this.status.isRunning = isRunning;
|
119
65
|
}
|
120
66
|
|
121
67
|
if ((0, _types.isDefined)(tests)) {
|
122
|
-
|
123
|
-
|
124
|
-
Object.values(tests).filter(_types.isDefined).forEach(
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
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];
|
134
80
|
|
135
81
|
if (!test) {
|
136
82
|
return prevTests[id] = update;
|
@@ -142,271 +88,177 @@ var CreeveyManager = /*#__PURE__*/function () {
|
|
142
88
|
test.status = status;
|
143
89
|
|
144
90
|
if ((0, _types.isDefined)(storyId) && (0, _types.isDefined)(prevStories[storyId])) {
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
var oldStatus = storyStatus.map(function (x) {
|
150
|
-
return x.id === id ? status : x.status;
|
151
|
-
}).reduce(function (oldStatus, newStatus) {
|
152
|
-
return (0, _helpers.calcStatus)(oldStatus, newStatus);
|
153
|
-
}, undefined);
|
154
|
-
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);
|
155
95
|
}
|
156
96
|
}
|
157
97
|
|
158
|
-
if ((0, _types.isDefined)(results)) test.results ?
|
98
|
+
if ((0, _types.isDefined)(results)) test.results ? test.results.push(...results) : test.results = results;
|
159
99
|
|
160
100
|
if ((0, _types.isDefined)(approved)) {
|
161
|
-
Object.entries(approved).forEach(
|
162
|
-
|
163
|
-
image = _ref3[0],
|
164
|
-
retry = _ref3[1];
|
165
|
-
|
101
|
+
Object.entries(approved).forEach(_ref => {
|
102
|
+
let [image, retry] = _ref;
|
166
103
|
return retry !== undefined && test && ((test.approved = (test === null || test === void 0 ? void 0 : test.approved) || {})[image] = retry);
|
167
104
|
});
|
168
105
|
}
|
169
106
|
});
|
170
|
-
removedTests.forEach(
|
171
|
-
|
107
|
+
removedTests.forEach(_ref2 => {
|
108
|
+
let {
|
109
|
+
id
|
110
|
+
} = _ref2;
|
172
111
|
return delete prevTests[id];
|
173
112
|
});
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
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);
|
180
117
|
}
|
181
118
|
|
182
|
-
|
183
|
-
return x(update);
|
184
|
-
});
|
119
|
+
this.updateStatusListeners.forEach(x => x(update));
|
185
120
|
});
|
186
121
|
|
187
|
-
_defineProperty(this, "getCurrentTest",
|
188
|
-
return
|
122
|
+
_defineProperty(this, "getCurrentTest", () => {
|
123
|
+
return this.status.tests[this.selectedTestId];
|
189
124
|
});
|
190
125
|
|
191
|
-
_defineProperty(this, "onStoryRendered",
|
192
|
-
if (
|
126
|
+
_defineProperty(this, "onStoryRendered", storyId => {
|
127
|
+
if (this.storyId === '') void this.addStatusesToSideBar();
|
193
128
|
|
194
|
-
if (
|
129
|
+
if (this.storyId !== storyId) {
|
195
130
|
var _this$getTestsByStory, _this$getTestsByStory2;
|
196
131
|
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
_this.changeTestListeners.forEach(function (x) {
|
203
|
-
return x(_this.selectedTestId);
|
204
|
-
});
|
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));
|
205
136
|
}
|
206
137
|
});
|
207
138
|
|
208
|
-
_defineProperty(this, "onStart",
|
139
|
+
_defineProperty(this, "onStart", () => {
|
209
140
|
var _this$creeveyApi;
|
210
141
|
|
211
|
-
(_this$creeveyApi =
|
142
|
+
(_this$creeveyApi = this.creeveyApi) === null || _this$creeveyApi === void 0 ? void 0 : _this$creeveyApi.start([this.selectedTestId]);
|
212
143
|
});
|
213
144
|
|
214
|
-
_defineProperty(this, "onStop",
|
145
|
+
_defineProperty(this, "onStop", () => {
|
215
146
|
var _this$creeveyApi2;
|
216
147
|
|
217
|
-
(_this$creeveyApi2 =
|
148
|
+
(_this$creeveyApi2 = this.creeveyApi) === null || _this$creeveyApi2 === void 0 ? void 0 : _this$creeveyApi2.stop();
|
218
149
|
});
|
219
150
|
|
220
|
-
_defineProperty(this, "onImageApprove",
|
151
|
+
_defineProperty(this, "onImageApprove", (id, retry, image) => {
|
221
152
|
var _this$creeveyApi3;
|
222
153
|
|
223
|
-
return (_this$creeveyApi3 =
|
154
|
+
return (_this$creeveyApi3 = this.creeveyApi) === null || _this$creeveyApi3 === void 0 ? void 0 : _this$creeveyApi3.approve(id, retry, image);
|
224
155
|
});
|
225
156
|
|
226
|
-
_defineProperty(this, "onStartAllStoryTests",
|
157
|
+
_defineProperty(this, "onStartAllStoryTests", () => {
|
227
158
|
var _this$creeveyApi4;
|
228
159
|
|
229
|
-
|
230
|
-
|
231
|
-
}).map(function (x) {
|
232
|
-
return x.id;
|
233
|
-
});
|
234
|
-
(_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);
|
235
162
|
});
|
236
163
|
|
237
|
-
_defineProperty(this, "onStartAllTests",
|
164
|
+
_defineProperty(this, "onStartAllTests", () => {
|
238
165
|
var _this$creeveyApi5;
|
239
166
|
|
240
|
-
|
241
|
-
|
242
|
-
});
|
243
|
-
(_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);
|
244
169
|
});
|
245
170
|
|
246
|
-
_defineProperty(this, "onSetStories",
|
247
|
-
|
248
|
-
|
171
|
+
_defineProperty(this, "onSetStories", data => {
|
172
|
+
const stories = data.v ? (0, _shared.denormalizeStoryParameters)(data) : data.stories;
|
173
|
+
this.stories = stories;
|
249
174
|
});
|
250
175
|
|
251
|
-
_defineProperty(this, "setActiveBrowser",
|
176
|
+
_defineProperty(this, "setActiveBrowser", browser => {
|
252
177
|
var _this$getTestsByStory3, _this$getTestsByStory4;
|
253
178
|
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
_this.changeTestListeners.forEach(function (x) {
|
258
|
-
return x(_this.selectedTestId);
|
259
|
-
});
|
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));
|
260
182
|
});
|
261
183
|
|
262
|
-
_defineProperty(this, "setSelectedTestId",
|
263
|
-
|
264
|
-
|
265
|
-
_this.changeTestListeners.forEach(function (x) {
|
266
|
-
return x(_this.selectedTestId);
|
267
|
-
});
|
184
|
+
_defineProperty(this, "setSelectedTestId", testId => {
|
185
|
+
this.selectedTestId = testId;
|
186
|
+
this.changeTestListeners.forEach(x => x(this.selectedTestId));
|
268
187
|
});
|
269
188
|
|
270
|
-
_defineProperty(this, "getStoryTests",
|
271
|
-
if (!
|
272
|
-
return Object.values(
|
273
|
-
return (result === null || result === void 0 ? void 0 : result.storyId) === storyId;
|
274
|
-
}).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);
|
275
192
|
});
|
276
193
|
|
277
|
-
_defineProperty(this, "getBrowsers",
|
278
|
-
return
|
194
|
+
_defineProperty(this, "getBrowsers", () => {
|
195
|
+
return this.status.browsers;
|
279
196
|
});
|
280
197
|
|
281
|
-
_defineProperty(this, "getTestsByStoryIdAndBrowser",
|
282
|
-
return Object.values(
|
283
|
-
return (x === null || x === void 0 ? void 0 : x.browser) === browser && x.storyId === _this.storyId;
|
284
|
-
}).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);
|
285
200
|
});
|
286
201
|
|
287
|
-
_defineProperty(this, "getTabTitle",
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
}).reduce(function (oldStatus, newStatus) {
|
293
|
-
return (0, _helpers.calcStatus)(oldStatus, newStatus);
|
294
|
-
}, undefined);
|
295
|
-
var browserSkip = tests.length > 0 ? tests.every(function (x) {
|
296
|
-
return x && x.skip;
|
297
|
-
}) : false;
|
298
|
-
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);
|
299
207
|
return "".concat(emojiStatus ? "".concat(emojiStatus, " ") : '', "Creevey/").concat(browser);
|
300
208
|
});
|
301
209
|
|
302
|
-
_defineProperty(this, "setPanelsTitle",
|
210
|
+
_defineProperty(this, "setPanelsTitle", () => {
|
303
211
|
var _this$storybookApi;
|
304
212
|
|
305
|
-
|
213
|
+
const panels = (_this$storybookApi = this.storybookApi) === null || _this$storybookApi === void 0 ? void 0 : _this$storybookApi.getPanels();
|
306
214
|
if (!panels) return;
|
307
|
-
|
215
|
+
let firstPanelBrowser = this.activeBrowser;
|
308
216
|
|
309
|
-
for (
|
217
|
+
for (const p in panels) {
|
310
218
|
var _panel$id;
|
311
219
|
|
312
|
-
|
220
|
+
const panel = panels[p];
|
313
221
|
|
314
222
|
if (((_panel$id = panel.id) === null || _panel$id === void 0 ? void 0 : _panel$id.indexOf(_register.ADDON_ID)) === 0 && panel.paramKey) {
|
315
|
-
panel.title =
|
223
|
+
panel.title = this.getTabTitle(panel.paramKey);
|
316
224
|
if (!firstPanelBrowser) firstPanelBrowser = panel.paramKey;
|
317
225
|
}
|
318
226
|
}
|
319
227
|
|
320
|
-
|
228
|
+
this.storybookApi.setSelectedPanel("".concat(_register.ADDON_ID, "/panel/").concat(firstPanelBrowser));
|
321
229
|
});
|
322
230
|
|
323
231
|
this.storybookApi = storybookApi;
|
324
232
|
}
|
325
233
|
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
this.updateStatusListeners.push(listener);
|
332
|
-
return function () {
|
333
|
-
return void (_this2.updateStatusListeners = _this2.updateStatusListeners.filter(function (x) {
|
334
|
-
return x != listener;
|
335
|
-
}));
|
336
|
-
};
|
337
|
-
}
|
338
|
-
}, {
|
339
|
-
key: "onChangeTest",
|
340
|
-
value: function onChangeTest(listener) {
|
341
|
-
var _this3 = this;
|
342
|
-
|
343
|
-
this.changeTestListeners.push(listener);
|
344
|
-
return function () {
|
345
|
-
return void (_this3.changeTestListeners = _this3.changeTestListeners.filter(function (x) {
|
346
|
-
return x != listener;
|
347
|
-
}));
|
348
|
-
};
|
349
|
-
}
|
350
|
-
}, {
|
351
|
-
key: "addStatusesToSideBar",
|
352
|
-
value: function () {
|
353
|
-
var _addStatusesToSideBar = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
|
354
|
-
var _this4 = this;
|
355
|
-
|
356
|
-
var stories;
|
357
|
-
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
358
|
-
while (1) {
|
359
|
-
switch (_context2.prev = _context2.next) {
|
360
|
-
case 0:
|
361
|
-
if (Object.keys(this.stories).length) {
|
362
|
-
_context2.next = 2;
|
363
|
-
break;
|
364
|
-
}
|
365
|
-
|
366
|
-
return _context2.abrupt("return");
|
367
|
-
|
368
|
-
case 2:
|
369
|
-
stories = this.stories;
|
370
|
-
Object.keys(this.stories).forEach(function (storyId) {
|
371
|
-
var storyStatus = _this4.getStoryTests(storyId);
|
372
|
-
|
373
|
-
var status = storyStatus.map(function (x) {
|
374
|
-
return x.status;
|
375
|
-
}).reduce(function (oldStatus, newStatus) {
|
376
|
-
return (0, _helpers.calcStatus)(oldStatus, newStatus);
|
377
|
-
}, undefined);
|
378
|
-
var skip = storyStatus.length > 0 ? storyStatus.every(function (x) {
|
379
|
-
return x.skip;
|
380
|
-
}) : false;
|
381
|
-
_this4.stories[storyId].name = _this4.addStatusToStoryName(stories[storyId].name, status, skip);
|
382
|
-
});
|
383
|
-
_context2.next = 6;
|
384
|
-
return this.storybookApi.setStories(this.stories);
|
385
|
-
|
386
|
-
case 6:
|
387
|
-
case "end":
|
388
|
-
return _context2.stop();
|
389
|
-
}
|
390
|
-
}
|
391
|
-
}, _callee2, this);
|
392
|
-
}));
|
234
|
+
onUpdateStatus(listener) {
|
235
|
+
this.updateStatusListeners.push(listener);
|
236
|
+
return () => void (this.updateStatusListeners = this.updateStatusListeners.filter(x => x != listener));
|
237
|
+
}
|
393
238
|
|
394
|
-
|
395
|
-
|
396
|
-
|
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
|
+
}
|
397
261
|
|
398
|
-
|
399
|
-
}()
|
400
|
-
}, {
|
401
|
-
key: "addStatusToStoryName",
|
402
|
-
value: function addStatusToStoryName(name, status, skip) {
|
403
|
-
name = name.replace(/^(❌|✔|🟡|🕗|⏸) /, '');
|
404
|
-
var emojiStatus = (0, _utils.getEmojiByTestStatus)(status, skip);
|
405
|
-
return "".concat(emojiStatus ? "".concat(emojiStatus, " ") : '', " ").concat(name);
|
406
|
-
}
|
407
|
-
}]);
|
408
|
-
|
409
|
-
return CreeveyManager;
|
410
|
-
}();
|
262
|
+
}
|
411
263
|
|
412
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,
|
@@ -35,7 +39,7 @@ var ForwardIcon = function ForwardIcon(_ref2) {
|
|
35
39
|
viewBox: "0 0 512 512"
|
36
40
|
}, /*#__PURE__*/_react.default.createElement("path", {
|
37
41
|
fill: "currentColor",
|
38
|
-
d: "M460.9,246.8l-209-164.2c-7.8-6.1-19.2-0.6-19.2,9.2v328.4c0,9.8,11.4,15.3,19.2,9.2l209-164.2c5.1-4,6-11.4,2-16.5 C462.4,248,461.7,247.3,460.9,246.8L460.9,246.8z M228.2,246.8L19.2,82.5C11.4,76.4,0,82,0,91.8v328.4c0,9.8,11.4,15.3,19.2,9.2 l209-164.2c3-2.3,4.5-5.8,4.5-9.2C232.7,252.6,231.2,249.1,228.2,246.8z M507.3,64h-37.2c-2.5,0-4.7,2-4.7,4.4v375.3 c0,2.4,2.1,4.4,4.7,4.4h37.2c2.5,0,4.7-2,4.7-4.4V68.4C512,66,509.9,64,507.3,64z"
|
42
|
+
d: "M460.9,246.8l-209-164.2c-7.8-6.1-19.2-0.6-19.2,9.2v328.4c0,9.8,11.4,15.3,19.2,9.2l209-164.2c5.1-4,6-11.4,2-16.5\r C462.4,248,461.7,247.3,460.9,246.8L460.9,246.8z M228.2,246.8L19.2,82.5C11.4,76.4,0,82,0,91.8v328.4c0,9.8,11.4,15.3,19.2,9.2\r l209-164.2c3-2.3,4.5-5.8,4.5-9.2C232.7,252.6,231.2,249.1,228.2,246.8z M507.3,64h-37.2c-2.5,0-4.7,2-4.7,4.4v375.3\r c0,2.4,2.1,4.4,4.7,4.4h37.2c2.5,0,4.7-2,4.7-4.4V68.4C512,66,509.9,64,507.3,64z"
|
39
43
|
}));
|
40
44
|
};
|
41
45
|
|