creevey 0.9.0-beta.1 → 0.9.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +51 -0
- package/README.md +9 -1
- package/addon/README.md +3 -0
- package/addon/package.json +5 -0
- package/docs/config.md +29 -26
- package/jest.config.js +6 -0
- package/lib/cjs/cli.js +5 -0
- package/lib/cjs/client/addon/Manager.js +264 -0
- package/lib/cjs/client/addon/components/Addon.js +55 -0
- package/lib/cjs/client/addon/components/Icons.js +46 -0
- package/lib/cjs/client/addon/components/Panel.js +72 -0
- package/lib/cjs/client/addon/components/TestSelect.js +65 -0
- package/lib/cjs/client/addon/components/Tools.js +95 -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.ie11.js +74 -0
- package/lib/cjs/client/addon/preset.js +17 -0
- package/lib/cjs/client/addon/preset.sb7.js +19 -0
- package/lib/cjs/client/addon/preview.js +14 -0
- package/lib/cjs/client/addon/readyForCapture.js +12 -0
- package/lib/cjs/client/addon/register.js +72 -0
- package/lib/cjs/client/addon/utils.js +42 -0
- package/lib/cjs/client/addon/withCreevey.js +351 -0
- package/lib/cjs/client/shared/components/ImagesView/BlendView.js +87 -0
- package/lib/cjs/client/shared/components/ImagesView/ImagesView.js +92 -0
- package/lib/cjs/client/shared/components/ImagesView/SideBySideView.js +154 -0
- package/lib/cjs/client/shared/components/ImagesView/SlideView.js +166 -0
- package/lib/cjs/client/shared/components/ImagesView/SwapView.js +91 -0
- package/lib/cjs/client/shared/components/ImagesView/index.js +45 -0
- package/lib/cjs/client/shared/components/PageFooter/PageFooter.js +50 -0
- package/lib/cjs/client/shared/components/PageFooter/Paging.js +94 -0
- package/lib/cjs/client/shared/components/PageHeader/ImagePreview.js +82 -0
- package/lib/cjs/client/shared/components/PageHeader/PageHeader.js +119 -0
- package/lib/cjs/client/shared/components/ResultsPage.js +143 -0
- package/lib/cjs/client/shared/creeveyClientApi.js +76 -0
- package/lib/cjs/client/shared/helpers.js +411 -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 +94 -0
- package/lib/cjs/server/docker.js +146 -0
- package/lib/cjs/server/extract.js +46 -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 +269 -0
- package/lib/cjs/server/loaders/webpack/creevey-loader.js +172 -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 +131 -0
- package/lib/cjs/server/messages.js +264 -0
- package/lib/cjs/server/selenium/browser.js +668 -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 +153 -0
- package/lib/cjs/server/storybook/entry.js +53 -0
- package/lib/cjs/server/storybook/helpers.js +158 -0
- package/lib/cjs/server/storybook/providers/browser.js +74 -0
- package/lib/cjs/server/storybook/providers/hybrid.js +82 -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 +44 -0
- package/lib/cjs/server/update.js +79 -0
- package/lib/cjs/server/utils.js +176 -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 +101 -0
- package/lib/cjs/shared/serializeRegExp.js +42 -0
- package/lib/cjs/types.js +75 -0
- package/lib/esm/cli.js +4 -0
- package/lib/esm/client/addon/Manager.js +248 -0
- package/lib/esm/client/addon/components/Addon.js +39 -0
- package/lib/esm/client/addon/components/Icons.js +31 -0
- package/lib/esm/client/addon/components/Panel.js +53 -0
- package/lib/esm/client/addon/components/TestSelect.js +51 -0
- package/lib/esm/client/addon/components/Tools.js +74 -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.ie11.js +59 -0
- package/lib/esm/client/addon/preset.js +8 -0
- package/lib/esm/client/addon/preset.sb7.js +8 -0
- package/lib/esm/client/addon/preview.js +5 -0
- package/lib/esm/client/addon/readyForCapture.js +5 -0
- package/lib/esm/client/addon/register.js +51 -0
- package/lib/esm/client/addon/utils.js +32 -0
- package/lib/esm/client/addon/withCreevey.js +325 -0
- package/lib/esm/client/shared/components/ImagesView/BlendView.js +67 -0
- package/lib/esm/client/shared/components/ImagesView/ImagesView.js +69 -0
- package/lib/esm/client/shared/components/ImagesView/SideBySideView.js +131 -0
- package/lib/esm/client/shared/components/ImagesView/SlideView.js +143 -0
- package/lib/esm/client/shared/components/ImagesView/SwapView.js +71 -0
- package/lib/esm/client/shared/components/ImagesView/index.js +5 -0
- package/lib/esm/client/shared/components/PageFooter/PageFooter.js +36 -0
- package/lib/esm/client/shared/components/PageFooter/Paging.js +80 -0
- package/lib/esm/client/shared/components/PageHeader/ImagePreview.js +68 -0
- package/lib/esm/client/shared/components/PageHeader/PageHeader.js +97 -0
- package/lib/esm/client/shared/components/ResultsPage.js +115 -0
- package/lib/esm/client/shared/creeveyClientApi.js +67 -0
- package/lib/esm/client/shared/helpers.js +353 -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 +71 -0
- package/lib/esm/server/docker.js +123 -0
- package/lib/esm/server/extract.js +32 -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 +246 -0
- package/lib/esm/server/loaders/webpack/creevey-loader.js +152 -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 +107 -0
- package/lib/esm/server/messages.js +232 -0
- package/lib/esm/server/selenium/browser.js +635 -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 +135 -0
- package/lib/esm/server/storybook/entry.js +27 -0
- package/lib/esm/server/storybook/helpers.js +97 -0
- package/lib/esm/server/storybook/providers/browser.js +58 -0
- package/lib/esm/server/storybook/providers/hybrid.js +60 -0
- package/lib/esm/server/storybook/providers/nodejs.js +216 -0
- package/lib/esm/server/testsFiles/parser.js +50 -0
- package/lib/esm/server/testsFiles/register.js +31 -0
- package/lib/esm/server/update.js +61 -0
- package/lib/esm/server/utils.js +133 -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 +78 -0
- package/lib/esm/shared/serializeRegExp.js +24 -0
- package/lib/esm/types.js +44 -0
- package/lib/types/client/addon/Manager.d.ts +2 -2
- package/lib/types/client/addon/components/TestSelect.d.ts +0 -1
- package/lib/types/client/addon/index.d.ts +2 -0
- package/lib/types/client/addon/preset.d.ts +0 -22
- package/lib/types/client/addon/preset.ie11.d.ts +10 -0
- package/lib/types/client/addon/preset.sb7.d.ts +2 -0
- package/lib/types/client/addon/preview.d.ts +4 -0
- package/lib/types/client/addon/utils.d.ts +1 -0
- package/lib/types/client/addon/withCreevey.d.ts +1 -1
- package/lib/types/client/shared/components/ImagesView/BlendView.d.ts +1 -1
- package/lib/types/client/shared/components/ImagesView/ImagesView.d.ts +0 -1
- package/lib/types/client/shared/components/ImagesView/SideBySideView.d.ts +1 -1
- package/lib/types/client/shared/components/ImagesView/SlideView.d.ts +1 -1
- package/lib/types/client/shared/components/ImagesView/SwapView.d.ts +1 -1
- package/lib/types/client/shared/components/PageFooter/PageFooter.d.ts +0 -1
- package/lib/types/client/shared/components/PageFooter/Paging.d.ts +0 -1
- package/lib/types/client/shared/components/PageHeader/ImagePreview.d.ts +1 -1
- package/lib/types/client/shared/components/PageHeader/PageHeader.d.ts +0 -1
- package/lib/types/client/shared/components/ResultsPage.d.ts +1 -1
- package/lib/types/client/web/CreeveyApp.d.ts +0 -1
- package/lib/types/client/web/CreeveyLoader.d.ts +1 -2
- package/lib/types/client/web/CreeveyView/SideBar/Checkbox.d.ts +1 -1
- package/lib/types/client/web/CreeveyView/SideBar/SideBarHeader.d.ts +0 -1
- package/lib/types/client/web/CreeveyView/SideBar/SuiteLink.d.ts +4 -4
- package/lib/types/client/web/CreeveyView/SideBar/TestLink.d.ts +0 -1
- package/lib/types/client/web/CreeveyView/SideBar/TestStatusIcon.d.ts +1 -1
- package/lib/types/client/web/CreeveyView/SideBar/TestsStatus.d.ts +1 -1
- package/lib/types/index.d.ts +1 -0
- package/lib/types/server/loaders/babel/register.d.ts +1 -1
- package/lib/types/server/loaders/webpack/creevey-loader.d.ts +4 -2
- package/lib/types/server/logger.d.ts +6 -2
- package/lib/types/server/messages.d.ts +14 -12
- package/lib/types/server/selenium/browser.d.ts +5 -3
- package/lib/types/server/storybook/entry.d.ts +2 -3
- package/lib/types/server/storybook/helpers.d.ts +1 -1
- package/lib/types/server/storybook/providers/browser.d.ts +2 -4
- package/lib/types/server/storybook/providers/hybrid.d.ts +2 -4
- package/lib/types/server/storybook/providers/nodejs.d.ts +3 -3
- package/lib/types/server/utils.d.ts +5 -1
- package/lib/types/{shared.d.ts → shared/index.d.ts} +1 -10
- package/lib/types/shared/serializeRegExp.d.ts +9 -0
- package/lib/types/types.d.ts +4 -7
- package/package.json +117 -103
- package/preset/ie11.js +5 -0
- package/{preset.js → preset/index.js} +2 -2
- package/preset/sb7.js +5 -0
- package/types/global.d.ts +5 -0
- package/types/mdx.d.ts +3 -2
- 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/CHANGELOG.md
CHANGED
@@ -1,3 +1,54 @@
|
|
1
|
+
# [0.9.0-beta.5](https://github.com/wKich/creevey/compare/v0.9.0-beta.4...v0.9.0-beta.5) (2023-04-14)
|
2
|
+
|
3
|
+
# [0.9.0-beta.4](https://github.com/wKich/creevey/compare/v0.9.0-beta.3...v0.9.0-beta.4) (2023-03-24)
|
4
|
+
|
5
|
+
# [0.9.0-beta.3](https://github.com/wKich/creevey/compare/v0.8.0...v0.9.0-beta.3) (2023-03-24)
|
6
|
+
|
7
|
+
### Features
|
8
|
+
|
9
|
+
- hybrid stories provider ([89d9c73](https://github.com/wKich/creevey/commit/89d9c7357369dffb320ea06fe158b4113f57034c))
|
10
|
+
|
11
|
+
## [0.8.1](https://github.com/wKich/creevey/compare/v0.8.1-beta.1...v0.8.1) (2023-05-29)
|
12
|
+
|
13
|
+
## [0.8.1-beta.1](https://github.com/wKich/creevey/compare/v0.8.1-beta.0...v0.8.1-beta.1) (2023-05-05)
|
14
|
+
|
15
|
+
### Bug Fixes
|
16
|
+
|
17
|
+
- **providers:** set creevey port for all providers ([79e8aae](https://github.com/wKich/creevey/commit/79e8aae629d79260f93a93057486bab659801a46))
|
18
|
+
|
19
|
+
## [0.8.1-beta.0](https://github.com/wKich/creevey/compare/v0.8.0...v0.8.1-beta.0) (2023-04-11)
|
20
|
+
|
21
|
+
### Bug Fixes
|
22
|
+
|
23
|
+
- **addon:** make bundlers to load esm version of addon ([f2937ca](https://github.com/wKich/creevey/commit/f2937caccca158e68c8be45d0882ec9b62eb05b2))
|
24
|
+
|
25
|
+
# [0.8.0](https://github.com/wKich/creevey/compare/v0.8.0-beta.1...v0.8.0) (2023-03-07)
|
26
|
+
|
27
|
+
### Bug Fixes
|
28
|
+
|
29
|
+
- drop support of SkipOption on root skip level ([31be1bf](https://github.com/wKich/creevey/commit/31be1bf4d67f464ea6790e6e218ca75674366711))
|
30
|
+
|
31
|
+
# [0.8.0-beta.1](https://github.com/wKich/creevey/compare/v0.8.0-beta.0...v0.8.0-beta.1) (2023-01-18)
|
32
|
+
|
33
|
+
### Bug Fixes
|
34
|
+
|
35
|
+
- **addon:** restore IE11 support ([94f452f](https://github.com/wKich/creevey/commit/94f452fff4225e974c9efdff21f982d5155de4f8))
|
36
|
+
- allow setting timeouts via capabilities ([72de9e5](https://github.com/wKich/creevey/commit/72de9e50b818587309f665c782637ae43c3e4864))
|
37
|
+
- infinite UI loading ([4f7b47d](https://github.com/wKich/creevey/commit/4f7b47db3ff1274217b044ce608e34d22148fe32))
|
38
|
+
- **addon:** restore and move ie11 support to separate addon ([3ba2cc7](https://github.com/wKich/creevey/commit/3ba2cc7fde281037406f1705c0abc616c576e641))
|
39
|
+
- browser-node regexp parameters transfering ([737670e](https://github.com/wKich/creevey/commit/737670e18aa5d0ce416fe12b765406116b453e31))
|
40
|
+
- correct call of the test fn ([98c03ad](https://github.com/wKich/creevey/commit/98c03ad1700486bfd75170f4517970717250f6d8))
|
41
|
+
- handle null from selectStory ([1895602](https://github.com/wKich/creevey/commit/1895602143b3236ab195e11fcfa162df2a01af03))
|
42
|
+
- ie11 support ([523e35b](https://github.com/wKich/creevey/commit/523e35b6950d978ca3aaa77dd4f072a835053687))
|
43
|
+
- move addon to the separate entry point ([f3fc59f](https://github.com/wKich/creevey/commit/f3fc59f980a56f87f882507c3a0367ed6a356d33))
|
44
|
+
- prevent importing browser-specific code to node ([37706ef](https://github.com/wKich/creevey/commit/37706efbb49dd5bd1d6ec06821fac52480a0e132))
|
45
|
+
- **selenium-webdriver:** bump [@types](https://github.com/types) package version ([ca4b369](https://github.com/wKich/creevey/commit/ca4b369046e2c56e0548f5cbb6f98c17b0125228))
|
46
|
+
|
47
|
+
### Features
|
48
|
+
|
49
|
+
- 🎸 add support `play()` story method ([318ac62](https://github.com/wKich/creevey/commit/318ac628cb14fb0de7a89c088ae241df520df1e7))
|
50
|
+
- drop support for storybook < 6.4 ([fb8c0f5](https://github.com/wKich/creevey/commit/fb8c0f5158ab7c0495949eaa61ba52049c3d66cf))
|
51
|
+
|
1
52
|
# [0.8.0-beta.0](https://github.com/wKich/creevey/compare/v0.7.39...v0.8.0-beta.0) (2022-03-17)
|
2
53
|
|
3
54
|
### Bug Fixes
|
package/README.md
CHANGED
@@ -1,9 +1,12 @@
|
|
1
|
-
|
1
|
+
[<img width="274" alt="Creevey" src="https://user-images.githubusercontent.com/4607770/220418756-89cf4f54-ccb7-4086-a74c-a044ea1d2a61.png">](https://harrypotter.fandom.com/wiki/Colin_Creevey)
|
2
|
+
|
3
|
+
**IMPORTANT** _Looking for any help with maintaining_
|
2
4
|
|
3
5
|
Cross-browser screenshot testing tool for [Storybook](https://storybook.js.org/) with fancy UI Runner.
|
4
6
|
|
5
7
|
[](https://www.npmjs.com/package/creevey)
|
6
8
|
[](http://commitizen.github.io/cz-cli/)
|
9
|
+
[](https://app.fossa.com/projects/git%2Bgithub.com%2FwKich%2Fcreevey?ref=badge_shield)
|
7
10
|
|
8
11
|

|
9
12
|
|
@@ -37,6 +40,7 @@ It named after [Colin Creevey](https://harrypotter.fandom.com/wiki/Colin_Creevey
|
|
37
40
|
## Pre-requisites
|
38
41
|
|
39
42
|
- Make sure you have installed [Docker](https://www.docker.com/products/docker-desktop). But if you going to use your own separate Selenium Grid, you don't need `Docker`.
|
43
|
+
- Supported Storybook versions: `^6.4.0`.
|
40
44
|
|
41
45
|
## How to start
|
42
46
|
|
@@ -145,3 +149,7 @@ Because tests defined in story parameters and `selenium-webdriver` depends on no
|
|
145
149
|
|
146
150
|
| [](https://whisk.com/) | [](https://kontur.ru/) | [](https://www.abbyy.com/) |
|
147
151
|
| --------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- |
|
152
|
+
|
153
|
+
## License
|
154
|
+
|
155
|
+
[](https://app.fossa.com/projects/git%2Bgithub.com%2FwKich%2Fcreevey?ref=badge_large)
|
package/addon/README.md
ADDED
@@ -0,0 +1,3 @@
|
|
1
|
+
This is a fallback for package.json's `exports.addon` field. It's required for outdated environments (like node 11 and typescript with the "node" moduleResolution) to resolve imports from `creevey/addon` properly.
|
2
|
+
|
3
|
+
See https://github.com/andrewbranch/example-subpath-exports-ts-compat. The fallback uses the "package-json-redirects" startegy.
|
package/docs/config.md
CHANGED
@@ -120,7 +120,7 @@ export const parameters = {
|
|
120
120
|
creevey: {
|
121
121
|
// Skip all *hover tests in IE11 on the global level
|
122
122
|
skip: {
|
123
|
-
ie11: { in: 'ie11', tests: /.*hover$/ },
|
123
|
+
"hovers don't work in ie11": { in: 'ie11', tests: /.*hover$/ },
|
124
124
|
},
|
125
125
|
},
|
126
126
|
};
|
@@ -137,15 +137,14 @@ export default {
|
|
137
137
|
parameters: {
|
138
138
|
creevey: {
|
139
139
|
// You could skip some browsers/stories or even specific tests
|
140
|
-
skip:
|
141
|
-
|
142
|
-
{ in: 'firefox', stories: 'Loading'
|
143
|
-
{
|
140
|
+
skip: {
|
141
|
+
"`MyComponent` doesn't support ie11": { in: 'ie11' },
|
142
|
+
"Loading stories are flaky in firefox": { in: 'firefox', stories: 'Loading' },
|
143
|
+
"`MyComponent` hovering doesn't work correctly": {
|
144
144
|
in: ['firefox', 'chrome'],
|
145
145
|
tests: /.*hover$/,
|
146
|
-
reason: "For some reason `MyComponent` hovering doesn't work correctly",
|
147
146
|
},
|
148
|
-
|
147
|
+
},
|
149
148
|
},
|
150
149
|
},
|
151
150
|
} as Meta & CreeveyMeta;
|
@@ -169,43 +168,47 @@ Basic.parameters = {
|
|
169
168
|
|
170
169
|
```ts
|
171
170
|
interface SkipOption {
|
172
|
-
reason?: string;
|
173
171
|
in?: string | string[] | RegExp;
|
174
172
|
kinds?: string | string[] | RegExp;
|
175
173
|
stories?: string | string[] | RegExp;
|
176
174
|
tests?: string | string[] | RegExp;
|
177
175
|
}
|
178
176
|
|
179
|
-
type SkipOptions =
|
177
|
+
type SkipOptions = boolean | string | Record<string, SkipOption | SkipOption[]>;
|
180
178
|
```
|
181
179
|
|
182
180
|
- Skip all stories for all browsers:
|
183
181
|
- `skip: true`
|
184
182
|
- `skip: 'Skip reason message'`
|
185
|
-
- `skip: {
|
183
|
+
- `skip: { 'Skip reason message': true }`
|
186
184
|
- Skip all stories for specific browsers:
|
187
|
-
- `skip: { in: 'ie11' }`
|
188
|
-
- `skip: { in: ['ie11', 'chrome'] }`
|
189
|
-
- `skip: { in: /^fire.*/ }`
|
185
|
+
- `skip: { 'Skip reason message': { in: 'ie11' } }`
|
186
|
+
- `skip: { 'Skip reason message': { in: ['ie11', 'chrome'] } }`
|
187
|
+
- `skip: { 'Skip reason message': { in: /^fire.*/ } }`
|
190
188
|
- Skip all stories in specific kinds:
|
191
|
-
- `skip: { kinds: 'Button' }`
|
192
|
-
- `skip: { kinds: ['Button', 'Input'] }`
|
193
|
-
- `skip: { kinds: /.*Modal$/ }`
|
189
|
+
- `skip: { 'Skip reason message': { kinds: 'Button' } }`
|
190
|
+
- `skip: { 'Skip reason message': { kinds: ['Button', 'Input'] } }`
|
191
|
+
- `skip: { 'Skip reason message': { kinds: /.*Modal$/ } }`
|
194
192
|
- Skip all tests in specific stories:
|
195
|
-
- `skip: { stories: 'simple' }`
|
196
|
-
- `skip: { stories: ['simple', 'special'] }`
|
197
|
-
- `skip: { stories: /.*large$/ }`
|
193
|
+
- `skip: { 'Skip reason message': { stories: 'simple' } }`
|
194
|
+
- `skip: { 'Skip reason message': { stories: ['simple', 'special'] } }`
|
195
|
+
- `skip: { 'Skip reason message': { stories: /.*large$/ } }`
|
198
196
|
- Skip specific tests:
|
199
|
-
- `skip: { tests: 'click' }`
|
200
|
-
- `skip: { tests: ['hover', 'click'] }`
|
201
|
-
- `skip: { tests: /^press.*$/ }`
|
197
|
+
- `skip: { 'Skip reason message': { tests: 'click' } }`
|
198
|
+
- `skip: { 'Skip reason message': { tests: ['hover', 'click'] } }`
|
199
|
+
- `skip: { 'Skip reason message': { tests: /^press.*$/ } }`
|
202
200
|
- Multiple skip options:
|
203
|
-
-
|
204
|
-
|
201
|
+
- for one reason
|
202
|
+
```
|
203
|
+
skip: {
|
204
|
+
"reason": [{ /* ... */ }, { /* ... */ }],
|
205
|
+
}
|
206
|
+
```
|
207
|
+
- for several reasons
|
205
208
|
```
|
206
209
|
skip: {
|
207
|
-
|
208
|
-
|
210
|
+
"reason 1": { /* ... */ },
|
211
|
+
"reason 2": { /* ... */ },
|
209
212
|
}
|
210
213
|
```
|
211
214
|
|
package/jest.config.js
ADDED
package/lib/cjs/cli.js
ADDED
@@ -0,0 +1,264 @@
|
|
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 _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; }
|
23
|
+
|
24
|
+
class CreeveyManager {
|
25
|
+
constructor(storybookApi) {
|
26
|
+
this.storybookApi = storybookApi;
|
27
|
+
|
28
|
+
_defineProperty(this, "storyId", '');
|
29
|
+
|
30
|
+
_defineProperty(this, "activeBrowser", '');
|
31
|
+
|
32
|
+
_defineProperty(this, "selectedTestId", '');
|
33
|
+
|
34
|
+
_defineProperty(this, "status", {
|
35
|
+
isRunning: false,
|
36
|
+
tests: {},
|
37
|
+
browsers: []
|
38
|
+
});
|
39
|
+
|
40
|
+
_defineProperty(this, "creeveyApi", null);
|
41
|
+
|
42
|
+
_defineProperty(this, "stories", {});
|
43
|
+
|
44
|
+
_defineProperty(this, "updateStatusListeners", []);
|
45
|
+
|
46
|
+
_defineProperty(this, "changeTestListeners", []);
|
47
|
+
|
48
|
+
_defineProperty(this, "initAll", async () => {
|
49
|
+
this.storybookApi.on(_coreEvents.STORY_RENDERED, this.onStoryRendered);
|
50
|
+
this.storybookApi.on(_coreEvents.SET_STORIES, this.onSetStories);
|
51
|
+
this.creeveyApi = await (0, _creeveyClientApi.initCreeveyClientApi)();
|
52
|
+
this.creeveyApi.onUpdate(this.handleCreeveyUpdate);
|
53
|
+
this.status = await this.creeveyApi.status;
|
54
|
+
});
|
55
|
+
|
56
|
+
_defineProperty(this, "handleCreeveyUpdate", update => {
|
57
|
+
const {
|
58
|
+
tests,
|
59
|
+
removedTests = [],
|
60
|
+
isRunning
|
61
|
+
} = update;
|
62
|
+
|
63
|
+
if ((0, _types.isDefined)(isRunning)) {
|
64
|
+
this.status.isRunning = isRunning;
|
65
|
+
}
|
66
|
+
|
67
|
+
if ((0, _types.isDefined)(tests)) {
|
68
|
+
const prevTests = this.status.tests;
|
69
|
+
const prevStories = this.stories || {};
|
70
|
+
Object.values(tests).filter(_types.isDefined).forEach(update => {
|
71
|
+
const {
|
72
|
+
id,
|
73
|
+
skip,
|
74
|
+
status,
|
75
|
+
results,
|
76
|
+
approved,
|
77
|
+
storyId
|
78
|
+
} = update;
|
79
|
+
const test = prevTests[id];
|
80
|
+
|
81
|
+
if (!test) {
|
82
|
+
return prevTests[id] = update;
|
83
|
+
}
|
84
|
+
|
85
|
+
if ((0, _types.isDefined)(skip)) test.skip = skip;
|
86
|
+
|
87
|
+
if ((0, _types.isDefined)(status)) {
|
88
|
+
test.status = status;
|
89
|
+
|
90
|
+
if ((0, _types.isDefined)(storyId) && (0, _types.isDefined)(prevStories[storyId])) {
|
91
|
+
const story = prevStories[storyId];
|
92
|
+
const storyStatus = this.getStoryTests(storyId);
|
93
|
+
const oldStatus = storyStatus.map(x => x.id === id ? status : x.status).reduce((oldStatus, newStatus) => (0, _helpers.calcStatus)(oldStatus, newStatus), undefined);
|
94
|
+
story.name = this.addStatusToStoryName(story.name, (0, _helpers.calcStatus)(oldStatus, status), skip || false);
|
95
|
+
}
|
96
|
+
}
|
97
|
+
|
98
|
+
if ((0, _types.isDefined)(results)) test.results ? test.results.push(...results) : test.results = results;
|
99
|
+
|
100
|
+
if ((0, _types.isDefined)(approved)) {
|
101
|
+
Object.entries(approved).forEach(_ref => {
|
102
|
+
let [image, retry] = _ref;
|
103
|
+
return retry !== undefined && test && ((test.approved = (test === null || test === void 0 ? void 0 : test.approved) || {})[image] = retry);
|
104
|
+
});
|
105
|
+
}
|
106
|
+
});
|
107
|
+
removedTests.forEach(_ref2 => {
|
108
|
+
let {
|
109
|
+
id
|
110
|
+
} = _ref2;
|
111
|
+
return delete prevTests[id];
|
112
|
+
});
|
113
|
+
this.status.tests = prevTests;
|
114
|
+
this.stories = prevStories;
|
115
|
+
this.setPanelsTitle();
|
116
|
+
void this.storybookApi.setStories(this.stories);
|
117
|
+
}
|
118
|
+
|
119
|
+
this.updateStatusListeners.forEach(x => x(update));
|
120
|
+
});
|
121
|
+
|
122
|
+
_defineProperty(this, "getCurrentTest", () => {
|
123
|
+
return this.status.tests[this.selectedTestId];
|
124
|
+
});
|
125
|
+
|
126
|
+
_defineProperty(this, "onStoryRendered", storyId => {
|
127
|
+
if (this.storyId === '') void this.addStatusesToSideBar();
|
128
|
+
|
129
|
+
if (this.storyId !== storyId) {
|
130
|
+
var _this$getTestsByStory, _this$getTestsByStory2;
|
131
|
+
|
132
|
+
this.storyId = storyId;
|
133
|
+
this.selectedTestId = (_this$getTestsByStory = (_this$getTestsByStory2 = this.getTestsByStoryIdAndBrowser(this.activeBrowser)[0]) === null || _this$getTestsByStory2 === void 0 ? void 0 : _this$getTestsByStory2.id) !== null && _this$getTestsByStory !== void 0 ? _this$getTestsByStory : '';
|
134
|
+
this.setPanelsTitle();
|
135
|
+
this.changeTestListeners.forEach(x => x(this.selectedTestId));
|
136
|
+
}
|
137
|
+
});
|
138
|
+
|
139
|
+
_defineProperty(this, "onStart", () => {
|
140
|
+
var _this$creeveyApi;
|
141
|
+
|
142
|
+
(_this$creeveyApi = this.creeveyApi) === null || _this$creeveyApi === void 0 ? void 0 : _this$creeveyApi.start([this.selectedTestId]);
|
143
|
+
});
|
144
|
+
|
145
|
+
_defineProperty(this, "onStop", () => {
|
146
|
+
var _this$creeveyApi2;
|
147
|
+
|
148
|
+
(_this$creeveyApi2 = this.creeveyApi) === null || _this$creeveyApi2 === void 0 ? void 0 : _this$creeveyApi2.stop();
|
149
|
+
});
|
150
|
+
|
151
|
+
_defineProperty(this, "onImageApprove", (id, retry, image) => {
|
152
|
+
var _this$creeveyApi3;
|
153
|
+
|
154
|
+
return (_this$creeveyApi3 = this.creeveyApi) === null || _this$creeveyApi3 === void 0 ? void 0 : _this$creeveyApi3.approve(id, retry, image);
|
155
|
+
});
|
156
|
+
|
157
|
+
_defineProperty(this, "onStartAllStoryTests", () => {
|
158
|
+
var _this$creeveyApi4;
|
159
|
+
|
160
|
+
const ids = Object.values(this.status.tests).filter(_types.isDefined).filter(x => x.storyId === this.storyId).map(x => x.id);
|
161
|
+
(_this$creeveyApi4 = this.creeveyApi) === null || _this$creeveyApi4 === void 0 ? void 0 : _this$creeveyApi4.start(ids);
|
162
|
+
});
|
163
|
+
|
164
|
+
_defineProperty(this, "onStartAllTests", () => {
|
165
|
+
var _this$creeveyApi5;
|
166
|
+
|
167
|
+
const ids = Object.values(this.status.tests).filter(_types.isDefined).map(x => x.id);
|
168
|
+
(_this$creeveyApi5 = this.creeveyApi) === null || _this$creeveyApi5 === void 0 ? void 0 : _this$creeveyApi5.start(ids);
|
169
|
+
});
|
170
|
+
|
171
|
+
_defineProperty(this, "onSetStories", data => {
|
172
|
+
const stories = data.v ? (0, _shared.denormalizeStoryParameters)(data) : data.stories;
|
173
|
+
this.stories = stories;
|
174
|
+
});
|
175
|
+
|
176
|
+
_defineProperty(this, "setActiveBrowser", browser => {
|
177
|
+
var _this$getTestsByStory3, _this$getTestsByStory4;
|
178
|
+
|
179
|
+
this.activeBrowser = browser;
|
180
|
+
this.selectedTestId = (_this$getTestsByStory3 = (_this$getTestsByStory4 = this.getTestsByStoryIdAndBrowser(this.activeBrowser)[0]) === null || _this$getTestsByStory4 === void 0 ? void 0 : _this$getTestsByStory4.id) !== null && _this$getTestsByStory3 !== void 0 ? _this$getTestsByStory3 : '';
|
181
|
+
this.changeTestListeners.forEach(x => x(this.selectedTestId));
|
182
|
+
});
|
183
|
+
|
184
|
+
_defineProperty(this, "setSelectedTestId", testId => {
|
185
|
+
this.selectedTestId = testId;
|
186
|
+
this.changeTestListeners.forEach(x => x(this.selectedTestId));
|
187
|
+
});
|
188
|
+
|
189
|
+
_defineProperty(this, "getStoryTests", storyId => {
|
190
|
+
if (!this.status || !this.status.tests) return [];
|
191
|
+
return Object.values(this.status.tests).filter(result => (result === null || result === void 0 ? void 0 : result.storyId) === storyId).filter(_types.isDefined);
|
192
|
+
});
|
193
|
+
|
194
|
+
_defineProperty(this, "getBrowsers", () => {
|
195
|
+
return this.status.browsers;
|
196
|
+
});
|
197
|
+
|
198
|
+
_defineProperty(this, "getTestsByStoryIdAndBrowser", browser => {
|
199
|
+
return Object.values(this.status.tests).filter(x => (x === null || x === void 0 ? void 0 : x.browser) === browser && x.storyId === this.storyId).filter(_types.isDefined);
|
200
|
+
});
|
201
|
+
|
202
|
+
_defineProperty(this, "getTabTitle", browser => {
|
203
|
+
const tests = this.getTestsByStoryIdAndBrowser(browser);
|
204
|
+
const browserStatus = tests.map(x => x && x.status).reduce((oldStatus, newStatus) => (0, _helpers.calcStatus)(oldStatus, newStatus), undefined);
|
205
|
+
const browserSkip = tests.length > 0 ? tests.every(x => x && x.skip) : false;
|
206
|
+
const emojiStatus = (0, _utils.getEmojiByTestStatus)(browserStatus, browserSkip);
|
207
|
+
return "".concat(emojiStatus ? "".concat(emojiStatus, " ") : '', "Creevey/").concat(browser);
|
208
|
+
});
|
209
|
+
|
210
|
+
_defineProperty(this, "setPanelsTitle", () => {
|
211
|
+
var _this$storybookApi;
|
212
|
+
|
213
|
+
const panels = (_this$storybookApi = this.storybookApi) === null || _this$storybookApi === void 0 ? void 0 : _this$storybookApi.getPanels();
|
214
|
+
if (!panels) return;
|
215
|
+
let firstPanelBrowser = this.activeBrowser;
|
216
|
+
|
217
|
+
for (const p in panels) {
|
218
|
+
var _panel$id;
|
219
|
+
|
220
|
+
const panel = panels[p];
|
221
|
+
|
222
|
+
if (((_panel$id = panel.id) === null || _panel$id === void 0 ? void 0 : _panel$id.indexOf(_register.ADDON_ID)) === 0 && panel.paramKey) {
|
223
|
+
panel.title = this.getTabTitle(panel.paramKey);
|
224
|
+
if (!firstPanelBrowser) firstPanelBrowser = panel.paramKey;
|
225
|
+
}
|
226
|
+
}
|
227
|
+
|
228
|
+
this.storybookApi.setSelectedPanel("".concat(_register.ADDON_ID, "/panel/").concat(firstPanelBrowser));
|
229
|
+
});
|
230
|
+
|
231
|
+
this.storybookApi = storybookApi;
|
232
|
+
}
|
233
|
+
|
234
|
+
onUpdateStatus(listener) {
|
235
|
+
this.updateStatusListeners.push(listener);
|
236
|
+
return () => void (this.updateStatusListeners = this.updateStatusListeners.filter(x => x != listener));
|
237
|
+
}
|
238
|
+
|
239
|
+
onChangeTest(listener) {
|
240
|
+
this.changeTestListeners.push(listener);
|
241
|
+
return () => void (this.changeTestListeners = this.changeTestListeners.filter(x => x != listener));
|
242
|
+
}
|
243
|
+
|
244
|
+
async addStatusesToSideBar() {
|
245
|
+
if (!Object.keys(this.stories).length) return;
|
246
|
+
const stories = this.stories;
|
247
|
+
Object.keys(this.stories).forEach(storyId => {
|
248
|
+
const storyStatus = this.getStoryTests(storyId);
|
249
|
+
const status = storyStatus.map(x => x.status).reduce((oldStatus, newStatus) => (0, _helpers.calcStatus)(oldStatus, newStatus), undefined);
|
250
|
+
const skip = storyStatus.length > 0 ? storyStatus.every(x => x.skip) : false;
|
251
|
+
this.stories[storyId].name = this.addStatusToStoryName(stories[storyId].name, status, skip);
|
252
|
+
});
|
253
|
+
await this.storybookApi.setStories(this.stories);
|
254
|
+
}
|
255
|
+
|
256
|
+
addStatusToStoryName(name, status, skip) {
|
257
|
+
name = name.replace(/^(❌|✔|🟡|🕗|⏸) /, '');
|
258
|
+
const emojiStatus = (0, _utils.getEmojiByTestStatus)(status, skip);
|
259
|
+
return "".concat(emojiStatus ? "".concat(emojiStatus, " ") : '', " ").concat(name);
|
260
|
+
}
|
261
|
+
|
262
|
+
}
|
263
|
+
|
264
|
+
exports.CreeveyManager = CreeveyManager;
|
@@ -0,0 +1,55 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.Addon = void 0;
|
7
|
+
|
8
|
+
var _components = require("@storybook/components");
|
9
|
+
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
11
|
+
|
12
|
+
var _Panel = require("./Panel");
|
13
|
+
|
14
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
15
|
+
|
16
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
17
|
+
|
18
|
+
const Addon = _ref => {
|
19
|
+
let {
|
20
|
+
active,
|
21
|
+
browser,
|
22
|
+
manager
|
23
|
+
} = _ref;
|
24
|
+
const [tests, setTests] = (0, _react.useState)([]);
|
25
|
+
const [selectedTestId, setSelectedTestId] = (0, _react.useState)(manager.selectedTestId);
|
26
|
+
(0, _react.useEffect)(() => {
|
27
|
+
if (active) {
|
28
|
+
manager.setActiveBrowser(browser);
|
29
|
+
const browserTests = manager.getTestsByStoryIdAndBrowser(manager.activeBrowser);
|
30
|
+
setTests(browserTests);
|
31
|
+
}
|
32
|
+
}, [active, browser, manager]);
|
33
|
+
(0, _react.useEffect)(() => {
|
34
|
+
const unsubscribe = manager.onChangeTest(testId => {
|
35
|
+
setSelectedTestId(testId);
|
36
|
+
const status = manager.getTestsByStoryIdAndBrowser(manager.activeBrowser);
|
37
|
+
setTests(status);
|
38
|
+
});
|
39
|
+
return unsubscribe;
|
40
|
+
}, [manager]);
|
41
|
+
(0, _react.useEffect)(() => {
|
42
|
+
const unsubscribe = manager.onUpdateStatus(() => {
|
43
|
+
setTests(manager.getTestsByStoryIdAndBrowser(manager.activeBrowser));
|
44
|
+
});
|
45
|
+
return unsubscribe;
|
46
|
+
}, [manager, browser]);
|
47
|
+
return active ? tests.length ? /*#__PURE__*/_react.default.createElement(_Panel.Panel, {
|
48
|
+
tests: tests,
|
49
|
+
selectedTestId: selectedTestId,
|
50
|
+
onChangeTest: manager.setSelectedTestId,
|
51
|
+
onImageApprove: manager.onImageApprove
|
52
|
+
}) : /*#__PURE__*/_react.default.createElement(_components.Placeholder, null, "No test results") : null;
|
53
|
+
};
|
54
|
+
|
55
|
+
exports.Addon = Addon;
|
@@ -0,0 +1,46 @@
|
|
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
|
+
const NextIcon = _ref => {
|
13
|
+
let {
|
14
|
+
width,
|
15
|
+
height
|
16
|
+
} = _ref;
|
17
|
+
return /*#__PURE__*/_react.default.createElement("svg", {
|
18
|
+
version: "1.1",
|
19
|
+
width: width,
|
20
|
+
height: height,
|
21
|
+
viewBox: "0 0 306 306"
|
22
|
+
}, /*#__PURE__*/_react.default.createElement("path", {
|
23
|
+
d: "M0,306l216.75-153L0,0V306z M255,0v306h51V0H255z",
|
24
|
+
fill: "currentColor"
|
25
|
+
}));
|
26
|
+
};
|
27
|
+
|
28
|
+
exports.NextIcon = NextIcon;
|
29
|
+
|
30
|
+
const ForwardIcon = _ref2 => {
|
31
|
+
let {
|
32
|
+
width,
|
33
|
+
height
|
34
|
+
} = _ref2;
|
35
|
+
return /*#__PURE__*/_react.default.createElement("svg", {
|
36
|
+
version: "1.1",
|
37
|
+
width: width,
|
38
|
+
height: height,
|
39
|
+
viewBox: "0 0 512 512"
|
40
|
+
}, /*#__PURE__*/_react.default.createElement("path", {
|
41
|
+
fill: "currentColor",
|
42
|
+
d: "M460.9,246.8l-209-164.2c-7.8-6.1-19.2-0.6-19.2,9.2v328.4c0,9.8,11.4,15.3,19.2,9.2l209-164.2c5.1-4,6-11.4,2-16.5 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"
|
43
|
+
}));
|
44
|
+
};
|
45
|
+
|
46
|
+
exports.ForwardIcon = ForwardIcon;
|
@@ -0,0 +1,72 @@
|
|
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
|
+
const Wrapper = _theming.styled.div(_ref => {
|
23
|
+
let {
|
24
|
+
isRunning
|
25
|
+
} = _ref;
|
26
|
+
return {
|
27
|
+
opacity: isRunning ? 0.5 : 1,
|
28
|
+
height: '100%'
|
29
|
+
};
|
30
|
+
});
|
31
|
+
|
32
|
+
const TestSelectContainer = _theming.styled.div(_ref2 => {
|
33
|
+
let {
|
34
|
+
theme
|
35
|
+
} = _ref2;
|
36
|
+
return {
|
37
|
+
padding: '8px',
|
38
|
+
border: "1px solid ".concat(theme.appBorderColor)
|
39
|
+
};
|
40
|
+
});
|
41
|
+
|
42
|
+
const Panel = _ref3 => {
|
43
|
+
var _result$results, _result$results$lengt, _result$results2;
|
44
|
+
|
45
|
+
let {
|
46
|
+
tests,
|
47
|
+
selectedTestId,
|
48
|
+
onChangeTest,
|
49
|
+
onImageApprove
|
50
|
+
} = _ref3;
|
51
|
+
const result = tests.find(x => x.id === selectedTestId);
|
52
|
+
const isRunning = (result === null || result === void 0 ? void 0 : result.status) === 'running';
|
53
|
+
return /*#__PURE__*/_react.default.createElement("div", null, tests.length > 1 && /*#__PURE__*/_react.default.createElement(TestSelectContainer, null, /*#__PURE__*/_react.default.createElement(_TestSelect.default, {
|
54
|
+
tests: tests,
|
55
|
+
selectedTestId: selectedTestId,
|
56
|
+
onChangeTest: onChangeTest
|
57
|
+
})), 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, {
|
58
|
+
isRunning: isRunning
|
59
|
+
}, /*#__PURE__*/_react.default.createElement(_ResultsPage.ResultsPage, {
|
60
|
+
height: '100%',
|
61
|
+
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
|
62
|
+
,
|
63
|
+
id: result.id,
|
64
|
+
path: (0, _helpers.getTestPath)(result) // TODO Memo?
|
65
|
+
,
|
66
|
+
results: result.results,
|
67
|
+
approved: result.approved,
|
68
|
+
onImageApprove: onImageApprove
|
69
|
+
})) : null);
|
70
|
+
};
|
71
|
+
|
72
|
+
exports.Panel = Panel;
|