@smoothdeploy/playwright 1.61.0 → 1.62.0

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/types/test.d.ts CHANGED
@@ -32,6 +32,7 @@ export type HtmlReporterOptions = {
32
32
  noSnippets?: boolean;
33
33
  noCopyPrompt?: boolean;
34
34
  doNotInlineAssets?: boolean;
35
+ mergeFiles?: boolean;
35
36
  };
36
37
 
37
38
  export type ReporterDescription = Readonly<
@@ -1640,6 +1641,31 @@ interface TestConfig<TestArgs = {}, WorkerArgs = {}> {
1640
1641
  */
1641
1642
  retries?: number;
1642
1643
 
1644
+ /**
1645
+ * Controls when failed tests are retried. Defaults to `'immediate'`.
1646
+ * - `'immediate'` - A failed test is retried as soon as a worker is available, interleaved with the rest of the
1647
+ * run. This is the default.
1648
+ * - `'isolated'` - Retries are run at the end, after all other tests have finished, one by one in a single worker.
1649
+ * This minimizes the interference between retried tests and the rest of the suite, at the expense of the total
1650
+ * run time.
1651
+ *
1652
+ * Learn more about [test retries](https://playwright.dev/docs/test-retries#retries).
1653
+ *
1654
+ * **Usage**
1655
+ *
1656
+ * ```js
1657
+ * // playwright.config.ts
1658
+ * import { defineConfig } from '@playwright/test';
1659
+ *
1660
+ * export default defineConfig({
1661
+ * retries: 2,
1662
+ * retryStrategy: 'isolated',
1663
+ * });
1664
+ * ```
1665
+ *
1666
+ */
1667
+ retryStrategy?: "immediate"|"isolated";
1668
+
1643
1669
  /**
1644
1670
  * Shard tests and execute only the selected shard. Specify in the one-based form like `{ total: 5, current: 2 }`.
1645
1671
  *
@@ -6918,6 +6944,61 @@ export interface PlaywrightWorkerOptions {
6918
6944
  * [testOptions.channel](https://playwright.dev/docs/api/class-testoptions#test-options-channel) are ignored.
6919
6945
  */
6920
6946
  connectOptions: ConnectOptions | undefined;
6947
+ /**
6948
+ * **NOTE** This option trades test isolation for speed and is intended for component tests that drive a story gallery. Leave
6949
+ * it unset for end-to-end tests - a fresh browser context per test is one of the core guarantees of Playwright Test.
6950
+ *
6951
+ * **Experimental.** When set to `true`, all tests in a worker process run in a single browser context that is reused
6952
+ * between tests, instead of getting a brand new context per test. Defaults to `false`.
6953
+ *
6954
+ * Between tests, Playwright resets the state that component tests typically touch: it clears cookies, cache, local
6955
+ * storage and IndexedDB of visited origins, unregisters service workers, closes extra pages, removes routes, bindings
6956
+ * and init scripts, and re-applies the configured storage state, viewport and emulation options.
6957
+ *
6958
+ * This reset is best-effort, not a guarantee of isolation. State that is **not** reset includes:
6959
+ * - Permissions granted with
6960
+ * [browserContext.grantPermissions(permissions[, options])](https://playwright.dev/docs/api/class-browsercontext#browser-context-grant-permissions)
6961
+ * during a test.
6962
+ * - Runtime changes made through
6963
+ * [browserContext.setGeolocation(geolocation)](https://playwright.dev/docs/api/class-browsercontext#browser-context-set-geolocation),
6964
+ * [browserContext.setOffline(offline)](https://playwright.dev/docs/api/class-browsercontext#browser-context-set-offline)
6965
+ * and
6966
+ * [browserContext.setExtraHTTPHeaders(headers)](https://playwright.dev/docs/api/class-browsercontext#browser-context-set-extra-http-headers).
6967
+ * - Browsing history, `window.name` and any browser-process-wide state.
6968
+ *
6969
+ * Additional restrictions:
6970
+ * - The option is ignored when
6971
+ * [testOptions.video](https://playwright.dev/docs/api/class-testoptions#test-options-video) recording is enabled.
6972
+ * - Only a few context options may differ between consecutive tests: `colorScheme`, `forcedColors`,
6973
+ * `reducedMotion`, `contrast`, `screen`, `userAgent`, `viewport` and `testIdAttribute`. Changing any other option
6974
+ * in [test.use(options)](https://playwright.dev/docs/api/class-test#test-use), for example `locale` or
6975
+ * `storageState`, silently forces a fresh context and negates the speedup.
6976
+ * - Do not combine with
6977
+ * [testOptions.connectOptions](https://playwright.dev/docs/api/class-testoptions#test-options-connect-options)
6978
+ * pointing multiple workers at a shared browser - workers would compete for the single reusable context.
6979
+ * - `recordHar` in
6980
+ * [testOptions.contextOptions](https://playwright.dev/docs/api/class-testoptions#test-options-context-options) is
6981
+ * not supported and produces no HAR file.
6982
+ *
6983
+ * **Usage**
6984
+ *
6985
+ * ```js
6986
+ * // playwright.config.ts
6987
+ * import { defineConfig } from '@playwright/test';
6988
+ *
6989
+ * export default defineConfig({
6990
+ * projects: [
6991
+ * {
6992
+ * name: 'components',
6993
+ * testDir: './tests/components',
6994
+ * use: { reuseContext: true },
6995
+ * },
6996
+ * ],
6997
+ * });
6998
+ * ```
6999
+ *
7000
+ */
7001
+ reuseContext: boolean;
6921
7002
  /**
6922
7003
  * Whether to automatically capture a screenshot after each test. Defaults to `'off'`.
6923
7004
  * - `'off'`: Do not capture screenshots.
@@ -7040,7 +7121,7 @@ export interface PlaywrightWorkerOptions {
7040
7121
  *
7041
7122
  * Learn more about [recording video](https://playwright.dev/docs/test-use-options#recording-options).
7042
7123
  */
7043
- video: VideoMode | /** deprecated */ 'retry-with-video' | { mode: VideoMode, size?: ViewportSize, show?: { actions?: { duration?: number, position?: 'top-left' | 'top' | 'top-right' | 'bottom-left' | 'bottom' | 'bottom-right', fontSize?: number }, test?: { level?: 'file' | 'title' | 'step', position?: 'top-left' | 'top' | 'top-right' | 'bottom-left' | 'bottom' | 'bottom-right', fontSize?: number } } };
7124
+ video: VideoMode | /** deprecated */ 'retry-with-video' | { mode: VideoMode, size?: ViewportSize, show?: { actions?: { duration?: number, position?: 'top-left' | 'top' | 'top-right' | 'bottom-left' | 'bottom' | 'bottom-right', fontSize?: number, cursor?: 'none' | 'pointer' }, test?: { level?: 'file' | 'title' | 'step', position?: 'top-left' | 'top' | 'top-right' | 'bottom-left' | 'bottom' | 'bottom-right', fontSize?: number } } };
7044
7125
  }
