creevey 0.10.0-beta.4 → 0.10.0-beta.40
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/README.md +19 -41
- package/dist/client/addon/components/Addon.js +17 -7
- package/dist/client/addon/components/Addon.js.map +1 -1
- package/dist/client/addon/components/Panel.js +2 -2
- package/dist/client/addon/components/Panel.js.map +1 -1
- package/dist/client/addon/components/Tools.js +17 -7
- package/dist/client/addon/components/Tools.js.map +1 -1
- package/dist/client/addon/withCreevey.d.ts +2 -1
- package/dist/client/addon/withCreevey.js +11 -1
- package/dist/client/addon/withCreevey.js.map +1 -1
- package/dist/client/shared/components/ImagesView/BlendView.d.ts +1 -1
- package/dist/client/shared/components/ImagesView/BlendView.js +17 -7
- package/dist/client/shared/components/ImagesView/BlendView.js.map +1 -1
- package/dist/client/shared/components/ImagesView/SideBySideView.d.ts +1 -1
- package/dist/client/shared/components/ImagesView/SideBySideView.js +17 -7
- package/dist/client/shared/components/ImagesView/SideBySideView.js.map +1 -1
- package/dist/client/shared/components/ImagesView/SlideView.d.ts +1 -1
- package/dist/client/shared/components/ImagesView/SlideView.js +17 -7
- package/dist/client/shared/components/ImagesView/SlideView.js.map +1 -1
- package/dist/client/shared/components/ImagesView/SwapView.d.ts +1 -1
- package/dist/client/shared/components/ImagesView/SwapView.js +29 -7
- package/dist/client/shared/components/ImagesView/SwapView.js.map +1 -1
- package/dist/client/shared/components/PageHeader/ImagePreview.d.ts +1 -1
- package/dist/client/shared/components/PageHeader/ImagePreview.js +1 -0
- package/dist/client/shared/components/PageHeader/ImagePreview.js.map +1 -1
- package/dist/client/shared/components/PageHeader/PageHeader.js +20 -8
- package/dist/client/shared/components/PageHeader/PageHeader.js.map +1 -1
- package/dist/client/shared/components/ResultsPage.d.ts +1 -1
- package/dist/client/shared/components/ResultsPage.js +43 -13
- package/dist/client/shared/components/ResultsPage.js.map +1 -1
- package/dist/client/shared/creeveyClientApi.js +8 -1
- package/dist/client/shared/creeveyClientApi.js.map +1 -1
- package/dist/client/shared/helpers.d.ts +1 -3
- package/dist/client/shared/helpers.js +4 -19
- package/dist/client/shared/helpers.js.map +1 -1
- package/dist/client/web/CreeveyApp.js +42 -14
- package/dist/client/web/CreeveyApp.js.map +1 -1
- package/dist/client/web/CreeveyContext.d.ts +5 -0
- package/dist/client/web/CreeveyContext.js +20 -7
- package/dist/client/web/CreeveyContext.js.map +1 -1
- package/dist/client/web/CreeveyLoader.js +2 -2
- package/dist/client/web/CreeveyLoader.js.map +1 -1
- package/dist/client/web/CreeveyView/SideBar/Search.js +19 -9
- package/dist/client/web/CreeveyView/SideBar/Search.js.map +1 -1
- package/dist/client/web/CreeveyView/SideBar/SideBar.js +18 -7
- package/dist/client/web/CreeveyView/SideBar/SideBar.js.map +1 -1
- package/dist/client/web/CreeveyView/SideBar/SideBarFooter.js +60 -7
- package/dist/client/web/CreeveyView/SideBar/SideBarFooter.js.map +1 -1
- package/dist/client/web/CreeveyView/SideBar/SideBarHeader.js +17 -7
- package/dist/client/web/CreeveyView/SideBar/SideBarHeader.js.map +1 -1
- package/dist/client/web/CreeveyView/SideBar/SuiteLink.d.ts +2 -2
- package/dist/client/web/CreeveyView/SideBar/SuiteLink.js +18 -10
- package/dist/client/web/CreeveyView/SideBar/SuiteLink.js.map +1 -1
- package/dist/client/web/CreeveyView/SideBar/TestLink.js +18 -10
- package/dist/client/web/CreeveyView/SideBar/TestLink.js.map +1 -1
- package/dist/client/web/CreeveyView/SideBar/TestStatusIcon.d.ts +1 -1
- package/dist/client/web/CreeveyView/SideBar/TestsStatus.d.ts +1 -1
- package/dist/client/web/KeyboardEventsContext.d.ts +1 -8
- package/dist/client/web/KeyboardEventsContext.js +79 -64
- package/dist/client/web/KeyboardEventsContext.js.map +1 -1
- package/dist/client/web/assets/index-B0Xv0lOY.js +802 -0
- package/dist/client/web/index.html +1 -1
- package/dist/client/web/index.js +17 -7
- package/dist/client/web/index.js.map +1 -1
- package/dist/client/web/themes.d.ts +2 -0
- package/dist/client/web/themes.js +22 -0
- package/dist/client/web/themes.js.map +1 -0
- package/dist/creevey.js +16 -9
- package/dist/creevey.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/server/config.d.ts +1 -1
- package/dist/server/config.js +27 -5
- package/dist/server/config.js.map +1 -1
- package/dist/server/connection.d.ts +3 -0
- package/dist/server/connection.js +28 -0
- package/dist/server/connection.js.map +1 -0
- package/dist/server/docker.d.ts +1 -1
- package/dist/server/docker.js +56 -32
- package/dist/server/docker.js.map +1 -1
- package/dist/server/index.js +64 -11
- package/dist/server/index.js.map +1 -1
- package/dist/server/logger.d.ts +2 -1
- package/dist/server/logger.js +7 -3
- package/dist/server/logger.js.map +1 -1
- package/dist/server/master/api.js +1 -1
- package/dist/server/master/api.js.map +1 -1
- package/dist/server/master/pool.d.ts +4 -3
- package/dist/server/master/pool.js +13 -66
- package/dist/server/master/pool.js.map +1 -1
- package/dist/server/master/queue.d.ts +13 -0
- package/dist/server/master/queue.js +71 -0
- package/dist/server/master/queue.js.map +1 -0
- package/dist/server/master/runner.d.ts +3 -0
- package/dist/server/master/runner.js +76 -10
- package/dist/server/master/runner.js.map +1 -1
- package/dist/server/master/server.js +1 -1
- package/dist/server/master/server.js.map +1 -1
- package/dist/server/master/start.js +13 -11
- package/dist/server/master/start.js.map +1 -1
- package/dist/server/playwright/docker-file.d.ts +1 -1
- package/dist/server/playwright/docker-file.js +15 -6
- package/dist/server/playwright/docker-file.js.map +1 -1
- package/dist/server/playwright/docker.d.ts +2 -1
- package/dist/server/playwright/docker.js +10 -2
- package/dist/server/playwright/docker.js.map +1 -1
- package/dist/server/playwright/index-source.mjs +16 -0
- package/dist/server/playwright/internal.d.ts +6 -6
- package/dist/server/playwright/internal.js +143 -91
- package/dist/server/playwright/internal.js.map +1 -1
- package/dist/server/playwright/webdriver.d.ts +1 -1
- package/dist/server/playwright/webdriver.js +5 -8
- package/dist/server/playwright/webdriver.js.map +1 -1
- package/dist/server/providers/browser.js +6 -4
- package/dist/server/providers/browser.js.map +1 -1
- package/dist/server/providers/hybrid.js +1 -1
- package/dist/server/providers/hybrid.js.map +1 -1
- package/dist/server/reporter.d.ts +4 -19
- package/dist/server/reporter.js +30 -21
- package/dist/server/reporter.js.map +1 -1
- package/dist/server/selenium/internal.d.ts +3 -4
- package/dist/server/selenium/internal.js +127 -108
- package/dist/server/selenium/internal.js.map +1 -1
- package/dist/server/selenium/selenoid.js +8 -6
- package/dist/server/selenium/selenoid.js.map +1 -1
- package/dist/server/selenium/webdriver.d.ts +1 -1
- package/dist/server/selenium/webdriver.js +5 -9
- package/dist/server/selenium/webdriver.js.map +1 -1
- package/dist/server/telemetry.js +2 -2
- package/dist/server/testsFiles/parser.js +45 -5
- package/dist/server/testsFiles/parser.js.map +1 -1
- package/dist/server/utils.d.ts +19 -1
- package/dist/server/utils.js +87 -8
- package/dist/server/utils.js.map +1 -1
- package/dist/server/webdriver.d.ts +5 -4
- package/dist/server/webdriver.js +23 -10
- package/dist/server/webdriver.js.map +1 -1
- package/dist/server/worker/chai-image.d.ts +1 -2
- package/dist/server/worker/chai-image.js +4 -3
- package/dist/server/worker/chai-image.js.map +1 -1
- package/dist/server/worker/context.d.ts +3 -0
- package/dist/server/worker/context.js +15 -0
- package/dist/server/worker/context.js.map +1 -0
- package/dist/server/worker/match-image.d.ts +4 -4
- package/dist/server/worker/match-image.js +7 -4
- package/dist/server/worker/match-image.js.map +1 -1
- package/dist/server/worker/start.js +45 -73
- package/dist/server/worker/start.js.map +1 -1
- package/dist/shared/index.d.ts +1 -1
- package/dist/types.d.ts +40 -8
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -1
- package/docs/cli.md +12 -0
- package/docs/config.md +179 -165
- package/docs/storybook.md +60 -0
- package/docs/tests.md +50 -45
- package/package.json +64 -63
- package/src/client/addon/components/Panel.tsx +2 -2
- package/src/client/addon/withCreevey.ts +10 -2
- package/src/client/shared/components/ImagesView/SwapView.tsx +18 -0
- package/src/client/shared/components/PageHeader/ImagePreview.tsx +1 -0
- package/src/client/shared/components/PageHeader/PageHeader.tsx +4 -2
- package/src/client/shared/components/ResultsPage.tsx +31 -8
- package/src/client/shared/creeveyClientApi.ts +9 -1
- package/src/client/shared/helpers.ts +4 -24
- package/src/client/web/CreeveyApp.tsx +27 -8
- package/src/client/web/CreeveyContext.tsx +9 -0
- package/src/client/web/CreeveyLoader.tsx +1 -1
- package/src/client/web/CreeveyView/SideBar/Search.tsx +3 -3
- package/src/client/web/CreeveyView/SideBar/SideBar.tsx +1 -0
- package/src/client/web/CreeveyView/SideBar/SideBarFooter.tsx +37 -6
- package/src/client/web/CreeveyView/SideBar/SuiteLink.tsx +3 -5
- package/src/client/web/CreeveyView/SideBar/TestLink.tsx +2 -4
- package/src/client/web/KeyboardEventsContext.tsx +61 -73
- package/src/client/web/themes.ts +24 -0
- package/src/creevey.ts +16 -10
- package/src/server/config.ts +28 -6
- package/src/server/connection.ts +26 -0
- package/src/server/docker.ts +63 -34
- package/src/server/index.ts +72 -14
- package/src/server/logger.ts +6 -2
- package/src/server/master/api.ts +1 -1
- package/src/server/master/pool.ts +23 -59
- package/src/server/master/queue.ts +77 -0
- package/src/server/master/runner.ts +94 -10
- package/src/server/master/server.ts +1 -1
- package/src/server/master/start.ts +16 -11
- package/src/server/playwright/docker-file.ts +18 -6
- package/src/server/playwright/docker.ts +16 -3
- package/src/server/playwright/index-source.mjs +16 -0
- package/src/server/playwright/internal.ts +182 -111
- package/src/server/playwright/webdriver.ts +6 -9
- package/src/server/providers/browser.ts +6 -4
- package/src/server/providers/hybrid.ts +1 -1
- package/src/server/reporter.ts +37 -34
- package/src/server/selenium/internal.ts +131 -116
- package/src/server/selenium/selenoid.ts +8 -6
- package/src/server/selenium/webdriver.ts +6 -10
- package/src/server/telemetry.ts +2 -2
- package/src/server/testsFiles/parser.ts +52 -4
- package/src/server/utils.ts +97 -9
- package/src/server/webdriver.ts +24 -16
- package/src/server/worker/chai-image.ts +4 -4
- package/src/server/worker/context.ts +14 -0
- package/src/server/worker/match-image.ts +12 -8
- package/src/server/worker/start.ts +49 -86
- package/src/shared/index.ts +1 -1
- package/src/types.ts +44 -8
- package/types/global.d.ts +1 -0
- package/.yarnrc.yml +0 -1
- package/chromatic.config.json +0 -5
- package/dist/client/web/assets/index-DkmZfG9C.js +0 -591
package/dist/types.d.ts
CHANGED
@@ -1,11 +1,10 @@
|
|
1
|
-
import type { StoryContextForEnhancers, DecoratorFunction } from '@storybook/
|
1
|
+
import type { StoryContextForEnhancers, DecoratorFunction } from '@storybook/types';
|
2
2
|
import type { Worker as ClusterWorker } from 'cluster';
|
3
3
|
import type Pixelmatch from 'pixelmatch';
|
4
4
|
import type { ODiffOptions } from 'odiff-bin';
|
5
5
|
import type { expect } from 'chai';
|
6
6
|
import type EventEmitter from 'events';
|
7
|
-
import type
|
8
|
-
import { LaunchOptions } from 'playwright-core';
|
7
|
+
import type { LaunchOptions } from 'playwright-core';
|
9
8
|
export type DiffOptions = typeof Pixelmatch extends (x1: any, x2: any, x3: any, x4: any, x5: any, options?: infer T) => void ? T : never;
|
10
9
|
export interface SetStoriesData {
|
11
10
|
v?: number;
|
@@ -115,7 +114,13 @@ export interface BrowserConfigObject {
|
|
115
114
|
platformName?: string;
|
116
115
|
[name: string]: unknown;
|
117
116
|
};
|
118
|
-
playwrightOptions?: Omit<LaunchOptions, 'logger'
|
117
|
+
playwrightOptions?: Omit<LaunchOptions, 'logger'> & {
|
118
|
+
trace?: {
|
119
|
+
screenshots?: boolean;
|
120
|
+
snapshots?: boolean;
|
121
|
+
sources?: boolean;
|
122
|
+
};
|
123
|
+
};
|
119
124
|
}
|
120
125
|
export type StorybookGlobals = Record<string, unknown>;
|
121
126
|
export type BrowserConfig = boolean | string | BrowserConfigObject;
|
@@ -125,7 +130,7 @@ export interface CreeveyWebdriver {
|
|
125
130
|
openBrowser(fresh?: boolean): Promise<CreeveyWebdriver | null>;
|
126
131
|
closeBrowser(): Promise<void>;
|
127
132
|
loadStoriesFromBrowser(): Promise<StoriesRaw>;
|
128
|
-
switchStory(story: StoryInput, context: BaseCreeveyTestContext
|
133
|
+
switchStory(story: StoryInput, context: BaseCreeveyTestContext): Promise<CreeveyTestContext>;
|
129
134
|
afterTest(test: ServerTest): Promise<void>;
|
130
135
|
}
|
131
136
|
export interface HookConfig {
|
@@ -158,6 +163,11 @@ export interface Config {
|
|
158
163
|
* Url where storybook hosted on
|
159
164
|
*/
|
160
165
|
resolveStorybookUrl?: () => Promise<string>;
|
166
|
+
/**
|
167
|
+
* Command to automatically start Storybook if it is not running.
|
168
|
+
* For example, `npm run storybook`, `yarn run storybook` etc.
|
169
|
+
*/
|
170
|
+
storybookAutorunCmd?: string;
|
161
171
|
/**
|
162
172
|
* Absolute path to directory with reference images
|
163
173
|
* @default path.join(process.cwd(), './images')
|
@@ -264,6 +274,11 @@ export interface Config {
|
|
264
274
|
* The `--ui` CLI option ignores this option
|
265
275
|
*/
|
266
276
|
failFast: boolean;
|
277
|
+
/**
|
278
|
+
* Start workers in sequential queue
|
279
|
+
* @default false
|
280
|
+
*/
|
281
|
+
useWorkerQueue: boolean;
|
267
282
|
/**
|
268
283
|
* Specify platform for docker images
|
269
284
|
*/
|
@@ -298,9 +313,13 @@ export interface Options {
|
|
298
313
|
screenDir?: string;
|
299
314
|
reportDir?: string;
|
300
315
|
gridUrl?: string;
|
316
|
+
storybookStart?: boolean | string;
|
301
317
|
storybookUrl?: string;
|
318
|
+
storybookPort?: string;
|
319
|
+
storybookAutorunCmd?: string;
|
302
320
|
failFast?: boolean;
|
303
321
|
odiff?: boolean;
|
322
|
+
noDocker?: boolean;
|
304
323
|
}
|
305
324
|
export type WorkerError = 'browser' | 'test' | 'unknown';
|
306
325
|
export type WorkerMessage = {
|
@@ -372,8 +391,12 @@ export interface Images {
|
|
372
391
|
export type TestStatus = 'unknown' | 'pending' | 'running' | 'failed' | 'approved' | 'success' | 'retrying';
|
373
392
|
export interface TestResult {
|
374
393
|
status: 'failed' | 'success';
|
394
|
+
retries: number;
|
375
395
|
images?: Partial<Record<string, Images>>;
|
376
396
|
error?: string;
|
397
|
+
duration?: number;
|
398
|
+
attachments?: string[];
|
399
|
+
sessionId?: string;
|
377
400
|
}
|
378
401
|
export declare class ImagesError extends Error {
|
379
402
|
images?: string | Partial<Record<string, string>>;
|
@@ -406,8 +429,8 @@ export interface BaseCreeveyTestContext {
|
|
406
429
|
imageName?: string;
|
407
430
|
screenshot: Buffer;
|
408
431
|
}[];
|
409
|
-
matchImage: (image: Buffer, imageName?: string) => Promise<void>;
|
410
|
-
matchImages: (images: Record<string, Buffer>) => Promise<void>;
|
432
|
+
matchImage: (image: Buffer | string, imageName?: string) => Promise<void>;
|
433
|
+
matchImages: (images: Record<string, Buffer | string>) => Promise<void>;
|
411
434
|
}
|
412
435
|
export interface CreeveyTestContext extends BaseCreeveyTestContext {
|
413
436
|
takeScreenshot: () => Promise<Buffer>;
|
@@ -417,6 +440,8 @@ export interface CreeveyTestContext extends BaseCreeveyTestContext {
|
|
417
440
|
export declare enum TEST_EVENTS {
|
418
441
|
RUN_BEGIN = "start",
|
419
442
|
RUN_END = "end",
|
443
|
+
SUITE_BEGIN = "suite",
|
444
|
+
SUITE_END = "suite end",
|
420
445
|
TEST_BEGIN = "test",
|
421
446
|
TEST_END = "test end",
|
422
447
|
TEST_FAIL = "fail",
|
@@ -437,7 +462,7 @@ export interface FakeTest {
|
|
437
462
|
title: string;
|
438
463
|
fullTitle: () => string;
|
439
464
|
titlePath: () => string[];
|
440
|
-
currentRetry: () => number;
|
465
|
+
currentRetry: () => number | undefined;
|
441
466
|
retires: () => number;
|
442
467
|
slow: () => number;
|
443
468
|
duration?: number;
|
@@ -445,6 +470,13 @@ export interface FakeTest {
|
|
445
470
|
speed?: 'slow' | 'medium' | 'fast';
|
446
471
|
err?: unknown;
|
447
472
|
attachments?: string[];
|
473
|
+
creevey: {
|
474
|
+
reportDir: string;
|
475
|
+
sessionId: string;
|
476
|
+
browserName: string;
|
477
|
+
willRetry: boolean;
|
478
|
+
images: Partial<Record<string, Partial<Images>>>;
|
479
|
+
};
|
448
480
|
}
|
449
481
|
export interface CreeveyStatus {
|
450
482
|
isRunning: boolean;
|
package/dist/types.js
CHANGED
@@ -32,6 +32,8 @@ var TEST_EVENTS;
|
|
32
32
|
(function (TEST_EVENTS) {
|
33
33
|
TEST_EVENTS["RUN_BEGIN"] = "start";
|
34
34
|
TEST_EVENTS["RUN_END"] = "end";
|
35
|
+
TEST_EVENTS["SUITE_BEGIN"] = "suite";
|
36
|
+
TEST_EVENTS["SUITE_END"] = "suite end";
|
35
37
|
TEST_EVENTS["TEST_BEGIN"] = "test";
|
36
38
|
TEST_EVENTS["TEST_END"] = "test end";
|
37
39
|
TEST_EVENTS["TEST_FAIL"] = "fail";
|
package/dist/types.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAolBA,oBAEC;AAED,8BAEC;AAED,wBASC;AAED,4BAEC;AAED,4BAEC;AAGD,gCAEC;AAED,oCAEC;AAED,4CAEC;AAED,0CAEC;AAED,4CAEC;AAED,sCAEC;AA3lBD,IAAY,eAUX;AAVD,WAAY,eAAe;IACzB,6CAA0B,CAAA;IAC1B,wDAAqC,CAAA;IACrC,iDAA8B,CAAA;IAC9B,mDAAgC,CAAA;IAChC,iDAA8B,CAAA;IAC9B,gEAA6C,CAAA;IAC7C,wDAAqC,CAAA;IACrC,6CAA0B,CAAA;IAC1B,mDAAgC,CAAA;AAClC,CAAC,EAVW,eAAe,+BAAf,eAAe,QAU1B;AA2XD,MAAa,WAAY,SAAQ,KAAK;IACpC,MAAM,CAA4C;CACnD;AAFD,kCAEC;AAwCD,IAAY,WASX;AATD,WAAY,WAAW;IACrB,kCAAmB,CAAA;IACnB,8BAAe,CAAA;IACf,oCAAqB,CAAA;IACrB,sCAAuB,CAAA;IACvB,kCAAmB,CAAA;IACnB,oCAAqB,CAAA;IACrB,iCAAkB,CAAA;IAClB,iCAAkB,CAAA;AACpB,CAAC,EATW,WAAW,2BAAX,WAAW,QAStB;AAiHD,SAAgB,IAAI;IAClB,UAAU;AACZ,CAAC;AAED,SAAgB,SAAS,CAAI,KAA2B;IACtD,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC;AAC/C,CAAC;AAED,SAAgB,MAAM,CAAC,CAA8B;IACnD,OAAO,CACL,SAAS,CAAC,CAAC,CAAC;QACZ,QAAQ,CAAC,CAAC,CAAC;QACX,IAAI,IAAI,CAAC;QACT,SAAS,IAAI,CAAC;QACd,OAAO,CAAC,CAAC,EAAE,IAAI,QAAQ;QACvB,OAAO,CAAC,CAAC,OAAO,IAAI,QAAQ,CAC7B,CAAC;AACJ,CAAC;AAED,SAAgB,QAAQ,CAAC,CAAU;IACjC,OAAO,OAAO,CAAC,IAAI,QAAQ,IAAI,CAAC,IAAI,IAAI,CAAC;AAC3C,CAAC;AAED,SAAgB,QAAQ,CAAC,CAAU;IACjC,OAAO,OAAO,CAAC,IAAI,QAAQ,CAAC;AAC9B,CAAC;AAED,8DAA8D;AAC9D,SAAgB,UAAU,CAAC,CAAU;IACnC,OAAO,OAAO,CAAC,IAAI,UAAU,CAAC;AAChC,CAAC;AAED,SAAgB,YAAY,CAAC,KAAc;IACzC,OAAO,KAAK,YAAY,WAAW,IAAI,QAAQ,IAAI,KAAK,CAAC;AAC3D,CAAC;AAED,SAAgB,gBAAgB,CAAC,OAAgB;IAC/C,OAAO,QAAQ,CAAC,OAAO,CAAC,IAAI,OAAO,IAAI,OAAO,CAAC;AACjD,CAAC;AAED,SAAgB,eAAe,CAAC,OAAgB;IAC9C,OAAO,gBAAgB,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,KAAK,IAAI,QAAQ,CAAC;AAChE,CAAC;AAED,SAAgB,gBAAgB,CAAC,OAAgB;IAC/C,OAAO,gBAAgB,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,KAAK,IAAI,SAAS,CAAC;AACjE,CAAC;AAED,SAAgB,aAAa,CAAC,OAAgB;IAC5C,OAAO,gBAAgB,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,KAAK,IAAI,MAAM,CAAC;AAC9D,CAAC"}
|
package/docs/cli.md
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
## Creevey CLI Options
|
2
|
+
|
3
|
+
There are several options available for the Creevey CLI:
|
4
|
+
|
5
|
+
- `--ui` — Starts Creevey UI Runner, which allows to run tests individually, compare screenshots and approve them without hesitation
|
6
|
+
- `-s, --storybookStart` — Starts Storybook for you by using `storybook dev` command
|
7
|
+
- `-c, --config` — Specify path to the config file. Default `.creevey/config.ts` or `creevey.config.ts`
|
8
|
+
- `-p, --port` — Specify port in which UI Runner should be started. Default `3000`
|
9
|
+
- `-d, --debug` — Enable debug output. It also enables recording video and traces if Playwright is used
|
10
|
+
- `-u, --update` — Approve all images from `report` directory. But it's recommended to do it from the UI Runner
|
11
|
+
- `--reportDir` — Path where reports will be stored
|
12
|
+
- `--screenDir` — Path where reference images are located
|
package/docs/config.md
CHANGED
@@ -1,212 +1,226 @@
|
|
1
|
-
|
1
|
+
# Creevey Configuration Examples
|
2
2
|
|
3
|
-
|
3
|
+
Creevey is highly configurable and can be tailored to your specific needs. Here are some examples of how to configure Creevey for your Storybook.
|
4
4
|
|
5
|
-
|
6
|
-
- `--ui` — Start runner web server
|
7
|
-
- `--update` — Approve all images from `report` directory
|
8
|
-
- `--port` — Specify port for web server. Default `3000`
|
9
|
-
- `--reportDir` — Path where reports will be stored
|
10
|
-
- `--screenDir` — Path where reference images are located
|
11
|
-
- `--debug` — Enable debug output
|
5
|
+
## Zero Configuration
|
12
6
|
|
13
|
-
|
7
|
+
The simplest way to get started with Creevey, just run it without any configuration:
|
14
8
|
|
15
|
-
|
9
|
+
```bash
|
10
|
+
yarn creevey -s
|
11
|
+
```
|
12
|
+
|
13
|
+
This will start Creevey with default settings, using Chrome as the browser and also start Storybook hosted at `http://localhost:6006`. Adding `--ui` flag will start the web server for the UI Runner.
|
14
|
+
|
15
|
+
**NOTE** By default, Creevey uses Selenium WebDriver, but it's done for backward compatibility and it's recommended to define webdriver explicitly in the configuration.
|
16
16
|
|
17
17
|
```ts
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
},
|
18
|
+
// creevey.config.ts
|
19
|
+
import { SeleniumWebdriver } from 'creevey/selenium';
|
20
|
+
|
21
|
+
const config = {
|
22
|
+
webdriver: SeleniumWebdriver,
|
23
|
+
};
|
24
|
+
|
25
|
+
// or use Playwright instead
|
26
|
+
|
27
|
+
import { PlaywrightWebdriver } from 'creevey/playwright';
|
28
|
+
|
29
|
+
const config = {
|
30
|
+
webdriver: PlaywrightWebdriver,
|
32
31
|
};
|
33
32
|
```
|
34
33
|
|
35
|
-
|
34
|
+
## Basic Configuration
|
36
35
|
|
37
|
-
|
36
|
+
The minimal configuration to test your stories might be:
|
38
37
|
|
39
38
|
```ts
|
40
|
-
|
39
|
+
// creevey.config.ts
|
40
|
+
import { CreeveyConfig } from 'creevey';
|
41
|
+
import { PlaywrightWebdriver } from 'creevey/playwright';
|
42
|
+
|
43
|
+
const config: CreeveyConfig = {
|
44
|
+
webdriver: PlaywrightWebdriver,
|
41
45
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
+
// The URL where your Storybook is hosted
|
47
|
+
storybookUrl: 'http://localhost:9000',
|
48
|
+
|
49
|
+
// Define which browsers to use for testing
|
50
|
+
browsers: {
|
51
|
+
chromium: {
|
52
|
+
// The browser type name which will be used by Playwright
|
53
|
+
browserName: 'chromium',
|
54
|
+
// Default viewport dimensions
|
55
|
+
viewport: { width: 1024, height: 768 },
|
56
|
+
// Limit of retries for failed tests
|
57
|
+
maxRetries: 2,
|
58
|
+
},
|
59
|
+
},
|
60
|
+
};
|
46
61
|
|
47
|
-
|
48
|
-
|
62
|
+
export default config;
|
63
|
+
```
|
49
64
|
|
50
|
-
|
51
|
-
screenDir: path.join(__dirname, '../images'),
|
65
|
+
## Multiple Browsers Configuration
|
52
66
|
|
53
|
-
|
54
|
-
reportDir: path.join(__dirname, '../report'),
|
67
|
+
It's possible to est your stories across different browsers:
|
55
68
|
|
56
|
-
|
57
|
-
|
69
|
+
```ts
|
70
|
+
// creevey.config.ts
|
71
|
+
import { CreeveyConfig } from 'creevey';
|
72
|
+
import { PlaywrightWebdriver } from 'creevey/playwright';
|
58
73
|
|
59
|
-
|
60
|
-
|
74
|
+
const config: CreeveyConfig = {
|
75
|
+
webdriver: PlaywrightWebdriver,
|
61
76
|
|
62
|
-
// Describe browsers and their options
|
63
77
|
browsers: {
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
otherChrome: {
|
69
|
-
browserName: 'chrome',
|
70
|
-
// Define initial viewport size
|
71
|
-
viewport: { width: 1024, height: 720 },
|
72
|
-
// Increase parallel sessions
|
78
|
+
chromium: {
|
79
|
+
browserName: 'chromium',
|
80
|
+
// Amount of parallel browser sessions
|
73
81
|
limit: 2,
|
74
|
-
/* Also you can define any browser capabilities here */
|
75
|
-
version: '86.0',
|
76
|
-
// It's possible to set Storybook's globals
|
77
|
-
// https://github.com/storybookjs/storybook/blob/v6.0.0/docs/essentials/toolbars-and-globals.md
|
78
|
-
// NOTE: This is an experimental feature and will be replaced in future
|
79
|
-
_storybookGlobals: {
|
80
|
-
myTheme: 'dark',
|
81
|
-
},
|
82
82
|
},
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
browserName: 'internet explorer',
|
87
|
-
// Like user another Selenium Grid url
|
88
|
-
gridUrl: '<anotherGridUrl>/wd/hub',
|
89
|
-
// Or use different storybook instance
|
90
|
-
storybookUrl: 'http://mystoryhost:6007',
|
91
|
-
// And use you own docker image
|
92
|
-
// By default Creevey will use selenoid image according browser name and version:
|
93
|
-
// `selenoid/${browserName}:${version ?? 'latest'}` image
|
94
|
-
dockerImage: 'microsoft/ie:11.0',
|
83
|
+
firefox: {
|
84
|
+
browserName: 'firefox',
|
85
|
+
limit: 2,
|
95
86
|
},
|
96
87
|
},
|
88
|
+
};
|
89
|
+
|
90
|
+
export default config;
|
91
|
+
```
|
92
|
+
|
93
|
+
## Test stories with different themes
|
94
|
+
|
95
|
+
Test your components with different themes:
|
97
96
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
97
|
+
```ts
|
98
|
+
// creevey.config.ts
|
99
|
+
import { CreeveyConfig } from 'creevey';
|
100
|
+
import { PlaywrightWebdriver } from 'creevey/playwright';
|
101
|
+
|
102
|
+
const config: CreeveyConfig = {
|
103
|
+
webdriver: PlaywrightWebdriver,
|
104
|
+
browsers: {
|
105
|
+
dark: {
|
106
|
+
browserName: 'chromium',
|
107
|
+
// Define a storybook globals which will be applied to the stories
|
108
|
+
_storybookGlobals: {
|
109
|
+
theme: 'dark',
|
110
|
+
},
|
102
111
|
},
|
103
|
-
|
104
|
-
|
112
|
+
light: {
|
113
|
+
browserName: 'chromium',
|
114
|
+
_storybookGlobals: {
|
115
|
+
theme: 'light',
|
116
|
+
},
|
105
117
|
},
|
106
118
|
},
|
107
119
|
};
|
120
|
+
|
121
|
+
export default config;
|
108
122
|
```
|
109
123
|
|
110
|
-
|
124
|
+
## Using dedicated Selenium Grid server
|
111
125
|
|
112
|
-
|
126
|
+
Use Selenium Grid for distributed testing:
|
113
127
|
|
114
|
-
```
|
115
|
-
// .
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
128
|
+
```ts
|
129
|
+
// creevey.config.ts
|
130
|
+
import { CreeveyConfig } from 'creevey';
|
131
|
+
import { SeleniumWebdriver } from 'creevey/selenium';
|
132
|
+
|
133
|
+
const config: CreeveyConfig = {
|
134
|
+
webdriver: SeleniumWebdriver,
|
135
|
+
// Selenium Grid connection settings
|
136
|
+
gridUrl: 'http://selenium-hub:4444/wd/hub',
|
137
|
+
browsers: {
|
138
|
+
chrome: {
|
139
|
+
browserName: 'chrome',
|
140
|
+
// You can define any additional selenium capabilities here
|
141
|
+
// https://w3c.github.io/webdriver/#capabilities
|
142
|
+
seleniumCapabilities: {
|
143
|
+
browserVersion: '128.0',
|
144
|
+
platformName: 'linux',
|
145
|
+
},
|
121
146
|
},
|
122
147
|
},
|
123
148
|
};
|
149
|
+
|
150
|
+
export default config;
|
124
151
|
```
|
125
152
|
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
153
|
+
## Playwright configuration options
|
154
|
+
|
155
|
+
Leverage Playwright for testing:
|
156
|
+
|
157
|
+
```ts
|
158
|
+
// creevey.config.ts
|
159
|
+
import { CreeveyConfig } from 'creevey';
|
160
|
+
import { PlaywrightWebdriver } from 'creevey/playwright';
|
161
|
+
|
162
|
+
const config: CreeveyConfig = {
|
163
|
+
webdriver: PlaywrightWebdriver,
|
164
|
+
browsers: {
|
165
|
+
chromium: {
|
166
|
+
browserName: 'chromium',
|
167
|
+
// Playwright-specific options
|
168
|
+
// https://playwright.dev/docs/api/class-browsertype#browser-type-launch-server
|
169
|
+
playwrightOptions: {
|
170
|
+
headless: false,
|
171
|
+
channel: 'chrome-canary',
|
172
|
+
slowMo: 50, // Slow down Playwright operations by 50ms
|
144
173
|
},
|
145
174
|
},
|
146
175
|
},
|
147
|
-
} as Meta & CreeveyMeta;
|
148
|
-
|
149
|
-
export const Basic: Story & CreeveyStory = () => <MyComponent />;
|
150
|
-
Basic.parameters = {
|
151
|
-
creevey: {
|
152
|
-
captureElement: '.container',
|
153
|
-
// elements to ignore in capturing screenshot
|
154
|
-
ignoreElements: ['button', '.local-time'],
|
155
|
-
// Delay before test starts in ms
|
156
|
-
delay: 1000,
|
157
|
-
tests: {
|
158
|
-
/* ... */
|
159
|
-
},
|
160
|
-
},
|
161
176
|
};
|
177
|
+
|
178
|
+
export default config;
|
162
179
|
```
|
163
180
|
|
164
|
-
|
181
|
+
## Advanced Configuration
|
182
|
+
|
183
|
+
Comprehensive example combining multiple features and additional options:
|
165
184
|
|
166
185
|
```ts
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
186
|
+
// creevey.config.ts
|
187
|
+
import path from 'path';
|
188
|
+
import MochaJUnitReporter from 'mocha-junit-reporter';
|
189
|
+
import { CreeveyConfig } from 'creevey';
|
190
|
+
import { PlaywrightWebdriver } from 'creevey/playwright';
|
191
|
+
|
192
|
+
const config: CreeveyConfig = {
|
193
|
+
webdriver: PlaywrightWebdriver,
|
194
|
+
|
195
|
+
// It's possible to resolve Storybook URL at the runtime
|
196
|
+
resolveStorybookUrl: () =>
|
197
|
+
fetch('https://example.com/resolve-ip')
|
198
|
+
.then((res) => res.text())
|
199
|
+
.then((data) => `http://${data}:6006`),
|
200
|
+
|
201
|
+
// Define custom reference screenshots directory
|
202
|
+
screenDir: path.join(process.cwd(), 'screenshots'),
|
203
|
+
|
204
|
+
// Define custom report directory
|
205
|
+
reportDir: path.join(process.cwd(), 'reports'),
|
206
|
+
|
207
|
+
// Define path where Creevey tests are located
|
208
|
+
testDir: path.join(process.cwd(), 'tests'),
|
209
|
+
|
210
|
+
// You can use any Mocha-like reporter
|
211
|
+
reporter: MochaJUnitReporter,
|
176
212
|
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
- `skip: { 'Skip reason message': { stories: ['simple', 'special'] } }`
|
192
|
-
- `skip: { 'Skip reason message': { stories: /.*large$/ } }`
|
193
|
-
- Skip specific tests:
|
194
|
-
- `skip: { 'Skip reason message': { tests: 'click' } }`
|
195
|
-
- `skip: { 'Skip reason message': { tests: ['hover', 'click'] } }`
|
196
|
-
- `skip: { 'Skip reason message': { tests: /^press.*$/ } }`
|
197
|
-
- Multiple skip options:
|
198
|
-
- for one reason
|
199
|
-
```
|
200
|
-
skip: {
|
201
|
-
"reason": [{ /* ... */ }, { /* ... */ }],
|
202
|
-
}
|
203
|
-
```
|
204
|
-
- for several reasons
|
205
|
-
```
|
206
|
-
skip: {
|
207
|
-
"reason 1": { /* ... */ },
|
208
|
-
"reason 2": { /* ... */ },
|
209
|
-
}
|
210
|
-
```
|
211
|
-
|
212
|
-
NOTE: If you try to skip stories by story name, the storybook name format will be used (For more info see [storybook-export-vs-name-handling](https://storybook.js.org/docs/formats/component-story-format/#storybook-export-vs-name-handling))
|
213
|
+
// Pixelmatch options
|
214
|
+
diffOptions: { threshold: 0.1 },
|
215
|
+
|
216
|
+
// Regex pattern to match test files
|
217
|
+
testsRegex: /\.creevey\.ts$/,
|
218
|
+
|
219
|
+
// Disable using docker, to start browsers locally, it's useful for CI
|
220
|
+
useDocker: process.env.CI,
|
221
|
+
|
222
|
+
browsers: {
|
223
|
+
/* ... */
|
224
|
+
},
|
225
|
+
};
|
226
|
+
```
|
@@ -0,0 +1,60 @@
|
|
1
|
+
## Creevey Storybook Parameters
|
2
|
+
|
3
|
+
Creevey allows you to customize how stories will be captured. You could define parameters on `global`, `kind` or `story` levels. All these parameters are deeply merged by Storybook for each story.
|
4
|
+
|
5
|
+
```ts
|
6
|
+
// .storybook/preview.tsx
|
7
|
+
export const parameters = {
|
8
|
+
creevey: {
|
9
|
+
// Global parameters are applied to all stories
|
10
|
+
captureElement: '#storybook-root',
|
11
|
+
},
|
12
|
+
};
|
13
|
+
```
|
14
|
+
|
15
|
+
```ts
|
16
|
+
// stories/MyModal.stories.tsx
|
17
|
+
import React from 'react';
|
18
|
+
import { Meta, StoryObj } from '@storybook/react';
|
19
|
+
import { CreeveyMeta, CreeveyStory } from 'creevey';
|
20
|
+
import MyModal from './src/components/MyModal';
|
21
|
+
|
22
|
+
const Kind: Meta<typeof MyModal> = {
|
23
|
+
title: 'MyModal',
|
24
|
+
component: MyModal,
|
25
|
+
parameters: {
|
26
|
+
creevey: {
|
27
|
+
// It's possible to add additional delay before capturing screenshot
|
28
|
+
delay: 1000,
|
29
|
+
|
30
|
+
// For capturing the whole browser viewport, you can define `null` instead of css selector.
|
31
|
+
captureElement: null,
|
32
|
+
|
33
|
+
// You can skip some stories from capturing, by defining `skip` option:
|
34
|
+
// skip: { "The reason why story is skipped": { in: 'chrome', stories: 'Loading' } }
|
35
|
+
// - `in` - browser name, regex or array of browser names, which are defined in the Creevey config
|
36
|
+
// - `stories` - story name, regex or array of story names
|
37
|
+
// - `tests` - test name, regex or array of test names
|
38
|
+
// NOTE: If you try to skip stories by story name, the storybook name format will be used
|
39
|
+
// For more info see [storybook-export-vs-name-handling](https://storybook.js.org/docs/formats/component-story-format/#storybook-export-vs-name-handling))
|
40
|
+
skip: {
|
41
|
+
"`MyModal` doesn't support ie11": { in: 'ie11' },
|
42
|
+
'Loading stories are flaky in firefox': { in: 'firefox', stories: 'Loading' },
|
43
|
+
"`MyModal` hovering doesn't work correctly": {
|
44
|
+
in: ['firefox', 'chrome'],
|
45
|
+
tests: /.*hover$/,
|
46
|
+
},
|
47
|
+
},
|
48
|
+
},
|
49
|
+
},
|
50
|
+
};
|
51
|
+
|
52
|
+
export default Kind;
|
53
|
+
|
54
|
+
export const Basic: StoryObj<typeof MyModal> = {
|
55
|
+
creevey: {
|
56
|
+
// Lastly some elements can be ignored in capturing screenshot
|
57
|
+
ignoreElements: ['button', '.local-time'],
|
58
|
+
},
|
59
|
+
};
|
60
|
+
```
|