creevey 0.9.0-beta.1 → 0.9.0-non-webpack.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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/cli.js +5 -0
- package/lib/cjs/client/addon/Manager.js +418 -0
- package/lib/cjs/client/addon/components/Addon.js +76 -0
- package/lib/cjs/client/addon/components/Icons.js +42 -0
- package/lib/cjs/client/addon/components/Panel.js +68 -0
- package/lib/cjs/client/addon/components/TestSelect.js +63 -0
- package/lib/cjs/client/addon/components/Tools.js +114 -0
- package/lib/cjs/client/addon/decorator.js +11 -0
- package/lib/cjs/client/addon/index.js +31 -0
- package/lib/cjs/client/addon/preset.js +81 -0
- package/lib/cjs/client/addon/readyForCapture.js +12 -0
- package/lib/cjs/client/addon/register.js +100 -0
- package/lib/cjs/client/addon/utils.js +38 -0
- package/lib/cjs/client/addon/withCreevey.js +558 -0
- package/lib/cjs/client/shared/components/ImagesView/BlendView.js +85 -0
- package/lib/cjs/client/shared/components/ImagesView/ImagesView.js +88 -0
- package/lib/cjs/client/shared/components/ImagesView/SideBySideView.js +176 -0
- package/lib/cjs/client/shared/components/ImagesView/SlideView.js +179 -0
- package/lib/cjs/client/shared/components/ImagesView/SwapView.js +110 -0
- package/lib/cjs/client/shared/components/ImagesView/index.js +45 -0
- package/lib/cjs/client/shared/components/PageFooter/PageFooter.js +46 -0
- package/lib/cjs/client/shared/components/PageFooter/Paging.js +98 -0
- package/lib/cjs/client/shared/components/PageHeader/ImagePreview.js +78 -0
- package/lib/cjs/client/shared/components/PageHeader/PageHeader.js +144 -0
- package/lib/cjs/client/shared/components/ResultsPage.js +173 -0
- package/lib/cjs/client/shared/creeveyClientApi.js +107 -0
- package/lib/cjs/client/shared/helpers.js +482 -0
- package/lib/cjs/client/shared/viewMode.js +17 -0
- 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 -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 +69 -0
- package/lib/cjs/index.js +62 -0
- package/lib/cjs/server/config.js +96 -0
- package/lib/cjs/server/docker.js +146 -0
- package/lib/cjs/server/extract.js +50 -0
- package/lib/cjs/server/index.js +83 -0
- package/lib/cjs/server/loaders/babel/creevey-plugin.js +86 -0
- package/lib/cjs/server/loaders/babel/helpers.js +469 -0
- package/lib/cjs/server/loaders/babel/register.js +124 -0
- package/lib/cjs/server/loaders/hooks/mdx.js +30 -0
- package/lib/cjs/server/loaders/hooks/svelte.js +65 -0
- package/lib/cjs/server/loaders/webpack/compile.js +293 -0
- package/lib/cjs/server/loaders/webpack/creevey-loader.js +179 -0
- package/lib/cjs/server/loaders/webpack/dummy-hmr.js +39 -0
- package/lib/cjs/server/loaders/webpack/mdx-loader.js +72 -0
- package/lib/cjs/server/loaders/webpack/start.js +41 -0
- package/lib/cjs/server/logger.js +48 -0
- package/lib/cjs/server/master/api.js +71 -0
- package/lib/cjs/server/master/index.js +146 -0
- package/lib/cjs/server/master/master.js +57 -0
- package/lib/cjs/server/master/pool.js +197 -0
- package/lib/cjs/server/master/runner.js +281 -0
- package/lib/cjs/server/master/server.js +129 -0
- package/lib/cjs/server/messages.js +264 -0
- package/lib/cjs/server/selenium/browser.js +672 -0
- package/lib/cjs/server/selenium/index.js +31 -0
- package/lib/cjs/server/selenium/selenoid.js +172 -0
- package/lib/cjs/server/stories.js +159 -0
- package/lib/cjs/server/storybook/entry.js +70 -0
- package/lib/cjs/server/storybook/helpers.js +159 -0
- package/lib/cjs/server/storybook/providers/browser.js +74 -0
- package/lib/cjs/server/storybook/providers/hybrid.js +84 -0
- package/lib/cjs/server/storybook/providers/nodejs.js +239 -0
- package/lib/cjs/server/testsFiles/parser.js +72 -0
- package/lib/cjs/server/testsFiles/register.js +48 -0
- package/lib/cjs/server/update.js +79 -0
- package/lib/cjs/server/utils.js +183 -0
- package/lib/cjs/server/worker/chai-image.js +142 -0
- package/lib/cjs/server/worker/helpers.js +69 -0
- package/lib/cjs/server/worker/index.js +15 -0
- package/lib/cjs/server/worker/reporter.js +108 -0
- package/lib/cjs/server/worker/worker.js +268 -0
- package/lib/cjs/shared/index.js +89 -0
- package/lib/cjs/shared/serializeRegExp.js +41 -0
- package/lib/cjs/types.js +74 -0
- package/lib/esm/cli.js +4 -0
- package/lib/esm/client/addon/Manager.js +402 -0
- package/lib/esm/client/addon/components/Addon.js +58 -0
- package/lib/esm/client/addon/components/Icons.js +27 -0
- package/lib/esm/client/addon/components/Panel.js +49 -0
- package/lib/esm/client/addon/components/TestSelect.js +49 -0
- package/lib/esm/client/addon/components/Tools.js +91 -0
- package/lib/esm/client/addon/decorator.js +2 -0
- package/lib/esm/client/addon/index.js +2 -0
- package/lib/esm/client/addon/preset.js +56 -0
- package/lib/esm/client/addon/readyForCapture.js +5 -0
- package/lib/esm/client/addon/register.js +79 -0
- package/lib/esm/client/addon/utils.js +31 -0
- package/lib/esm/client/addon/withCreevey.js +534 -0
- package/lib/esm/client/shared/components/ImagesView/BlendView.js +63 -0
- package/lib/esm/client/shared/components/ImagesView/ImagesView.js +65 -0
- package/lib/esm/client/shared/components/ImagesView/SideBySideView.js +151 -0
- package/lib/esm/client/shared/components/ImagesView/SlideView.js +154 -0
- package/lib/esm/client/shared/components/ImagesView/SwapView.js +88 -0
- package/lib/esm/client/shared/components/ImagesView/index.js +5 -0
- package/lib/esm/client/shared/components/PageFooter/PageFooter.js +32 -0
- package/lib/esm/client/shared/components/PageFooter/Paging.js +84 -0
- package/lib/esm/client/shared/components/PageHeader/ImagePreview.js +64 -0
- package/lib/esm/client/shared/components/PageHeader/PageHeader.js +120 -0
- package/lib/esm/client/shared/components/ResultsPage.js +143 -0
- package/lib/esm/client/shared/creeveyClientApi.js +98 -0
- package/lib/esm/client/shared/helpers.js +424 -0
- package/lib/esm/client/shared/viewMode.js +6 -0
- package/lib/esm/creevey.js +54 -0
- package/lib/esm/index.js +5 -0
- package/lib/esm/server/config.js +73 -0
- package/lib/esm/server/docker.js +123 -0
- package/lib/esm/server/extract.js +34 -0
- package/lib/esm/server/index.js +64 -0
- package/lib/esm/server/loaders/babel/creevey-plugin.js +72 -0
- package/lib/esm/server/loaders/babel/helpers.js +452 -0
- package/lib/esm/server/loaders/babel/register.js +103 -0
- package/lib/esm/server/loaders/hooks/mdx.js +15 -0
- package/lib/esm/server/loaders/hooks/svelte.js +49 -0
- package/lib/esm/server/loaders/webpack/compile.js +270 -0
- package/lib/esm/server/loaders/webpack/creevey-loader.js +158 -0
- package/lib/esm/server/loaders/webpack/dummy-hmr.js +32 -0
- package/lib/esm/server/loaders/webpack/mdx-loader.js +58 -0
- package/lib/esm/server/loaders/webpack/start.js +27 -0
- package/lib/esm/server/logger.js +20 -0
- package/lib/esm/server/master/api.js +60 -0
- package/lib/esm/server/master/index.js +125 -0
- package/lib/esm/server/master/master.js +38 -0
- package/lib/esm/server/master/pool.js +176 -0
- package/lib/esm/server/master/runner.js +259 -0
- package/lib/esm/server/master/server.js +105 -0
- package/lib/esm/server/messages.js +232 -0
- package/lib/esm/server/selenium/browser.js +639 -0
- package/lib/esm/server/selenium/index.js +2 -0
- package/lib/esm/server/selenium/selenoid.js +149 -0
- package/lib/esm/server/stories.js +140 -0
- package/lib/esm/server/storybook/entry.js +46 -0
- package/lib/esm/server/storybook/helpers.js +98 -0
- package/lib/esm/server/storybook/providers/browser.js +60 -0
- package/lib/esm/server/storybook/providers/hybrid.js +64 -0
- package/lib/esm/server/storybook/providers/nodejs.js +217 -0
- package/lib/esm/server/testsFiles/parser.js +50 -0
- package/lib/esm/server/testsFiles/register.js +35 -0
- package/lib/esm/server/update.js +61 -0
- package/lib/esm/server/utils.js +142 -0
- package/lib/esm/server/worker/chai-image.js +130 -0
- package/lib/esm/server/worker/helpers.js +60 -0
- package/lib/esm/server/worker/index.js +1 -0
- package/lib/esm/server/worker/reporter.js +86 -0
- package/lib/esm/server/worker/worker.js +238 -0
- package/lib/esm/shared/index.js +66 -0
- package/lib/esm/shared/serializeRegExp.js +23 -0
- package/lib/esm/types.js +43 -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 +1 -4
- 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/storybook-static/stories.json +0 -21
package/lib/cjs/cli.js
ADDED
@@ -0,0 +1,418 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
4
|
+
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
6
|
+
value: true
|
7
|
+
});
|
8
|
+
exports.CreeveyManager = void 0;
|
9
|
+
|
10
|
+
var _coreEvents = require("@storybook/core-events");
|
11
|
+
|
12
|
+
var _shared = require("../../shared");
|
13
|
+
|
14
|
+
var _types = require("../../types");
|
15
|
+
|
16
|
+
var _creeveyClientApi = require("../shared/creeveyClientApi");
|
17
|
+
|
18
|
+
var _helpers = require("../shared/helpers");
|
19
|
+
|
20
|
+
var _register = require("./register");
|
21
|
+
|
22
|
+
var _utils = require("./utils");
|
23
|
+
|
24
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
25
|
+
|
26
|
+
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."); }
|
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
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
33
|
+
|
34
|
+
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."); }
|
35
|
+
|
36
|
+
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); }
|
37
|
+
|
38
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
39
|
+
|
40
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
41
|
+
|
42
|
+
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; }
|
43
|
+
|
44
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
45
|
+
|
46
|
+
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); } }
|
47
|
+
|
48
|
+
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); }); }; }
|
49
|
+
|
50
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
51
|
+
|
52
|
+
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); } }
|
53
|
+
|
54
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
55
|
+
|
56
|
+
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; }
|
57
|
+
|
58
|
+
var CreeveyManager = /*#__PURE__*/function () {
|
59
|
+
function CreeveyManager(storybookApi) {
|
60
|
+
var _this = this;
|
61
|
+
|
62
|
+
_classCallCheck(this, CreeveyManager);
|
63
|
+
|
64
|
+
_defineProperty(this, "storyId", '');
|
65
|
+
|
66
|
+
_defineProperty(this, "activeBrowser", '');
|
67
|
+
|
68
|
+
_defineProperty(this, "selectedTestId", '');
|
69
|
+
|
70
|
+
_defineProperty(this, "status", {
|
71
|
+
isRunning: false,
|
72
|
+
tests: {},
|
73
|
+
browsers: []
|
74
|
+
});
|
75
|
+
|
76
|
+
_defineProperty(this, "creeveyApi", null);
|
77
|
+
|
78
|
+
_defineProperty(this, "storybookApi", void 0);
|
79
|
+
|
80
|
+
_defineProperty(this, "stories", {});
|
81
|
+
|
82
|
+
_defineProperty(this, "updateStatusListeners", []);
|
83
|
+
|
84
|
+
_defineProperty(this, "changeTestListeners", []);
|
85
|
+
|
86
|
+
_defineProperty(this, "initAll", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
87
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
88
|
+
while (1) {
|
89
|
+
switch (_context.prev = _context.next) {
|
90
|
+
case 0:
|
91
|
+
_this.storybookApi.on(_coreEvents.STORY_RENDERED, _this.onStoryRendered);
|
92
|
+
|
93
|
+
_this.storybookApi.on(_coreEvents.SET_STORIES, _this.onSetStories);
|
94
|
+
|
95
|
+
_context.next = 4;
|
96
|
+
return (0, _creeveyClientApi.initCreeveyClientApi)();
|
97
|
+
|
98
|
+
case 4:
|
99
|
+
_this.creeveyApi = _context.sent;
|
100
|
+
|
101
|
+
_this.creeveyApi.onUpdate(_this.handleCreeveyUpdate);
|
102
|
+
|
103
|
+
_context.next = 8;
|
104
|
+
return _this.creeveyApi.status;
|
105
|
+
|
106
|
+
case 8:
|
107
|
+
_this.status = _context.sent;
|
108
|
+
|
109
|
+
case 9:
|
110
|
+
case "end":
|
111
|
+
return _context.stop();
|
112
|
+
}
|
113
|
+
}
|
114
|
+
}, _callee);
|
115
|
+
})));
|
116
|
+
|
117
|
+
_defineProperty(this, "handleCreeveyUpdate", function (update) {
|
118
|
+
var tests = update.tests,
|
119
|
+
_update$removedTests = update.removedTests,
|
120
|
+
removedTests = _update$removedTests === void 0 ? [] : _update$removedTests,
|
121
|
+
isRunning = update.isRunning;
|
122
|
+
|
123
|
+
if ((0, _types.isDefined)(isRunning)) {
|
124
|
+
_this.status.isRunning = isRunning;
|
125
|
+
}
|
126
|
+
|
127
|
+
if ((0, _types.isDefined)(tests)) {
|
128
|
+
var prevTests = _this.status.tests;
|
129
|
+
var prevStories = _this.stories || {};
|
130
|
+
Object.values(tests).filter(_types.isDefined).forEach(function (update) {
|
131
|
+
var _test$results;
|
132
|
+
|
133
|
+
var id = update.id,
|
134
|
+
skip = update.skip,
|
135
|
+
status = update.status,
|
136
|
+
results = update.results,
|
137
|
+
approved = update.approved,
|
138
|
+
storyId = update.storyId;
|
139
|
+
var test = prevTests[id];
|
140
|
+
|
141
|
+
if (!test) {
|
142
|
+
return prevTests[id] = update;
|
143
|
+
}
|
144
|
+
|
145
|
+
if ((0, _types.isDefined)(skip)) test.skip = skip;
|
146
|
+
|
147
|
+
if ((0, _types.isDefined)(status)) {
|
148
|
+
test.status = status;
|
149
|
+
|
150
|
+
if ((0, _types.isDefined)(storyId) && (0, _types.isDefined)(prevStories[storyId])) {
|
151
|
+
var story = prevStories[storyId];
|
152
|
+
|
153
|
+
var storyStatus = _this.getStoryTests(storyId);
|
154
|
+
|
155
|
+
var oldStatus = storyStatus.map(function (x) {
|
156
|
+
return x.id === id ? status : x.status;
|
157
|
+
}).reduce(function (oldStatus, newStatus) {
|
158
|
+
return (0, _helpers.calcStatus)(oldStatus, newStatus);
|
159
|
+
}, undefined);
|
160
|
+
story.name = _this.addStatusToStoryName(story.name, (0, _helpers.calcStatus)(oldStatus, status), skip || false);
|
161
|
+
}
|
162
|
+
}
|
163
|
+
|
164
|
+
if ((0, _types.isDefined)(results)) test.results ? (_test$results = test.results).push.apply(_test$results, _toConsumableArray(results)) : test.results = results;
|
165
|
+
|
166
|
+
if ((0, _types.isDefined)(approved)) {
|
167
|
+
Object.entries(approved).forEach(function (_ref2) {
|
168
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
169
|
+
image = _ref3[0],
|
170
|
+
retry = _ref3[1];
|
171
|
+
|
172
|
+
return retry !== undefined && test && ((test.approved = (test === null || test === void 0 ? void 0 : test.approved) || {})[image] = retry);
|
173
|
+
});
|
174
|
+
}
|
175
|
+
});
|
176
|
+
removedTests.forEach(function (_ref4) {
|
177
|
+
var id = _ref4.id;
|
178
|
+
return delete prevTests[id];
|
179
|
+
});
|
180
|
+
_this.status.tests = prevTests;
|
181
|
+
_this.stories = prevStories;
|
182
|
+
|
183
|
+
_this.setPanelsTitle();
|
184
|
+
|
185
|
+
void _this.storybookApi.setStories(_this.stories);
|
186
|
+
}
|
187
|
+
|
188
|
+
_this.updateStatusListeners.forEach(function (x) {
|
189
|
+
return x(update);
|
190
|
+
});
|
191
|
+
});
|
192
|
+
|
193
|
+
_defineProperty(this, "getCurrentTest", function () {
|
194
|
+
return _this.status.tests[_this.selectedTestId];
|
195
|
+
});
|
196
|
+
|
197
|
+
_defineProperty(this, "onStoryRendered", function (storyId) {
|
198
|
+
if (_this.storyId === '') void _this.addStatusesToSideBar();
|
199
|
+
|
200
|
+
if (_this.storyId !== storyId) {
|
201
|
+
var _this$getTestsByStory, _this$getTestsByStory2;
|
202
|
+
|
203
|
+
_this.storyId = storyId;
|
204
|
+
_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 : '';
|
205
|
+
|
206
|
+
_this.setPanelsTitle();
|
207
|
+
|
208
|
+
_this.changeTestListeners.forEach(function (x) {
|
209
|
+
return x(_this.selectedTestId);
|
210
|
+
});
|
211
|
+
}
|
212
|
+
});
|
213
|
+
|
214
|
+
_defineProperty(this, "onStart", function () {
|
215
|
+
var _this$creeveyApi;
|
216
|
+
|
217
|
+
(_this$creeveyApi = _this.creeveyApi) === null || _this$creeveyApi === void 0 ? void 0 : _this$creeveyApi.start([_this.selectedTestId]);
|
218
|
+
});
|
219
|
+
|
220
|
+
_defineProperty(this, "onStop", function () {
|
221
|
+
var _this$creeveyApi2;
|
222
|
+
|
223
|
+
(_this$creeveyApi2 = _this.creeveyApi) === null || _this$creeveyApi2 === void 0 ? void 0 : _this$creeveyApi2.stop();
|
224
|
+
});
|
225
|
+
|
226
|
+
_defineProperty(this, "onImageApprove", function (id, retry, image) {
|
227
|
+
var _this$creeveyApi3;
|
228
|
+
|
229
|
+
return (_this$creeveyApi3 = _this.creeveyApi) === null || _this$creeveyApi3 === void 0 ? void 0 : _this$creeveyApi3.approve(id, retry, image);
|
230
|
+
});
|
231
|
+
|
232
|
+
_defineProperty(this, "onStartAllStoryTests", function () {
|
233
|
+
var _this$creeveyApi4;
|
234
|
+
|
235
|
+
var ids = Object.values(_this.status.tests).filter(_types.isDefined).filter(function (x) {
|
236
|
+
return x.storyId === _this.storyId;
|
237
|
+
}).map(function (x) {
|
238
|
+
return x.id;
|
239
|
+
});
|
240
|
+
(_this$creeveyApi4 = _this.creeveyApi) === null || _this$creeveyApi4 === void 0 ? void 0 : _this$creeveyApi4.start(ids);
|
241
|
+
});
|
242
|
+
|
243
|
+
_defineProperty(this, "onStartAllTests", function () {
|
244
|
+
var _this$creeveyApi5;
|
245
|
+
|
246
|
+
var ids = Object.values(_this.status.tests).filter(_types.isDefined).map(function (x) {
|
247
|
+
return x.id;
|
248
|
+
});
|
249
|
+
(_this$creeveyApi5 = _this.creeveyApi) === null || _this$creeveyApi5 === void 0 ? void 0 : _this$creeveyApi5.start(ids);
|
250
|
+
});
|
251
|
+
|
252
|
+
_defineProperty(this, "onSetStories", function (data) {
|
253
|
+
var stories = data.v ? (0, _shared.denormalizeStoryParameters)(data) : data.stories;
|
254
|
+
_this.stories = stories;
|
255
|
+
});
|
256
|
+
|
257
|
+
_defineProperty(this, "setActiveBrowser", function (browser) {
|
258
|
+
var _this$getTestsByStory3, _this$getTestsByStory4;
|
259
|
+
|
260
|
+
_this.activeBrowser = browser;
|
261
|
+
_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 : '';
|
262
|
+
|
263
|
+
_this.changeTestListeners.forEach(function (x) {
|
264
|
+
return x(_this.selectedTestId);
|
265
|
+
});
|
266
|
+
});
|
267
|
+
|
268
|
+
_defineProperty(this, "setSelectedTestId", function (testId) {
|
269
|
+
_this.selectedTestId = testId;
|
270
|
+
|
271
|
+
_this.changeTestListeners.forEach(function (x) {
|
272
|
+
return x(_this.selectedTestId);
|
273
|
+
});
|
274
|
+
});
|
275
|
+
|
276
|
+
_defineProperty(this, "getStoryTests", function (storyId) {
|
277
|
+
if (!_this.status || !_this.status.tests) return [];
|
278
|
+
return Object.values(_this.status.tests).filter(function (result) {
|
279
|
+
return (result === null || result === void 0 ? void 0 : result.storyId) === storyId;
|
280
|
+
}).filter(_types.isDefined);
|
281
|
+
});
|
282
|
+
|
283
|
+
_defineProperty(this, "getBrowsers", function () {
|
284
|
+
return _this.status.browsers;
|
285
|
+
});
|
286
|
+
|
287
|
+
_defineProperty(this, "getTestsByStoryIdAndBrowser", function (browser) {
|
288
|
+
return Object.values(_this.status.tests).filter(function (x) {
|
289
|
+
return (x === null || x === void 0 ? void 0 : x.browser) === browser && x.storyId === _this.storyId;
|
290
|
+
}).filter(_types.isDefined);
|
291
|
+
});
|
292
|
+
|
293
|
+
_defineProperty(this, "getTabTitle", function (browser) {
|
294
|
+
var tests = _this.getTestsByStoryIdAndBrowser(browser);
|
295
|
+
|
296
|
+
var browserStatus = tests.map(function (x) {
|
297
|
+
return x && x.status;
|
298
|
+
}).reduce(function (oldStatus, newStatus) {
|
299
|
+
return (0, _helpers.calcStatus)(oldStatus, newStatus);
|
300
|
+
}, undefined);
|
301
|
+
var browserSkip = tests.length > 0 ? tests.every(function (x) {
|
302
|
+
return x && x.skip;
|
303
|
+
}) : false;
|
304
|
+
var emojiStatus = (0, _utils.getEmojiByTestStatus)(browserStatus, browserSkip);
|
305
|
+
return "".concat(emojiStatus ? "".concat(emojiStatus, " ") : '', "Creevey/").concat(browser);
|
306
|
+
});
|
307
|
+
|
308
|
+
_defineProperty(this, "setPanelsTitle", function () {
|
309
|
+
var _this$storybookApi;
|
310
|
+
|
311
|
+
var panels = (_this$storybookApi = _this.storybookApi) === null || _this$storybookApi === void 0 ? void 0 : _this$storybookApi.getPanels();
|
312
|
+
if (!panels) return;
|
313
|
+
var firstPanelBrowser = _this.activeBrowser;
|
314
|
+
|
315
|
+
for (var p in panels) {
|
316
|
+
var _panel$id;
|
317
|
+
|
318
|
+
var panel = panels[p];
|
319
|
+
|
320
|
+
if (((_panel$id = panel.id) === null || _panel$id === void 0 ? void 0 : _panel$id.indexOf(_register.ADDON_ID)) === 0 && panel.paramKey) {
|
321
|
+
panel.title = _this.getTabTitle(panel.paramKey);
|
322
|
+
if (!firstPanelBrowser) firstPanelBrowser = panel.paramKey;
|
323
|
+
}
|
324
|
+
}
|
325
|
+
|
326
|
+
_this.storybookApi.setSelectedPanel("".concat(_register.ADDON_ID, "/panel/").concat(firstPanelBrowser));
|
327
|
+
});
|
328
|
+
|
329
|
+
this.storybookApi = storybookApi;
|
330
|
+
}
|
331
|
+
|
332
|
+
_createClass(CreeveyManager, [{
|
333
|
+
key: "onUpdateStatus",
|
334
|
+
value: function onUpdateStatus(listener) {
|
335
|
+
var _this2 = this;
|
336
|
+
|
337
|
+
this.updateStatusListeners.push(listener);
|
338
|
+
return function () {
|
339
|
+
return void (_this2.updateStatusListeners = _this2.updateStatusListeners.filter(function (x) {
|
340
|
+
return x != listener;
|
341
|
+
}));
|
342
|
+
};
|
343
|
+
}
|
344
|
+
}, {
|
345
|
+
key: "onChangeTest",
|
346
|
+
value: function onChangeTest(listener) {
|
347
|
+
var _this3 = this;
|
348
|
+
|
349
|
+
this.changeTestListeners.push(listener);
|
350
|
+
return function () {
|
351
|
+
return void (_this3.changeTestListeners = _this3.changeTestListeners.filter(function (x) {
|
352
|
+
return x != listener;
|
353
|
+
}));
|
354
|
+
};
|
355
|
+
}
|
356
|
+
}, {
|
357
|
+
key: "addStatusesToSideBar",
|
358
|
+
value: function () {
|
359
|
+
var _addStatusesToSideBar = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
360
|
+
var _this4 = this;
|
361
|
+
|
362
|
+
var stories;
|
363
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
364
|
+
while (1) {
|
365
|
+
switch (_context2.prev = _context2.next) {
|
366
|
+
case 0:
|
367
|
+
if (Object.keys(this.stories).length) {
|
368
|
+
_context2.next = 2;
|
369
|
+
break;
|
370
|
+
}
|
371
|
+
|
372
|
+
return _context2.abrupt("return");
|
373
|
+
|
374
|
+
case 2:
|
375
|
+
stories = this.stories;
|
376
|
+
Object.keys(this.stories).forEach(function (storyId) {
|
377
|
+
var storyStatus = _this4.getStoryTests(storyId);
|
378
|
+
|
379
|
+
var status = storyStatus.map(function (x) {
|
380
|
+
return x.status;
|
381
|
+
}).reduce(function (oldStatus, newStatus) {
|
382
|
+
return (0, _helpers.calcStatus)(oldStatus, newStatus);
|
383
|
+
}, undefined);
|
384
|
+
var skip = storyStatus.length > 0 ? storyStatus.every(function (x) {
|
385
|
+
return x.skip;
|
386
|
+
}) : false;
|
387
|
+
_this4.stories[storyId].name = _this4.addStatusToStoryName(stories[storyId].name, status, skip);
|
388
|
+
});
|
389
|
+
_context2.next = 6;
|
390
|
+
return this.storybookApi.setStories(this.stories);
|
391
|
+
|
392
|
+
case 6:
|
393
|
+
case "end":
|
394
|
+
return _context2.stop();
|
395
|
+
}
|
396
|
+
}
|
397
|
+
}, _callee2, this);
|
398
|
+
}));
|
399
|
+
|
400
|
+
function addStatusesToSideBar() {
|
401
|
+
return _addStatusesToSideBar.apply(this, arguments);
|
402
|
+
}
|
403
|
+
|
404
|
+
return addStatusesToSideBar;
|
405
|
+
}()
|
406
|
+
}, {
|
407
|
+
key: "addStatusToStoryName",
|
408
|
+
value: function addStatusToStoryName(name, status, skip) {
|
409
|
+
name = name.replace(/^(❌|✔|🟡|🕗|⏸) /, '');
|
410
|
+
var emojiStatus = (0, _utils.getEmojiByTestStatus)(status, skip);
|
411
|
+
return "".concat(emojiStatus ? "".concat(emojiStatus, " ") : '', " ").concat(name);
|
412
|
+
}
|
413
|
+
}]);
|
414
|
+
|
415
|
+
return CreeveyManager;
|
416
|
+
}();
|
417
|
+
|
418
|
+
exports.CreeveyManager = CreeveyManager;
|
@@ -0,0 +1,76 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
4
|
+
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
6
|
+
value: true
|
7
|
+
});
|
8
|
+
exports.Addon = void 0;
|
9
|
+
|
10
|
+
var _components = require("@storybook/components");
|
11
|
+
|
12
|
+
var _react = _interopRequireWildcard(require("react"));
|
13
|
+
|
14
|
+
var _Panel = require("./Panel");
|
15
|
+
|
16
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
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];
|
41
|
+
|
42
|
+
var _useState3 = (0, _react.useState)(manager.selectedTestId),
|
43
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
44
|
+
selectedTestId = _useState4[0],
|
45
|
+
setSelectedTestId = _useState4[1];
|
46
|
+
|
47
|
+
(0, _react.useEffect)(function () {
|
48
|
+
if (active) {
|
49
|
+
manager.setActiveBrowser(browser);
|
50
|
+
var browserTests = manager.getTestsByStoryIdAndBrowser(manager.activeBrowser);
|
51
|
+
setTests(browserTests);
|
52
|
+
}
|
53
|
+
}, [active, browser, manager]);
|
54
|
+
(0, _react.useEffect)(function () {
|
55
|
+
var unsubscribe = manager.onChangeTest(function (testId) {
|
56
|
+
setSelectedTestId(testId);
|
57
|
+
var status = manager.getTestsByStoryIdAndBrowser(manager.activeBrowser);
|
58
|
+
setTests(status);
|
59
|
+
});
|
60
|
+
return unsubscribe;
|
61
|
+
}, [manager]);
|
62
|
+
(0, _react.useEffect)(function () {
|
63
|
+
var unsubscribe = manager.onUpdateStatus(function () {
|
64
|
+
setTests(manager.getTestsByStoryIdAndBrowser(manager.activeBrowser));
|
65
|
+
});
|
66
|
+
return unsubscribe;
|
67
|
+
}, [manager, browser]);
|
68
|
+
return active ? tests.length ? /*#__PURE__*/_react.default.createElement(_Panel.Panel, {
|
69
|
+
tests: tests,
|
70
|
+
selectedTestId: selectedTestId,
|
71
|
+
onChangeTest: manager.setSelectedTestId,
|
72
|
+
onImageApprove: manager.onImageApprove
|
73
|
+
}) : /*#__PURE__*/_react.default.createElement(_components.Placeholder, null, "No test results") : null;
|
74
|
+
};
|
75
|
+
|
76
|
+
exports.Addon = Addon;
|
@@ -0,0 +1,42 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.NextIcon = exports.ForwardIcon = void 0;
|
7
|
+
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
9
|
+
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
11
|
+
|
12
|
+
var NextIcon = function NextIcon(_ref) {
|
13
|
+
var width = _ref.width,
|
14
|
+
height = _ref.height;
|
15
|
+
return /*#__PURE__*/_react.default.createElement("svg", {
|
16
|
+
version: "1.1",
|
17
|
+
width: width,
|
18
|
+
height: height,
|
19
|
+
viewBox: "0 0 306 306"
|
20
|
+
}, /*#__PURE__*/_react.default.createElement("path", {
|
21
|
+
d: "M0,306l216.75-153L0,0V306z M255,0v306h51V0H255z",
|
22
|
+
fill: "currentColor"
|
23
|
+
}));
|
24
|
+
};
|
25
|
+
|
26
|
+
exports.NextIcon = NextIcon;
|
27
|
+
|
28
|
+
var ForwardIcon = function ForwardIcon(_ref2) {
|
29
|
+
var width = _ref2.width,
|
30
|
+
height = _ref2.height;
|
31
|
+
return /*#__PURE__*/_react.default.createElement("svg", {
|
32
|
+
version: "1.1",
|
33
|
+
width: width,
|
34
|
+
height: height,
|
35
|
+
viewBox: "0 0 512 512"
|
36
|
+
}, /*#__PURE__*/_react.default.createElement("path", {
|
37
|
+
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\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
|
+
}));
|
40
|
+
};
|
41
|
+
|
42
|
+
exports.ForwardIcon = ForwardIcon;
|
@@ -0,0 +1,68 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.Panel = void 0;
|
7
|
+
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
9
|
+
|
10
|
+
var _components = require("@storybook/components");
|
11
|
+
|
12
|
+
var _ResultsPage = require("../../shared/components/ResultsPage");
|
13
|
+
|
14
|
+
var _theming = require("@storybook/theming");
|
15
|
+
|
16
|
+
var _helpers = require("../../shared/helpers");
|
17
|
+
|
18
|
+
var _TestSelect = _interopRequireDefault(require("./TestSelect"));
|
19
|
+
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
21
|
+
|
22
|
+
var Wrapper = _theming.styled.div(function (_ref) {
|
23
|
+
var isRunning = _ref.isRunning;
|
24
|
+
return {
|
25
|
+
opacity: isRunning ? 0.5 : 1,
|
26
|
+
height: '100%'
|
27
|
+
};
|
28
|
+
});
|
29
|
+
|
30
|
+
var TestSelectContainer = _theming.styled.div(function (_ref2) {
|
31
|
+
var theme = _ref2.theme;
|
32
|
+
return {
|
33
|
+
padding: '8px',
|
34
|
+
border: "1px solid ".concat(theme.appBorderColor)
|
35
|
+
};
|
36
|
+
});
|
37
|
+
|
38
|
+
var Panel = function Panel(_ref3) {
|
39
|
+
var _result$results, _result$results$lengt, _result$results2;
|
40
|
+
|
41
|
+
var tests = _ref3.tests,
|
42
|
+
selectedTestId = _ref3.selectedTestId,
|
43
|
+
onChangeTest = _ref3.onChangeTest,
|
44
|
+
onImageApprove = _ref3.onImageApprove;
|
45
|
+
var result = tests.find(function (x) {
|
46
|
+
return x.id === selectedTestId;
|
47
|
+
});
|
48
|
+
var isRunning = (result === null || result === void 0 ? void 0 : result.status) === 'running';
|
49
|
+
return /*#__PURE__*/_react.default.createElement("div", null, tests.length > 1 && /*#__PURE__*/_react.default.createElement(TestSelectContainer, null, /*#__PURE__*/_react.default.createElement(_TestSelect.default, {
|
50
|
+
tests: tests,
|
51
|
+
selectedTestId: selectedTestId,
|
52
|
+
onChangeTest: onChangeTest
|
53
|
+
})), isRunning && /*#__PURE__*/_react.default.createElement(_components.Loader, null), result !== null && result !== void 0 && (_result$results = result.results) !== null && _result$results !== void 0 && _result$results.length ? /*#__PURE__*/_react.default.createElement(Wrapper, {
|
54
|
+
isRunning: isRunning
|
55
|
+
}, /*#__PURE__*/_react.default.createElement(_ResultsPage.ResultsPage, {
|
56
|
+
height: '100%',
|
57
|
+
key: "".concat(result.id, "_").concat((_result$results$lengt = (_result$results2 = result.results) === null || _result$results2 === void 0 ? void 0 : _result$results2.length) !== null && _result$results$lengt !== void 0 ? _result$results$lengt : 0) // TODO
|
58
|
+
,
|
59
|
+
id: result.id,
|
60
|
+
path: (0, _helpers.getTestPath)(result) // TODO Memo?
|
61
|
+
,
|
62
|
+
results: result.results,
|
63
|
+
approved: result.approved,
|
64
|
+
onImageApprove: onImageApprove
|
65
|
+
})) : null);
|
66
|
+
};
|
67
|
+
|
68
|
+
exports.Panel = Panel;
|