7045
7126
 
7046
7127
  export type ScreenshotMode = 'off' | 'on' | 'only-on-failure' | 'on-first-failure';
@@ -7716,6 +7797,12 @@ export interface PlaywrightWorkerArgs {
7716
7797
  browser: Browser;
7717
7798
  }
7718
7799
 
7800
+ type StoryProps<Story> =
7801
+ Story extends (props: infer Props) => any ? Props :
7802
+ Story extends new (...args: any[]) => { $props: infer Props } ? Props :
7803
+ Story extends new (props: infer Props, ...args: any[]) => any ? Props :
7804
+ Story;
7805
+
7719
7806
  /**
7720
7807
  * Playwright Test is based on the concept of the [test fixtures](https://playwright.dev/docs/test-fixtures). Test fixtures are used to
7721
7808
  * establish environment for each test, giving the test everything it needs and nothing else.
@@ -7807,6 +7894,48 @@ export interface PlaywrightTestArgs {
7807
7894
  *
7808
7895
  */
7809
7896
  request: APIRequestContext;
7897
+ /**
7898
+ * Mounts a component story and returns a [Locator](https://playwright.dev/docs/api/class-locator) pointing to the
7899
+ * root element the story was rendered into. Scope your queries from the returned locator:
7900
+ * `component.getByRole('button')`, not `page.getByRole('button')`.
7901
+ *
7902
+ * A **story** is a small wrapper component that embeds the component under test in one specific scenario: hard-coded
7903
+ * props, mock data, providers, recorded callbacks. Stories are rendered by a **gallery** page that you implement and
7904
+ * serve at [testOptions.baseURL](https://playwright.dev/docs/api/class-testoptions#test-options-base-url). The
7905
+ * gallery exposes `window.mount(params)` and `window.unmount()` functions that render a story into its root element.
7906
+ * Each call to [fixtures.mount(storyId[, props])](https://playwright.dev/docs/api/class-fixtures#fixtures-mount)
7907
+ * navigates to [testOptions.baseURL](https://playwright.dev/docs/api/class-testoptions#test-options-base-url) and
7908
+ * calls `window.mount()` with the story id and props, so tests are fully isolated from each other.
7909
+ *
7910
+ * **Usage**
7911
+ *
7912
+ * ```js
7913
+ * test('click should expand', async ({ mount }) => {
7914
+ * const component = await mount('components/Expandable/Stateful');
7915
+ * await component.getByRole('button').click();
7916
+ * await expect(component.getByTestId('expanded')).toHaveValue('true');
7917
+ * });
7918
+ * ```
7919
+ *
7920
+ * Pass the story type as a template argument to type-check the props:
7921
+ *
7922
+ * ```js
7923
+ * import type { WithTitle } from './Button.story';
7924
+ *
7925
+ * test('renders the title', async ({ mount }) => {
7926
+ * const component = await mount<typeof WithTitle>('Button/WithTitle', { title: 'Hello' });
7927
+ * await expect(component).toContainText('Hello');
7928
+ * });
7929
+ * ```
7930
+ *
7931
+ * The returned locator is augmented with two methods:
7932
+ * - `update(props)` - re-renders the same story with new props without remounting, preserving component state;
7933
+ * - `unmount()` - unmounts the story.
7934
+ * @param storyId Identifier of the story to mount, as resolved by the gallery page. Conventionally, the story file path plus the
7935
+ * exported story name, for example `'components/Button/Primary'`.
7936
+ * @param props Optional plain, serializable props passed to the story.
7937
+ */
7938
+ mount: <Story = Record<string, any>>(storyId: string, props?: StoryProps<Story>) => Promise<Locator & { update(props?: StoryProps<Story>): Promise<void>, unmount(): Promise<void> }>;
7810
7939
  }
