From 5c3a67378d10c93c34d82c50e863ca50ce68222e Mon Sep 17 00:00:00 2001 From: wadackel Date: Sat, 3 Feb 2024 01:07:43 +0900 Subject: [PATCH] refactor: patch update --- .changeset/red-fireants-travel.md | 8 ++++++++ CHANGELOG.md | 0 README.md | 18 ++++++++++++++++-- packages/storycap-testrun/src/screenshot.ts | 6 +++--- 4 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 .changeset/red-fireants-travel.md delete mode 100644 CHANGELOG.md diff --git a/.changeset/red-fireants-travel.md b/.changeset/red-fireants-travel.md new file mode 100644 index 0000000..faa6235 --- /dev/null +++ b/.changeset/red-fireants-travel.md @@ -0,0 +1,8 @@ +--- +'storycap-testrun': patch +--- + +A micro update: + +- Increased the default retry count for `retake` from 5 to 10 +- Improved the type for `flakiness` diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index e69de29..0000000 diff --git a/README.md b/README.md index ed239f1..9d54db7 100644 --- a/README.md +++ b/README.md @@ -176,7 +176,7 @@ The interval in milliseconds before attempting to capture the screenshot again. ### `flakiness.retake.retries` **Type:** `number` -**Default:** `5` +**Default:** `10` The number of times to repeat capturing the screenshot until the hash values of the images are identical. A value of 3 or more is recommended to achieve the effect of retries. @@ -234,6 +234,20 @@ See [Page | Playwright][playwright-screenshot]. These are parameters that can be specified for each Story. +```typescript +// Button.stories.tsx +const meta: Meta = { + component: Button, + parameters: { + screenshot: { + /* parameters... */ + }, + }, +}; + +export default meta; +``` + ### `skip` **Type:** `boolean` @@ -264,7 +278,7 @@ Removes elements corresponding to the CSS selector. ## CHANGELOG -See [CHANGELOG.md](./CHANGELOG.md). +See [CHANGELOG.md](./packages/storycap-testrun/CHANGELOG.md). ## License diff --git a/packages/storycap-testrun/src/screenshot.ts b/packages/storycap-testrun/src/screenshot.ts index 8e564ca..204fd58 100644 --- a/packages/storycap-testrun/src/screenshot.ts +++ b/packages/storycap-testrun/src/screenshot.ts @@ -35,11 +35,11 @@ export type ScreenshotOptions = { }; flakiness?: { metrics?: { - enabled: boolean; + enabled?: boolean; retries?: number; }; retake?: { - enabled: boolean; + enabled?: boolean; interval?: number; retries?: number; }; @@ -66,7 +66,7 @@ const defaultScreenshotOptions: ResolvedScreenshotOptions = { retake: { enabled: true, interval: 100, - retries: 5, + retries: 10, }, }, hooks: [],