creevey 0.9.0-beta.0 → 0.9.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/types/index.d.ts +4 -3
- package/lib/types/server/config.d.ts +1 -1
- package/lib/types/server/messages.d.ts +0 -1
- package/lib/types/server/{parser.d.ts → testsFiles/parser.d.ts} +1 -1
- package/lib/types/server/testsFiles/register.d.ts +2 -0
- package/lib/types/types.d.ts +3 -2
- package/package.json +5 -2
- package/lib/cjs/cli.js +0 -5
- package/lib/cjs/client/addon/Manager.js +0 -412
- package/lib/cjs/client/addon/components/Addon.js +0 -76
- package/lib/cjs/client/addon/components/Icons.js +0 -42
- package/lib/cjs/client/addon/components/Panel.js +0 -68
- package/lib/cjs/client/addon/components/TestSelect.js +0 -63
- package/lib/cjs/client/addon/components/Tools.js +0 -114
- package/lib/cjs/client/addon/decorator.js +0 -11
- package/lib/cjs/client/addon/preset.js +0 -81
- package/lib/cjs/client/addon/readyForCapture.js +0 -12
- package/lib/cjs/client/addon/register.js +0 -96
- package/lib/cjs/client/addon/utils.js +0 -38
- package/lib/cjs/client/addon/withCreevey.js +0 -556
- package/lib/cjs/client/shared/components/ImagesView/BlendView.js +0 -85
- package/lib/cjs/client/shared/components/ImagesView/ImagesView.js +0 -88
- package/lib/cjs/client/shared/components/ImagesView/SideBySideView.js +0 -176
- package/lib/cjs/client/shared/components/ImagesView/SlideView.js +0 -179
- package/lib/cjs/client/shared/components/ImagesView/SwapView.js +0 -110
- package/lib/cjs/client/shared/components/ImagesView/index.js +0 -45
- package/lib/cjs/client/shared/components/PageFooter/PageFooter.js +0 -46
- package/lib/cjs/client/shared/components/PageFooter/Paging.js +0 -98
- package/lib/cjs/client/shared/components/PageHeader/ImagePreview.js +0 -78
- package/lib/cjs/client/shared/components/PageHeader/PageHeader.js +0 -144
- package/lib/cjs/client/shared/components/ResultsPage.js +0 -173
- package/lib/cjs/client/shared/creeveyClientApi.js +0 -103
- package/lib/cjs/client/shared/helpers.js +0 -482
- package/lib/cjs/client/shared/viewMode.js +0 -17
- package/lib/cjs/client/web/index.html +0 -19
- package/lib/cjs/creevey.js +0 -71
- package/lib/cjs/index.js +0 -62
- package/lib/cjs/server/config.js +0 -96
- package/lib/cjs/server/docker.js +0 -150
- package/lib/cjs/server/extract.js +0 -50
- package/lib/cjs/server/index.js +0 -83
- package/lib/cjs/server/loaders/babel/creevey-plugin.js +0 -88
- package/lib/cjs/server/loaders/babel/helpers.js +0 -479
- package/lib/cjs/server/loaders/babel/register.js +0 -126
- package/lib/cjs/server/loaders/hooks/mdx.js +0 -30
- package/lib/cjs/server/loaders/hooks/svelte.js +0 -65
- package/lib/cjs/server/loaders/webpack/compile.js +0 -286
- package/lib/cjs/server/loaders/webpack/creevey-loader.js +0 -174
- package/lib/cjs/server/loaders/webpack/dummy-hmr.js +0 -44
- package/lib/cjs/server/loaders/webpack/mdx-loader.js +0 -72
- package/lib/cjs/server/loaders/webpack/start.js +0 -41
- package/lib/cjs/server/logger.js +0 -47
- package/lib/cjs/server/master/api.js +0 -71
- package/lib/cjs/server/master/index.js +0 -146
- package/lib/cjs/server/master/master.js +0 -57
- package/lib/cjs/server/master/pool.js +0 -206
- package/lib/cjs/server/master/runner.js +0 -294
- package/lib/cjs/server/master/server.js +0 -129
- package/lib/cjs/server/messages.js +0 -266
- package/lib/cjs/server/parser.js +0 -85
- package/lib/cjs/server/selenium/browser.js +0 -680
- package/lib/cjs/server/selenium/index.js +0 -31
- package/lib/cjs/server/selenium/selenoid.js +0 -174
- package/lib/cjs/server/stories.js +0 -170
- package/lib/cjs/server/storybook/entry.js +0 -68
- package/lib/cjs/server/storybook/helpers.js +0 -165
- package/lib/cjs/server/storybook/providers/browser.js +0 -78
- package/lib/cjs/server/storybook/providers/hybrid.js +0 -79
- package/lib/cjs/server/storybook/providers/nodejs.js +0 -239
- package/lib/cjs/server/update.js +0 -83
- package/lib/cjs/server/utils.js +0 -185
- package/lib/cjs/server/worker/chai-image.js +0 -142
- package/lib/cjs/server/worker/helpers.js +0 -69
- package/lib/cjs/server/worker/index.js +0 -15
- package/lib/cjs/server/worker/reporter.js +0 -120
- package/lib/cjs/server/worker/worker.js +0 -278
- package/lib/cjs/shared.js +0 -107
- package/lib/cjs/types.js +0 -74
- package/lib/esm/cli.js +0 -4
- package/lib/esm/client/addon/Manager.js +0 -396
- package/lib/esm/client/addon/components/Addon.js +0 -58
- package/lib/esm/client/addon/components/Icons.js +0 -27
- package/lib/esm/client/addon/components/Panel.js +0 -49
- package/lib/esm/client/addon/components/TestSelect.js +0 -49
- package/lib/esm/client/addon/components/Tools.js +0 -91
- package/lib/esm/client/addon/decorator.js +0 -2
- package/lib/esm/client/addon/preset.js +0 -56
- package/lib/esm/client/addon/readyForCapture.js +0 -5
- package/lib/esm/client/addon/register.js +0 -75
- package/lib/esm/client/addon/utils.js +0 -31
- package/lib/esm/client/addon/withCreevey.js +0 -532
- package/lib/esm/client/shared/components/ImagesView/BlendView.js +0 -63
- package/lib/esm/client/shared/components/ImagesView/ImagesView.js +0 -65
- package/lib/esm/client/shared/components/ImagesView/SideBySideView.js +0 -151
- package/lib/esm/client/shared/components/ImagesView/SlideView.js +0 -154
- package/lib/esm/client/shared/components/ImagesView/SwapView.js +0 -88
- package/lib/esm/client/shared/components/ImagesView/index.js +0 -5
- package/lib/esm/client/shared/components/PageFooter/PageFooter.js +0 -32
- package/lib/esm/client/shared/components/PageFooter/Paging.js +0 -84
- package/lib/esm/client/shared/components/PageHeader/ImagePreview.js +0 -64
- package/lib/esm/client/shared/components/PageHeader/PageHeader.js +0 -120
- package/lib/esm/client/shared/components/ResultsPage.js +0 -143
- package/lib/esm/client/shared/creeveyClientApi.js +0 -94
- package/lib/esm/client/shared/helpers.js +0 -424
- package/lib/esm/client/shared/viewMode.js +0 -6
- package/lib/esm/creevey.js +0 -56
- package/lib/esm/index.js +0 -7
- package/lib/esm/server/config.js +0 -73
- package/lib/esm/server/docker.js +0 -123
- package/lib/esm/server/extract.js +0 -34
- package/lib/esm/server/index.js +0 -64
- package/lib/esm/server/loaders/babel/creevey-plugin.js +0 -74
- package/lib/esm/server/loaders/babel/helpers.js +0 -462
- package/lib/esm/server/loaders/babel/register.js +0 -105
- package/lib/esm/server/loaders/hooks/mdx.js +0 -15
- package/lib/esm/server/loaders/hooks/svelte.js +0 -49
- package/lib/esm/server/loaders/webpack/compile.js +0 -263
- package/lib/esm/server/loaders/webpack/creevey-loader.js +0 -153
- package/lib/esm/server/loaders/webpack/dummy-hmr.js +0 -36
- package/lib/esm/server/loaders/webpack/mdx-loader.js +0 -58
- package/lib/esm/server/loaders/webpack/start.js +0 -27
- package/lib/esm/server/logger.js +0 -20
- package/lib/esm/server/master/api.js +0 -60
- package/lib/esm/server/master/index.js +0 -125
- package/lib/esm/server/master/master.js +0 -38
- package/lib/esm/server/master/pool.js +0 -187
- package/lib/esm/server/master/runner.js +0 -272
- package/lib/esm/server/master/server.js +0 -105
- package/lib/esm/server/messages.js +0 -234
- package/lib/esm/server/parser.js +0 -63
- package/lib/esm/server/selenium/browser.js +0 -647
- package/lib/esm/server/selenium/index.js +0 -2
- package/lib/esm/server/selenium/selenoid.js +0 -151
- package/lib/esm/server/stories.js +0 -151
- package/lib/esm/server/storybook/entry.js +0 -44
- package/lib/esm/server/storybook/helpers.js +0 -106
- package/lib/esm/server/storybook/providers/browser.js +0 -61
- package/lib/esm/server/storybook/providers/hybrid.js +0 -63
- package/lib/esm/server/storybook/providers/nodejs.js +0 -217
- package/lib/esm/server/update.js +0 -65
- package/lib/esm/server/utils.js +0 -146
- package/lib/esm/server/worker/chai-image.js +0 -130
- package/lib/esm/server/worker/helpers.js +0 -60
- package/lib/esm/server/worker/index.js +0 -1
- package/lib/esm/server/worker/reporter.js +0 -98
- package/lib/esm/server/worker/worker.js +0 -248
- package/lib/esm/shared.js +0 -76
- package/lib/esm/types.js +0 -43
package/lib/cjs/shared.js
DELETED
@@ -1,107 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.deserializeStory = exports.deserializeRawStories = exports.serializeRawStories = exports.deserializeRegExp = exports.serializeRegExp = exports.isSerializedRegExp = exports.denormalizeStoryParameters = exports.combineParameters = void 0;
|
7
|
-
|
8
|
-
var _lodash = require("lodash");
|
9
|
-
|
10
|
-
// NOTE: Copy-paste from storybook/api
|
11
|
-
const combineParameters = (...parameterSets) => // eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
12
|
-
(0, _lodash.mergeWith)({}, ...parameterSets, (_, srcValue) => {
|
13
|
-
// Treat arrays as scalars:
|
14
|
-
if (Array.isArray(srcValue)) return srcValue;
|
15
|
-
return undefined;
|
16
|
-
}); // NOTE: Copy-paste from storybook/api
|
17
|
-
|
18
|
-
|
19
|
-
exports.combineParameters = combineParameters;
|
20
|
-
|
21
|
-
const denormalizeStoryParameters = ({
|
22
|
-
globalParameters,
|
23
|
-
kindParameters,
|
24
|
-
stories
|
25
|
-
}) => {
|
26
|
-
return (0, _lodash.mapValues)(stories, storyData => {
|
27
|
-
var _globalParameters$cre, _kindParameters$story, _kindParameters$story2;
|
28
|
-
|
29
|
-
storyData.parameters.creevey = combineParameters((_globalParameters$cre = globalParameters.creevey) !== null && _globalParameters$cre !== void 0 ? _globalParameters$cre : {}, (_kindParameters$story = (_kindParameters$story2 = kindParameters[storyData.kind]) === null || _kindParameters$story2 === void 0 ? void 0 : _kindParameters$story2.creevey) !== null && _kindParameters$story !== void 0 ? _kindParameters$story : {}, storyData.parameters.creevey);
|
30
|
-
return storyData;
|
31
|
-
});
|
32
|
-
};
|
33
|
-
|
34
|
-
exports.denormalizeStoryParameters = denormalizeStoryParameters;
|
35
|
-
|
36
|
-
const isSerializedRegExp = exp => {
|
37
|
-
return typeof exp === 'object' && exp !== null && Reflect.get(exp, '__regexp') === true;
|
38
|
-
};
|
39
|
-
|
40
|
-
exports.isSerializedRegExp = isSerializedRegExp;
|
41
|
-
|
42
|
-
const serializeRegExp = exp => {
|
43
|
-
const {
|
44
|
-
source,
|
45
|
-
flags
|
46
|
-
} = exp;
|
47
|
-
return {
|
48
|
-
__regexp: true,
|
49
|
-
source,
|
50
|
-
flags
|
51
|
-
};
|
52
|
-
};
|
53
|
-
|
54
|
-
exports.serializeRegExp = serializeRegExp;
|
55
|
-
|
56
|
-
const deserializeRegExp = ({
|
57
|
-
source,
|
58
|
-
flags
|
59
|
-
}) => {
|
60
|
-
return new RegExp(source, flags);
|
61
|
-
};
|
62
|
-
|
63
|
-
exports.deserializeRegExp = deserializeRegExp;
|
64
|
-
|
65
|
-
const serializeRawStories = stories => {
|
66
|
-
return (0, _lodash.mapValues)(stories, storyData => {
|
67
|
-
const creevey = storyData.parameters.creevey;
|
68
|
-
|
69
|
-
if ((creevey === null || creevey === void 0 ? void 0 : creevey.skip) !== undefined) {
|
70
|
-
creevey.skip = (0, _lodash.cloneDeepWith)(creevey.skip, value => {
|
71
|
-
if (value instanceof RegExp) {
|
72
|
-
return serializeRegExp(value);
|
73
|
-
}
|
74
|
-
|
75
|
-
return undefined;
|
76
|
-
});
|
77
|
-
}
|
78
|
-
|
79
|
-
return storyData;
|
80
|
-
});
|
81
|
-
};
|
82
|
-
|
83
|
-
exports.serializeRawStories = serializeRawStories;
|
84
|
-
|
85
|
-
const deserializeRawStories = stories => {
|
86
|
-
return (0, _lodash.mapValues)(stories, deserializeStory);
|
87
|
-
};
|
88
|
-
|
89
|
-
exports.deserializeRawStories = deserializeRawStories;
|
90
|
-
|
91
|
-
const deserializeStory = story => {
|
92
|
-
const creevey = story.parameters.creevey;
|
93
|
-
|
94
|
-
if ((creevey === null || creevey === void 0 ? void 0 : creevey.skip) !== undefined) {
|
95
|
-
creevey.skip = (0, _lodash.cloneDeepWith)(creevey.skip, value => {
|
96
|
-
if (isSerializedRegExp(value)) {
|
97
|
-
return deserializeRegExp(value);
|
98
|
-
}
|
99
|
-
|
100
|
-
return undefined;
|
101
|
-
});
|
102
|
-
}
|
103
|
-
|
104
|
-
return story;
|
105
|
-
};
|
106
|
-
|
107
|
-
exports.deserializeStory = deserializeStory;
|
package/lib/cjs/types.js
DELETED
@@ -1,74 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.noop = noop;
|
7
|
-
exports.isDefined = isDefined;
|
8
|
-
exports.isTest = isTest;
|
9
|
-
exports.isObject = isObject;
|
10
|
-
exports.isString = isString;
|
11
|
-
exports.isFunction = isFunction;
|
12
|
-
exports.isImageError = isImageError;
|
13
|
-
exports.isProcessMessage = isProcessMessage;
|
14
|
-
exports.isWorkerMessage = isWorkerMessage;
|
15
|
-
exports.isStoriesMessage = isStoriesMessage;
|
16
|
-
exports.isTestMessage = isTestMessage;
|
17
|
-
exports.isWebpackMessage = isWebpackMessage;
|
18
|
-
exports.isDockerMessage = isDockerMessage;
|
19
|
-
|
20
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
21
|
-
|
22
|
-
/* eslint-enable @typescript-eslint/no-explicit-any */
|
23
|
-
function noop() {
|
24
|
-
/* noop */
|
25
|
-
}
|
26
|
-
|
27
|
-
function isDefined(value) {
|
28
|
-
return value !== null && value !== undefined;
|
29
|
-
}
|
30
|
-
|
31
|
-
function isTest(x) {
|
32
|
-
return isDefined(x) && 'id' in x && 'storyId' in x && typeof x.id == 'string' && typeof x.storyId == 'string';
|
33
|
-
}
|
34
|
-
|
35
|
-
function isObject(x) {
|
36
|
-
return typeof x == 'object' && x != null;
|
37
|
-
}
|
38
|
-
|
39
|
-
function isString(x) {
|
40
|
-
return typeof x == 'string';
|
41
|
-
} // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
42
|
-
|
43
|
-
|
44
|
-
function isFunction(x) {
|
45
|
-
return typeof x == 'function';
|
46
|
-
}
|
47
|
-
|
48
|
-
function isImageError(error) {
|
49
|
-
return error instanceof Error && 'images' in error;
|
50
|
-
}
|
51
|
-
|
52
|
-
function isProcessMessage(message) {
|
53
|
-
return isObject(message) && 'scope' in message;
|
54
|
-
}
|
55
|
-
|
56
|
-
function isWorkerMessage(message) {
|
57
|
-
return isProcessMessage(message) && message.scope == 'worker';
|
58
|
-
}
|
59
|
-
|
60
|
-
function isStoriesMessage(message) {
|
61
|
-
return isProcessMessage(message) && message.scope == 'stories';
|
62
|
-
}
|
63
|
-
|
64
|
-
function isTestMessage(message) {
|
65
|
-
return isProcessMessage(message) && message.scope == 'test';
|
66
|
-
}
|
67
|
-
|
68
|
-
function isWebpackMessage(message) {
|
69
|
-
return isProcessMessage(message) && message.scope == 'webpack';
|
70
|
-
}
|
71
|
-
|
72
|
-
function isDockerMessage(message) {
|
73
|
-
return isProcessMessage(message) && message.scope == 'docker';
|
74
|
-
}
|
package/lib/esm/cli.js
DELETED
@@ -1,396 +0,0 @@
|
|
1
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
2
|
-
|
3
|
-
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."); }
|
4
|
-
|
5
|
-
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; }
|
6
|
-
|
7
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
8
|
-
|
9
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
10
|
-
|
11
|
-
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."); }
|
12
|
-
|
13
|
-
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); }
|
14
|
-
|
15
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
16
|
-
|
17
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
18
|
-
|
19
|
-
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; }
|
20
|
-
|
21
|
-
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); } }
|
22
|
-
|
23
|
-
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); }); }; }
|
24
|
-
|
25
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
26
|
-
|
27
|
-
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); } }
|
28
|
-
|
29
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
30
|
-
|
31
|
-
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; }
|
32
|
-
|
33
|
-
import { SET_STORIES, STORY_RENDERED } from '@storybook/core-events';
|
34
|
-
import { denormalizeStoryParameters } from '../../shared';
|
35
|
-
import { isDefined } from '../../types';
|
36
|
-
import { initCreeveyClientApi } from '../shared/creeveyClientApi';
|
37
|
-
import { calcStatus } from '../shared/helpers';
|
38
|
-
import { ADDON_ID } from './register';
|
39
|
-
import { getEmojiByTestStatus } from './utils';
|
40
|
-
export var CreeveyManager = /*#__PURE__*/function () {
|
41
|
-
function CreeveyManager(storybookApi) {
|
42
|
-
var _this = this;
|
43
|
-
|
44
|
-
_classCallCheck(this, CreeveyManager);
|
45
|
-
|
46
|
-
_defineProperty(this, "storyId", '');
|
47
|
-
|
48
|
-
_defineProperty(this, "activeBrowser", '');
|
49
|
-
|
50
|
-
_defineProperty(this, "selectedTestId", '');
|
51
|
-
|
52
|
-
_defineProperty(this, "status", {
|
53
|
-
isRunning: false,
|
54
|
-
tests: {},
|
55
|
-
browsers: []
|
56
|
-
});
|
57
|
-
|
58
|
-
_defineProperty(this, "creeveyApi", null);
|
59
|
-
|
60
|
-
_defineProperty(this, "stories", {});
|
61
|
-
|
62
|
-
_defineProperty(this, "updateStatusListeners", []);
|
63
|
-
|
64
|
-
_defineProperty(this, "changeTestListeners", []);
|
65
|
-
|
66
|
-
_defineProperty(this, "initAll", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
67
|
-
return regeneratorRuntime.wrap(function _callee$(_context) {
|
68
|
-
while (1) {
|
69
|
-
switch (_context.prev = _context.next) {
|
70
|
-
case 0:
|
71
|
-
_this.storybookApi.on(STORY_RENDERED, _this.onStoryRendered);
|
72
|
-
|
73
|
-
_this.storybookApi.on(SET_STORIES, _this.onSetStories);
|
74
|
-
|
75
|
-
_context.next = 4;
|
76
|
-
return initCreeveyClientApi();
|
77
|
-
|
78
|
-
case 4:
|
79
|
-
_this.creeveyApi = _context.sent;
|
80
|
-
|
81
|
-
_this.creeveyApi.onUpdate(_this.handleCreeveyUpdate);
|
82
|
-
|
83
|
-
_context.next = 8;
|
84
|
-
return _this.creeveyApi.status;
|
85
|
-
|
86
|
-
case 8:
|
87
|
-
_this.status = _context.sent;
|
88
|
-
|
89
|
-
case 9:
|
90
|
-
case "end":
|
91
|
-
return _context.stop();
|
92
|
-
}
|
93
|
-
}
|
94
|
-
}, _callee);
|
95
|
-
})));
|
96
|
-
|
97
|
-
_defineProperty(this, "handleCreeveyUpdate", function (update) {
|
98
|
-
var tests = update.tests,
|
99
|
-
_update$removedTests = update.removedTests,
|
100
|
-
removedTests = _update$removedTests === void 0 ? [] : _update$removedTests,
|
101
|
-
isRunning = update.isRunning;
|
102
|
-
|
103
|
-
if (isDefined(isRunning)) {
|
104
|
-
_this.status.isRunning = isRunning;
|
105
|
-
}
|
106
|
-
|
107
|
-
if (isDefined(tests)) {
|
108
|
-
var prevTests = _this.status.tests;
|
109
|
-
var prevStories = _this.stories || {};
|
110
|
-
Object.values(tests).filter(isDefined).forEach(function (update) {
|
111
|
-
var _test$results;
|
112
|
-
|
113
|
-
var id = update.id,
|
114
|
-
skip = update.skip,
|
115
|
-
status = update.status,
|
116
|
-
results = update.results,
|
117
|
-
approved = update.approved,
|
118
|
-
storyId = update.storyId;
|
119
|
-
var test = prevTests[id];
|
120
|
-
|
121
|
-
if (!test) {
|
122
|
-
return prevTests[id] = update;
|
123
|
-
}
|
124
|
-
|
125
|
-
if (isDefined(skip)) test.skip = skip;
|
126
|
-
|
127
|
-
if (isDefined(status)) {
|
128
|
-
test.status = status;
|
129
|
-
|
130
|
-
if (isDefined(storyId) && isDefined(prevStories[storyId])) {
|
131
|
-
var story = prevStories[storyId];
|
132
|
-
|
133
|
-
var storyStatus = _this.getStoryTests(storyId);
|
134
|
-
|
135
|
-
var oldStatus = storyStatus.map(function (x) {
|
136
|
-
return x.id === id ? status : x.status;
|
137
|
-
}).reduce(function (oldStatus, newStatus) {
|
138
|
-
return calcStatus(oldStatus, newStatus);
|
139
|
-
}, undefined);
|
140
|
-
story.name = _this.addStatusToStoryName(story.name, calcStatus(oldStatus, status), skip || false);
|
141
|
-
}
|
142
|
-
}
|
143
|
-
|
144
|
-
if (isDefined(results)) test.results ? (_test$results = test.results).push.apply(_test$results, _toConsumableArray(results)) : test.results = results;
|
145
|
-
|
146
|
-
if (isDefined(approved)) {
|
147
|
-
Object.entries(approved).forEach(function (_ref2) {
|
148
|
-
var _ref3 = _slicedToArray(_ref2, 2),
|
149
|
-
image = _ref3[0],
|
150
|
-
retry = _ref3[1];
|
151
|
-
|
152
|
-
return retry !== undefined && test && ((test.approved = (test === null || test === void 0 ? void 0 : test.approved) || {})[image] = retry);
|
153
|
-
});
|
154
|
-
}
|
155
|
-
});
|
156
|
-
removedTests.forEach(function (_ref4) {
|
157
|
-
var id = _ref4.id;
|
158
|
-
return delete prevTests[id];
|
159
|
-
});
|
160
|
-
_this.status.tests = prevTests;
|
161
|
-
_this.stories = prevStories;
|
162
|
-
|
163
|
-
_this.setPanelsTitle();
|
164
|
-
|
165
|
-
void _this.storybookApi.setStories(_this.stories);
|
166
|
-
}
|
167
|
-
|
168
|
-
_this.updateStatusListeners.forEach(function (x) {
|
169
|
-
return x(update);
|
170
|
-
});
|
171
|
-
});
|
172
|
-
|
173
|
-
_defineProperty(this, "getCurrentTest", function () {
|
174
|
-
return _this.status.tests[_this.selectedTestId];
|
175
|
-
});
|
176
|
-
|
177
|
-
_defineProperty(this, "onStoryRendered", function (storyId) {
|
178
|
-
if (_this.storyId === '') void _this.addStatusesToSideBar();
|
179
|
-
|
180
|
-
if (_this.storyId !== storyId) {
|
181
|
-
var _this$getTestsByStory, _this$getTestsByStory2;
|
182
|
-
|
183
|
-
_this.storyId = storyId;
|
184
|
-
_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 : '';
|
185
|
-
|
186
|
-
_this.setPanelsTitle();
|
187
|
-
|
188
|
-
_this.changeTestListeners.forEach(function (x) {
|
189
|
-
return x(_this.selectedTestId);
|
190
|
-
});
|
191
|
-
}
|
192
|
-
});
|
193
|
-
|
194
|
-
_defineProperty(this, "onStart", function () {
|
195
|
-
var _this$creeveyApi;
|
196
|
-
|
197
|
-
(_this$creeveyApi = _this.creeveyApi) === null || _this$creeveyApi === void 0 ? void 0 : _this$creeveyApi.start([_this.selectedTestId]);
|
198
|
-
});
|
199
|
-
|
200
|
-
_defineProperty(this, "onStop", function () {
|
201
|
-
var _this$creeveyApi2;
|
202
|
-
|
203
|
-
(_this$creeveyApi2 = _this.creeveyApi) === null || _this$creeveyApi2 === void 0 ? void 0 : _this$creeveyApi2.stop();
|
204
|
-
});
|
205
|
-
|
206
|
-
_defineProperty(this, "onImageApprove", function (id, retry, image) {
|
207
|
-
var _this$creeveyApi3;
|
208
|
-
|
209
|
-
return (_this$creeveyApi3 = _this.creeveyApi) === null || _this$creeveyApi3 === void 0 ? void 0 : _this$creeveyApi3.approve(id, retry, image);
|
210
|
-
});
|
211
|
-
|
212
|
-
_defineProperty(this, "onStartAllStoryTests", function () {
|
213
|
-
var _this$creeveyApi4;
|
214
|
-
|
215
|
-
var ids = Object.values(_this.status.tests).filter(isDefined).filter(function (x) {
|
216
|
-
return x.storyId === _this.storyId;
|
217
|
-
}).map(function (x) {
|
218
|
-
return x.id;
|
219
|
-
});
|
220
|
-
(_this$creeveyApi4 = _this.creeveyApi) === null || _this$creeveyApi4 === void 0 ? void 0 : _this$creeveyApi4.start(ids);
|
221
|
-
});
|
222
|
-
|
223
|
-
_defineProperty(this, "onStartAllTests", function () {
|
224
|
-
var _this$creeveyApi5;
|
225
|
-
|
226
|
-
var ids = Object.values(_this.status.tests).filter(isDefined).map(function (x) {
|
227
|
-
return x.id;
|
228
|
-
});
|
229
|
-
(_this$creeveyApi5 = _this.creeveyApi) === null || _this$creeveyApi5 === void 0 ? void 0 : _this$creeveyApi5.start(ids);
|
230
|
-
});
|
231
|
-
|
232
|
-
_defineProperty(this, "onSetStories", function (data) {
|
233
|
-
var stories = data.v ? denormalizeStoryParameters(data) : data.stories;
|
234
|
-
_this.stories = stories;
|
235
|
-
});
|
236
|
-
|
237
|
-
_defineProperty(this, "setActiveBrowser", function (browser) {
|
238
|
-
var _this$getTestsByStory3, _this$getTestsByStory4;
|
239
|
-
|
240
|
-
_this.activeBrowser = browser;
|
241
|
-
_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 : '';
|
242
|
-
|
243
|
-
_this.changeTestListeners.forEach(function (x) {
|
244
|
-
return x(_this.selectedTestId);
|
245
|
-
});
|
246
|
-
});
|
247
|
-
|
248
|
-
_defineProperty(this, "setSelectedTestId", function (testId) {
|
249
|
-
_this.selectedTestId = testId;
|
250
|
-
|
251
|
-
_this.changeTestListeners.forEach(function (x) {
|
252
|
-
return x(_this.selectedTestId);
|
253
|
-
});
|
254
|
-
});
|
255
|
-
|
256
|
-
_defineProperty(this, "getStoryTests", function (storyId) {
|
257
|
-
if (!_this.status || !_this.status.tests) return [];
|
258
|
-
return Object.values(_this.status.tests).filter(function (result) {
|
259
|
-
return (result === null || result === void 0 ? void 0 : result.storyId) === storyId;
|
260
|
-
}).filter(isDefined);
|
261
|
-
});
|
262
|
-
|
263
|
-
_defineProperty(this, "getBrowsers", function () {
|
264
|
-
return _this.status.browsers;
|
265
|
-
});
|
266
|
-
|
267
|
-
_defineProperty(this, "getTestsByStoryIdAndBrowser", function (browser) {
|
268
|
-
return Object.values(_this.status.tests).filter(function (x) {
|
269
|
-
return (x === null || x === void 0 ? void 0 : x.browser) === browser && x.storyId === _this.storyId;
|
270
|
-
}).filter(isDefined);
|
271
|
-
});
|
272
|
-
|
273
|
-
_defineProperty(this, "getTabTitle", function (browser) {
|
274
|
-
var tests = _this.getTestsByStoryIdAndBrowser(browser);
|
275
|
-
|
276
|
-
var browserStatus = tests.map(function (x) {
|
277
|
-
return x && x.status;
|
278
|
-
}).reduce(function (oldStatus, newStatus) {
|
279
|
-
return calcStatus(oldStatus, newStatus);
|
280
|
-
}, undefined);
|
281
|
-
var browserSkip = tests.length > 0 ? tests.every(function (x) {
|
282
|
-
return x && x.skip;
|
283
|
-
}) : false;
|
284
|
-
var emojiStatus = getEmojiByTestStatus(browserStatus, browserSkip);
|
285
|
-
return "".concat(emojiStatus ? "".concat(emojiStatus, " ") : '', "Creevey/").concat(browser);
|
286
|
-
});
|
287
|
-
|
288
|
-
_defineProperty(this, "setPanelsTitle", function () {
|
289
|
-
var _this$storybookApi;
|
290
|
-
|
291
|
-
var panels = (_this$storybookApi = _this.storybookApi) === null || _this$storybookApi === void 0 ? void 0 : _this$storybookApi.getPanels();
|
292
|
-
if (!panels) return;
|
293
|
-
var firstPanelBrowser = _this.activeBrowser;
|
294
|
-
|
295
|
-
for (var p in panels) {
|
296
|
-
var _panel$id;
|
297
|
-
|
298
|
-
var panel = panels[p];
|
299
|
-
|
300
|
-
if (((_panel$id = panel.id) === null || _panel$id === void 0 ? void 0 : _panel$id.indexOf(ADDON_ID)) === 0 && panel.paramKey) {
|
301
|
-
panel.title = _this.getTabTitle(panel.paramKey);
|
302
|
-
if (!firstPanelBrowser) firstPanelBrowser = panel.paramKey;
|
303
|
-
}
|
304
|
-
}
|
305
|
-
|
306
|
-
_this.storybookApi.setSelectedPanel("".concat(ADDON_ID, "/panel/").concat(firstPanelBrowser));
|
307
|
-
});
|
308
|
-
|
309
|
-
this.storybookApi = storybookApi;
|
310
|
-
}
|
311
|
-
|
312
|
-
_createClass(CreeveyManager, [{
|
313
|
-
key: "onUpdateStatus",
|
314
|
-
value: function onUpdateStatus(listener) {
|
315
|
-
var _this2 = this;
|
316
|
-
|
317
|
-
this.updateStatusListeners.push(listener);
|
318
|
-
return function () {
|
319
|
-
return void (_this2.updateStatusListeners = _this2.updateStatusListeners.filter(function (x) {
|
320
|
-
return x != listener;
|
321
|
-
}));
|
322
|
-
};
|
323
|
-
}
|
324
|
-
}, {
|
325
|
-
key: "onChangeTest",
|
326
|
-
value: function onChangeTest(listener) {
|
327
|
-
var _this3 = this;
|
328
|
-
|
329
|
-
this.changeTestListeners.push(listener);
|
330
|
-
return function () {
|
331
|
-
return void (_this3.changeTestListeners = _this3.changeTestListeners.filter(function (x) {
|
332
|
-
return x != listener;
|
333
|
-
}));
|
334
|
-
};
|
335
|
-
}
|
336
|
-
}, {
|
337
|
-
key: "addStatusesToSideBar",
|
338
|
-
value: function () {
|
339
|
-
var _addStatusesToSideBar = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
|
340
|
-
var _this4 = this;
|
341
|
-
|
342
|
-
var stories;
|
343
|
-
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
344
|
-
while (1) {
|
345
|
-
switch (_context2.prev = _context2.next) {
|
346
|
-
case 0:
|
347
|
-
if (Object.keys(this.stories).length) {
|
348
|
-
_context2.next = 2;
|
349
|
-
break;
|
350
|
-
}
|
351
|
-
|
352
|
-
return _context2.abrupt("return");
|
353
|
-
|
354
|
-
case 2:
|
355
|
-
stories = this.stories;
|
356
|
-
Object.keys(this.stories).forEach(function (storyId) {
|
357
|
-
var storyStatus = _this4.getStoryTests(storyId);
|
358
|
-
|
359
|
-
var status = storyStatus.map(function (x) {
|
360
|
-
return x.status;
|
361
|
-
}).reduce(function (oldStatus, newStatus) {
|
362
|
-
return calcStatus(oldStatus, newStatus);
|
363
|
-
}, undefined);
|
364
|
-
var skip = storyStatus.length > 0 ? storyStatus.every(function (x) {
|
365
|
-
return x.skip;
|
366
|
-
}) : false;
|
367
|
-
_this4.stories[storyId].name = _this4.addStatusToStoryName(stories[storyId].name, status, skip);
|
368
|
-
});
|
369
|
-
_context2.next = 6;
|
370
|
-
return this.storybookApi.setStories(this.stories);
|
371
|
-
|
372
|
-
case 6:
|
373
|
-
case "end":
|
374
|
-
return _context2.stop();
|
375
|
-
}
|
376
|
-
}
|
377
|
-
}, _callee2, this);
|
378
|
-
}));
|
379
|
-
|
380
|
-
function addStatusesToSideBar() {
|
381
|
-
return _addStatusesToSideBar.apply(this, arguments);
|
382
|
-
}
|
383
|
-
|
384
|
-
return addStatusesToSideBar;
|
385
|
-
}()
|
386
|
-
}, {
|
387
|
-
key: "addStatusToStoryName",
|
388
|
-
value: function addStatusToStoryName(name, status, skip) {
|
389
|
-
name = name.replace(/^(❌|✔|🟡|🕗|⏸) /, '');
|
390
|
-
var emojiStatus = getEmojiByTestStatus(status, skip);
|
391
|
-
return "".concat(emojiStatus ? "".concat(emojiStatus, " ") : '', " ").concat(name);
|
392
|
-
}
|
393
|
-
}]);
|
394
|
-
|
395
|
-
return CreeveyManager;
|
396
|
-
}();
|
@@ -1,58 +0,0 @@
|
|
1
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
2
|
-
|
3
|
-
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."); }
|
4
|
-
|
5
|
-
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); }
|
6
|
-
|
7
|
-
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; }
|
8
|
-
|
9
|
-
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; }
|
10
|
-
|
11
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
12
|
-
|
13
|
-
import { Placeholder } from '@storybook/components';
|
14
|
-
import React, { useEffect, useState } from 'react';
|
15
|
-
import { Panel } from './Panel';
|
16
|
-
export var Addon = function Addon(_ref) {
|
17
|
-
var active = _ref.active,
|
18
|
-
browser = _ref.browser,
|
19
|
-
manager = _ref.manager;
|
20
|
-
|
21
|
-
var _useState = useState([]),
|
22
|
-
_useState2 = _slicedToArray(_useState, 2),
|
23
|
-
tests = _useState2[0],
|
24
|
-
setTests = _useState2[1];
|
25
|
-
|
26
|
-
var _useState3 = useState(manager.selectedTestId),
|
27
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
28
|
-
selectedTestId = _useState4[0],
|
29
|
-
setSelectedTestId = _useState4[1];
|
30
|
-
|
31
|
-
useEffect(function () {
|
32
|
-
if (active) {
|
33
|
-
manager.setActiveBrowser(browser);
|
34
|
-
var browserTests = manager.getTestsByStoryIdAndBrowser(manager.activeBrowser);
|
35
|
-
setTests(browserTests);
|
36
|
-
}
|
37
|
-
}, [active, browser, manager]);
|
38
|
-
useEffect(function () {
|
39
|
-
var unsubscribe = manager.onChangeTest(function (testId) {
|
40
|
-
setSelectedTestId(testId);
|
41
|
-
var status = manager.getTestsByStoryIdAndBrowser(manager.activeBrowser);
|
42
|
-
setTests(status);
|
43
|
-
});
|
44
|
-
return unsubscribe;
|
45
|
-
}, [manager]);
|
46
|
-
useEffect(function () {
|
47
|
-
var unsubscribe = manager.onUpdateStatus(function () {
|
48
|
-
setTests(manager.getTestsByStoryIdAndBrowser(manager.activeBrowser));
|
49
|
-
});
|
50
|
-
return unsubscribe;
|
51
|
-
}, [manager, browser]);
|
52
|
-
return active ? tests.length ? /*#__PURE__*/React.createElement(Panel, {
|
53
|
-
tests: tests,
|
54
|
-
selectedTestId: selectedTestId,
|
55
|
-
onChangeTest: manager.setSelectedTestId,
|
56
|
-
onImageApprove: manager.onImageApprove
|
57
|
-
}) : /*#__PURE__*/React.createElement(Placeholder, null, "No test results") : null;
|
58
|
-
};
|
@@ -1,27 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
export var NextIcon = function NextIcon(_ref) {
|
3
|
-
var width = _ref.width,
|
4
|
-
height = _ref.height;
|
5
|
-
return /*#__PURE__*/React.createElement("svg", {
|
6
|
-
version: "1.1",
|
7
|
-
width: width,
|
8
|
-
height: height,
|
9
|
-
viewBox: "0 0 306 306"
|
10
|
-
}, /*#__PURE__*/React.createElement("path", {
|
11
|
-
d: "M0,306l216.75-153L0,0V306z M255,0v306h51V0H255z",
|
12
|
-
fill: "currentColor"
|
13
|
-
}));
|
14
|
-
};
|
15
|
-
export var ForwardIcon = function ForwardIcon(_ref2) {
|
16
|
-
var width = _ref2.width,
|
17
|
-
height = _ref2.height;
|
18
|
-
return /*#__PURE__*/React.createElement("svg", {
|
19
|
-
version: "1.1",
|
20
|
-
width: width,
|
21
|
-
height: height,
|
22
|
-
viewBox: "0 0 512 512"
|
23
|
-
}, /*#__PURE__*/React.createElement("path", {
|
24
|
-
fill: "currentColor",
|
25
|
-
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"
|
26
|
-
}));
|
27
|
-
};
|