7811
7940
 
7812
7941
  type ExcludeProps<A, B> = {
@@ -8670,7 +8799,6 @@ export function mergeExpects<List extends any[]>(...expects: List): MergedExpect
8670
8799
  export { };
8671
8800
 
8672
8801
 
8673
-
8674
8802
  /**
8675
8803
  * The [APIResponseAssertions](https://playwright.dev/docs/api/class-apiresponseassertions) class provides assertion
8676
8804
  * methods that can be used to make assertions about the
@@ -8747,6 +8875,13 @@ interface LocatorAssertions {
8747
8875
  toBeAttached(options?: {
8748
8876
  attached?: boolean;
8749
8877
 
8878
+ /**
8879
+ * An optional [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) that can cancel the
8880
+ * assertion. Aborting the signal fails the assertion like a timeout: if the signal is aborted while the assertion is
8881
+ * retrying, or is already aborted before the assertion starts, the assertion fails without retrying further.
8882
+ */
8883
+ signal?: AbortSignal;
8884
+
8750
8885
  /**
8751
8886
  * Time to retry the assertion for in milliseconds. Defaults to `timeout` in `TestConfig.expect`.
8752
8887
  */
@@ -8781,6 +8916,13 @@ interface LocatorAssertions {
8781
8916
  */
8782
8917
  indeterminate?: boolean;
8783
8918
 
8919
+ /**
8920
+ * An optional [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) that can cancel the
8921
+ * assertion. Aborting the signal fails the assertion like a timeout: if the signal is aborted while the assertion is
8922
+ * retrying, or is already aborted before the assertion starts, the assertion fails without retrying further.
8923
+ */
8924
+ signal?: AbortSignal;
8925
+
8784
8926
  /**
8785
8927
  * Time to retry the assertion for in milliseconds. Defaults to `timeout` in `TestConfig.expect`.
8786
8928
  */
@@ -8804,6 +8946,13 @@ interface LocatorAssertions {
8804
8946
  * @param options
8805
8947
  */
8806
8948
  toBeDisabled(options?: {
8949
+ /**
8950
+ * An optional [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) that can cancel the
8951
+ * assertion. Aborting the signal fails the assertion like a timeout: if the signal is aborted while the assertion is
8952
+ * retrying, or is already aborted before the assertion starts, the assertion fails without retrying further.
8953
+ */
8954
+ signal?: AbortSignal;
8955
+
8807
8956
  /**
8808
8957
  * Time to retry the assertion for in milliseconds. Defaults to `timeout` in `TestConfig.expect`.
8809
8958
  */
@@ -8825,6 +8974,13 @@ interface LocatorAssertions {
8825
8974
  toBeEditable(options?: {
8826
8975
  editable?: boolean;
8827
8976
 
8977
+ /**
8978
+ * An optional [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) that can cancel the
8979
+ * assertion. Aborting the signal fails the assertion like a timeout: if the signal is aborted while the assertion is
8980
+ * retrying, or is already aborted before the assertion starts, the assertion fails without retrying further.
8981
+ */
8982
+ signal?: AbortSignal;
8983
+
8828
8984
  /**
8829
8985
  * Time to retry the assertion for in milliseconds. Defaults to `timeout` in `TestConfig.expect`.
8830
8986
  */
@@ -8845,6 +9001,13 @@ interface LocatorAssertions {
8845
9001
  * @param options
8846
9002
  */
8847
9003
  toBeEmpty(options?: {
9004
+ /**
9005
+ * An optional [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) that can cancel the
9006
+ * assertion. Aborting the signal fails the assertion like a timeout: if the signal is aborted while the assertion is
9007
+ * retrying, or is already aborted before the assertion starts, the assertion fails without retrying further.
9008
+ */
9009
+ signal?: AbortSignal;
9010
+
8848
9011
  /**
8849
9012
  * Time to retry the assertion for in milliseconds. Defaults to `timeout` in `TestConfig.expect`.
8850
9013
  */
@@ -8866,6 +9029,13 @@ interface LocatorAssertions {
8866
9029
  toBeEnabled(options?: {
8867
9030
  enabled?: boolean;
8868
9031
 
9032
+ /**
9033
+ * An optional [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) that can cancel the
9034
+ * assertion. Aborting the signal fails the assertion like a timeout: if the signal is aborted while the assertion is
9035
+ * retrying, or is already aborted before the assertion starts, the assertion fails without retrying further.
9036
+ */
9037
+ signal?: AbortSignal;
9038
+
8869
9039
  /**
8870
9040
  * Time to retry the assertion for in milliseconds. Defaults to `timeout` in `TestConfig.expect`.
8871
9041
  */
@@ -8885,6 +9055,13 @@ interface LocatorAssertions {
8885
9055
  * @param options
8886
9056
  */
8887
9057
  toBeFocused(options?: {
9058
+ /**
9059
+ * An optional [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) that can cancel the
9060
+ * assertion. Aborting the signal fails the assertion like a timeout: if the signal is aborted while the assertion is
9061
+ * retrying, or is already aborted before the assertion starts, the assertion fails without retrying further.
9062
+ */
9063
+ signal?: AbortSignal;
9064
+
8888
9065
  /**
8889
9066
  * Time to retry the assertion for in milliseconds. Defaults to `timeout` in `TestConfig.expect`.
8890
9067
  */
@@ -8905,6 +9082,13 @@ interface LocatorAssertions {
8905
9082
  * @param options
8906
9083
  */
8907
9084
  toBeHidden(options?: {
9085
+ /**
9086
+ * An optional [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) that can cancel the
9087
+ * assertion. Aborting the signal fails the assertion like a timeout: if the signal is aborted while the assertion is
9088
+ * retrying, or is already aborted before the assertion starts, the assertion fails without retrying further.
9089
+ */
9090
+ signal?: AbortSignal;
9091
+
8908
9092
  /**
8909
9093
  * Time to retry the assertion for in milliseconds. Defaults to `timeout` in `TestConfig.expect`.
8910
9094
  */
@@ -8937,6 +9121,13 @@ interface LocatorAssertions {
8937
9121
  */
8938
9122
  ratio?: number;
8939
9123
 
9124
+ /**
9125
+ * An optional [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) that can cancel the
9126
+ * assertion. Aborting the signal fails the assertion like a timeout: if the signal is aborted while the assertion is
9127
+ * retrying, or is already aborted before the assertion starts, the assertion fails without retrying further.
9128
+ */
9129
+ signal?: AbortSignal;
9130
+
8940
9131
  /**
8941
9132
  * Time to retry the assertion for in milliseconds. Defaults to `timeout` in `TestConfig.expect`.
8942
9133
  */
@@ -8970,6 +9161,13 @@ interface LocatorAssertions {
8970
9161
  * @param options
8971
9162
  */
8972
9163
  toBeVisible(options?: {
9164
+ /**
9165
+ * An optional [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) that can cancel the
9166
+ * assertion. Aborting the signal fails the assertion like a timeout: if the signal is aborted while the assertion is
9167
+ * retrying, or is already aborted before the assertion starts, the assertion fails without retrying further.
9168
+ */
9169
+ signal?: AbortSignal;
9170
+
8973
9171
  /**
8974
9172
  * Time to retry the assertion for in milliseconds. Defaults to `timeout` in `TestConfig.expect`.
8975
9173
  */
@@ -9017,6 +9215,13 @@ interface LocatorAssertions {
9017
9215
  * @param options
9018
9216
  */
9019
9217
  toContainClass(expected: string|ReadonlyArray<string>, options?: {
9218
+ /**
9219
+ * An optional [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) that can cancel the
9220
+ * assertion. Aborting the signal fails the assertion like a timeout: if the signal is aborted while the assertion is
9221
+ * retrying, or is already aborted before the assertion starts, the assertion fails without retrying further.
9222
+ */
9223
+ signal?: AbortSignal;
9224
+
9020
9225
  /**
9021
9226
  * Time to retry the assertion for in milliseconds. Defaults to `timeout` in `TestConfig.expect`.
9022
9227
  */
@@ -9084,6 +9289,13 @@ interface LocatorAssertions {
9084
9289
  */
9085
9290
  ignoreCase?: boolean;
9086
9291
 
9292
+ /**
9293
+ * An optional [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) that can cancel the
9294
+ * assertion. Aborting the signal fails the assertion like a timeout: if the signal is aborted while the assertion is
9295
+ * retrying, or is already aborted before the assertion starts, the assertion fails without retrying further.
9296
+ */
9297
+ signal?: AbortSignal;
9298
+
9087
9299
  /**
9088
9300
  * Time to retry the assertion for in milliseconds. Defaults to `timeout` in `TestConfig.expect`.
9089
9301
  */
@@ -9117,6 +9329,13 @@ interface LocatorAssertions {
9117
9329
  */
9118
9330
  ignoreCase?: boolean;
9119
9331
 
9332
+ /**
9333
+ * An optional [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) that can cancel the
9334
+ * assertion. Aborting the signal fails the assertion like a timeout: if the signal is aborted while the assertion is
9335
+ * retrying, or is already aborted before the assertion starts, the assertion fails without retrying further.
9336
+ */
9337
+ signal?: AbortSignal;
9338
+
9120
9339
  /**
9121
9340
  * Time to retry the assertion for in milliseconds. Defaults to `timeout` in `TestConfig.expect`.
9122
9341
  */
@@ -9145,6 +9364,13 @@ interface LocatorAssertions {
9145
9364
  */
9146
9365
  ignoreCase?: boolean;
9147
9366
 
9367
+ /**
9368
+ * An optional [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) that can cancel the
9369
+ * assertion. Aborting the signal fails the assertion like a timeout: if the signal is aborted while the assertion is
9370
+ * retrying, or is already aborted before the assertion starts, the assertion fails without retrying further.
9371
+ */
9372
+ signal?: AbortSignal;
9373
+
9148
9374
  /**
9149
9375
  * Time to retry the assertion for in milliseconds. Defaults to `timeout` in `TestConfig.expect`.
9150
9376
  */
@@ -9173,6 +9399,13 @@ interface LocatorAssertions {
9173
9399
  */
9174
9400
  ignoreCase?: boolean;
9175
9401
 
9402
+ /**
9403
+ * An optional [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) that can cancel the
9404
+ * assertion. Aborting the signal fails the assertion like a timeout: if the signal is aborted while the assertion is
9405
+ * retrying, or is already aborted before the assertion starts, the assertion fails without retrying further.
9406
+ */
9407
+ signal?: AbortSignal;
9408
+
9176
9409
  /**
9177
9410
  * Time to retry the assertion for in milliseconds. Defaults to `timeout` in `TestConfig.expect`.
9178
9411
  */
@@ -9201,6 +9434,13 @@ interface LocatorAssertions {
9201
9434
  */
9202
9435
  ignoreCase?: boolean;
9203
9436
 
9437
+ /**
9438
+ * An optional [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) that can cancel the
9439
+ * assertion. Aborting the signal fails the assertion like a timeout: if the signal is aborted while the assertion is
9440
+ * retrying, or is already aborted before the assertion starts, the assertion fails without retrying further.
9441
+ */
9442
+ signal?: AbortSignal;
9443
+
9204
9444
  /**
9205
9445
  * Time to retry the assertion for in milliseconds. Defaults to `timeout` in `TestConfig.expect`.
9206
9446
  */
@@ -9222,6 +9462,13 @@ interface LocatorAssertions {
9222
9462
  * @param options
9223
9463
  */
9224
9464
  toHaveAttribute(name: string, options?: {
9465
+ /**
9466
+ * An optional [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) that can cancel the
9467
+ * assertion. Aborting the signal fails the assertion like a timeout: if the signal is aborted while the assertion is
9468
+ * retrying, or is already aborted before the assertion starts, the assertion fails without retrying further.
9469
+ */
9470
+ signal?: AbortSignal;
9471
+
9225
9472
  /**
9226
9473
  * Time to retry the assertion for in milliseconds. Defaults to `timeout` in `TestConfig.expect`.
9227
9474
  */
@@ -9258,6 +9505,13 @@ interface LocatorAssertions {
9258
9505
  * @param options
9259
9506
  */
9260
9507
  toHaveClass(expected: string|RegExp|ReadonlyArray<string|RegExp>, options?: {
9508
+ /**
9509
+ * An optional [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) that can cancel the
9510
+ * assertion. Aborting the signal fails the assertion like a timeout: if the signal is aborted while the assertion is
9511
+ * retrying, or is already aborted before the assertion starts, the assertion fails without retrying further.
9512
+ */
9513
+ signal?: AbortSignal;
9514
+
9261
9515
  /**
9262
9516
  * Time to retry the assertion for in milliseconds. Defaults to `timeout` in `TestConfig.expect`.
9263
9517
  */
@@ -9278,6 +9532,13 @@ interface LocatorAssertions {
9278
9532
  * @param options
9279
9533
  */
9280
9534
  toHaveCount(count: number, options?: {
9535
+ /**
9536
+ * An optional [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) that can cancel the
9537
+ * assertion. Aborting the signal fails the assertion like a timeout: if the signal is aborted while the assertion is
9538
+ * retrying, or is already aborted before the assertion starts, the assertion fails without retrying further.
9539
+ */
9540
+ signal?: AbortSignal;
9541
+
9281
9542
  /**
9282
9543
  * Time to retry the assertion for in milliseconds. Defaults to `timeout` in `TestConfig.expect`.
9283
9544
  */
@@ -9305,6 +9566,13 @@ interface LocatorAssertions {
9305
9566
  */
9306
9567
  pseudo?: "before"|"after";
9307
9568
 
9569
+ /**
9570
+ * An optional [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) that can cancel the
9571
+ * assertion. Aborting the signal fails the assertion like a timeout: if the signal is aborted while the assertion is
9572
+ * retrying, or is already aborted before the assertion starts, the assertion fails without retrying further.
9573
+ */
9574
+ signal?: AbortSignal;
9575
+
9308
9576
  /**
9309
9577
  * Time to retry the assertion for in milliseconds. Defaults to `timeout` in `TestConfig.expect`.
9310
9578
  */
@@ -9326,6 +9594,13 @@ interface LocatorAssertions {
9326
9594
  * @param options
9327
9595
  */
9328
9596
  toHaveId(id: string|RegExp, options?: {
9597
+ /**
9598
+ * An optional [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) that can cancel the
9599
+ * assertion. Aborting the signal fails the assertion like a timeout: if the signal is aborted while the assertion is
9600
+ * retrying, or is already aborted before the assertion starts, the assertion fails without retrying further.
9601
+ */
9602
+ signal?: AbortSignal;
9603
+
9329
9604
  /**
9330
9605
  * Time to retry the assertion for in milliseconds. Defaults to `timeout` in `TestConfig.expect`.
9331
9606
  */
@@ -9348,6 +9623,13 @@ interface LocatorAssertions {
9348
9623
  * @param options
9349
9624
  */
9350
9625
  toHaveJSProperty(name: string, value: any, options?: {
9626
+ /**
9627
+ * An optional [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) that can cancel the
9628
+ * assertion. Aborting the signal fails the assertion like a timeout: if the signal is aborted while the assertion is
9629
+ * retrying, or is already aborted before the assertion starts, the assertion fails without retrying further.
9630
+ */
9631
+ signal?: AbortSignal;
9632
+
9351
9633
  /**
9352
9634
  * Time to retry the assertion for in milliseconds. Defaults to `timeout` in `TestConfig.expect`.
9353
9635
  */
@@ -9372,6 +9654,13 @@ interface LocatorAssertions {
9372
9654
  * @param options
9373
9655
  */
9374
9656
  toHaveRole(role: "alert"|"alertdialog"|"application"|"article"|"banner"|"blockquote"|"button"|"caption"|"cell"|"checkbox"|"code"|"columnheader"|"combobox"|"complementary"|"contentinfo"|"definition"|"deletion"|"dialog"|"directory"|"document"|"emphasis"|"feed"|"figure"|"form"|"generic"|"grid"|"gridcell"|"group"|"heading"|"img"|"insertion"|"link"|"list"|"listbox"|"listitem"|"log"|"main"|"marquee"|"math"|"meter"|"menu"|"menubar"|"menuitem"|"menuitemcheckbox"|"menuitemradio"|"navigation"|"none"|"note"|"option"|"paragraph"|"presentation"|"progressbar"|"radio"|"radiogroup"|"region"|"row"|"rowgroup"|"rowheader"|"scrollbar"|"search"|"searchbox"|"separator"|"slider"|"spinbutton"|"status"|"strong"|"subscript"|"superscript"|"switch"|"tab"|"table"|"tablist"|"tabpanel"|"term"|"textbox"|"time"|"timer"|"toolbar"|"tooltip"|"tree"|"treegrid"|"treeitem", options?: {
9657
+ /**
9658
+ * An optional [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) that can cancel the
9659
+ * assertion. Aborting the signal fails the assertion like a timeout: if the signal is aborted while the assertion is
9660
+ * retrying, or is already aborted before the assertion starts, the assertion fails without retrying further.
9661
+ */
9662
+ signal?: AbortSignal;
9663
+
9375
9664
  /**
9376
9665
  * Time to retry the assertion for in milliseconds. Defaults to `timeout` in `TestConfig.expect`.
9377
9666
  */
@@ -9387,10 +9676,14 @@ interface LocatorAssertions {
9387
9676
  * ```js
9388
9677
  * const locator = page.getByRole('button');
9389
9678
  * await expect(locator).toHaveScreenshot('image.png');
9679
+ *
9680
+ * // Store the snapshot in the WebP format.
9681
+ * await expect(locator).toHaveScreenshot('image.webp');
9390
9682
  * ```
9391
9683
  *
9392
9684
  * Note that screenshot assertions only work with Playwright test runner.
9393
- * @param name Snapshot name.
9685
+ * @param name Snapshot name. Must have a `.png` or `.webp` extension, the screenshot is captured in the corresponding format.
9686
+ * Both formats are lossless.
9394
9687
  * @param options
9395
9688
  */
9396
9689
  toHaveScreenshot(name: string|ReadonlyArray<string>, options?: {
@@ -9452,6 +9745,13 @@ interface LocatorAssertions {
9452
9745
  */
9453
9746
  scale?: "css"|"device";
9454
9747
 
9748
+ /**
9749
+ * An optional [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) that can cancel the
9750
+ * assertion. Aborting the signal fails the assertion like a timeout: if the signal is aborted while the assertion is
9751
+ * retrying, or is already aborted before the assertion starts, the assertion fails without retrying further.
9752
+ */
9753
+ signal?: AbortSignal;
9754
+
9455
9755
  /**
9456
9756
  * File name containing the stylesheet to apply while making the screenshot. This is where you can hide dynamic
9457
9757
  * elements, make elements invisible or change their properties to help you creating repeatable screenshots. This
@@ -9476,6 +9776,9 @@ interface LocatorAssertions {
9476
9776
  * This function will wait until two consecutive locator screenshots yield the same result, and then compare the last
9477
9777
  * screenshot with the expectation.
9478
9778
  *
9779
+ * The snapshot is stored in the PNG format. To store it in the WebP format instead, pass a snapshot name with the
9780
+ * `.webp` extension.
9781
+ *
9479
9782
  * **Usage**
9480
9783
  *
9481
9784
  * ```js
@@ -9545,6 +9848,13 @@ interface LocatorAssertions {
9545
9848
  */
9546
9849
  scale?: "css"|"device";
9547
9850
 
9851
+ /**
9852
+ * An optional [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) that can cancel the
9853
+ * assertion. Aborting the signal fails the assertion like a timeout: if the signal is aborted while the assertion is
9854
+ * retrying, or is already aborted before the assertion starts, the assertion fails without retrying further.
9855
+ */
9856
+ signal?: AbortSignal;
9857
+
9548
9858
  /**
9549
9859
  * File name containing the stylesheet to apply while making the screenshot. This is where you can hide dynamic
9550
9860
  * elements, make elements invisible or change their properties to help you creating repeatable screenshots. This
@@ -9625,6 +9935,13 @@ interface LocatorAssertions {
9625
9935
  */
9626
9936
  ignoreCase?: boolean;
9627
9937
 
9938
+ /**
9939
+ * An optional [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) that can cancel the
9940
+ * assertion. Aborting the signal fails the assertion like a timeout: if the signal is aborted while the assertion is
9941
+ * retrying, or is already aborted before the assertion starts, the assertion fails without retrying further.
9942
+ */
9943
+ signal?: AbortSignal;
9944
+
9628
9945
  /**
9629
9946
  * Time to retry the assertion for in milliseconds. Defaults to `timeout` in `TestConfig.expect`.
9630
9947
  */
@@ -9651,6 +9968,13 @@ interface LocatorAssertions {
9651
9968
  * @param options
9652
9969
  */
9653
9970
  toHaveValue(value: string|RegExp, options?: {
9971
+ /**
9972
+ * An optional [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) that can cancel the
9973
+ * assertion. Aborting the signal fails the assertion like a timeout: if the signal is aborted while the assertion is
9974
+ * retrying, or is already aborted before the assertion starts, the assertion fails without retrying further.
9975
+ */
9976
+ signal?: AbortSignal;
9977
+
9654
9978
  /**
9655
9979
  * Time to retry the assertion for in milliseconds. Defaults to `timeout` in `TestConfig.expect`.
9656
9980
  */
@@ -9683,6 +10007,13 @@ interface LocatorAssertions {
9683
10007
  * @param options
9684
10008
  */
9685
10009
  toHaveValues(values: ReadonlyArray<string|RegExp>, options?: {
10010
+ /**
10011
+ * An optional [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) that can cancel the
10012
+ * assertion. Aborting the signal fails the assertion like a timeout: if the signal is aborted while the assertion is
10013
+ * retrying, or is already aborted before the assertion starts, the assertion fails without retrying further.
10014
+ */
10015
+ signal?: AbortSignal;
10016
+
9686
10017
  /**
9687
10018
  * Time to retry the assertion for in milliseconds. Defaults to `timeout` in `TestConfig.expect`.
9688
10019
  */
@@ -9706,6 +10037,13 @@ interface LocatorAssertions {
9706
10037
  * @param options
9707
10038
  */
9708
10039
  toMatchAriaSnapshot(expected: string, options?: {
10040
+ /**
10041
+ * An optional [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) that can cancel the
10042
+ * assertion. Aborting the signal fails the assertion like a timeout: if the signal is aborted while the assertion is
10043
+ * retrying, or is already aborted before the assertion starts, the assertion fails without retrying further.
10044
+ */
10045
+ signal?: AbortSignal;
10046
+
9709
10047
  /**
9710
10048
  * Time to retry the assertion for in milliseconds. Defaults to `timeout` in `TestConfig.expect`.
9711
10049
  */
@@ -9734,6 +10072,13 @@ interface LocatorAssertions {
9734
10072
  */
9735
10073
  name?: string;
9736
10074
 
10075
+ /**
10076
+ * An optional [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) that can cancel the
10077
+ * assertion. Aborting the signal fails the assertion like a timeout: if the signal is aborted while the assertion is
10078
+ * retrying, or is already aborted before the assertion starts, the assertion fails without retrying further.
10079
+ */
10080
+ signal?: AbortSignal;
10081
+
9737
10082
  /**
9738
10083
  * Time to retry the assertion for in milliseconds. Defaults to `timeout` in `TestConfig.expect`.
9739
10084
  */
@@ -9779,10 +10124,14 @@ interface PageAssertions {
9779
10124
  *
9780
10125
  * ```js
9781
10126
  * await expect(page).toHaveScreenshot('image.png');
10127
+ *
10128
+ * // Store the snapshot in the WebP format.
10129
+ * await expect(page).toHaveScreenshot('image.webp');
9782
10130
  * ```
9783
10131
  *
9784
10132
  * Note that screenshot assertions only work with Playwright test runner.
9785
- * @param name Snapshot name.
10133
+ * @param name Snapshot name. Must have a `.png` or `.webp` extension, the screenshot is captured in the corresponding format.
10134
+ * Both formats are lossless.
9786
10135
  * @param options
9787
10136
  */
9788
10137
  toHaveScreenshot(name: string|ReadonlyArray<string>, options?: PageAssertionsToHaveScreenshotOptions): Promise<void>;
@@ -9791,6 +10140,9 @@ interface PageAssertions {
9791
10140
  * This function will wait until two consecutive page screenshots yield the same result, and then compare the last
9792
10141
  * screenshot with the expectation.
9793
10142
  *
10143
+ * The snapshot is stored in the PNG format. To store it in the WebP format instead, pass a snapshot name with the
10144
+ * `.webp` extension.
10145
+ *
9794
10146
  * **Usage**
9795
10147
  *
9796
10148
  * ```js
@@ -9815,6 +10167,13 @@ interface PageAssertions {
9815
10167
  * @param options
9816
10168
  */
9817
10169
  toHaveTitle(titleOrRegExp: string|RegExp, options?: {
10170
+ /**
10171
+ * An optional [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) that can cancel the
10172
+ * assertion. Aborting the signal fails the assertion like a timeout: if the signal is aborted while the assertion is
10173
+ * retrying, or is already aborted before the assertion starts, the assertion fails without retrying further.
10174
+ */
10175
+ signal?: AbortSignal;
10176
+
9818
10177
  /**
9819
10178
  * Time to retry the assertion for in milliseconds. Defaults to `timeout` in `TestConfig.expect`.
9820
10179
  */
@@ -9860,6 +10219,13 @@ interface PageAssertions {
9860
10219
  */
9861
10220
  ignoreCase?: boolean;
9862
10221
 
10222
+ /**
10223
+ * An optional [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) that can cancel the
10224
+ * assertion. Aborting the signal fails the assertion like a timeout: if the signal is aborted while the assertion is
10225
+ * retrying, or is already aborted before the assertion starts, the assertion fails without retrying further.
10226
+ */
10227
+ signal?: AbortSignal;
10228
+
9863
10229
  /**
9864
10230
  * Time to retry the assertion for in milliseconds. Defaults to `timeout` in `TestConfig.expect`.
9865
10231
  */
@@ -9883,6 +10249,13 @@ interface PageAssertions {
9883
10249
  * @param options
9884
10250
  */
9885
10251
  toMatchAriaSnapshot(expected: string, options?: {
10252
+ /**
10253
+ * An optional [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) that can cancel the
10254
+ * assertion. Aborting the signal fails the assertion like a timeout: if the signal is aborted while the assertion is
10255
+ * retrying, or is already aborted before the assertion starts, the assertion fails without retrying further.
10256
+ */
10257
+ signal?: AbortSignal;
10258
+
9886
10259
  /**
9887
10260
  * Time to retry the assertion for in milliseconds. Defaults to `timeout` in `TestConfig.expect`.
9888
10261
  */
@@ -9911,6 +10284,13 @@ interface PageAssertions {
9911
10284
  */
9912
10285
  name?: string;
9913
10286
 
10287
+ /**
10288
+ * An optional [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) that can cancel the
10289
+ * assertion. Aborting the signal fails the assertion like a timeout: if the signal is aborted while the assertion is
10290
+ * retrying, or is already aborted before the assertion starts, the assertion fails without retrying further.
10291
+ */
10292
+ signal?: AbortSignal;
10293
+
9914
10294
  /**
9915
10295
  * Time to retry the assertion for in milliseconds. Defaults to `timeout` in `TestConfig.expect`.
9916
10296
  */
@@ -10366,6 +10746,13 @@ export interface PageAssertionsToHaveScreenshotOptions {
10366
10746
  */
10367
10747
  scale?: "css"|"device";
10368
10748
 
10749
+ /**
10750
+ * An optional [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) that can cancel the
10751
+ * assertion. Aborting the signal fails the assertion like a timeout: if the signal is aborted while the assertion is
10752
+ * retrying, or is already aborted before the assertion starts, the assertion fails without retrying further.
10753
+ */
10754
+ signal?: AbortSignal;
10755
+
10369
10756
  /**
10370
10757
  * File name containing the stylesheet to apply while making the screenshot. This is where you can hide dynamic
10371
10758
  * elements, make elements invisible or change their properties to help you creating repeatable screenshots. This