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/types/index.d.ts
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
/// <reference types="../../types/chai" />
|
2
1
|
export * from './types';
|
3
|
-
|
4
|
-
export
|
2
|
+
export { loadStories as browserStoriesProvider } from './server/storybook/providers/browser';
|
3
|
+
export { loadStories as nodejsStoriesProvider } from './server/storybook/providers/nodejs';
|
4
|
+
export { loadStories as hybridStoriesProvider } from './server/storybook/providers/hybrid';
|
5
|
+
export * from './server/testsFiles/parser';
|
@@ -1,4 +1,4 @@
|
|
1
1
|
import { Config, Options } from '../types';
|
2
2
|
export declare const defaultBrowser = "chrome";
|
3
|
-
export declare const defaultConfig: Omit<Config, 'gridUrl' | 'storiesProvider' | '
|
3
|
+
export declare const defaultConfig: Omit<Config, 'gridUrl' | 'storiesProvider' | 'testsDir' | 'tsConfig'>;
|
4
4
|
export declare function readConfig(options: Options): Promise<Config>;
|
@@ -1,4 +1,3 @@
|
|
1
|
-
/// <reference types="webpack-env" />
|
2
1
|
/// <reference types="node" />
|
3
2
|
import cluster from 'cluster';
|
4
3
|
import { WorkerMessage, StoriesMessage, TestMessage, WebpackMessage, DockerMessage, WorkerHandler, StoriesHandler, TestHandler, WebpackHandler, DockerHandler, ShutdownHandler } from '../types';
|
package/lib/types/types.d.ts
CHANGED
@@ -246,8 +246,9 @@ export interface Config {
|
|
246
246
|
* Specify platform for docker images
|
247
247
|
*/
|
248
248
|
dockerImagePlatform: string;
|
249
|
-
|
250
|
-
|
249
|
+
testsRegex?: RegExp;
|
250
|
+
testsDir?: string;
|
251
|
+
tsConfig?: string;
|
251
252
|
}
|
252
253
|
export declare type CreeveyConfig = Partial<Config>;
|
253
254
|
export interface Options {
|
package/package.json
CHANGED
@@ -13,7 +13,7 @@
|
|
13
13
|
"addon",
|
14
14
|
"test"
|
15
15
|
],
|
16
|
-
"version": "0.9.0-beta.
|
16
|
+
"version": "0.9.0-beta.1",
|
17
17
|
"bin": {
|
18
18
|
"creevey": "./lib/cjs/cli.js"
|
19
19
|
},
|
@@ -75,6 +75,7 @@
|
|
75
75
|
"@babel/parser": "^7.15.3",
|
76
76
|
"@babel/plugin-transform-runtime": "^7.15.0",
|
77
77
|
"@babel/preset-env": "^7.15.0",
|
78
|
+
"@babel/preset-typescript": "^7.15.0",
|
78
79
|
"@babel/register": "^7.15.3",
|
79
80
|
"@babel/runtime-corejs3": "^7.15.3",
|
80
81
|
"@babel/traverse": "^7.15.0",
|
@@ -88,6 +89,7 @@
|
|
88
89
|
"@types/chai": "^4.2.15",
|
89
90
|
"@types/selenium-webdriver": "^4.0.12",
|
90
91
|
"airbnb-js-shims": "^2.2.1",
|
92
|
+
"babel-plugin-tsconfig-paths": "^1.0.3",
|
91
93
|
"chai": "^4.3.4",
|
92
94
|
"chalk": "^4.1.2",
|
93
95
|
"chokidar": "^3.5.1",
|
@@ -95,6 +97,7 @@
|
|
95
97
|
"dockerode": "^3.2.1",
|
96
98
|
"event-source-polyfill": "1.0.25",
|
97
99
|
"find-cache-dir": "^3.3.1",
|
100
|
+
"get-tsconfig": "^4.2.0",
|
98
101
|
"global-jsdom": "8.3.0",
|
99
102
|
"jsdom": "^16.5.2",
|
100
103
|
"koa": "^2.13.1",
|
@@ -120,6 +123,7 @@
|
|
120
123
|
"schema-utils": "^3.0.0",
|
121
124
|
"selenium-webdriver": "^4.0.0-beta.3",
|
122
125
|
"shelljs": "^0.8.4",
|
126
|
+
"ts-node": "^10.9.1",
|
123
127
|
"tsconfig-paths": "^3.11.0",
|
124
128
|
"webpack-node-externals": "^3.0.0",
|
125
129
|
"ws": "^7.4.6"
|
@@ -129,7 +133,6 @@
|
|
129
133
|
"@babel/core": "^7.15.0",
|
130
134
|
"@babel/plugin-proposal-class-properties": "^7.13.0",
|
131
135
|
"@babel/preset-react": "^7.13.13",
|
132
|
-
"@babel/preset-typescript": "^7.15.0",
|
133
136
|
"@mdx-js/mdx": "^1.6.22",
|
134
137
|
"@storybook/addon-essentials": "^6.4.19",
|
135
138
|
"@storybook/addon-postcss": "^2.0.0",
|
package/lib/cjs/cli.js
DELETED
@@ -1,412 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.CreeveyManager = void 0;
|
7
|
-
|
8
|
-
var _coreEvents = require("@storybook/core-events");
|
9
|
-
|
10
|
-
var _shared = require("../../shared");
|
11
|
-
|
12
|
-
var _types = require("../../types");
|
13
|
-
|
14
|
-
var _creeveyClientApi = require("../shared/creeveyClientApi");
|
15
|
-
|
16
|
-
var _helpers = require("../shared/helpers");
|
17
|
-
|
18
|
-
var _register = require("./register");
|
19
|
-
|
20
|
-
var _utils = require("./utils");
|
21
|
-
|
22
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
23
|
-
|
24
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
25
|
-
|
26
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
27
|
-
|
28
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
29
|
-
|
30
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
31
|
-
|
32
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
33
|
-
|
34
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
35
|
-
|
36
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
37
|
-
|
38
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
39
|
-
|
40
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
41
|
-
|
42
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
43
|
-
|
44
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
45
|
-
|
46
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
47
|
-
|
48
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
49
|
-
|
50
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
51
|
-
|
52
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
53
|
-
|
54
|
-
var CreeveyManager = /*#__PURE__*/function () {
|
55
|
-
function CreeveyManager(storybookApi) {
|
56
|
-
var _this = this;
|
57
|
-
|
58
|
-
_classCallCheck(this, CreeveyManager);
|
59
|
-
|
60
|
-
_defineProperty(this, "storyId", '');
|
61
|
-
|
62
|
-
_defineProperty(this, "activeBrowser", '');
|
63
|
-
|
64
|
-
_defineProperty(this, "selectedTestId", '');
|
65
|
-
|
66
|
-
_defineProperty(this, "status", {
|
67
|
-
isRunning: false,
|
68
|
-
tests: {},
|
69
|
-
browsers: []
|
70
|
-
});
|
71
|
-
|
72
|
-
_defineProperty(this, "creeveyApi", null);
|
73
|
-
|
74
|
-
_defineProperty(this, "stories", {});
|
75
|
-
|
76
|
-
_defineProperty(this, "updateStatusListeners", []);
|
77
|
-
|
78
|
-
_defineProperty(this, "changeTestListeners", []);
|
79
|
-
|
80
|
-
_defineProperty(this, "initAll", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
81
|
-
return regeneratorRuntime.wrap(function _callee$(_context) {
|
82
|
-
while (1) {
|
83
|
-
switch (_context.prev = _context.next) {
|
84
|
-
case 0:
|
85
|
-
_this.storybookApi.on(_coreEvents.STORY_RENDERED, _this.onStoryRendered);
|
86
|
-
|
87
|
-
_this.storybookApi.on(_coreEvents.SET_STORIES, _this.onSetStories);
|
88
|
-
|
89
|
-
_context.next = 4;
|
90
|
-
return (0, _creeveyClientApi.initCreeveyClientApi)();
|
91
|
-
|
92
|
-
case 4:
|
93
|
-
_this.creeveyApi = _context.sent;
|
94
|
-
|
95
|
-
_this.creeveyApi.onUpdate(_this.handleCreeveyUpdate);
|
96
|
-
|
97
|
-
_context.next = 8;
|
98
|
-
return _this.creeveyApi.status;
|
99
|
-
|
100
|
-
case 8:
|
101
|
-
_this.status = _context.sent;
|
102
|
-
|
103
|
-
case 9:
|
104
|
-
case "end":
|
105
|
-
return _context.stop();
|
106
|
-
}
|
107
|
-
}
|
108
|
-
}, _callee);
|
109
|
-
})));
|
110
|
-
|
111
|
-
_defineProperty(this, "handleCreeveyUpdate", function (update) {
|
112
|
-
var tests = update.tests,
|
113
|
-
_update$removedTests = update.removedTests,
|
114
|
-
removedTests = _update$removedTests === void 0 ? [] : _update$removedTests,
|
115
|
-
isRunning = update.isRunning;
|
116
|
-
|
117
|
-
if ((0, _types.isDefined)(isRunning)) {
|
118
|
-
_this.status.isRunning = isRunning;
|
119
|
-
}
|
120
|
-
|
121
|
-
if ((0, _types.isDefined)(tests)) {
|
122
|
-
var prevTests = _this.status.tests;
|
123
|
-
var prevStories = _this.stories || {};
|
124
|
-
Object.values(tests).filter(_types.isDefined).forEach(function (update) {
|
125
|
-
var _test$results;
|
126
|
-
|
127
|
-
var id = update.id,
|
128
|
-
skip = update.skip,
|
129
|
-
status = update.status,
|
130
|
-
results = update.results,
|
131
|
-
approved = update.approved,
|
132
|
-
storyId = update.storyId;
|
133
|
-
var test = prevTests[id];
|
134
|
-
|
135
|
-
if (!test) {
|
136
|
-
return prevTests[id] = update;
|
137
|
-
}
|
138
|
-
|
139
|
-
if ((0, _types.isDefined)(skip)) test.skip = skip;
|
140
|
-
|
141
|
-
if ((0, _types.isDefined)(status)) {
|
142
|
-
test.status = status;
|
143
|
-
|
144
|
-
if ((0, _types.isDefined)(storyId) && (0, _types.isDefined)(prevStories[storyId])) {
|
145
|
-
var story = prevStories[storyId];
|
146
|
-
|
147
|
-
var storyStatus = _this.getStoryTests(storyId);
|
148
|
-
|
149
|
-
var oldStatus = storyStatus.map(function (x) {
|
150
|
-
return x.id === id ? status : x.status;
|
151
|
-
}).reduce(function (oldStatus, newStatus) {
|
152
|
-
return (0, _helpers.calcStatus)(oldStatus, newStatus);
|
153
|
-
}, undefined);
|
154
|
-
story.name = _this.addStatusToStoryName(story.name, (0, _helpers.calcStatus)(oldStatus, status), skip || false);
|
155
|
-
}
|
156
|
-
}
|
157
|
-
|
158
|
-
if ((0, _types.isDefined)(results)) test.results ? (_test$results = test.results).push.apply(_test$results, _toConsumableArray(results)) : test.results = results;
|
159
|
-
|
160
|
-
if ((0, _types.isDefined)(approved)) {
|
161
|
-
Object.entries(approved).forEach(function (_ref2) {
|
162
|
-
var _ref3 = _slicedToArray(_ref2, 2),
|
163
|
-
image = _ref3[0],
|
164
|
-
retry = _ref3[1];
|
165
|
-
|
166
|
-
return retry !== undefined && test && ((test.approved = (test === null || test === void 0 ? void 0 : test.approved) || {})[image] = retry);
|
167
|
-
});
|
168
|
-
}
|
169
|
-
});
|
170
|
-
removedTests.forEach(function (_ref4) {
|
171
|
-
var id = _ref4.id;
|
172
|
-
return delete prevTests[id];
|
173
|
-
});
|
174
|
-
_this.status.tests = prevTests;
|
175
|
-
_this.stories = prevStories;
|
176
|
-
|
177
|
-
_this.setPanelsTitle();
|
178
|
-
|
179
|
-
void _this.storybookApi.setStories(_this.stories);
|
180
|
-
}
|
181
|
-
|
182
|
-
_this.updateStatusListeners.forEach(function (x) {
|
183
|
-
return x(update);
|
184
|
-
});
|
185
|
-
});
|
186
|
-
|
187
|
-
_defineProperty(this, "getCurrentTest", function () {
|
188
|
-
return _this.status.tests[_this.selectedTestId];
|
189
|
-
});
|
190
|
-
|
191
|
-
_defineProperty(this, "onStoryRendered", function (storyId) {
|
192
|
-
if (_this.storyId === '') void _this.addStatusesToSideBar();
|
193
|
-
|
194
|
-
if (_this.storyId !== storyId) {
|
195
|
-
var _this$getTestsByStory, _this$getTestsByStory2;
|
196
|
-
|
197
|
-
_this.storyId = storyId;
|
198
|
-
_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 : '';
|
199
|
-
|
200
|
-
_this.setPanelsTitle();
|
201
|
-
|
202
|
-
_this.changeTestListeners.forEach(function (x) {
|
203
|
-
return x(_this.selectedTestId);
|
204
|
-
});
|
205
|
-
}
|
206
|
-
});
|
207
|
-
|
208
|
-
_defineProperty(this, "onStart", function () {
|
209
|
-
var _this$creeveyApi;
|
210
|
-
|
211
|
-
(_this$creeveyApi = _this.creeveyApi) === null || _this$creeveyApi === void 0 ? void 0 : _this$creeveyApi.start([_this.selectedTestId]);
|
212
|
-
});
|
213
|
-
|
214
|
-
_defineProperty(this, "onStop", function () {
|
215
|
-
var _this$creeveyApi2;
|
216
|
-
|
217
|
-
(_this$creeveyApi2 = _this.creeveyApi) === null || _this$creeveyApi2 === void 0 ? void 0 : _this$creeveyApi2.stop();
|
218
|
-
});
|
219
|
-
|
220
|
-
_defineProperty(this, "onImageApprove", function (id, retry, image) {
|
221
|
-
var _this$creeveyApi3;
|
222
|
-
|
223
|
-
return (_this$creeveyApi3 = _this.creeveyApi) === null || _this$creeveyApi3 === void 0 ? void 0 : _this$creeveyApi3.approve(id, retry, image);
|
224
|
-
});
|
225
|
-
|
226
|
-
_defineProperty(this, "onStartAllStoryTests", function () {
|
227
|
-
var _this$creeveyApi4;
|
228
|
-
|
229
|
-
var ids = Object.values(_this.status.tests).filter(_types.isDefined).filter(function (x) {
|
230
|
-
return x.storyId === _this.storyId;
|
231
|
-
}).map(function (x) {
|
232
|
-
return x.id;
|
233
|
-
});
|
234
|
-
(_this$creeveyApi4 = _this.creeveyApi) === null || _this$creeveyApi4 === void 0 ? void 0 : _this$creeveyApi4.start(ids);
|
235
|
-
});
|
236
|
-
|
237
|
-
_defineProperty(this, "onStartAllTests", function () {
|
238
|
-
var _this$creeveyApi5;
|
239
|
-
|
240
|
-
var ids = Object.values(_this.status.tests).filter(_types.isDefined).map(function (x) {
|
241
|
-
return x.id;
|
242
|
-
});
|
243
|
-
(_this$creeveyApi5 = _this.creeveyApi) === null || _this$creeveyApi5 === void 0 ? void 0 : _this$creeveyApi5.start(ids);
|
244
|
-
});
|
245
|
-
|
246
|
-
_defineProperty(this, "onSetStories", function (data) {
|
247
|
-
var stories = data.v ? (0, _shared.denormalizeStoryParameters)(data) : data.stories;
|
248
|
-
_this.stories = stories;
|
249
|
-
});
|
250
|
-
|
251
|
-
_defineProperty(this, "setActiveBrowser", function (browser) {
|
252
|
-
var _this$getTestsByStory3, _this$getTestsByStory4;
|
253
|
-
|
254
|
-
_this.activeBrowser = browser;
|
255
|
-
_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 : '';
|
256
|
-
|
257
|
-
_this.changeTestListeners.forEach(function (x) {
|
258
|
-
return x(_this.selectedTestId);
|
259
|
-
});
|
260
|
-
});
|
261
|
-
|
262
|
-
_defineProperty(this, "setSelectedTestId", function (testId) {
|
263
|
-
_this.selectedTestId = testId;
|
264
|
-
|
265
|
-
_this.changeTestListeners.forEach(function (x) {
|
266
|
-
return x(_this.selectedTestId);
|
267
|
-
});
|
268
|
-
});
|
269
|
-
|
270
|
-
_defineProperty(this, "getStoryTests", function (storyId) {
|
271
|
-
if (!_this.status || !_this.status.tests) return [];
|
272
|
-
return Object.values(_this.status.tests).filter(function (result) {
|
273
|
-
return (result === null || result === void 0 ? void 0 : result.storyId) === storyId;
|
274
|
-
}).filter(_types.isDefined);
|
275
|
-
});
|
276
|
-
|
277
|
-
_defineProperty(this, "getBrowsers", function () {
|
278
|
-
return _this.status.browsers;
|
279
|
-
});
|
280
|
-
|
281
|
-
_defineProperty(this, "getTestsByStoryIdAndBrowser", function (browser) {
|
282
|
-
return Object.values(_this.status.tests).filter(function (x) {
|
283
|
-
return (x === null || x === void 0 ? void 0 : x.browser) === browser && x.storyId === _this.storyId;
|
284
|
-
}).filter(_types.isDefined);
|
285
|
-
});
|
286
|
-
|
287
|
-
_defineProperty(this, "getTabTitle", function (browser) {
|
288
|
-
var tests = _this.getTestsByStoryIdAndBrowser(browser);
|
289
|
-
|
290
|
-
var browserStatus = tests.map(function (x) {
|
291
|
-
return x && x.status;
|
292
|
-
}).reduce(function (oldStatus, newStatus) {
|
293
|
-
return (0, _helpers.calcStatus)(oldStatus, newStatus);
|
294
|
-
}, undefined);
|
295
|
-
var browserSkip = tests.length > 0 ? tests.every(function (x) {
|
296
|
-
return x && x.skip;
|
297
|
-
}) : false;
|
298
|
-
var emojiStatus = (0, _utils.getEmojiByTestStatus)(browserStatus, browserSkip);
|
299
|
-
return "".concat(emojiStatus ? "".concat(emojiStatus, " ") : '', "Creevey/").concat(browser);
|
300
|
-
});
|
301
|
-
|
302
|
-
_defineProperty(this, "setPanelsTitle", function () {
|
303
|
-
var _this$storybookApi;
|
304
|
-
|
305
|
-
var panels = (_this$storybookApi = _this.storybookApi) === null || _this$storybookApi === void 0 ? void 0 : _this$storybookApi.getPanels();
|
306
|
-
if (!panels) return;
|
307
|
-
var firstPanelBrowser = _this.activeBrowser;
|
308
|
-
|
309
|
-
for (var p in panels) {
|
310
|
-
var _panel$id;
|
311
|
-
|
312
|
-
var panel = panels[p];
|
313
|
-
|
314
|
-
if (((_panel$id = panel.id) === null || _panel$id === void 0 ? void 0 : _panel$id.indexOf(_register.ADDON_ID)) === 0 && panel.paramKey) {
|
315
|
-
panel.title = _this.getTabTitle(panel.paramKey);
|
316
|
-
if (!firstPanelBrowser) firstPanelBrowser = panel.paramKey;
|
317
|
-
}
|
318
|
-
}
|
319
|
-
|
320
|
-
_this.storybookApi.setSelectedPanel("".concat(_register.ADDON_ID, "/panel/").concat(firstPanelBrowser));
|
321
|
-
});
|
322
|
-
|
323
|
-
this.storybookApi = storybookApi;
|
324
|
-
}
|
325
|
-
|
326
|
-
_createClass(CreeveyManager, [{
|
327
|
-
key: "onUpdateStatus",
|
328
|
-
value: function onUpdateStatus(listener) {
|
329
|
-
var _this2 = this;
|
330
|
-
|
331
|
-
this.updateStatusListeners.push(listener);
|
332
|
-
return function () {
|
333
|
-
return void (_this2.updateStatusListeners = _this2.updateStatusListeners.filter(function (x) {
|
334
|
-
return x != listener;
|
335
|
-
}));
|
336
|
-
};
|
337
|
-
}
|
338
|
-
}, {
|
339
|
-
key: "onChangeTest",
|
340
|
-
value: function onChangeTest(listener) {
|
341
|
-
var _this3 = this;
|
342
|
-
|
343
|
-
this.changeTestListeners.push(listener);
|
344
|
-
return function () {
|
345
|
-
return void (_this3.changeTestListeners = _this3.changeTestListeners.filter(function (x) {
|
346
|
-
return x != listener;
|
347
|
-
}));
|
348
|
-
};
|
349
|
-
}
|
350
|
-
}, {
|
351
|
-
key: "addStatusesToSideBar",
|
352
|
-
value: function () {
|
353
|
-
var _addStatusesToSideBar = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
|
354
|
-
var _this4 = this;
|
355
|
-
|
356
|
-
var stories;
|
357
|
-
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
358
|
-
while (1) {
|
359
|
-
switch (_context2.prev = _context2.next) {
|
360
|
-
case 0:
|
361
|
-
if (Object.keys(this.stories).length) {
|
362
|
-
_context2.next = 2;
|
363
|
-
break;
|
364
|
-
}
|
365
|
-
|
366
|
-
return _context2.abrupt("return");
|
367
|
-
|
368
|
-
case 2:
|
369
|
-
stories = this.stories;
|
370
|
-
Object.keys(this.stories).forEach(function (storyId) {
|
371
|
-
var storyStatus = _this4.getStoryTests(storyId);
|
372
|
-
|
373
|
-
var status = storyStatus.map(function (x) {
|
374
|
-
return x.status;
|
375
|
-
}).reduce(function (oldStatus, newStatus) {
|
376
|
-
return (0, _helpers.calcStatus)(oldStatus, newStatus);
|
377
|
-
}, undefined);
|
378
|
-
var skip = storyStatus.length > 0 ? storyStatus.every(function (x) {
|
379
|
-
return x.skip;
|
380
|
-
}) : false;
|
381
|
-
_this4.stories[storyId].name = _this4.addStatusToStoryName(stories[storyId].name, status, skip);
|
382
|
-
});
|
383
|
-
_context2.next = 6;
|
384
|
-
return this.storybookApi.setStories(this.stories);
|
385
|
-
|
386
|
-
case 6:
|
387
|
-
case "end":
|
388
|
-
return _context2.stop();
|
389
|
-
}
|
390
|
-
}
|
391
|
-
}, _callee2, this);
|
392
|
-
}));
|
393
|
-
|
394
|
-
function addStatusesToSideBar() {
|
395
|
-
return _addStatusesToSideBar.apply(this, arguments);
|
396
|
-
}
|
397
|
-
|
398
|
-
return addStatusesToSideBar;
|
399
|
-
}()
|
400
|
-
}, {
|
401
|
-
key: "addStatusToStoryName",
|
402
|
-
value: function addStatusToStoryName(name, status, skip) {
|
403
|
-
name = name.replace(/^(❌|✔|🟡|🕗|⏸) /, '');
|
404
|
-
var emojiStatus = (0, _utils.getEmojiByTestStatus)(status, skip);
|
405
|
-
return "".concat(emojiStatus ? "".concat(emojiStatus, " ") : '', " ").concat(name);
|
406
|
-
}
|
407
|
-
}]);
|
408
|
-
|
409
|
-
return CreeveyManager;
|
410
|
-
}();
|
411
|
-
|
412
|
-
exports.CreeveyManager = CreeveyManager;
|
@@ -1,76 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
4
|
-
|
5
|
-
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;
|
@@ -1,42 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.ForwardIcon = exports.NextIcon = 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 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"
|
39
|
-
}));
|
40
|
-
};
|
41
|
-
|
42
|
-
exports.ForwardIcon = ForwardIcon;
|