storybook-addon-playwright 5.1.1 → 5.1.3
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/dist/api/server/routes.d.mts +1 -1
- package/dist/api/server/routes.d.ts +1 -1
- package/dist/api/server/routes.js +4 -4
- package/dist/api/server/routes.js.map +1 -1
- package/dist/api/server/routes.mjs +4 -4
- package/dist/api/server/routes.mjs.map +1 -1
- package/dist/get-screenshots.js +2 -2
- package/dist/get-screenshots.js.map +1 -1
- package/dist/get-screenshots.mjs +2 -2
- package/dist/get-screenshots.mjs.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/dist/register.js +9 -9
- package/dist/register.js.map +1 -1
- package/dist/register.mjs +9 -9
- package/dist/register.mjs.map +1 -1
- package/dist/run-image-diff.js +2 -2
- package/dist/run-image-diff.js.map +1 -1
- package/dist/run-image-diff.mjs +2 -2
- package/dist/run-image-diff.mjs.map +1 -1
- package/dist/to-match-screenshots.js +2 -2
- package/dist/to-match-screenshots.js.map +1 -1
- package/dist/to-match-screenshots.mjs +2 -2
- package/dist/to-match-screenshots.mjs.map +1 -1
- package/dist/trpc/router.d.mts +15 -15
- package/dist/trpc/router.d.ts +15 -15
- package/dist/trpc/router.js +4 -4
- package/dist/trpc/router.js.map +1 -1
- package/dist/trpc/router.mjs +4 -4
- package/dist/trpc/router.mjs.map +1 -1
- package/package.json +52 -61
|
@@ -5,7 +5,7 @@ import 'ts-to-json';
|
|
|
5
5
|
import '../../request-CyuY6GGO.mjs';
|
|
6
6
|
import 'zod';
|
|
7
7
|
import '@trpc/server';
|
|
8
|
-
import 'http';
|
|
8
|
+
import 'node:http';
|
|
9
9
|
import 'jest-image-snapshot';
|
|
10
10
|
import '../../image-diff-Dg_Di4zv.mjs';
|
|
11
11
|
import '../../get-screenshot-paths-BhXNedbs.mjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var q=require('zod'),Ho=require('array-move'),pe=require('lodash/kebabCase'),router=require('@storybook/core/router'),Qe=require('normalize-url'),objectPathImmutable=require('object-path-immutable');require('@pixpilot/dom'),require('@storybook/components'),require('@storybook/icons'),require('react'),require('@pixpilot/hash'),require('sonner');var N=require('fs'),jsonfile=require('jsonfile'),R=require('path'),ut=require('fast-deep-equal'),nanoid=require('nanoid'),server=require('@trpc/server'),Go=require('deepmerge'),or=require('join-images'),rr=require('sharp'),diffSnapshot=require('jest-image-snapshot/src/diff-snapshot'),ar=require('p-limit'),nr=require('fast-glob');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var q__default=/*#__PURE__*/_interopDefault(q);var Ho__default=/*#__PURE__*/_interopDefault(Ho);var pe__default=/*#__PURE__*/_interopDefault(pe);var Qe__default=/*#__PURE__*/_interopDefault(Qe);var N__namespace=/*#__PURE__*/_interopNamespace(N);var R__namespace=/*#__PURE__*/_interopNamespace(R);var ut__default=/*#__PURE__*/_interopDefault(ut);var Go__default=/*#__PURE__*/_interopDefault(Go);var or__default=/*#__PURE__*/_interopDefault(or);var rr__default=/*#__PURE__*/_interopDefault(rr);var ar__default=/*#__PURE__*/_interopDefault(ar);var nr__default=/*#__PURE__*/_interopDefault(nr);var ue=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,o)=>(typeof require<"u"?require:t)[o]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var Pe={filePath:q__default.default.string(),storyId:q__default.default.string()};q__default.default.object(Pe);function T(e){return q__default.default.object({...Pe,...e})}var Z=T({}),ke=q__default.default.object({filePath:q__default.default.string(),id:q__default.default.string(),name:q__default.default.string(),parent:q__default.default.string()});var ho=q.z.object({args:q.z.record(q.z.string(),q.z.unknown()).optional(),id:q.z.string(),labe:q.z.string().optional(),name:q.z.string(),subtitleItems:q.z.array(q.z.string()).optional()}),V=q.z.object({actions:q.z.array(ho),id:q.z.string(),temp:q.z.boolean().optional(),title:q.z.string()}),fe=V.extend({visibleTo:q.z.string().optional()}),Te=Z,De=T({actionSetId:q.z.string()}),Ae=T({actionSet:V}),Oe=T({newIndex:q.z.number().int().nonnegative(),oldIndex:q.z.number().int().nonnegative()});var Ee=fe,Fe=q.z.object({actionSetId:q.z.string()});q.z.object({actionSets:q.z.array(fe)});var qe=ke.extend({previousNamedExport:q.z.string().optional()});var L=q.z.record(q.z.string(),q.z.unknown()),ye=q.z.enum(["chromium","firefox","webkit"]),Ce=q.z.enum(["file","story","all","story-screenshot"]),G=q.z.object({requestId:q.z.string().optional(),requestType:Ce.optional()}),Re=q.z.custom(e=>e===void 0||typeof e=="object"),Me=q.z.custom(e=>e===void 0||typeof e=="object"),We=q.z.object({actionSets:q.z.array(V).optional(),args:L.optional(),browserOptions:Re.optional(),browserOptionsId:q.z.string().optional(),browserType:ye,props:L.optional(),screenshotOptions:Me.optional(),screenshotOptionsId:q.z.string().optional()}),je=We.extend({id:q.z.string(),index:q.z.number().int().nonnegative().optional(),title:q.z.string()}),fo=T({screenshotId:q.z.string()}),ze=T({newIndex:q.z.number().int().nonnegative(),oldIndex:q.z.number().int().nonnegative()}),Le=fo,Ue=T({}),Be=T({...je.shape,base64:q.z.string().optional(),updateScreenshot:je.omit({actionSets:true}).optional()}),yo=q.z.object({actionSets:q.z.array(V).optional(),args:L.optional(),browserOptions:q.z.unknown().optional(),browserOptionsId:q.z.string().optional(),browserType:ye,id:q.z.string(),index:q.z.number().int().nonnegative().optional(),props:L.optional(),screenshotOptions:q.z.unknown().optional(),screenshotOptionsId:q.z.string().optional(),title:q.z.string()}),_e=q.z.object({added:q.z.boolean().optional(),diffDirection:q.z.enum(["horizontal","vertical"]).optional(),diffPixelCount:q.z.number().optional(),diffRatio:q.z.number().optional(),diffSize:q.z.boolean().optional(),error:q.z.string().optional(),filePath:q.z.string().optional(),imageDimensions:q.z.object({baselineHeight:q.z.number(),baselineWidth:q.z.number(),receivedHeight:q.z.number(),receivedWidth:q.z.number()}).optional(),imgSrcString:q.z.string().optional(),index:q.z.number().int().nonnegative().optional(),newScreenshot:q.z.string().optional(),oldScreenShotTitle:q.z.string().optional(),pass:q.z.boolean().optional(),screenshotId:q.z.string().optional(),selected:q.z.boolean().optional(),storyId:q.z.string().optional()}),He=_e,Q=_e.extend({screenshotData:yo.optional()}),Ne=We.extend(G.shape).extend({storyId:q.z.string()}),$e=T({...G.shape,screenshotId:q.z.string()}),Ve=T({...G.shape}),Ke=T({...G.shape,requestType:Ce}),Ye=T({base64:q.z.string().optional(),screenshotId:q.z.string()}),Ze=q.z.object({story:q.z.object({changedArgs:L.optional(),initialArgs:L.optional(),argTypes:q.z.record(q.z.string(),q.z.unknown()).optional(),name:q.z.string(),title:q.z.string(),parameters:q.z.record(q.z.string(),q.z.unknown()).optional(),filePath:q.z.string(),id:q.z.string()}),browser:q.z.object({type:ye.nullable(),options:Re.optional()}),screenshotOptions:Me.optional()});function ge(e){let{screenshotTitle:t,storyId:o,storyTitle:r,browser:i}=e;return `${pe__default.default(`${r} ${o} ${t} ${i}`)}-snap.png`}function Xe(e){return !e||Object.keys(e).length===0?"":router.buildArgsParam({},e)}function Ge(e){if(!e)return "";let o=Object.keys(e).map(r=>{let i=e[r];return Array.isArray(i)?i.length>0&&typeof i[0]=="object"?`knob-${r}=${JSON.stringify(i)}`:`knob-${r}=${i.join(",")}`:typeof i=="object"?`knob-${r}=${JSON.stringify(i)}`:`knob-${r}=${i}`});return encodeURI(o.join("&"))}function Je(e,t,o,r){let i;/^\.{0,2}[/\\]/.test(e)?i=`file:///${e.replace(/\\/g,"/").replace(/^\/+/,"")}`:/^https?:\/\//i.test(e)||/^file:\/\//i.test(e)?i=Qe__default.default(e):i=Qe__default.default(`http://${e}`);let s=`${i}/iframe.html?id=${t}`;if(r){let n=Xe(r);n&&(s=`${s}&args=${n}`);}if(o){let n=Ge(o);n&&(s=`${s}&${n}`);}return s.replace(/\\/g,"/")}function J(e,t){if(!t)return;let o=t.split(".").join(".properties.");return objectPathImmutable.get(e,o)}function et(e,t){let o=J(t,e.name);if(!o)throw new Error(`Unable to find '${e.name}', possibly this action has deprecated/removed from playwright and or from custom definitions.`);let r=o.parameters||{};return Object.keys(r).reduce((s,n)=>{let a=o.required&&o.required.includes(n);if(e&&e.args&&e.args[n]!==void 0){let p=e.args[n];if(!a&&p!==null&&(p===void 0||typeof p=="object"&&Object.keys(p).length===0||Array.isArray(p)&&p.length===0))return s;s.push(e.args[n]);}else s.push(void 0);return s},[])}var j=e=>{if(!e)return;let t=e.args&&Object.keys(e.args).length?e.args:void 0;return t||(e.props&&Object.keys(e.props).length?e.props:void 0)};function tt(e,t){if(e===t)return true;let o=e.split(".").slice(0,-2).join(".");return t.split(".").slice(0,-1).join(".").endsWith(o)}function Co(e,t){let o=J(e,t.name);if(!o||!o.required||!o.required.length)return {};if(!t.args)return {required:o.required};if(Object.keys(t.args).length===0)return {required:o.required};let i=[];for(let s=0;s<o.required.length;s++){let n=o.required[s];t.args[n]||i.push(n);}return {required:i.length===0?void 0:i}}function st(e,t){return Co(e,t).required===void 0}function v(){throw new Error("Configuration has not been set.");}var at={clearInput:{kind:"function",type:"Promise",parameters:{selector:{type:"string"},options:{type:"object",properties:{timeout:{type:"number"},blur:{type:"boolean"}},additionalProperties:false}},required:["selector"],description:"This method fetches an element with `selector`, waits for actionability checks, focuses the element, clear it and triggers an input event. If the element matching selector is not an <input>, <textarea> or [contenteditable] element, this method throws an error."},dragDropSelector:{kind:"function",type:"Promise",parameters:{selector:{type:"string"},to:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},additionalProperties:false},mouseDownRelativeToSelector:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},additionalProperties:false},options:{type:"object",properties:{steps:{type:"number",default:1},skipMouseUp:{type:"boolean"}},additionalProperties:false}},required:["selector","to"],description:"This method fetches an element with `selector`, and move it to the position given by user. If there's no element matching `selector`, the method waits until a matching element appears in the DOM."},mouseFromTo:{kind:"function",type:"Promise",parameters:{from:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},additionalProperties:false},to:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},additionalProperties:false},options:{type:"object",properties:{steps:{type:"number",default:1},skipMouseUp:{type:"boolean"}},additionalProperties:false}},required:["from","to"],description:"This method will perform mouse down, move,and up from to selected location."},scrollSelector:{kind:"function",type:"Promise",parameters:{selector:{type:"string"},scrollProperty:{type:"object",properties:{top:{type:"number"},left:{type:"number"}},additionalProperties:false}},required:["selector","scrollProperty"],description:"This method fetches an element with `selector`, and set the selector scrollLeft and scrollTop. If there's no element matching `selector`, the method waits until a matching element appears in the DOM."},mouseDownOnSelector:{kind:"function",type:"Promise",parameters:{selector:{type:"string"},point:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},additionalProperties:false},options:{type:"object",properties:{steps:{type:"number",default:1}},additionalProperties:false}},required:["selector"],description:"This method fetches an element with `selector`, and perform mousedown on the center of selector. If there's no element matching `selector`, the method waits until a matching element appears in the DOM."},mouseMoveToSelector:{kind:"function",type:"Promise",parameters:{selector:{type:"string"},point:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},additionalProperties:false},options:{type:"object",properties:{steps:{type:"number",default:1}},additionalProperties:false}},required:["selector"],description:"This method fetches an element with `selector`, and move the mouse to center of selector. If there's no element matching `selector`, the method waits until a matching element appears in the DOM."},setSelectorSize:{kind:"function",type:"Promise",parameters:{selector:{type:"string"},width:{type:"string"},height:{type:"string"}},required:["selector"],description:"This method fetches an element with `selector`, set the height and with. If there's no element matching `selector`, the method waits until a matching element appears in the DOM."},selectorMouseWheel:{kind:"function",type:"Promise",parameters:{selector:{type:"string"},eventInitDict:{type:"object",properties:{deltaMode:{type:"number"},deltaX:{type:"number"},deltaY:{type:"number"},deltaZ:{type:"number"}},additionalProperties:false}},required:["selector"],description:"This method fetches an element with `selector`, and dispatch WheelEvent. If there's no element matching `selector`, the method waits until a matching element appears in the DOM."},touchStart:{kind:"function",type:"Promise",parameters:{selector:{type:"string"},page:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},additionalProperties:false},screen:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},additionalProperties:false},client:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},additionalProperties:false},options:{type:"object",properties:{bubbles:{type:"boolean",default:true},cancelable:{type:"boolean",default:true}},additionalProperties:false}},required:["selector"],description:"This method fetches an element with `selector`, and dispatch touchstart event. If there's no element matching `selector`, the method waits until a matching element appears in the DOM."},touchMove:{kind:"function",type:"Promise",parameters:{selector:{type:"string"},page:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},additionalProperties:false},screen:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},additionalProperties:false},client:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},additionalProperties:false},options:{type:"object",properties:{bubbles:{type:"boolean",default:true},cancelable:{type:"boolean",default:true}},additionalProperties:false}},required:["selector"],description:"This method fetches an element with `selector`, and dispatch touchmove event. If there's no element matching `selector`, the method waits until a matching element appears in the DOM."},touchEnd:{kind:"function",type:"Promise",parameters:{selector:{type:"string"},page:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},additionalProperties:false},screen:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},additionalProperties:false},client:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},additionalProperties:false},options:{type:"object",properties:{bubbles:{type:"boolean",default:true},cancelable:{type:"boolean",default:true}},additionalProperties:false}},required:["selector"],description:"This method fetches an element with `selector`, and dispatch touchend event. If there's no element matching `selector`, the method waits until a matching element appears in the DOM."},touchCancel:{kind:"function",type:"Promise",parameters:{selector:{type:"string"},page:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},additionalProperties:false},screen:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},additionalProperties:false},client:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},additionalProperties:false},options:{type:"object",properties:{bubbles:{type:"boolean",default:true},cancelable:{type:"boolean",default:true}},additionalProperties:false}},required:["selector"],description:"This method fetches an element with `selector`, and dispatch touchcancel event. If there's no element matching `selector`, the method waits until a matching element appears in the DOM."},touchFromTo:{kind:"function",type:"Promise",parameters:{selector:{type:"string"},pageFrom:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},additionalProperties:false},pageTo:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},additionalProperties:false},clientFrom:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},additionalProperties:false},clientTo:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},additionalProperties:false},screenFrom:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},additionalProperties:false},screenTo:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},additionalProperties:false},options:{type:"object",properties:{bubbles:{type:"boolean",default:true},cancelable:{type:"boolean",default:true}},additionalProperties:false}},required:["selector"],description:"This method fetches an element with `selector`, and dispatch touchstart,touchmove and touchend event. If there's no element matching `selector`, the method waits until a matching element appears in the DOM."},waitForSelector:{kind:"function",type:"Promise",parameters:{selector:{type:"string",description:"A selector to query for. See [working with selectors](https://playwright.dev/docs/selectors) for more details."},options:{type:"object",properties:{state:{type:"string",enum:["attached","detached","visible","hidden"],description:"Defaults to `'visible'`. Can be either:\n- `'attached'` - wait for element to be present in DOM.\n- `'detached'` - wait for element to not be present in DOM.\n- `'visible'` - wait for element to have non-empty bounding box and no `visibility:hidden`. Note that element without any content or with `display:none` has an empty bounding box and is not considered visible.\n- `'hidden'` - wait for element to be either detached from DOM, or have an empty bounding box or `visibility:hidden`. This is opposite to the `'visible'` option."},strict:{type:"boolean",description:"When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception."},timeout:{type:"number",description:"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-browsercontext#browser-context-set-default-timeout) or [page.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-page#page-set-default-timeout) methods."}},additionalProperties:false}},required:["selector","options"],description:"Returns when element specified by selector satisfies `state` option. Returns `null` if waiting for `hidden` or `detached`.\n\n> NOTE: Playwright automatically waits for element to be ready before performing an action. Using [Locator] objects and web-first assertions make the code wait-for-selector-free.\n\nWait for the `selector` to satisfy `state` option (either appear/disappear from dom, or become visible/hidden). If at the moment of calling the method `selector` already satisfies the condition, the method will return immediately. If the selector doesn't satisfy the condition for the `timeout` milliseconds, the function will throw.\n\nThis method works across navigations:\n\n```js const { chromium } = require('playwright'); // Or 'firefox' or 'webkit'.\n\n(async () => { const browser = await chromium.launch(); const page = await browser.newPage(); for (let currentURL of ['https://google.com', 'https://bbc.com']) { await page.goto(currentURL); const element = await page.waitForSelector('img'); console.log('Loaded image: ' + await element.getAttribute('src')); } await browser.close(); })(); ```"},check:{kind:"function",type:"Promise",parameters:{selector:{type:"string",description:"A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://playwright.dev/docs/selectors) for more details."},options:{type:"object",properties:{force:{type:"boolean",description:"Whether to bypass the [actionability](https://playwright.dev/docs/actionability) checks. Defaults to `false`."},noWaitAfter:{type:"boolean",description:"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`."},position:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},required:["x","y"],additionalProperties:false,description:"A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the element."},strict:{type:"boolean",description:"When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception."},timeout:{type:"number",description:"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-browsercontext#browser-context-set-default-timeout) or [page.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-page#page-set-default-timeout) methods."},trial:{type:"boolean",description:"When set, this method only performs the [actionability](https://playwright.dev/docs/actionability) checks and skips the action. Defaults to `false`. Useful to wait until the element is ready for the action without performing it."}},additionalProperties:false}},required:["selector"],description:"This method checks an element matching `selector` by performing the following steps: 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM. 1. Ensure that matched element is a checkbox or a radio input. If not, this method throws. If the element is already checked, this method returns immediately. 1. Wait for [actionability](https://playwright.dev/docs/actionability) checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried. 1. Scroll the element into view if needed. 1. Use [page.mouse](https://playwright.dev/docs/api/class-page#page-mouse) to click in the center of the element. 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set. 1. Ensure that the element is now checked. If not, this method throws.\n\nWhen all steps combined have not finished during the specified `timeout`, this method throws a [TimeoutError]. Passing zero timeout disables this.\n\nShortcut for main frame's [frame.check(selector[, options])](https://playwright.dev/docs/api/class-frame#frame-check)."},click:{kind:"function",type:"Promise",parameters:{selector:{type:"string",description:"A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://playwright.dev/docs/selectors) for more details."},options:{type:"object",properties:{button:{type:"string",enum:["left","right","middle"],description:"Defaults to `left`."},clickCount:{type:"number",description:"defaults to 1. See [UIEvent.detail]."},delay:{type:"number",description:"Time to wait between `mousedown` and `mouseup` in milliseconds. Defaults to 0."},force:{type:"boolean",description:"Whether to bypass the [actionability](https://playwright.dev/docs/actionability) checks. Defaults to `false`."},modifiers:{type:"array",items:{type:"string",enum:["Alt","Control","Meta","Shift"]},description:"Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current modifiers back. If not specified, currently pressed modifiers are used."},noWaitAfter:{type:"boolean",description:"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`."},position:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},required:["x","y"],additionalProperties:false,description:"A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the element."},strict:{type:"boolean",description:"When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception."},timeout:{type:"number",description:"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-browsercontext#browser-context-set-default-timeout) or [page.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-page#page-set-default-timeout) methods."},trial:{type:"boolean",description:"When set, this method only performs the [actionability](https://playwright.dev/docs/actionability) checks and skips the action. Defaults to `false`. Useful to wait until the element is ready for the action without performing it."}},additionalProperties:false}},required:["selector"],description:"This method clicks an element matching `selector` by performing the following steps: 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM. 1. Wait for [actionability](https://playwright.dev/docs/actionability) checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried. 1. Scroll the element into view if needed. 1. Use [page.mouse](https://playwright.dev/docs/api/class-page#page-mouse) to click in the center of the element, or the specified `position`. 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.\n\nWhen all steps combined have not finished during the specified `timeout`, this method throws a [TimeoutError]. Passing zero timeout disables this.\n\nShortcut for main frame's [frame.click(selector[, options])](https://playwright.dev/docs/api/class-frame#frame-click)."},dblclick:{kind:"function",type:"Promise",parameters:{selector:{type:"string",description:"A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://playwright.dev/docs/selectors) for more details."},options:{type:"object",properties:{button:{type:"string",enum:["left","right","middle"],description:"Defaults to `left`."},delay:{type:"number",description:"Time to wait between `mousedown` and `mouseup` in milliseconds. Defaults to 0."},force:{type:"boolean",description:"Whether to bypass the [actionability](https://playwright.dev/docs/actionability) checks. Defaults to `false`."},modifiers:{type:"array",items:{type:"string",enum:["Alt","Control","Meta","Shift"]},description:"Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current modifiers back. If not specified, currently pressed modifiers are used."},noWaitAfter:{type:"boolean",description:"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`."},position:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},required:["x","y"],additionalProperties:false,description:"A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the element."},strict:{type:"boolean",description:"When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception."},timeout:{type:"number",description:"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-browsercontext#browser-context-set-default-timeout) or [page.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-page#page-set-default-timeout) methods."},trial:{type:"boolean",description:"When set, this method only performs the [actionability](https://playwright.dev/docs/actionability) checks and skips the action. Defaults to `false`. Useful to wait until the element is ready for the action without performing it."}},additionalProperties:false}},required:["selector"],description:"This method double clicks an element matching `selector` by performing the following steps: 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM. 1. Wait for [actionability](https://playwright.dev/docs/actionability) checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried. 1. Scroll the element into view if needed. 1. Use [page.mouse](https://playwright.dev/docs/api/class-page#page-mouse) to double click in the center of the element, or the specified `position`. 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set. Note that if the first click of the `dblclick()` triggers a navigation event, this method will throw.\n\nWhen all steps combined have not finished during the specified `timeout`, this method throws a [TimeoutError]. Passing zero timeout disables this.\n\n> NOTE: `page.dblclick()` dispatches two `click` events and a single `dblclick` event.\n\nShortcut for main frame's [frame.dblclick(selector[, options])](https://playwright.dev/docs/api/class-frame#frame-dblclick)."},fill:{kind:"function",type:"Promise",parameters:{selector:{type:"string",description:"A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://playwright.dev/docs/selectors) for more details."},value:{type:"string",description:"Value to fill for the `<input>`, `<textarea>` or `[contenteditable]` element."},options:{type:"object",properties:{force:{type:"boolean",description:"Whether to bypass the [actionability](https://playwright.dev/docs/actionability) checks. Defaults to `false`."},noWaitAfter:{type:"boolean",description:"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`."},strict:{type:"boolean",description:"When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception."},timeout:{type:"number",description:"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-browsercontext#browser-context-set-default-timeout) or [page.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-page#page-set-default-timeout) methods."}},additionalProperties:false}},required:["selector","value"],description:"This method waits for an element matching `selector`, waits for [actionability](https://playwright.dev/docs/actionability) checks, focuses the element, fills it and triggers an `input` event after filling. Note that you can pass an empty string to clear the input field.\n\nIf the target element is not an `<input>`, `<textarea>` or `[contenteditable]` element, this method throws an error. However, if the element is inside the `<label>` element that has an associated [control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), the control will be filled instead.\n\nTo send fine-grained keyboard events, use [page.type(selector, text[, options])](https://playwright.dev/docs/api/class-page#page-type).\n\nShortcut for main frame's [frame.fill(selector, value[, options])](https://playwright.dev/docs/api/class-frame#frame-fill)."},focus:{kind:"function",type:"Promise",parameters:{selector:{type:"string",description:"A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://playwright.dev/docs/selectors) for more details."},options:{type:"object",properties:{strict:{type:"boolean",description:"When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception."},timeout:{type:"number",description:"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-browsercontext#browser-context-set-default-timeout) or [page.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-page#page-set-default-timeout) methods."}},additionalProperties:false}},required:["selector"],description:"This method fetches an element with `selector` and focuses it. If there's no element matching `selector`, the method waits until a matching element appears in the DOM.\n\nShortcut for main frame's [frame.focus(selector[, options])](https://playwright.dev/docs/api/class-frame#frame-focus)."},hover:{kind:"function",type:"Promise",parameters:{selector:{type:"string",description:"A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://playwright.dev/docs/selectors) for more details."},options:{type:"object",properties:{force:{type:"boolean",description:"Whether to bypass the [actionability](https://playwright.dev/docs/actionability) checks. Defaults to `false`."},modifiers:{type:"array",items:{type:"string",enum:["Alt","Control","Meta","Shift"]},description:"Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current modifiers back. If not specified, currently pressed modifiers are used."},position:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},required:["x","y"],additionalProperties:false,description:"A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the element."},strict:{type:"boolean",description:"When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception."},timeout:{type:"number",description:"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-browsercontext#browser-context-set-default-timeout) or [page.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-page#page-set-default-timeout) methods."},trial:{type:"boolean",description:"When set, this method only performs the [actionability](https://playwright.dev/docs/actionability) checks and skips the action. Defaults to `false`. Useful to wait until the element is ready for the action without performing it."}},additionalProperties:false}},required:["selector"],description:"This method hovers over an element matching `selector` by performing the following steps: 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM. 1. Wait for [actionability](https://playwright.dev/docs/actionability) checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried. 1. Scroll the element into view if needed. 1. Use [page.mouse](https://playwright.dev/docs/api/class-page#page-mouse) to hover over the center of the element, or the specified `position`. 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.\n\nWhen all steps combined have not finished during the specified `timeout`, this method throws a [TimeoutError]. Passing zero timeout disables this.\n\nShortcut for main frame's [frame.hover(selector[, options])](https://playwright.dev/docs/api/class-frame#frame-hover)."},keyboard:{type:"object",properties:{down:{kind:"function",type:"Promise",parameters:{key:{type:"string",description:"Name of the key to press or a character to generate, such as `ArrowLeft` or `a`."}},required:["key"],description:"Dispatches a `keydown` event.\n\n`key` can specify the intended [keyboardEvent.key](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key) value or a single character to generate the text for. A superset of the `key` values can be found [here](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values). Examples of the keys are:\n\n`F1` - `F12`, `Digit0`- `Digit9`, `KeyA`- `KeyZ`, `Backquote`, `Minus`, `Equal`, `Backslash`, `Backspace`, `Tab`, `Delete`, `Escape`, `ArrowDown`, `End`, `Enter`, `Home`, `Insert`, `PageDown`, `PageUp`, `ArrowRight`, `ArrowUp`, etc.\n\nFollowing modification shortcuts are also supported: `Shift`, `Control`, `Alt`, `Meta`, `ShiftLeft`.\n\nHolding down `Shift` will type the text that corresponds to the `key` in the upper case.\n\nIf `key` is a single character, it is case-sensitive, so the values `a` and `A` will generate different respective texts.\n\nIf `key` is a modifier key, `Shift`, `Meta`, `Control`, or `Alt`, subsequent key presses will be sent with that modifier active. To release the modifier key, use [keyboard.up(key)](https://playwright.dev/docs/api/class-keyboard#keyboard-up).\n\nAfter the key is pressed once, subsequent calls to [keyboard.down(key)](https://playwright.dev/docs/api/class-keyboard#keyboard-down) will have [repeat](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/repeat) set to true. To release the key, use [keyboard.up(key)](https://playwright.dev/docs/api/class-keyboard#keyboard-up).\n\n> NOTE: Modifier keys DO influence `keyboard.down`. Holding down `Shift` will type the text in upper case."},insertText:{kind:"function",type:"Promise",parameters:{text:{type:"string",description:"Sets input to the specified text value."}},required:["text"],description:"Dispatches only `input` event, does not emit the `keydown`, `keyup` or `keypress` events.\n\n```js page.keyboard.insertText('\u55E8'); ```\n\n> NOTE: Modifier keys DO NOT effect `keyboard.insertText`. Holding down `Shift` will not type the text in upper case."},press:{kind:"function",type:"Promise",parameters:{key:{type:"string",description:"Name of the key to press or a character to generate, such as `ArrowLeft` or `a`."},options:{type:"object",properties:{delay:{type:"number",description:"Time to wait between `keydown` and `keyup` in milliseconds. Defaults to 0."}},additionalProperties:false}},required:["key"],description:"`key` can specify the intended [keyboardEvent.key](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key) value or a single character to generate the text for. A superset of the `key` values can be found [here](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values). Examples of the keys are:\n\n`F1` - `F12`, `Digit0`- `Digit9`, `KeyA`- `KeyZ`, `Backquote`, `Minus`, `Equal`, `Backslash`, `Backspace`, `Tab`, `Delete`, `Escape`, `ArrowDown`, `End`, `Enter`, `Home`, `Insert`, `PageDown`, `PageUp`, `ArrowRight`, `ArrowUp`, etc.\n\nFollowing modification shortcuts are also supported: `Shift`, `Control`, `Alt`, `Meta`, `ShiftLeft`.\n\nHolding down `Shift` will type the text that corresponds to the `key` in the upper case.\n\nIf `key` is a single character, it is case-sensitive, so the values `a` and `A` will generate different respective texts.\n\nShortcuts such as `key: \"Control+o\"` or `key: \"Control+Shift+T\"` are supported as well. When specified with the modifier, modifier is pressed and being held while the subsequent key is being pressed.\n\n```js const page = await browser.newPage(); await page.goto('https://keycode.info'); await page.keyboard.press('A'); await page.screenshot({ path: 'A.png' }); await page.keyboard.press('ArrowLeft'); await page.screenshot({ path: 'ArrowLeft.png' }); await page.keyboard.press('Shift+O'); await page.screenshot({ path: 'O.png' }); await browser.close(); ```\n\nShortcut for [keyboard.down(key)](https://playwright.dev/docs/api/class-keyboard#keyboard-down) and [keyboard.up(key)](https://playwright.dev/docs/api/class-keyboard#keyboard-up)."},type:{kind:"function",type:"Promise",parameters:{text:{type:"string",description:"A text to type into a focused element."},options:{type:"object",properties:{delay:{type:"number",description:"Time to wait between key presses in milliseconds. Defaults to 0."}},additionalProperties:false}},required:["text"],description:"Sends a `keydown`, `keypress`/`input`, and `keyup` event for each character in the text.\n\nTo press a special key, like `Control` or `ArrowDown`, use [keyboard.press(key[, options])](https://playwright.dev/docs/api/class-keyboard#keyboard-press).\n\n```js await page.keyboard.type('Hello'); // Types instantly await page.keyboard.type('World', {delay: 100}); // Types slower, like a user ```\n\n> NOTE: Modifier keys DO NOT effect `keyboard.type`. Holding down `Shift` will not type the text in upper case. > NOTE: For characters that are not on a US keyboard, only an `input` event will be sent."},up:{kind:"function",type:"Promise",parameters:{key:{type:"string",description:"Name of the key to press or a character to generate, such as `ArrowLeft` or `a`."}},required:["key"],description:"Dispatches a `keyup` event."}},required:["down","insertText","press","type","up"],additionalProperties:false,description:"Keyboard provides an api for managing a virtual keyboard. The high level api is [keyboard.type(text[, options])](https://playwright.dev/docs/api/class-keyboard#keyboard-type), which takes raw characters and generates proper keydown, keypress/input, and keyup events on your page.\n\nFor finer control, you can use [keyboard.down(key)](https://playwright.dev/docs/api/class-keyboard#keyboard-down), [keyboard.up(key)](https://playwright.dev/docs/api/class-keyboard#keyboard-up), and [keyboard.insertText(text)](https://playwright.dev/docs/api/class-keyboard#keyboard-insert-text) to manually fire events as if they were generated from a real keyboard.\n\nAn example of holding down `Shift` in order to select and delete some text:\n\n```js await page.keyboard.type('Hello World!'); await page.keyboard.press('ArrowLeft');\n\nawait page.keyboard.down('Shift'); for (let i = 0; i < ' World'.length; i++) await page.keyboard.press('ArrowLeft'); await page.keyboard.up('Shift');\n\nawait page.keyboard.press('Backspace'); // Result text will end up saying 'Hello!' ```\n\nAn example of pressing uppercase `A`\n\n```js await page.keyboard.press('Shift+KeyA'); // or await page.keyboard.press('Shift+A'); ```\n\nAn example to trigger select-all with the keyboard\n\n```js // on Windows and Linux await page.keyboard.press('Control+A'); // on macOS await page.keyboard.press('Meta+A'); ```"},mouse:{type:"object",properties:{click:{kind:"function",type:"Promise",parameters:{x:{type:"number"},y:{type:"number"},options:{type:"object",properties:{button:{type:"string",enum:["left","right","middle"],description:"Defaults to `left`."},clickCount:{type:"number",description:"defaults to 1. See [UIEvent.detail]."},delay:{type:"number",description:"Time to wait between `mousedown` and `mouseup` in milliseconds. Defaults to 0."}},additionalProperties:false}},required:["x","y"],description:"Shortcut for [mouse.move(x, y[, options])](https://playwright.dev/docs/api/class-mouse#mouse-move), [mouse.down([options])](https://playwright.dev/docs/api/class-mouse#mouse-down), [mouse.up([options])](https://playwright.dev/docs/api/class-mouse#mouse-up)."},dblclick:{kind:"function",type:"Promise",parameters:{x:{type:"number"},y:{type:"number"},options:{type:"object",properties:{button:{type:"string",enum:["left","right","middle"],description:"Defaults to `left`."},delay:{type:"number",description:"Time to wait between `mousedown` and `mouseup` in milliseconds. Defaults to 0."}},additionalProperties:false}},required:["x","y"],description:"Shortcut for [mouse.move(x, y[, options])](https://playwright.dev/docs/api/class-mouse#mouse-move), [mouse.down([options])](https://playwright.dev/docs/api/class-mouse#mouse-down), [mouse.up([options])](https://playwright.dev/docs/api/class-mouse#mouse-up), [mouse.down([options])](https://playwright.dev/docs/api/class-mouse#mouse-down) and [mouse.up([options])](https://playwright.dev/docs/api/class-mouse#mouse-up)."},down:{kind:"function",type:"Promise",parameters:{options:{type:"object",properties:{button:{type:"string",enum:["left","right","middle"],description:"Defaults to `left`."},clickCount:{type:"number",description:"defaults to 1. See [UIEvent.detail]."}},additionalProperties:false}},required:[],description:"Dispatches a `mousedown` event."},move:{kind:"function",type:"Promise",parameters:{x:{type:"number"},y:{type:"number"},options:{type:"object",properties:{steps:{type:"number",description:"defaults to 1. Sends intermediate `mousemove` events."}},additionalProperties:false}},required:["x","y"],description:"Dispatches a `mousemove` event."},up:{kind:"function",type:"Promise",parameters:{options:{type:"object",properties:{button:{type:"string",enum:["left","right","middle"],description:"Defaults to `left`."},clickCount:{type:"number",description:"defaults to 1. See [UIEvent.detail]."}},additionalProperties:false}},required:[],description:"Dispatches a `mouseup` event."}},required:["click","dblclick","down","move","up"],additionalProperties:false,description:"The Mouse class operates in main-frame CSS pixels relative to the top-left corner of the viewport.\n\nEvery `page` object has its own Mouse, accessible with [page.mouse](https://playwright.dev/docs/api/class-page#page-mouse).\n\n```js // Using \u2018page.mouse\u2019 to trace a 100x100 square. await page.mouse.move(0, 0); await page.mouse.down(); await page.mouse.move(0, 100); await page.mouse.move(100, 100); await page.mouse.move(100, 0); await page.mouse.move(0, 0); await page.mouse.up(); ```"},press:{kind:"function",type:"Promise",parameters:{selector:{type:"string",description:"A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://playwright.dev/docs/selectors) for more details."},key:{type:"string",description:"Name of the key to press or a character to generate, such as `ArrowLeft` or `a`."},options:{type:"object",properties:{delay:{type:"number",description:"Time to wait between `keydown` and `keyup` in milliseconds. Defaults to 0."},noWaitAfter:{type:"boolean",description:"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`."},strict:{type:"boolean",description:"When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception."},timeout:{type:"number",description:"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-browsercontext#browser-context-set-default-timeout) or [page.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-page#page-set-default-timeout) methods."}},additionalProperties:false}},required:["selector","key"],description:"Focuses the element, and then uses [keyboard.down(key)](https://playwright.dev/docs/api/class-keyboard#keyboard-down) and [keyboard.up(key)](https://playwright.dev/docs/api/class-keyboard#keyboard-up).\n\n`key` can specify the intended [keyboardEvent.key](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key) value or a single character to generate the text for. A superset of the `key` values can be found [here](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values). Examples of the keys are:\n\n`F1` - `F12`, `Digit0`- `Digit9`, `KeyA`- `KeyZ`, `Backquote`, `Minus`, `Equal`, `Backslash`, `Backspace`, `Tab`, `Delete`, `Escape`, `ArrowDown`, `End`, `Enter`, `Home`, `Insert`, `PageDown`, `PageUp`, `ArrowRight`, `ArrowUp`, etc.\n\nFollowing modification shortcuts are also supported: `Shift`, `Control`, `Alt`, `Meta`, `ShiftLeft`.\n\nHolding down `Shift` will type the text that corresponds to the `key` in the upper case.\n\nIf `key` is a single character, it is case-sensitive, so the values `a` and `A` will generate different respective texts.\n\nShortcuts such as `key: \"Control+o\"` or `key: \"Control+Shift+T\"` are supported as well. When specified with the modifier, modifier is pressed and being held while the subsequent key is being pressed.\n\n```js const page = await browser.newPage(); await page.goto('https://keycode.info'); await page.press('body', 'A'); await page.screenshot({ path: 'A.png' }); await page.press('body', 'ArrowLeft'); await page.screenshot({ path: 'ArrowLeft.png' }); await page.press('body', 'Shift+O'); await page.screenshot({ path: 'O.png' }); await browser.close(); ```"},touchscreen:{type:"object",properties:{tap:{kind:"function",type:"Promise",parameters:{x:{type:"number"},y:{type:"number"}},required:["x","y"],description:"Dispatches a `touchstart` and `touchend` event with a single touch at the position (`x`,`y`)."}},required:["tap"],additionalProperties:false,description:"The Touchscreen class operates in main-frame CSS pixels relative to the top-left corner of the viewport. Methods on the touchscreen can only be used in browser contexts that have been initialized with `hasTouch` set to true."},type:{kind:"function",type:"Promise",parameters:{selector:{type:"string",description:"A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://playwright.dev/docs/selectors) for more details."},text:{type:"string",description:"A text to type into a focused element."},options:{type:"object",properties:{delay:{type:"number",description:"Time to wait between key presses in milliseconds. Defaults to 0."},noWaitAfter:{type:"boolean",description:"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`."},strict:{type:"boolean",description:"When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception."},timeout:{type:"number",description:"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-browsercontext#browser-context-set-default-timeout) or [page.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-page#page-set-default-timeout) methods."}},additionalProperties:false}},required:["selector","text"],description:"Sends a `keydown`, `keypress`/`input`, and `keyup` event for each character in the text. `page.type` can be used to send fine-grained keyboard events. To fill values in form fields, use [page.fill(selector, value[, options])](https://playwright.dev/docs/api/class-page#page-fill).\n\nTo press a special key, like `Control` or `ArrowDown`, use [keyboard.press(key[, options])](https://playwright.dev/docs/api/class-keyboard#keyboard-press).\n\n```js await page.type('#mytextarea', 'Hello'); // Types instantly await page.type('#mytextarea', 'World', {delay: 100}); // Types slower, like a user ```\n\nShortcut for main frame's [frame.type(selector, text[, options])](https://playwright.dev/docs/api/class-frame#frame-type)."},uncheck:{kind:"function",type:"Promise",parameters:{selector:{type:"string",description:"A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://playwright.dev/docs/selectors) for more details."},options:{type:"object",properties:{force:{type:"boolean",description:"Whether to bypass the [actionability](https://playwright.dev/docs/actionability) checks. Defaults to `false`."},noWaitAfter:{type:"boolean",description:"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`."},position:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},required:["x","y"],additionalProperties:false,description:"A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the element."},strict:{type:"boolean",description:"When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception."},timeout:{type:"number",description:"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-browsercontext#browser-context-set-default-timeout) or [page.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-page#page-set-default-timeout) methods."},trial:{type:"boolean",description:"When set, this method only performs the [actionability](https://playwright.dev/docs/actionability) checks and skips the action. Defaults to `false`. Useful to wait until the element is ready for the action without performing it."}},additionalProperties:false}},required:["selector"],description:"This method unchecks an element matching `selector` by performing the following steps: 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM. 1. Ensure that matched element is a checkbox or a radio input. If not, this method throws. If the element is already unchecked, this method returns immediately. 1. Wait for [actionability](https://playwright.dev/docs/actionability) checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried. 1. Scroll the element into view if needed. 1. Use [page.mouse](https://playwright.dev/docs/api/class-page#page-mouse) to click in the center of the element. 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set. 1. Ensure that the element is now unchecked. If not, this method throws.\n\nWhen all steps combined have not finished during the specified `timeout`, this method throws a [TimeoutError]. Passing zero timeout disables this.\n\nShortcut for main frame's [frame.uncheck(selector[, options])](https://playwright.dev/docs/api/class-frame#frame-uncheck)."},waitForTimeout:{kind:"function",type:"Promise",parameters:{timeout:{type:"number",description:"A timeout to wait for"}},required:["timeout"],description:"Waits for the given `timeout` in milliseconds.\n\nNote that `page.waitForTimeout()` should only be used for debugging. Tests using the timer in production are going to be flaky. Use signals such as network events, selectors becoming visible and others instead.\n\n```js // wait for 1 second await page.waitForTimeout(1000); ```\n\nShortcut for main frame's [frame.waitForTimeout(timeout)](https://playwright.dev/docs/api/class-frame#frame-wait-for-timeout)."},takeScreenshot:{kind:"function",type:"Promise",parameters:{stitchOptions:{type:"object",properties:{blend:{type:"string",enum:["clear","source","over","in","out","atop","dest","dest-over","dest-in","dest-out","dest-atop","xor","add","saturate","multiply","screen","overlay","darken","lighten","colour-dodge","colour-burn","hard-light","soft-light","difference","exclusion"],description:"How to blend this image with the image below. (optional)",default:"multiply"}},additionalProperties:false}},required:[],description:"This method will take a screenshot at the position that it activated, its useful for taking a screenshot in sequence for events/actions. In the end the screenshots will be merged with the final screenshot."},takeScreenshotAll:{kind:"function",type:"Promise",parameters:{stitchOptions:{type:"object",properties:{blend:{type:"string",enum:["clear","source","over","in","out","atop","dest","dest-over","dest-in","dest-out","dest-atop","xor","add","saturate","multiply","screen","overlay","darken","lighten","colour-dodge","colour-burn","hard-light","soft-light","difference","exclusion"],description:"How to blend this image with the image below. (optional)",default:"multiply"}},additionalProperties:false}},required:[],description:"This method will take a screenshot after each action, its useful for looking at over all action execution. In the end the screenshots will be merged."},takeElementScreenshot:{kind:"function",type:"Promise",parameters:{selector:{type:"string"}},required:["selector"],description:"This method will take a screenshot of an element."},takeScreenshotOptions:{kind:"function",type:"Promise",parameters:{mergeType:{type:"string",enum:["stitch","overlay"]},stitchOptions:{type:"object",properties:{direction:{type:"string",enum:["vertical","horizontal"],description:"Direction of the merged image."},align:{type:"string",enum:["start","center","end"],description:"Aligning of given images. If the images are not all the same size, images will be sorted to largest image. Possible values are `start`, `center` and `end`. Default is `start`."},offset:{type:"number",description:"Offset in pixels between each image. Default is `0`"},margin:{type:"string",description:"Set the margin of image, considered as standard css shorthand properties (e.g. '40 40 0 10')",default:"0 0 0 0"},color:{type:"string",description:"Set the background color of image."}},additionalProperties:false},overlayOptions:{type:"object",properties:{blend:{type:"string",enum:["clear","source","over","in","out","atop","dest","dest-over","dest-in","dest-out","dest-atop","xor","add","saturate","multiply","screen","overlay","darken","lighten","colour-dodge","colour-burn","hard-light","soft-light","difference","exclusion"],description:"How to blend this image with the image below. (optional)",default:"multiply"}},additionalProperties:false}},required:[],description:"The purpose of this action is to have centralized options for all screenshots. This action can be used in conjunction with takeScreenshot action only. Only one instance can be used."}};function te(){let e=at,t=v().customActionSchema;return t&&(e={...e,...t}),e}async function pt(e,t){let o=te();if(!st(o,t))return;let r=et(t,o),i=t.name.split("."),s=e,n=[s];for(let a=0;a<i.length;a++){let p=i[a];if(typeof s!="object"&&typeof s!="function"||s===null)break;let l=s[p];if(l===void 0)break;s=l,n.push(s);}if(n.length!==1&&typeof s=="function")return await s.call(n[n.length-2],...r)}async function w(e,t,o=true){return new Promise((r,i)=>{if(!N__namespace.default.existsSync(e)){if(!o){r(void 0);return}r(t==="*"?{stories:{}}:{stories:{[t]:{}}});return}jsonfile.readFile(e,(s,n)=>{if(s){i(s);return}let a=n||{stories:{}};a.stories||(a.stories={}),!a.stories[t]&&t!=="*"&&(a.stories[t]={}),r(a);});})}async function ct(e){let t=await w(e,"*")||{stories:{}},o=t.stories||{},i=Object.keys(o).map(s=>({data:o[s],storyId:s}));return {playWrightData:t,storyData:i}}function g(e){let t=R__namespace.resolve(e),o=R__namespace.parse(t),r=o.ext===".json"?`${o.name}.json`:`${o.name}.playwright.json`;return {dir:o.dir,name:r,path:R__namespace.join(R__namespace.dirname(t),r),screenShotsDir:R__namespace.join(o.dir,"__screenshots__")}}function zo(e){let t=e;for(;t!==R__namespace.default.dirname(t);){let o=R__namespace.default.join(t,"package.json");try{return ue.resolve(o),o}catch{}t=R__namespace.default.dirname(t);}throw new Error("Cannot find package.json")}function lt(){let e=zo(process.cwd());return ue(e).version.split(".")[0].toString()}async function dt(e){await e.waitForLoadState("load"),await e.evaluate(`
|
|
1
|
+
'use strict';var q=require('zod'),Ho=require('array-move'),pe=require('lodash/kebabCase'),router=require('@storybook/core/router'),Qe=require('normalize-url'),objectPathImmutable=require('object-path-immutable');require('@pixpilot/dom'),require('@storybook/components'),require('@storybook/icons'),require('react'),require('@pixpilot/hash'),require('sonner');var N=require('fs'),jsonfile=require('jsonfile'),R=require('path'),ut=require('fast-deep-equal'),nanoid=require('nanoid'),server=require('@trpc/server'),Go=require('deepmerge'),rr=require('join-images'),ir=require('sharp'),diffSnapshot=require('jest-image-snapshot/src/diff-snapshot'),pr=require('p-limit'),ar=require('fast-glob');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var q__default=/*#__PURE__*/_interopDefault(q);var Ho__default=/*#__PURE__*/_interopDefault(Ho);var pe__default=/*#__PURE__*/_interopDefault(pe);var Qe__default=/*#__PURE__*/_interopDefault(Qe);var N__namespace=/*#__PURE__*/_interopNamespace(N);var R__namespace=/*#__PURE__*/_interopNamespace(R);var ut__default=/*#__PURE__*/_interopDefault(ut);var Go__default=/*#__PURE__*/_interopDefault(Go);var rr__default=/*#__PURE__*/_interopDefault(rr);var ir__default=/*#__PURE__*/_interopDefault(ir);var pr__default=/*#__PURE__*/_interopDefault(pr);var ar__default=/*#__PURE__*/_interopDefault(ar);var ue=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,o)=>(typeof require<"u"?require:t)[o]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var Pe={filePath:q__default.default.string(),storyId:q__default.default.string()};q__default.default.object(Pe);function T(e){return q__default.default.object({...Pe,...e})}var Z=T({}),ke=q__default.default.object({filePath:q__default.default.string(),id:q__default.default.string(),name:q__default.default.string(),parent:q__default.default.string()});var ho=q.z.object({args:q.z.record(q.z.string(),q.z.unknown()).optional(),id:q.z.string(),labe:q.z.string().optional(),name:q.z.string(),subtitleItems:q.z.array(q.z.string()).optional()}),V=q.z.object({actions:q.z.array(ho),id:q.z.string(),temp:q.z.boolean().optional(),title:q.z.string()}),fe=V.extend({visibleTo:q.z.string().optional()}),Te=Z,De=T({actionSetId:q.z.string()}),Ae=T({actionSet:V}),Oe=T({newIndex:q.z.number().int().nonnegative(),oldIndex:q.z.number().int().nonnegative()});var Ee=fe,Fe=q.z.object({actionSetId:q.z.string()});q.z.object({actionSets:q.z.array(fe)});var qe=ke.extend({previousNamedExport:q.z.string().optional()});var L=q.z.record(q.z.string(),q.z.unknown()),ye=q.z.enum(["chromium","firefox","webkit"]),Ce=q.z.enum(["file","story","all","story-screenshot"]),G=q.z.object({requestId:q.z.string().optional(),requestType:Ce.optional()}),Re=q.z.custom(e=>e===void 0||typeof e=="object"),Me=q.z.custom(e=>e===void 0||typeof e=="object"),We=q.z.object({actionSets:q.z.array(V).optional(),args:L.optional(),browserOptions:Re.optional(),browserOptionsId:q.z.string().optional(),browserType:ye,props:L.optional(),screenshotOptions:Me.optional(),screenshotOptionsId:q.z.string().optional()}),je=We.extend({id:q.z.string(),index:q.z.number().int().nonnegative().optional(),title:q.z.string()}),fo=T({screenshotId:q.z.string()}),ze=T({newIndex:q.z.number().int().nonnegative(),oldIndex:q.z.number().int().nonnegative()}),Le=fo,Ue=T({}),Be=T({...je.shape,base64:q.z.string().optional(),updateScreenshot:je.omit({actionSets:true}).optional()}),yo=q.z.object({actionSets:q.z.array(V).optional(),args:L.optional(),browserOptions:q.z.unknown().optional(),browserOptionsId:q.z.string().optional(),browserType:ye,id:q.z.string(),index:q.z.number().int().nonnegative().optional(),props:L.optional(),screenshotOptions:q.z.unknown().optional(),screenshotOptionsId:q.z.string().optional(),title:q.z.string()}),_e=q.z.object({added:q.z.boolean().optional(),diffDirection:q.z.enum(["horizontal","vertical"]).optional(),diffPixelCount:q.z.number().optional(),diffRatio:q.z.number().optional(),diffSize:q.z.boolean().optional(),error:q.z.string().optional(),filePath:q.z.string().optional(),imageDimensions:q.z.object({baselineHeight:q.z.number(),baselineWidth:q.z.number(),receivedHeight:q.z.number(),receivedWidth:q.z.number()}).optional(),imgSrcString:q.z.string().optional(),index:q.z.number().int().nonnegative().optional(),newScreenshot:q.z.string().optional(),oldScreenShotTitle:q.z.string().optional(),pass:q.z.boolean().optional(),screenshotId:q.z.string().optional(),selected:q.z.boolean().optional(),storyId:q.z.string().optional()}),He=_e,Q=_e.extend({screenshotData:yo.optional()}),Ne=We.extend(G.shape).extend({storyId:q.z.string()}),$e=T({...G.shape,screenshotId:q.z.string()}),Ve=T({...G.shape}),Ke=T({...G.shape,requestType:Ce}),Ye=T({base64:q.z.string().optional(),screenshotId:q.z.string()}),Ze=q.z.object({story:q.z.object({changedArgs:L.optional(),initialArgs:L.optional(),argTypes:q.z.record(q.z.string(),q.z.unknown()).optional(),name:q.z.string(),title:q.z.string(),parameters:q.z.record(q.z.string(),q.z.unknown()).optional(),filePath:q.z.string(),id:q.z.string()}),browser:q.z.object({type:ye.nullable(),options:Re.optional()}),screenshotOptions:Me.optional()});function ge(e){let{screenshotTitle:t,storyId:o,storyTitle:r,browser:i}=e;return `${pe__default.default(`${r} ${o} ${t} ${i}`)}-snap.png`}function Xe(e){return !e||Object.keys(e).length===0?"":router.buildArgsParam({},e)}function Ge(e){if(!e)return "";let o=Object.keys(e).map(r=>{let i=e[r];return Array.isArray(i)?i.length>0&&typeof i[0]=="object"?`knob-${r}=${JSON.stringify(i)}`:`knob-${r}=${i.join(",")}`:typeof i=="object"?`knob-${r}=${JSON.stringify(i)}`:`knob-${r}=${i}`});return encodeURI(o.join("&"))}function Je(e,t,o,r){let i;/^\.{0,2}[/\\]/.test(e)?i=`file:///${e.replace(/\\/g,"/").replace(/^\/+/,"")}`:/^https?:\/\//i.test(e)||/^file:\/\//i.test(e)?i=Qe__default.default(e):i=Qe__default.default(`http://${e}`);let s=`${i}/iframe.html?id=${t}`;if(r){let n=Xe(r);n&&(s=`${s}&args=${n}`);}if(o){let n=Ge(o);n&&(s=`${s}&${n}`);}return s.replace(/\\/g,"/")}function J(e,t){if(!t)return;let o=t.split(".").join(".properties.");return objectPathImmutable.get(e,o)}function et(e,t){let o=J(t,e.name);if(!o)throw new Error(`Unable to find '${e.name}', possibly this action has deprecated/removed from playwright and or from custom definitions.`);let r=o.parameters||{};return Object.keys(r).reduce((s,n)=>{let a=o.required&&o.required.includes(n);if(e&&e.args&&e.args[n]!==void 0){let p=e.args[n];if(!a&&p!==null&&(p===void 0||typeof p=="object"&&Object.keys(p).length===0||Array.isArray(p)&&p.length===0))return s;s.push(e.args[n]);}else s.push(void 0);return s},[])}var j=e=>{if(!e)return;let t=e.args&&Object.keys(e.args).length?e.args:void 0;return t||(e.props&&Object.keys(e.props).length?e.props:void 0)};function tt(e,t){if(e===t)return true;let o=e.split(".").slice(0,-2).join(".");return t.split(".").slice(0,-1).join(".").endsWith(o)}function Co(e,t){let o=J(e,t.name);if(!o||!o.required||!o.required.length)return {};if(!t.args)return {required:o.required};if(Object.keys(t.args).length===0)return {required:o.required};let i=[];for(let s=0;s<o.required.length;s++){let n=o.required[s];t.args[n]||i.push(n);}return {required:i.length===0?void 0:i}}function st(e,t){return Co(e,t).required===void 0}function v(){throw new Error("Configuration has not been set.");}var at={clearInput:{kind:"function",type:"Promise",parameters:{selector:{type:"string"},options:{type:"object",properties:{timeout:{type:"number"},blur:{type:"boolean"}},additionalProperties:false}},required:["selector"],description:"This method fetches an element with `selector`, waits for actionability checks, focuses the element, clear it and triggers an input event. If the element matching selector is not an <input>, <textarea> or [contenteditable] element, this method throws an error."},dragDropSelector:{kind:"function",type:"Promise",parameters:{selector:{type:"string"},to:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},additionalProperties:false},mouseDownRelativeToSelector:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},additionalProperties:false},options:{type:"object",properties:{steps:{type:"number",default:1},skipMouseUp:{type:"boolean"}},additionalProperties:false}},required:["selector","to"],description:"This method fetches an element with `selector`, and move it to the position given by user. If there's no element matching `selector`, the method waits until a matching element appears in the DOM."},mouseFromTo:{kind:"function",type:"Promise",parameters:{from:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},additionalProperties:false},to:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},additionalProperties:false},options:{type:"object",properties:{steps:{type:"number",default:1},skipMouseUp:{type:"boolean"}},additionalProperties:false}},required:["from","to"],description:"This method will perform mouse down, move,and up from to selected location."},scrollSelector:{kind:"function",type:"Promise",parameters:{selector:{type:"string"},scrollProperty:{type:"object",properties:{top:{type:"number"},left:{type:"number"}},additionalProperties:false}},required:["selector","scrollProperty"],description:"This method fetches an element with `selector`, and set the selector scrollLeft and scrollTop. If there's no element matching `selector`, the method waits until a matching element appears in the DOM."},mouseDownOnSelector:{kind:"function",type:"Promise",parameters:{selector:{type:"string"},point:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},additionalProperties:false},options:{type:"object",properties:{steps:{type:"number",default:1}},additionalProperties:false}},required:["selector"],description:"This method fetches an element with `selector`, and perform mousedown on the center of selector. If there's no element matching `selector`, the method waits until a matching element appears in the DOM."},mouseMoveToSelector:{kind:"function",type:"Promise",parameters:{selector:{type:"string"},point:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},additionalProperties:false},options:{type:"object",properties:{steps:{type:"number",default:1}},additionalProperties:false}},required:["selector"],description:"This method fetches an element with `selector`, and move the mouse to center of selector. If there's no element matching `selector`, the method waits until a matching element appears in the DOM."},setSelectorSize:{kind:"function",type:"Promise",parameters:{selector:{type:"string"},width:{type:"string"},height:{type:"string"}},required:["selector"],description:"This method fetches an element with `selector`, set the height and with. If there's no element matching `selector`, the method waits until a matching element appears in the DOM."},selectorMouseWheel:{kind:"function",type:"Promise",parameters:{selector:{type:"string"},eventInitDict:{type:"object",properties:{deltaMode:{type:"number"},deltaX:{type:"number"},deltaY:{type:"number"},deltaZ:{type:"number"}},additionalProperties:false}},required:["selector"],description:"This method fetches an element with `selector`, and dispatch WheelEvent. If there's no element matching `selector`, the method waits until a matching element appears in the DOM."},touchStart:{kind:"function",type:"Promise",parameters:{selector:{type:"string"},page:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},additionalProperties:false},screen:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},additionalProperties:false},client:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},additionalProperties:false},options:{type:"object",properties:{bubbles:{type:"boolean",default:true},cancelable:{type:"boolean",default:true}},additionalProperties:false}},required:["selector"],description:"This method fetches an element with `selector`, and dispatch touchstart event. If there's no element matching `selector`, the method waits until a matching element appears in the DOM."},touchMove:{kind:"function",type:"Promise",parameters:{selector:{type:"string"},page:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},additionalProperties:false},screen:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},additionalProperties:false},client:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},additionalProperties:false},options:{type:"object",properties:{bubbles:{type:"boolean",default:true},cancelable:{type:"boolean",default:true}},additionalProperties:false}},required:["selector"],description:"This method fetches an element with `selector`, and dispatch touchmove event. If there's no element matching `selector`, the method waits until a matching element appears in the DOM."},touchEnd:{kind:"function",type:"Promise",parameters:{selector:{type:"string"},page:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},additionalProperties:false},screen:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},additionalProperties:false},client:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},additionalProperties:false},options:{type:"object",properties:{bubbles:{type:"boolean",default:true},cancelable:{type:"boolean",default:true}},additionalProperties:false}},required:["selector"],description:"This method fetches an element with `selector`, and dispatch touchend event. If there's no element matching `selector`, the method waits until a matching element appears in the DOM."},touchCancel:{kind:"function",type:"Promise",parameters:{selector:{type:"string"},page:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},additionalProperties:false},screen:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},additionalProperties:false},client:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},additionalProperties:false},options:{type:"object",properties:{bubbles:{type:"boolean",default:true},cancelable:{type:"boolean",default:true}},additionalProperties:false}},required:["selector"],description:"This method fetches an element with `selector`, and dispatch touchcancel event. If there's no element matching `selector`, the method waits until a matching element appears in the DOM."},touchFromTo:{kind:"function",type:"Promise",parameters:{selector:{type:"string"},pageFrom:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},additionalProperties:false},pageTo:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},additionalProperties:false},clientFrom:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},additionalProperties:false},clientTo:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},additionalProperties:false},screenFrom:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},additionalProperties:false},screenTo:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},additionalProperties:false},options:{type:"object",properties:{bubbles:{type:"boolean",default:true},cancelable:{type:"boolean",default:true}},additionalProperties:false}},required:["selector"],description:"This method fetches an element with `selector`, and dispatch touchstart,touchmove and touchend event. If there's no element matching `selector`, the method waits until a matching element appears in the DOM."},waitForSelector:{kind:"function",type:"Promise",parameters:{selector:{type:"string",description:"A selector to query for. See [working with selectors](https://playwright.dev/docs/selectors) for more details."},options:{type:"object",properties:{state:{type:"string",enum:["attached","detached","visible","hidden"],description:"Defaults to `'visible'`. Can be either:\n- `'attached'` - wait for element to be present in DOM.\n- `'detached'` - wait for element to not be present in DOM.\n- `'visible'` - wait for element to have non-empty bounding box and no `visibility:hidden`. Note that element without any content or with `display:none` has an empty bounding box and is not considered visible.\n- `'hidden'` - wait for element to be either detached from DOM, or have an empty bounding box or `visibility:hidden`. This is opposite to the `'visible'` option."},strict:{type:"boolean",description:"When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception."},timeout:{type:"number",description:"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-browsercontext#browser-context-set-default-timeout) or [page.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-page#page-set-default-timeout) methods."}},additionalProperties:false}},required:["selector","options"],description:"Returns when element specified by selector satisfies `state` option. Returns `null` if waiting for `hidden` or `detached`.\n\n> NOTE: Playwright automatically waits for element to be ready before performing an action. Using [Locator] objects and web-first assertions make the code wait-for-selector-free.\n\nWait for the `selector` to satisfy `state` option (either appear/disappear from dom, or become visible/hidden). If at the moment of calling the method `selector` already satisfies the condition, the method will return immediately. If the selector doesn't satisfy the condition for the `timeout` milliseconds, the function will throw.\n\nThis method works across navigations:\n\n```js const { chromium } = require('playwright'); // Or 'firefox' or 'webkit'.\n\n(async () => { const browser = await chromium.launch(); const page = await browser.newPage(); for (let currentURL of ['https://google.com', 'https://bbc.com']) { await page.goto(currentURL); const element = await page.waitForSelector('img'); console.log('Loaded image: ' + await element.getAttribute('src')); } await browser.close(); })(); ```"},check:{kind:"function",type:"Promise",parameters:{selector:{type:"string",description:"A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://playwright.dev/docs/selectors) for more details."},options:{type:"object",properties:{force:{type:"boolean",description:"Whether to bypass the [actionability](https://playwright.dev/docs/actionability) checks. Defaults to `false`."},noWaitAfter:{type:"boolean",description:"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`."},position:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},required:["x","y"],additionalProperties:false,description:"A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the element."},strict:{type:"boolean",description:"When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception."},timeout:{type:"number",description:"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-browsercontext#browser-context-set-default-timeout) or [page.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-page#page-set-default-timeout) methods."},trial:{type:"boolean",description:"When set, this method only performs the [actionability](https://playwright.dev/docs/actionability) checks and skips the action. Defaults to `false`. Useful to wait until the element is ready for the action without performing it."}},additionalProperties:false}},required:["selector"],description:"This method checks an element matching `selector` by performing the following steps: 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM. 1. Ensure that matched element is a checkbox or a radio input. If not, this method throws. If the element is already checked, this method returns immediately. 1. Wait for [actionability](https://playwright.dev/docs/actionability) checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried. 1. Scroll the element into view if needed. 1. Use [page.mouse](https://playwright.dev/docs/api/class-page#page-mouse) to click in the center of the element. 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set. 1. Ensure that the element is now checked. If not, this method throws.\n\nWhen all steps combined have not finished during the specified `timeout`, this method throws a [TimeoutError]. Passing zero timeout disables this.\n\nShortcut for main frame's [frame.check(selector[, options])](https://playwright.dev/docs/api/class-frame#frame-check)."},click:{kind:"function",type:"Promise",parameters:{selector:{type:"string",description:"A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://playwright.dev/docs/selectors) for more details."},options:{type:"object",properties:{button:{type:"string",enum:["left","right","middle"],description:"Defaults to `left`."},clickCount:{type:"number",description:"defaults to 1. See [UIEvent.detail]."},delay:{type:"number",description:"Time to wait between `mousedown` and `mouseup` in milliseconds. Defaults to 0."},force:{type:"boolean",description:"Whether to bypass the [actionability](https://playwright.dev/docs/actionability) checks. Defaults to `false`."},modifiers:{type:"array",items:{type:"string",enum:["Alt","Control","Meta","Shift"]},description:"Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current modifiers back. If not specified, currently pressed modifiers are used."},noWaitAfter:{type:"boolean",description:"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`."},position:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},required:["x","y"],additionalProperties:false,description:"A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the element."},strict:{type:"boolean",description:"When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception."},timeout:{type:"number",description:"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-browsercontext#browser-context-set-default-timeout) or [page.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-page#page-set-default-timeout) methods."},trial:{type:"boolean",description:"When set, this method only performs the [actionability](https://playwright.dev/docs/actionability) checks and skips the action. Defaults to `false`. Useful to wait until the element is ready for the action without performing it."}},additionalProperties:false}},required:["selector"],description:"This method clicks an element matching `selector` by performing the following steps: 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM. 1. Wait for [actionability](https://playwright.dev/docs/actionability) checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried. 1. Scroll the element into view if needed. 1. Use [page.mouse](https://playwright.dev/docs/api/class-page#page-mouse) to click in the center of the element, or the specified `position`. 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.\n\nWhen all steps combined have not finished during the specified `timeout`, this method throws a [TimeoutError]. Passing zero timeout disables this.\n\nShortcut for main frame's [frame.click(selector[, options])](https://playwright.dev/docs/api/class-frame#frame-click)."},dblclick:{kind:"function",type:"Promise",parameters:{selector:{type:"string",description:"A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://playwright.dev/docs/selectors) for more details."},options:{type:"object",properties:{button:{type:"string",enum:["left","right","middle"],description:"Defaults to `left`."},delay:{type:"number",description:"Time to wait between `mousedown` and `mouseup` in milliseconds. Defaults to 0."},force:{type:"boolean",description:"Whether to bypass the [actionability](https://playwright.dev/docs/actionability) checks. Defaults to `false`."},modifiers:{type:"array",items:{type:"string",enum:["Alt","Control","Meta","Shift"]},description:"Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current modifiers back. If not specified, currently pressed modifiers are used."},noWaitAfter:{type:"boolean",description:"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`."},position:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},required:["x","y"],additionalProperties:false,description:"A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the element."},strict:{type:"boolean",description:"When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception."},timeout:{type:"number",description:"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-browsercontext#browser-context-set-default-timeout) or [page.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-page#page-set-default-timeout) methods."},trial:{type:"boolean",description:"When set, this method only performs the [actionability](https://playwright.dev/docs/actionability) checks and skips the action. Defaults to `false`. Useful to wait until the element is ready for the action without performing it."}},additionalProperties:false}},required:["selector"],description:"This method double clicks an element matching `selector` by performing the following steps: 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM. 1. Wait for [actionability](https://playwright.dev/docs/actionability) checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried. 1. Scroll the element into view if needed. 1. Use [page.mouse](https://playwright.dev/docs/api/class-page#page-mouse) to double click in the center of the element, or the specified `position`. 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set. Note that if the first click of the `dblclick()` triggers a navigation event, this method will throw.\n\nWhen all steps combined have not finished during the specified `timeout`, this method throws a [TimeoutError]. Passing zero timeout disables this.\n\n> NOTE: `page.dblclick()` dispatches two `click` events and a single `dblclick` event.\n\nShortcut for main frame's [frame.dblclick(selector[, options])](https://playwright.dev/docs/api/class-frame#frame-dblclick)."},fill:{kind:"function",type:"Promise",parameters:{selector:{type:"string",description:"A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://playwright.dev/docs/selectors) for more details."},value:{type:"string",description:"Value to fill for the `<input>`, `<textarea>` or `[contenteditable]` element."},options:{type:"object",properties:{force:{type:"boolean",description:"Whether to bypass the [actionability](https://playwright.dev/docs/actionability) checks. Defaults to `false`."},noWaitAfter:{type:"boolean",description:"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`."},strict:{type:"boolean",description:"When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception."},timeout:{type:"number",description:"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-browsercontext#browser-context-set-default-timeout) or [page.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-page#page-set-default-timeout) methods."}},additionalProperties:false}},required:["selector","value"],description:"This method waits for an element matching `selector`, waits for [actionability](https://playwright.dev/docs/actionability) checks, focuses the element, fills it and triggers an `input` event after filling. Note that you can pass an empty string to clear the input field.\n\nIf the target element is not an `<input>`, `<textarea>` or `[contenteditable]` element, this method throws an error. However, if the element is inside the `<label>` element that has an associated [control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), the control will be filled instead.\n\nTo send fine-grained keyboard events, use [page.type(selector, text[, options])](https://playwright.dev/docs/api/class-page#page-type).\n\nShortcut for main frame's [frame.fill(selector, value[, options])](https://playwright.dev/docs/api/class-frame#frame-fill)."},focus:{kind:"function",type:"Promise",parameters:{selector:{type:"string",description:"A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://playwright.dev/docs/selectors) for more details."},options:{type:"object",properties:{strict:{type:"boolean",description:"When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception."},timeout:{type:"number",description:"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-browsercontext#browser-context-set-default-timeout) or [page.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-page#page-set-default-timeout) methods."}},additionalProperties:false}},required:["selector"],description:"This method fetches an element with `selector` and focuses it. If there's no element matching `selector`, the method waits until a matching element appears in the DOM.\n\nShortcut for main frame's [frame.focus(selector[, options])](https://playwright.dev/docs/api/class-frame#frame-focus)."},hover:{kind:"function",type:"Promise",parameters:{selector:{type:"string",description:"A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://playwright.dev/docs/selectors) for more details."},options:{type:"object",properties:{force:{type:"boolean",description:"Whether to bypass the [actionability](https://playwright.dev/docs/actionability) checks. Defaults to `false`."},modifiers:{type:"array",items:{type:"string",enum:["Alt","Control","Meta","Shift"]},description:"Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current modifiers back. If not specified, currently pressed modifiers are used."},position:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},required:["x","y"],additionalProperties:false,description:"A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the element."},strict:{type:"boolean",description:"When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception."},timeout:{type:"number",description:"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-browsercontext#browser-context-set-default-timeout) or [page.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-page#page-set-default-timeout) methods."},trial:{type:"boolean",description:"When set, this method only performs the [actionability](https://playwright.dev/docs/actionability) checks and skips the action. Defaults to `false`. Useful to wait until the element is ready for the action without performing it."}},additionalProperties:false}},required:["selector"],description:"This method hovers over an element matching `selector` by performing the following steps: 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM. 1. Wait for [actionability](https://playwright.dev/docs/actionability) checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried. 1. Scroll the element into view if needed. 1. Use [page.mouse](https://playwright.dev/docs/api/class-page#page-mouse) to hover over the center of the element, or the specified `position`. 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.\n\nWhen all steps combined have not finished during the specified `timeout`, this method throws a [TimeoutError]. Passing zero timeout disables this.\n\nShortcut for main frame's [frame.hover(selector[, options])](https://playwright.dev/docs/api/class-frame#frame-hover)."},keyboard:{type:"object",properties:{down:{kind:"function",type:"Promise",parameters:{key:{type:"string",description:"Name of the key to press or a character to generate, such as `ArrowLeft` or `a`."}},required:["key"],description:"Dispatches a `keydown` event.\n\n`key` can specify the intended [keyboardEvent.key](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key) value or a single character to generate the text for. A superset of the `key` values can be found [here](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values). Examples of the keys are:\n\n`F1` - `F12`, `Digit0`- `Digit9`, `KeyA`- `KeyZ`, `Backquote`, `Minus`, `Equal`, `Backslash`, `Backspace`, `Tab`, `Delete`, `Escape`, `ArrowDown`, `End`, `Enter`, `Home`, `Insert`, `PageDown`, `PageUp`, `ArrowRight`, `ArrowUp`, etc.\n\nFollowing modification shortcuts are also supported: `Shift`, `Control`, `Alt`, `Meta`, `ShiftLeft`.\n\nHolding down `Shift` will type the text that corresponds to the `key` in the upper case.\n\nIf `key` is a single character, it is case-sensitive, so the values `a` and `A` will generate different respective texts.\n\nIf `key` is a modifier key, `Shift`, `Meta`, `Control`, or `Alt`, subsequent key presses will be sent with that modifier active. To release the modifier key, use [keyboard.up(key)](https://playwright.dev/docs/api/class-keyboard#keyboard-up).\n\nAfter the key is pressed once, subsequent calls to [keyboard.down(key)](https://playwright.dev/docs/api/class-keyboard#keyboard-down) will have [repeat](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/repeat) set to true. To release the key, use [keyboard.up(key)](https://playwright.dev/docs/api/class-keyboard#keyboard-up).\n\n> NOTE: Modifier keys DO influence `keyboard.down`. Holding down `Shift` will type the text in upper case."},insertText:{kind:"function",type:"Promise",parameters:{text:{type:"string",description:"Sets input to the specified text value."}},required:["text"],description:"Dispatches only `input` event, does not emit the `keydown`, `keyup` or `keypress` events.\n\n```js page.keyboard.insertText('\u55E8'); ```\n\n> NOTE: Modifier keys DO NOT effect `keyboard.insertText`. Holding down `Shift` will not type the text in upper case."},press:{kind:"function",type:"Promise",parameters:{key:{type:"string",description:"Name of the key to press or a character to generate, such as `ArrowLeft` or `a`."},options:{type:"object",properties:{delay:{type:"number",description:"Time to wait between `keydown` and `keyup` in milliseconds. Defaults to 0."}},additionalProperties:false}},required:["key"],description:"`key` can specify the intended [keyboardEvent.key](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key) value or a single character to generate the text for. A superset of the `key` values can be found [here](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values). Examples of the keys are:\n\n`F1` - `F12`, `Digit0`- `Digit9`, `KeyA`- `KeyZ`, `Backquote`, `Minus`, `Equal`, `Backslash`, `Backspace`, `Tab`, `Delete`, `Escape`, `ArrowDown`, `End`, `Enter`, `Home`, `Insert`, `PageDown`, `PageUp`, `ArrowRight`, `ArrowUp`, etc.\n\nFollowing modification shortcuts are also supported: `Shift`, `Control`, `Alt`, `Meta`, `ShiftLeft`.\n\nHolding down `Shift` will type the text that corresponds to the `key` in the upper case.\n\nIf `key` is a single character, it is case-sensitive, so the values `a` and `A` will generate different respective texts.\n\nShortcuts such as `key: \"Control+o\"` or `key: \"Control+Shift+T\"` are supported as well. When specified with the modifier, modifier is pressed and being held while the subsequent key is being pressed.\n\n```js const page = await browser.newPage(); await page.goto('https://keycode.info'); await page.keyboard.press('A'); await page.screenshot({ path: 'A.png' }); await page.keyboard.press('ArrowLeft'); await page.screenshot({ path: 'ArrowLeft.png' }); await page.keyboard.press('Shift+O'); await page.screenshot({ path: 'O.png' }); await browser.close(); ```\n\nShortcut for [keyboard.down(key)](https://playwright.dev/docs/api/class-keyboard#keyboard-down) and [keyboard.up(key)](https://playwright.dev/docs/api/class-keyboard#keyboard-up)."},type:{kind:"function",type:"Promise",parameters:{text:{type:"string",description:"A text to type into a focused element."},options:{type:"object",properties:{delay:{type:"number",description:"Time to wait between key presses in milliseconds. Defaults to 0."}},additionalProperties:false}},required:["text"],description:"Sends a `keydown`, `keypress`/`input`, and `keyup` event for each character in the text.\n\nTo press a special key, like `Control` or `ArrowDown`, use [keyboard.press(key[, options])](https://playwright.dev/docs/api/class-keyboard#keyboard-press).\n\n```js await page.keyboard.type('Hello'); // Types instantly await page.keyboard.type('World', {delay: 100}); // Types slower, like a user ```\n\n> NOTE: Modifier keys DO NOT effect `keyboard.type`. Holding down `Shift` will not type the text in upper case. > NOTE: For characters that are not on a US keyboard, only an `input` event will be sent."},up:{kind:"function",type:"Promise",parameters:{key:{type:"string",description:"Name of the key to press or a character to generate, such as `ArrowLeft` or `a`."}},required:["key"],description:"Dispatches a `keyup` event."}},required:["down","insertText","press","type","up"],additionalProperties:false,description:"Keyboard provides an api for managing a virtual keyboard. The high level api is [keyboard.type(text[, options])](https://playwright.dev/docs/api/class-keyboard#keyboard-type), which takes raw characters and generates proper keydown, keypress/input, and keyup events on your page.\n\nFor finer control, you can use [keyboard.down(key)](https://playwright.dev/docs/api/class-keyboard#keyboard-down), [keyboard.up(key)](https://playwright.dev/docs/api/class-keyboard#keyboard-up), and [keyboard.insertText(text)](https://playwright.dev/docs/api/class-keyboard#keyboard-insert-text) to manually fire events as if they were generated from a real keyboard.\n\nAn example of holding down `Shift` in order to select and delete some text:\n\n```js await page.keyboard.type('Hello World!'); await page.keyboard.press('ArrowLeft');\n\nawait page.keyboard.down('Shift'); for (let i = 0; i < ' World'.length; i++) await page.keyboard.press('ArrowLeft'); await page.keyboard.up('Shift');\n\nawait page.keyboard.press('Backspace'); // Result text will end up saying 'Hello!' ```\n\nAn example of pressing uppercase `A`\n\n```js await page.keyboard.press('Shift+KeyA'); // or await page.keyboard.press('Shift+A'); ```\n\nAn example to trigger select-all with the keyboard\n\n```js // on Windows and Linux await page.keyboard.press('Control+A'); // on macOS await page.keyboard.press('Meta+A'); ```"},mouse:{type:"object",properties:{click:{kind:"function",type:"Promise",parameters:{x:{type:"number"},y:{type:"number"},options:{type:"object",properties:{button:{type:"string",enum:["left","right","middle"],description:"Defaults to `left`."},clickCount:{type:"number",description:"defaults to 1. See [UIEvent.detail]."},delay:{type:"number",description:"Time to wait between `mousedown` and `mouseup` in milliseconds. Defaults to 0."}},additionalProperties:false}},required:["x","y"],description:"Shortcut for [mouse.move(x, y[, options])](https://playwright.dev/docs/api/class-mouse#mouse-move), [mouse.down([options])](https://playwright.dev/docs/api/class-mouse#mouse-down), [mouse.up([options])](https://playwright.dev/docs/api/class-mouse#mouse-up)."},dblclick:{kind:"function",type:"Promise",parameters:{x:{type:"number"},y:{type:"number"},options:{type:"object",properties:{button:{type:"string",enum:["left","right","middle"],description:"Defaults to `left`."},delay:{type:"number",description:"Time to wait between `mousedown` and `mouseup` in milliseconds. Defaults to 0."}},additionalProperties:false}},required:["x","y"],description:"Shortcut for [mouse.move(x, y[, options])](https://playwright.dev/docs/api/class-mouse#mouse-move), [mouse.down([options])](https://playwright.dev/docs/api/class-mouse#mouse-down), [mouse.up([options])](https://playwright.dev/docs/api/class-mouse#mouse-up), [mouse.down([options])](https://playwright.dev/docs/api/class-mouse#mouse-down) and [mouse.up([options])](https://playwright.dev/docs/api/class-mouse#mouse-up)."},down:{kind:"function",type:"Promise",parameters:{options:{type:"object",properties:{button:{type:"string",enum:["left","right","middle"],description:"Defaults to `left`."},clickCount:{type:"number",description:"defaults to 1. See [UIEvent.detail]."}},additionalProperties:false}},required:[],description:"Dispatches a `mousedown` event."},move:{kind:"function",type:"Promise",parameters:{x:{type:"number"},y:{type:"number"},options:{type:"object",properties:{steps:{type:"number",description:"defaults to 1. Sends intermediate `mousemove` events."}},additionalProperties:false}},required:["x","y"],description:"Dispatches a `mousemove` event."},up:{kind:"function",type:"Promise",parameters:{options:{type:"object",properties:{button:{type:"string",enum:["left","right","middle"],description:"Defaults to `left`."},clickCount:{type:"number",description:"defaults to 1. See [UIEvent.detail]."}},additionalProperties:false}},required:[],description:"Dispatches a `mouseup` event."}},required:["click","dblclick","down","move","up"],additionalProperties:false,description:"The Mouse class operates in main-frame CSS pixels relative to the top-left corner of the viewport.\n\nEvery `page` object has its own Mouse, accessible with [page.mouse](https://playwright.dev/docs/api/class-page#page-mouse).\n\n```js // Using \u2018page.mouse\u2019 to trace a 100x100 square. await page.mouse.move(0, 0); await page.mouse.down(); await page.mouse.move(0, 100); await page.mouse.move(100, 100); await page.mouse.move(100, 0); await page.mouse.move(0, 0); await page.mouse.up(); ```"},press:{kind:"function",type:"Promise",parameters:{selector:{type:"string",description:"A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://playwright.dev/docs/selectors) for more details."},key:{type:"string",description:"Name of the key to press or a character to generate, such as `ArrowLeft` or `a`."},options:{type:"object",properties:{delay:{type:"number",description:"Time to wait between `keydown` and `keyup` in milliseconds. Defaults to 0."},noWaitAfter:{type:"boolean",description:"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`."},strict:{type:"boolean",description:"When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception."},timeout:{type:"number",description:"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-browsercontext#browser-context-set-default-timeout) or [page.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-page#page-set-default-timeout) methods."}},additionalProperties:false}},required:["selector","key"],description:"Focuses the element, and then uses [keyboard.down(key)](https://playwright.dev/docs/api/class-keyboard#keyboard-down) and [keyboard.up(key)](https://playwright.dev/docs/api/class-keyboard#keyboard-up).\n\n`key` can specify the intended [keyboardEvent.key](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key) value or a single character to generate the text for. A superset of the `key` values can be found [here](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values). Examples of the keys are:\n\n`F1` - `F12`, `Digit0`- `Digit9`, `KeyA`- `KeyZ`, `Backquote`, `Minus`, `Equal`, `Backslash`, `Backspace`, `Tab`, `Delete`, `Escape`, `ArrowDown`, `End`, `Enter`, `Home`, `Insert`, `PageDown`, `PageUp`, `ArrowRight`, `ArrowUp`, etc.\n\nFollowing modification shortcuts are also supported: `Shift`, `Control`, `Alt`, `Meta`, `ShiftLeft`.\n\nHolding down `Shift` will type the text that corresponds to the `key` in the upper case.\n\nIf `key` is a single character, it is case-sensitive, so the values `a` and `A` will generate different respective texts.\n\nShortcuts such as `key: \"Control+o\"` or `key: \"Control+Shift+T\"` are supported as well. When specified with the modifier, modifier is pressed and being held while the subsequent key is being pressed.\n\n```js const page = await browser.newPage(); await page.goto('https://keycode.info'); await page.press('body', 'A'); await page.screenshot({ path: 'A.png' }); await page.press('body', 'ArrowLeft'); await page.screenshot({ path: 'ArrowLeft.png' }); await page.press('body', 'Shift+O'); await page.screenshot({ path: 'O.png' }); await browser.close(); ```"},touchscreen:{type:"object",properties:{tap:{kind:"function",type:"Promise",parameters:{x:{type:"number"},y:{type:"number"}},required:["x","y"],description:"Dispatches a `touchstart` and `touchend` event with a single touch at the position (`x`,`y`)."}},required:["tap"],additionalProperties:false,description:"The Touchscreen class operates in main-frame CSS pixels relative to the top-left corner of the viewport. Methods on the touchscreen can only be used in browser contexts that have been initialized with `hasTouch` set to true."},type:{kind:"function",type:"Promise",parameters:{selector:{type:"string",description:"A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://playwright.dev/docs/selectors) for more details."},text:{type:"string",description:"A text to type into a focused element."},options:{type:"object",properties:{delay:{type:"number",description:"Time to wait between key presses in milliseconds. Defaults to 0."},noWaitAfter:{type:"boolean",description:"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`."},strict:{type:"boolean",description:"When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception."},timeout:{type:"number",description:"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-browsercontext#browser-context-set-default-timeout) or [page.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-page#page-set-default-timeout) methods."}},additionalProperties:false}},required:["selector","text"],description:"Sends a `keydown`, `keypress`/`input`, and `keyup` event for each character in the text. `page.type` can be used to send fine-grained keyboard events. To fill values in form fields, use [page.fill(selector, value[, options])](https://playwright.dev/docs/api/class-page#page-fill).\n\nTo press a special key, like `Control` or `ArrowDown`, use [keyboard.press(key[, options])](https://playwright.dev/docs/api/class-keyboard#keyboard-press).\n\n```js await page.type('#mytextarea', 'Hello'); // Types instantly await page.type('#mytextarea', 'World', {delay: 100}); // Types slower, like a user ```\n\nShortcut for main frame's [frame.type(selector, text[, options])](https://playwright.dev/docs/api/class-frame#frame-type)."},uncheck:{kind:"function",type:"Promise",parameters:{selector:{type:"string",description:"A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://playwright.dev/docs/selectors) for more details."},options:{type:"object",properties:{force:{type:"boolean",description:"Whether to bypass the [actionability](https://playwright.dev/docs/actionability) checks. Defaults to `false`."},noWaitAfter:{type:"boolean",description:"Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`."},position:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},required:["x","y"],additionalProperties:false,description:"A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the element."},strict:{type:"boolean",description:"When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception."},timeout:{type:"number",description:"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-browsercontext#browser-context-set-default-timeout) or [page.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-page#page-set-default-timeout) methods."},trial:{type:"boolean",description:"When set, this method only performs the [actionability](https://playwright.dev/docs/actionability) checks and skips the action. Defaults to `false`. Useful to wait until the element is ready for the action without performing it."}},additionalProperties:false}},required:["selector"],description:"This method unchecks an element matching `selector` by performing the following steps: 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM. 1. Ensure that matched element is a checkbox or a radio input. If not, this method throws. If the element is already unchecked, this method returns immediately. 1. Wait for [actionability](https://playwright.dev/docs/actionability) checks on the matched element, unless `force` option is set. If the element is detached during the checks, the whole action is retried. 1. Scroll the element into view if needed. 1. Use [page.mouse](https://playwright.dev/docs/api/class-page#page-mouse) to click in the center of the element. 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set. 1. Ensure that the element is now unchecked. If not, this method throws.\n\nWhen all steps combined have not finished during the specified `timeout`, this method throws a [TimeoutError]. Passing zero timeout disables this.\n\nShortcut for main frame's [frame.uncheck(selector[, options])](https://playwright.dev/docs/api/class-frame#frame-uncheck)."},waitForTimeout:{kind:"function",type:"Promise",parameters:{timeout:{type:"number",description:"A timeout to wait for"}},required:["timeout"],description:"Waits for the given `timeout` in milliseconds.\n\nNote that `page.waitForTimeout()` should only be used for debugging. Tests using the timer in production are going to be flaky. Use signals such as network events, selectors becoming visible and others instead.\n\n```js // wait for 1 second await page.waitForTimeout(1000); ```\n\nShortcut for main frame's [frame.waitForTimeout(timeout)](https://playwright.dev/docs/api/class-frame#frame-wait-for-timeout)."},takeScreenshot:{kind:"function",type:"Promise",parameters:{stitchOptions:{type:"object",properties:{blend:{type:"string",enum:["clear","source","over","in","out","atop","dest","dest-over","dest-in","dest-out","dest-atop","xor","add","saturate","multiply","screen","overlay","darken","lighten","colour-dodge","colour-burn","hard-light","soft-light","difference","exclusion"],description:"How to blend this image with the image below. (optional)",default:"multiply"}},additionalProperties:false}},required:[],description:"This method will take a screenshot at the position that it activated, its useful for taking a screenshot in sequence for events/actions. In the end the screenshots will be merged with the final screenshot."},takeScreenshotAll:{kind:"function",type:"Promise",parameters:{stitchOptions:{type:"object",properties:{blend:{type:"string",enum:["clear","source","over","in","out","atop","dest","dest-over","dest-in","dest-out","dest-atop","xor","add","saturate","multiply","screen","overlay","darken","lighten","colour-dodge","colour-burn","hard-light","soft-light","difference","exclusion"],description:"How to blend this image with the image below. (optional)",default:"multiply"}},additionalProperties:false}},required:[],description:"This method will take a screenshot after each action, its useful for looking at over all action execution. In the end the screenshots will be merged."},takeElementScreenshot:{kind:"function",type:"Promise",parameters:{selector:{type:"string"}},required:["selector"],description:"This method will take a screenshot of an element."},takeScreenshotOptions:{kind:"function",type:"Promise",parameters:{mergeType:{type:"string",enum:["stitch","overlay"]},stitchOptions:{type:"object",properties:{direction:{type:"string",enum:["vertical","horizontal"],description:"Direction of the merged image."},align:{type:"string",enum:["start","center","end"],description:"Aligning of given images. If the images are not all the same size, images will be sorted to largest image. Possible values are `start`, `center` and `end`. Default is `start`."},offset:{type:"number",description:"Offset in pixels between each image. Default is `0`"},margin:{type:"string",description:"Set the margin of image, considered as standard css shorthand properties (e.g. '40 40 0 10')",default:"0 0 0 0"},color:{type:"string",description:"Set the background color of image."}},additionalProperties:false},overlayOptions:{type:"object",properties:{blend:{type:"string",enum:["clear","source","over","in","out","atop","dest","dest-over","dest-in","dest-out","dest-atop","xor","add","saturate","multiply","screen","overlay","darken","lighten","colour-dodge","colour-burn","hard-light","soft-light","difference","exclusion"],description:"How to blend this image with the image below. (optional)",default:"multiply"}},additionalProperties:false}},required:[],description:"The purpose of this action is to have centralized options for all screenshots. This action can be used in conjunction with takeScreenshot action only. Only one instance can be used."}};function te(){let e=at,t=v().customActionSchema;return t&&(e={...e,...t}),e}async function pt(e,t){let o=te();if(!st(o,t))return;let r=et(t,o),i=t.name.split("."),s=e,n=[s];for(let a=0;a<i.length;a++){let p=i[a];if(typeof s!="object"&&typeof s!="function"||s===null)break;let l=s[p];if(l===void 0)break;s=l,n.push(s);}if(n.length!==1&&typeof s=="function")return await s.call(n[n.length-2],...r)}async function b(e,t,o=true){return new Promise((r,i)=>{if(!N__namespace.default.existsSync(e)){if(!o){r(void 0);return}r(t==="*"?{stories:{}}:{stories:{[t]:{}}});return}jsonfile.readFile(e,(s,n)=>{if(s){i(s);return}let a=n||{stories:{}};a.stories||(a.stories={}),!a.stories[t]&&t!=="*"&&(a.stories[t]={}),r(a);});})}async function ct(e){let t=await b(e,"*")||{stories:{}},o=t.stories||{},i=Object.keys(o).map(s=>({data:o[s],storyId:s}));return {playWrightData:t,storyData:i}}function g(e){let t=R__namespace.resolve(e),o=R__namespace.parse(t),r=o.ext===".json"?`${o.name}.json`:`${o.name}.playwright.json`;return {dir:o.dir,name:r,path:R__namespace.join(R__namespace.dirname(t),r),screenShotsDir:R__namespace.join(o.dir,"__screenshots__")}}function zo(e){let t=e;for(;t!==R__namespace.default.dirname(t);){let o=R__namespace.default.join(t,"package.json");try{return ue.resolve(o),o}catch{}t=R__namespace.default.dirname(t);}throw new Error("Cannot find package.json")}function lt(){let e=zo(process.cwd());return ue(e).version.split(".")[0].toString()}async function dt(e){await e.waitForLoadState("load"),await e.evaluate(`
|
|
2
2
|
(() => {
|
|
3
3
|
if (window !== window.parent) return;
|
|
4
4
|
const box = document.createElement('playwright-mouse-pointer');
|
|
@@ -126,11 +126,11 @@
|
|
|
126
126
|
);
|
|
127
127
|
})();
|
|
128
128
|
`);}function A(e,t){let o=t?.stories;if(o&&Object.keys(o).forEach(r=>{Object.keys(o[r]||{}).length||delete o[r];}),t&&o&&Object.keys(o).length>0){let r={version:lt(),...t};jsonfile.writeFileSync(e.path,r,{EOL:`\r
|
|
129
|
-
`,spaces:2});}else try{N__namespace.unlinkSync(e.path);}catch{}}function x(e,t,o=false){if(e){if(!e.stories){if(!o)return;e.stories={};}if(!(!o&&!e.stories[t]))return e.stories[t]||(e.stories[t]={}),e.stories[t]}}function ht(e,t){let o=x(e,t);return o&&e.stories&&!Object.keys(o).length&&delete e.stories[t],e}function
|
|
129
|
+
`,spaces:2});}else try{N__namespace.unlinkSync(e.path);}catch{}}function x(e,t,o=false){if(e){if(!e.stories){if(!o)return;e.stories={};}if(!(!o&&!e.stories[t]))return e.stories[t]||(e.stories[t]={}),e.stories[t]}}function ht(e,t){let o=x(e,t);return o&&e.stories&&!Object.keys(o).length&&delete e.stories[t],e}function be(e,t,o){let r=`${t}Id`,i=e[t];if(!o||!i)return e;let s=false,n=e.stories||{},a=Object.keys(n);for(let p=0;p<a.length;p++){let l=n[a[p]];if(l.screenshots&&l.screenshots.find(d=>d[r]===o)){s=true;break}}return !s&&i[o]&&delete i[o],Object.keys(i).length||delete e[t],e}function K(e,t,o){if(!o||!e[t])return;let r=Object.keys(e[t]);for(let i=0;i<r.length;i++){let s=r[i],n=e[t][s];if(ut__default.default(n,o))return s}}function ft(e,t,o){let r=K(e,"browserOptions",o.browserOptions),i=K(e,"screenshotOptions",o.screenshotOptions),s=j(o),n=a=>a.actionSets&&a.actionSets.length>0?a.actionSets.map(l=>{let{id:d,...f}=l;return f}):void 0;for(let a=0;a<t.length;a++){let p=t[a];if(p.browserOptionsId===r&&p.screenshotOptionsId===i&&p.browserType===o.browserType&&ut__default.default(n(p),n(o))&&ut__default.default(j(p),s))return p}}function re(e,t){if(!e||!e.length)return;let o=t?.regenerateIds===true;return e.map(r=>({...r,actions:r.actions.map(i=>({...i,id:o?nanoid.nanoid(12):i.id||nanoid.nanoid(12)})),id:o?nanoid.nanoid(12):r.id||nanoid.nanoid(12)}))}function ie(e,t){e.browserOptions&&t.browserOptionsId&&(t.browserOptions=e.browserOptions[t.browserOptionsId]),e.screenshotOptions&&t.screenshotOptionsId&&(t.screenshotOptions=e.screenshotOptions[t.screenshotOptionsId]);}async function se(e){let t=g(e.filePath),o=await b(t.path,e.storyId);if(!o)return;let r=x(o,e.storyId);if(!r||!r.screenshots)return;let i=r.screenshots.find(s=>s.id===e.screenshotId);return i&&(ie(o,i),{...i,actionSets:re(i.actionSets)})}async function yt(e){let t=g(e);return await b(t.path,"*")}var Bo=["waitForSelector","waitForTimeout","takeScreenshot","takeScreenshotAll","takeScreenshotOptions"];function ne(e){return !Bo.includes(e.name)}async function gt(e,t){if(t){let o=["Shift","Meta","Control","Alt"];for(let r=0;r<t.length;r++){let i=t[r];for(let s=0;s<i.actions.length;s++){let n=i.actions[s];n.name==="keyboard.down"&&n.args&&n.args.key&&o.includes(n.args.key)&&await e.keyboard.up(n.args.key);}}}}function Se(e,t,o){if(!o||!Object.keys(o).length)return;e[t]||(e[t]={});let r=K(e,t,o);if(r)return r;let i=nanoid.nanoid(12);return e[t][i]=o,i}function wt(e,t,o){let r=e[t+1];return o&&e.length>1&&e.length>t+1&&r&&ne(r)}async function bt(e){let t=g(e.filePath),o=await b(t.path,e.storyId),r=x(o,e.storyId,false);!r||!r.actionSets||(r.actionSets=Ho__default.default(r.actionSets,e.oldIndex,e.newIndex),await A(t,o));}async function St(e){let t=g(e.filePath),o=await b(t.path,e.storyId);if(!o)return;if(!e.actionSetId)throw new Error("Action set id has not been provided!");let r=x(o,e.storyId);!r||!r.actionSets||(r.actionSets=r.actionSets.filter(i=>i.id!==e.actionSetId),r.actionSets.length===0&&delete r.actionSets,o=ht(o,e.storyId),await A(t,o));}async function xt(e){let t=g(e.filePath),o=await b(t.path,e.storyId),r=x(o,e.storyId);return r?r.actionSets?r.actionSets.map(i=>(i.actions.forEach(s=>{s.id=nanoid.nanoid();}),i)):[]:[]}async function vt(e){let t=g(e.filePath),o=await b(t.path,e.storyId),r=x(o,e.storyId,true);if(!r)return;r.actionSets||(r.actionSets=[]),r.actionSets=r.actionSets.filter(s=>s.id!==e.actionSet.id);let i={...e.actionSet,actions:e.actionSet.actions.map(s=>{let{id:n,...a}=s;return a})};r.actionSets.push(i),await A(t,o);}var xe=server.initTRPC.context().create(),{router:O}=xe,u=xe.procedure,{createCallerFactory:Dn}=xe;var It=O({changeActionSetIndex:u.input(Oe).mutation(async({input:e})=>bt(e)),deleteActionSet:u.input(De).mutation(async({input:e})=>St(e)),getActionSet:u.input(Te).mutation(async({input:e})=>xt(e)),saveActionSet:u.input(Ae).mutation(async({input:e})=>vt(e))});var M=".storybook/playwright-favourite-actions.json";async function kt(e){e.id=nanoid.nanoid(15);let t=N__namespace.existsSync(M)?jsonfile.readFileSync(M):{actionSets:[]};t.actionSets.push(e),jsonfile.writeFileSync(M,t,{EOL:`\r
|
|
130
130
|
`,spaces:2});}async function ae(){return new Promise((e,t)=>{if(!N__namespace.existsSync(M)){e([]);return}jsonfile.readFile(M,(o,r)=>{if(o){t(o);return}e(r?.actionSets??[]);});})}async function Dt(e){let o={actionSets:(await ae()).filter(r=>r.id!==e.actionSetId)};jsonfile.writeFileSync(M,o,{EOL:`\r
|
|
131
|
-
`,spaces:2});}var At=O({addFavouriteAction:u.input(Ee).mutation(async({input:e})=>kt(e)),deleteFavouriteAction:u.input(Fe).mutation(async({input:e})=>Dt(e)),getFavouriteActions:u.query(async()=>ae())});async function Ft(e){let t=await yt(e.filePath);if(!t)throw new Error("Unable to load screenshot config file data.");let o=g(e.filePath),r=pe__default.default(e.previousNamedExport),i=e.id.split("--")[1],s=i?pe__default.default(i):"",n="",a="",p=[],l=false,d=t.stories||{};if(t.stories||(t.stories=d),Object.keys(d).forEach(f=>{let y=d[f],m=f.split("--"),I=m[1]||"";n||(n=m[0]),a=e.parent;let h=r&&I===r;!l&&h&&(l=true),p=[...p,...(y.screenshots||[]).map(P=>({browser:P.browserType,newStoryId:h?s:void 0,screenshotTitle:P.title,storyId:I,storyTitle:n}))],m[0]=e.parent,h&&(m[1]=s);let S=m.join("--"),b=d[S];S!==f&&(delete d[f],delete d[S],d[S]=b?Go__default.default(y,b):y);},{}),r&&!l)throw new Error("Unable to locate old stories, make sure the previous named function name entered currently.");if(n&&a){n=pe__default.default(n),a=pe__default.default(a);for(let f=0;f<p.length;f++){let y=p[f],m=ge(y),I=ge({...y,storyId:y.newStoryId?y.newStoryId:y.storyId,storyTitle:a}),h=R__namespace.default.join(o.screenShotsDir,m);N__namespace.default.existsSync(h)&&N__namespace.default.renameSync(h,R__namespace.default.join(o.screenShotsDir,I));}}await A(o,t);}var qt=O({fixScreenshotFileName:u.input(qe).mutation(async({input:e})=>Ft(e))});var jt={acceptDownloads:{type:"boolean",description:"Whether to automatically download all the attachments. Defaults to `false` where all the downloads are canceled."},baseURL:{type:"string",description:"When using [page.goto(url[, options])](https://playwright.dev/docs/api/class-page#page-goto), [page.route(url, handler[, options])](https://playwright.dev/docs/api/class-page#page-route), [page.waitForURL(url[, options])](https://playwright.dev/docs/api/class-page#page-wait-for-url), [page.waitForRequest(urlOrPredicate[, options])](https://playwright.dev/docs/api/class-page#page-wait-for-request), or [page.waitForResponse(urlOrPredicate[, options])](https://playwright.dev/docs/api/class-page#page-wait-for-response) it takes the base URL in consideration by using the [`URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor for building the corresponding URL. Examples:\n- baseURL: `http://localhost:3000` and navigating to `/bar.html` results in `http://localhost:3000/bar.html`\n- baseURL: `http://localhost:3000/foo/` and navigating to `./bar.html` results in `http://localhost:3000/foo/bar.html`"},bypassCSP:{type:"boolean",description:"Toggles bypassing page's Content-Security-Policy."},colorScheme:{type:"string",enum:["light","dark","no-preference"],description:"Emulates `'prefers-colors-scheme'` media feature, supported values are `'light'`, `'dark'`, `'no-preference'`. See [page.emulateMedia([options])](https://playwright.dev/docs/api/class-page#page-emulate-media) for more details. Defaults to `'light'`."},deviceScaleFactor:{type:"number",description:"Specify device scale factor (can be thought of as dpr). Defaults to `1`."},forcedColors:{type:"string",enum:["active","none"],description:"Emulates `'forced-colors'` media feature, supported values are `'active'`, `'none'`. See [page.emulateMedia([options])](https://playwright.dev/docs/api/class-page#page-emulate-media) for more details. Defaults to `'none'`.\n\n> NOTE: It's not supported in WebKit, see [here](https://bugs.webkit.org/show_bug.cgi?id=225281) in their issue tracker."},geolocation:{type:"object",properties:{latitude:{type:"number",description:"Latitude between -90 and 90."},longitude:{type:"number",description:"Longitude between -180 and 180."},accuracy:{type:"number",description:"Non-negative accuracy value. Defaults to `0`."}},required:["latitude","longitude"],additionalProperties:false},hasTouch:{type:"boolean",description:"Specifies if viewport supports touch events. Defaults to false."},httpCredentials:{type:"object",properties:{username:{type:"string"},password:{type:"string"}},required:["username","password"],additionalProperties:false,description:"Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication)."},ignoreHTTPSErrors:{type:"boolean",description:"Whether to ignore HTTPS errors when sending network requests. Defaults to `false`."},isMobile:{type:"boolean",description:"Whether the `meta viewport` tag is taken into account and touch events are enabled. Defaults to `false`. Not supported in Firefox."},javaScriptEnabled:{type:"boolean",description:"Whether or not to enable JavaScript in the context. Defaults to `true`."},locale:{type:"string",description:"Specify user locale, for example `en-GB`, `de-DE`, etc. Locale will affect `navigator.language` value, `Accept-Language` request header value as well as number and date formatting rules."},offline:{type:"boolean",description:"Whether to emulate network being offline. Defaults to `false`."},permissions:{type:"array",items:{type:"string"},description:"A list of permissions to grant to all pages in this context. See [browserContext.grantPermissions(permissions[, options])](https://playwright.dev/docs/api/class-browsercontext#browser-context-grant-permissions) for more details."},proxy:{type:"object",properties:{server:{type:"string",description:"Proxy to be used for all requests. HTTP and SOCKS proxies are supported, for example `http://myproxy.com:3128` or `socks5://myproxy.com:3128`. Short form `myproxy.com:3128` is considered an HTTP proxy."},bypass:{type:"string",description:'Optional comma-separated domains to bypass proxy, for example `".com, chromium.org, .domain.com"`.'},username:{type:"string",description:"Optional username to use if HTTP proxy requires authentication."},password:{type:"string",description:"Optional password to use if HTTP proxy requires authentication."}},required:["server"],additionalProperties:false,description:"Network proxy settings to use with this context.\n\n> NOTE: For Chromium on Windows the browser needs to be launched with the global proxy for this option to work. If all contexts override the proxy, global proxy will be never used and can be any string, for example `launch({ proxy: { server: 'http://per-context' } })`."},recordHar:{type:"object",properties:{omitContent:{type:"boolean",description:"Optional setting to control whether to omit request content from the HAR. Defaults to `false`."},path:{type:"string",description:"Path on the filesystem to write the HAR file to."}},required:["path"],additionalProperties:false,description:"Enables [HAR](http://www.softwareishard.com/blog/har-12-spec) recording for all pages into `recordHar.path` file. If not specified, the HAR is not recorded. Make sure to await [browserContext.close()](https://playwright.dev/docs/api/class-browsercontext#browser-context-close) for the HAR to be saved."},recordVideo:{type:"object",properties:{dir:{type:"string",description:"Path to the directory to put videos into."},size:{type:"object",properties:{width:{type:"number",description:"Video frame width."},height:{type:"number",description:"Video frame height."}},required:["width","height"],additionalProperties:false,description:"Optional dimensions of the recorded videos. If not specified the size will be equal to `viewport` scaled down to fit into 800x800. If `viewport` is not configured explicitly the video size defaults to 800x450. Actual picture of each page will be scaled down if necessary to fit the specified size."}},required:["dir"],additionalProperties:false,description:"Enables video recording for all pages into `recordVideo.dir` directory. If not specified videos are not recorded. Make sure to await [browserContext.close()](https://playwright.dev/docs/api/class-browsercontext#browser-context-close) for videos to be saved."},reducedMotion:{type:"string",enum:["reduce","no-preference"],description:"Emulates `'prefers-reduced-motion'` media feature, supported values are `'reduce'`, `'no-preference'`. See [page.emulateMedia([options])](https://playwright.dev/docs/api/class-page#page-emulate-media) for more details. Defaults to `'no-preference'`."},screen:{type:"object",properties:{width:{type:"number",description:"page width in pixels."},height:{type:"number",description:"page height in pixels."}},required:["width","height"],additionalProperties:false,description:"Emulates consistent window screen size available inside web page via `window.screen`. Is only used when the `viewport` is set."},storageState:{anyOf:[{type:"string"},{type:"object",properties:{cookies:{type:"array",items:{type:"object",properties:{name:{type:"string"},value:{type:"string"},domain:{type:"string",description:"domain and path are required"},path:{type:"string",description:"domain and path are required"},expires:{type:"number",description:"Unix time in seconds."},httpOnly:{type:"boolean"},secure:{type:"boolean"},sameSite:{type:"string",enum:["Strict","Lax","None"],description:"sameSite flag"}},required:["name","value","domain","path","expires","httpOnly","secure","sameSite"],additionalProperties:false},description:"cookies to set for context"},origins:{type:"array",items:{type:"object",properties:{origin:{type:"string"},localStorage:{type:"array",items:{type:"object",additionalProperties:false}}},required:["origin","localStorage"],additionalProperties:false},description:"localStorage to set for context"}},required:["cookies","origins"],additionalProperties:false}],description:"Populates context with given storage state. This option can be used to initialize context with logged-in information obtained via [browserContext.storageState([options])](https://playwright.dev/docs/api/class-browsercontext#browser-context-storage-state). Either a path to the file with saved storage, or an object with the following fields:"},strictSelectors:{type:"boolean",description:"It specified, enables strict selectors mode for this context. In the strict selectors mode all operations on selectors that imply single target DOM element will throw when more than one element matches the selector. See [Locator] to learn more about the strict mode."},timezoneId:{type:"string",description:"Changes the timezone of the context. See [ICU's metaZones.txt](https://cs.chromium.org/chromium/src/third_party/icu/source/data/misc/metaZones.txt?rcl=faee8bc70570192d82d2978a71e2a615788597d1) for a list of supported timezone IDs."},userAgent:{type:"string",description:"Specific user agent to use in this context."},videoSize:{type:"object",properties:{width:{type:"number",description:"Video frame width."},height:{type:"number",description:"Video frame height."}},required:["width","height"],additionalProperties:false,description:"**DEPRECATED** Use `recordVideo` instead.",deprecated:true},videosPath:{type:"string",description:"**DEPRECATED** Use `recordVideo` instead.",deprecated:true},viewport:{type:"object",properties:{width:{type:"number",description:"page width in pixels."},height:{type:"number",description:"page height in pixels."}},required:["width","height"],additionalProperties:false,description:"Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. `null` disables the default viewport."},cursor:{type:"boolean"}};var Ct={type:{type:"string",enum:["png","jpeg"],description:"Specify screenshot type, defaults to `png`."},quality:{type:"number",description:"The quality of the image, between 0-100. Not applicable to `png` images."},fullPage:{type:"boolean",description:"When true, takes a screenshot of the full scrollable page, instead of the currently visibvle viewport. Defaults to `false`."},clip:{type:"object",properties:{x:{type:"number",description:"x-coordinate of top-left corner of clip area"},y:{type:"number",description:"y-coordinate of top-left corner of clip area"},width:{type:"number",description:"width of clipping area"},height:{type:"number",description:"height of clipping area"}},required:["x","y","width","height"],additionalProperties:false,description:"An object which specifies clipping of the resulting image. Should have the following fields:"},omitBackground:{type:"boolean",description:"Hides default white background and allows capturing screenshots with transparency. Not applicable to `jpeg` images. Defaults to `false`."},timeout:{type:"number",description:"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the browserContext.setDefaultTimeout(timeout) or page.setDefaultTimeout(timeout) methods."}};function Rt(e){if(e==="browser-options")return jt;if(e==="screenshot-options")return Ct}var Wt=O({getActionsSchema:u.query(()=>te()),getSchema:u.input(q.z.object({schemaName:q.z.string()})).mutation(({input:e})=>Rt(e.schemaName))});async function zt(e){let t=g(e.filePath),o=await w(t.path,e.storyId),r=x(o,e.storyId,false);if(!r||!r.screenshots)return;let i=Ho__default.default(r.screenshots,e.oldIndex,e.newIndex);r.screenshots=i.map((s,n)=>(s.index=n,s)),await A(t,o);}function B(e){let t=g(e.filePath),o=pe__default.default(`${R__namespace.default.basename(e.storyId)}--${e.title}--${e.browserType}`),r=R__namespace.default.join(t.screenShotsDir,"__diff_output__"),i=R__namespace.default.join(t.screenShotsDir,`${o}-snap.png`);return {diffDir:r,filePath:i,screenshotIdentifier:o,screenshotsDir:t.screenShotsDir}}async function _(e){let t=g(e.filePath),o=await w(t.path,e.storyId,false);if(!o)return;let r=x(o,e.storyId);if(!r||!r.screenshots||!r.screenshots.length)return [];let i=r.screenshots.find(n=>n.id===e.screenshotId);if(!i)return r.screenshots;let s=B({browserType:i.browserType,filePath:e.filePath,storyId:e.storyId,title:i.title});return N__namespace.existsSync(s.filePath)&&N__namespace.unlinkSync(s.filePath),r.screenshots=r.screenshots.filter(n=>n.id!==e.screenshotId),r.screenshots.length||delete r.screenshots,we(o,"browserOptions",i.browserOptionsId),we(o,"screenshotOptions",i.screenshotOptionsId),await A(t,o),r.screenshots||[]}async function le(e){let t=g(e.filePath),o=await w(t.path,e.storyId),r=x(o,e.storyId);if(!(!r||!r.screenshots||!r.screenshots.length))return r.screenshots.map(i=>(o&&ie(o,i),i))}async function Lt(e){let t=await le(e);if(!(!t||!t.length))for(let o=0;o<t.length;o++){let r=t[o];r&&await _({filePath:e.filePath,screenshotId:r.id,storyId:e.storyId});}}async function Ut(e){let{getScreenshotTitle:t}=v();if(!t)throw new Error("getScreenshotTitle is not configured.");return t({...e})}function Bt(){return typeof v().getScreenshotTitle=="function"}async function _t(e,t={}){let{blur:o,timeout:r}=t;await this.fill(e,""),o&&await this.$eval(e,i=>i.blur()),r&&await this.waitForTimeout(r);}async function H(e,t){await e.waitForSelector(t);let o=await e.$(t);if(!o)throw new Error("Unable to find selector!");let r=await o.boundingBox();if(!r)throw new Error("Unable to get boundingBox!");return r}function F(e,t,o){return !o||!o[t]?e:o[t]}async function Ht(e,t,o,r){let{steps:i=1,skipMouseUp:s}=r||{},n=await H(this,e),a=F(n.width/2,"x",o),p=F(n.height/2,"y",o),l=F(0,"x",t),d=F(0,"y",t);await this.mouse.move(n.x+a,n.y+p,{steps:i}),await this.mouse.down(),await this.mouse.move(l,d,{steps:i}),s||await this.mouse.up();}async function E(e,t,o,r,i,s,n){await e.$eval(o,(a,p)=>{let l=a.getBoundingClientRect(),{client:d={},page:f={},screen:y={},type:m,options:I}=p,h=new Touch({clientX:d.x,clientY:d.y,identifier:Date.now(),pageX:f.x||(d.x!==void 0?l.left+d.x:void 0),pageY:f.y||(d.y!==void 0?l.top+d.y:void 0),screenX:y.x,screenY:y.y,target:a}),S=new TouchEvent(m,{bubbles:true,cancelable:true,...I,changedTouches:[h],targetTouches:[h],touches:[h]});return a.dispatchEvent(S)},{client:s,options:n,page:r,screen:i,type:t});}async function Nt(e,t,o,r,i,s,n,a){await E(this,"touchstart",e,t,s,r,a),await E(this,"touchmove",e,o,n,i,a),await E(this,"touchend",e,o,n,i,a);}function $t(e){let t=e;return t.dragDropSelector=Ht,t.scrollSelector=Zt,t.mouseDownOnSelector=Vt,t.mouseMoveToSelector=Yt,t.setSelectorSize=Gt,t.clearInput=_t,t.selectorMouseWheel=Xt,t.touchCancel=Qt,t.touchMove=eo,t.touchEnd=Jt,t.touchStart=to,t.touchFromTo=Nt,t.mouseFromTo=Kt,t}async function Vt(e,t,o){let{steps:r=1}=o||{},i=await H(this,e),s=F(i.width/2,"x",t),n=F(i.height/2,"y",t);await this.mouse.move(i.x+s,i.y+n,{steps:r}),await this.mouse.down();}async function Kt(e,t,o){let{skipMouseUp:r,steps:i=1}=o||{};if(e.x===void 0||e.y===void 0||t.x===void 0||t.y===void 0)throw new Error("mouseFromTo requires from/to coordinates (x and y).");await this.mouse.move(e.x,e.y,{steps:i}),await this.mouse.down(),await this.mouse.move(t.x,t.y,{steps:i}),r||await this.mouse.up();}async function Yt(e,t,o){let{steps:r=1}=o||{},i=await H(this,e),s=F(i.width/2,"x",t),n=F(i.height/2,"y",t);await this.mouse.move(i.x+s,i.y+n,{steps:r});}async function Zt(e,t){return await this.waitForSelector(e),await this.$eval(e,(r,i)=>{i.top&&(r.scrollTop=i.top),i.left&&(r.scrollLeft=i.left);},t)}async function Xt(e,t){return await this.waitForSelector(e),await this.$eval(e,(r,i)=>{let s=new WheelEvent("wheel",i);r.dispatchEvent(s);},t)}async function Gt(e,t,o){await this.$eval(e,(r,i)=>{i.width!==void 0&&(r.style.width=i.width),i.height!==void 0&&(r.style.height=i.height);},{height:o,width:t});}async function Qt(e,t,o,r,i){await E(this,"touchcancel",e,t,o,r,i);}async function Jt(e,t,o,r,i){await E(this,"touchend",e,t,o,r,i);}async function eo(e,t,o,r,i){await E(this,"touchmove",e,t,o,r,i);}async function to(e,t,o,r,i){await E(this,"touchstart",e,t,o,r,i);}async function Y(e,t,o,r){let i={...t,requestId:t.requestId||""};return o.beforeScreenshot&&await o.beforeScreenshot(e,i,i),r?r.screenshot(t.screenshotOptions):e.screenshot(t.screenshotOptions)}async function de(e,t){let o={...e,requestId:e.requestId||""},r=v(),{screenshotOptions:i={}}=r,s=e.browserOptions,n=await r.getPage(o.browserType,s,o);if(!n)throw new Error("Make sure to return an instance of a page from getPage.");$t(n);let a=j(e),p=Je(r.storybookEndpoint,e.storyId,e.props,a);r.afterUrlConstruction&&(p=r.afterUrlConstruction(p,o)),await n.goto(p,r.pageGotoOptions),r.afterNavigation&&await r.afterNavigation(n,o),s&&s.cursor&&await dt(n);let l=[],d,f;if(e.actionSets){let I=e.actionSets.reduce((b,P)=>(b=[...b,...P.actions],b),[]);f=I.slice(-1)[0];let h=I.find(b=>b.name==="takeScreenshotAll");d=I.find(b=>b.name==="takeScreenshotOptions");let S=I.filter(b=>!["takeScreenshotAll","takeScreenshotOptions"].includes(b.name));h&&S.filter(b=>ne(b)).length>0&&l.push({buffer:await Y(n,e,r),options:h.args});for(let b=0;b<S.length;b++){let P=S[b];if(P.name==="takeElementScreenshot"){if(P&&P.args&&P.args.selector){let W=await n.$(P.args.selector);l.push({buffer:await Y(n,e,r,W||void 0),options:P.args});}continue}if(P.name==="takeScreenshot"){l.push({buffer:await Y(n,e,r),options:P.args});continue}await pt(n,P),bt(S,b,!!h)&&l.push({buffer:await Y(n,e,r),options:h?.args||{}});}}let y=f&&(f.name==="takeElementScreenshot"||f.name==="takeScreenshot"),m;if(y||(m=await Y(n,e,r)),r.releaseModifierKey&&await gt(n,e.actionSets||[]),r.afterScreenshot&&await r.afterScreenshot(n,o),l.length){let I=e&&e.screenshotOptions&&e.screenshotOptions.type?e.screenshotOptions.type:"png",h=d&&d.args?d.args:{};if(h={mergeType:h.mergeType?h.mergeType:i.mergeType||"stitch",overlayOptions:{...i.overlayOptions,...h.overlayOptions},stitchOptions:{...i.stitchOptions,...h.stitchOptions}},h.mergeType==="stitch"){let S=l.map(b=>b.buffer);m&&S.push(m),m=await(await or__default.default(S,{...h.stitchOptions})).toFormat(I).toBuffer();}else {let S=m||l[0]?.buffer;if(!S)throw new Error("Unable to create screenshot image buffer.");let P=(m===void 0&&l.length===1?l:l.filter((W,mo)=>!(m===void 0&&mo===0))).map(W=>({blend:"multiply",input:W.buffer,...h.overlayOptions,...W.options?W.options.stitchOptions:{}}));m=await rr__default.default(S).composite(P).toFormat(I).toBuffer();}}if(!m)throw new Error("Unable to create screenshot image buffer.");return {base64:t?m.toString("base64"):void 0,browserName:e.browserType,buffer:m}}async function $(e,t,o){return new Promise((r,i)=>{try{let s=B(e),n=v(),a=n.imageDiffOptions??{},p=R__namespace.default.resolve(process.cwd(),"__stories__",e.storyId,"__diff_output__");N__namespace.existsSync(p)||N__namespace.mkdirSync(p,{recursive:!0});let l=diffSnapshot.runDiffImageToSnapshot({blur:0,diffDir:p,diffDirection:n.diffDirection?n.diffDirection:"horizontal",failureThreshold:0,failureThresholdType:"pixel",receivedImageBuffer:t,snapshotIdentifier:s.screenshotIdentifier,snapshotsDir:s.screenshotsDir,updatePassedSnapshot:!1,updateSnapshot:!1,...a,...o});l.pass||N__namespace.rmdirSync(p,{recursive:!0}),l.added&&l.pass===!1&&delete l.pass,l.diffDirection=n.diffDirection,a.allowSizeMismatch&&(l.diffSize=!1),r(l);}catch(s){i(s);}})}async function oo(e){let t=g(e.filePath),o=await w(t.path,e.storyId);if(!o)throw new Error("Unable to load story data.");let r=x(o,e.storyId,true);if(!r)throw new Error("Story not found");if(e.updateScreenshot&&(r.screenshots=await _({filePath:e.filePath,screenshotId:e.updateScreenshot.id,storyId:e.storyId})),r.screenshots||(r.screenshots=[]),!e.base64)throw new Error("Unable to save screenshot without image data.");let i=r.screenshots.find(p=>p.id===e.id);if(!i){let p=r.screenshots.find(d=>d.title===e.title&&d.browserType===e.browserType);if(p)throw new Error(`Found screenshot with the same title, title must be unique.
|
|
131
|
+
`,spaces:2});}var At=O({addFavouriteAction:u.input(Ee).mutation(async({input:e})=>kt(e)),deleteFavouriteAction:u.input(Fe).mutation(async({input:e})=>Dt(e)),getFavouriteActions:u.query(async()=>ae())});async function Ft(e){let t=await yt(e.filePath);if(!t)throw new Error("Unable to load screenshot config file data.");let o=g(e.filePath),r=pe__default.default(e.previousNamedExport),i=e.id.split("--")[1],s=i?pe__default.default(i):"",n="",a="",p=[],l=false,d=t.stories||{};if(t.stories||(t.stories=d),Object.keys(d).forEach(f=>{let y=d[f],m=f.split("--"),I=m[1]||"";n||(n=m[0]),a=e.parent;let h=r&&I===r;!l&&h&&(l=true),p=[...p,...(y.screenshots||[]).map(P=>({browser:P.browserType,newStoryId:h?s:void 0,screenshotTitle:P.title,storyId:I,storyTitle:n}))],m[0]=e.parent,h&&(m[1]=s);let S=m.join("--"),w=d[S];S!==f&&(delete d[f],delete d[S],d[S]=w?Go__default.default(y,w):y);},{}),r&&!l)throw new Error("Unable to locate old stories, make sure the previous named function name entered currently.");if(n&&a){n=pe__default.default(n),a=pe__default.default(a);for(let f=0;f<p.length;f++){let y=p[f],m=ge(y),I=ge({...y,storyId:y.newStoryId?y.newStoryId:y.storyId,storyTitle:a}),h=R__namespace.default.join(o.screenShotsDir,m);N__namespace.default.existsSync(h)&&N__namespace.default.renameSync(h,R__namespace.default.join(o.screenShotsDir,I));}}await A(o,t);}var qt=O({fixScreenshotFileName:u.input(qe).mutation(async({input:e})=>Ft(e))});var jt={acceptDownloads:{type:"boolean",description:"Whether to automatically download all the attachments. Defaults to `false` where all the downloads are canceled."},baseURL:{type:"string",description:"When using [page.goto(url[, options])](https://playwright.dev/docs/api/class-page#page-goto), [page.route(url, handler[, options])](https://playwright.dev/docs/api/class-page#page-route), [page.waitForURL(url[, options])](https://playwright.dev/docs/api/class-page#page-wait-for-url), [page.waitForRequest(urlOrPredicate[, options])](https://playwright.dev/docs/api/class-page#page-wait-for-request), or [page.waitForResponse(urlOrPredicate[, options])](https://playwright.dev/docs/api/class-page#page-wait-for-response) it takes the base URL in consideration by using the [`URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor for building the corresponding URL. Examples:\n- baseURL: `http://localhost:3000` and navigating to `/bar.html` results in `http://localhost:3000/bar.html`\n- baseURL: `http://localhost:3000/foo/` and navigating to `./bar.html` results in `http://localhost:3000/foo/bar.html`"},bypassCSP:{type:"boolean",description:"Toggles bypassing page's Content-Security-Policy."},colorScheme:{type:"string",enum:["light","dark","no-preference"],description:"Emulates `'prefers-colors-scheme'` media feature, supported values are `'light'`, `'dark'`, `'no-preference'`. See [page.emulateMedia([options])](https://playwright.dev/docs/api/class-page#page-emulate-media) for more details. Defaults to `'light'`."},deviceScaleFactor:{type:"number",description:"Specify device scale factor (can be thought of as dpr). Defaults to `1`."},forcedColors:{type:"string",enum:["active","none"],description:"Emulates `'forced-colors'` media feature, supported values are `'active'`, `'none'`. See [page.emulateMedia([options])](https://playwright.dev/docs/api/class-page#page-emulate-media) for more details. Defaults to `'none'`.\n\n> NOTE: It's not supported in WebKit, see [here](https://bugs.webkit.org/show_bug.cgi?id=225281) in their issue tracker."},geolocation:{type:"object",properties:{latitude:{type:"number",description:"Latitude between -90 and 90."},longitude:{type:"number",description:"Longitude between -180 and 180."},accuracy:{type:"number",description:"Non-negative accuracy value. Defaults to `0`."}},required:["latitude","longitude"],additionalProperties:false},hasTouch:{type:"boolean",description:"Specifies if viewport supports touch events. Defaults to false."},httpCredentials:{type:"object",properties:{username:{type:"string"},password:{type:"string"}},required:["username","password"],additionalProperties:false,description:"Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication)."},ignoreHTTPSErrors:{type:"boolean",description:"Whether to ignore HTTPS errors when sending network requests. Defaults to `false`."},isMobile:{type:"boolean",description:"Whether the `meta viewport` tag is taken into account and touch events are enabled. Defaults to `false`. Not supported in Firefox."},javaScriptEnabled:{type:"boolean",description:"Whether or not to enable JavaScript in the context. Defaults to `true`."},locale:{type:"string",description:"Specify user locale, for example `en-GB`, `de-DE`, etc. Locale will affect `navigator.language` value, `Accept-Language` request header value as well as number and date formatting rules."},offline:{type:"boolean",description:"Whether to emulate network being offline. Defaults to `false`."},permissions:{type:"array",items:{type:"string"},description:"A list of permissions to grant to all pages in this context. See [browserContext.grantPermissions(permissions[, options])](https://playwright.dev/docs/api/class-browsercontext#browser-context-grant-permissions) for more details."},proxy:{type:"object",properties:{server:{type:"string",description:"Proxy to be used for all requests. HTTP and SOCKS proxies are supported, for example `http://myproxy.com:3128` or `socks5://myproxy.com:3128`. Short form `myproxy.com:3128` is considered an HTTP proxy."},bypass:{type:"string",description:'Optional comma-separated domains to bypass proxy, for example `".com, chromium.org, .domain.com"`.'},username:{type:"string",description:"Optional username to use if HTTP proxy requires authentication."},password:{type:"string",description:"Optional password to use if HTTP proxy requires authentication."}},required:["server"],additionalProperties:false,description:"Network proxy settings to use with this context.\n\n> NOTE: For Chromium on Windows the browser needs to be launched with the global proxy for this option to work. If all contexts override the proxy, global proxy will be never used and can be any string, for example `launch({ proxy: { server: 'http://per-context' } })`."},recordHar:{type:"object",properties:{omitContent:{type:"boolean",description:"Optional setting to control whether to omit request content from the HAR. Defaults to `false`."},path:{type:"string",description:"Path on the filesystem to write the HAR file to."}},required:["path"],additionalProperties:false,description:"Enables [HAR](http://www.softwareishard.com/blog/har-12-spec) recording for all pages into `recordHar.path` file. If not specified, the HAR is not recorded. Make sure to await [browserContext.close()](https://playwright.dev/docs/api/class-browsercontext#browser-context-close) for the HAR to be saved."},recordVideo:{type:"object",properties:{dir:{type:"string",description:"Path to the directory to put videos into."},size:{type:"object",properties:{width:{type:"number",description:"Video frame width."},height:{type:"number",description:"Video frame height."}},required:["width","height"],additionalProperties:false,description:"Optional dimensions of the recorded videos. If not specified the size will be equal to `viewport` scaled down to fit into 800x800. If `viewport` is not configured explicitly the video size defaults to 800x450. Actual picture of each page will be scaled down if necessary to fit the specified size."}},required:["dir"],additionalProperties:false,description:"Enables video recording for all pages into `recordVideo.dir` directory. If not specified videos are not recorded. Make sure to await [browserContext.close()](https://playwright.dev/docs/api/class-browsercontext#browser-context-close) for videos to be saved."},reducedMotion:{type:"string",enum:["reduce","no-preference"],description:"Emulates `'prefers-reduced-motion'` media feature, supported values are `'reduce'`, `'no-preference'`. See [page.emulateMedia([options])](https://playwright.dev/docs/api/class-page#page-emulate-media) for more details. Defaults to `'no-preference'`."},screen:{type:"object",properties:{width:{type:"number",description:"page width in pixels."},height:{type:"number",description:"page height in pixels."}},required:["width","height"],additionalProperties:false,description:"Emulates consistent window screen size available inside web page via `window.screen`. Is only used when the `viewport` is set."},storageState:{anyOf:[{type:"string"},{type:"object",properties:{cookies:{type:"array",items:{type:"object",properties:{name:{type:"string"},value:{type:"string"},domain:{type:"string",description:"domain and path are required"},path:{type:"string",description:"domain and path are required"},expires:{type:"number",description:"Unix time in seconds."},httpOnly:{type:"boolean"},secure:{type:"boolean"},sameSite:{type:"string",enum:["Strict","Lax","None"],description:"sameSite flag"}},required:["name","value","domain","path","expires","httpOnly","secure","sameSite"],additionalProperties:false},description:"cookies to set for context"},origins:{type:"array",items:{type:"object",properties:{origin:{type:"string"},localStorage:{type:"array",items:{type:"object",additionalProperties:false}}},required:["origin","localStorage"],additionalProperties:false},description:"localStorage to set for context"}},required:["cookies","origins"],additionalProperties:false}],description:"Populates context with given storage state. This option can be used to initialize context with logged-in information obtained via [browserContext.storageState([options])](https://playwright.dev/docs/api/class-browsercontext#browser-context-storage-state). Either a path to the file with saved storage, or an object with the following fields:"},strictSelectors:{type:"boolean",description:"It specified, enables strict selectors mode for this context. In the strict selectors mode all operations on selectors that imply single target DOM element will throw when more than one element matches the selector. See [Locator] to learn more about the strict mode."},timezoneId:{type:"string",description:"Changes the timezone of the context. See [ICU's metaZones.txt](https://cs.chromium.org/chromium/src/third_party/icu/source/data/misc/metaZones.txt?rcl=faee8bc70570192d82d2978a71e2a615788597d1) for a list of supported timezone IDs."},userAgent:{type:"string",description:"Specific user agent to use in this context."},videoSize:{type:"object",properties:{width:{type:"number",description:"Video frame width."},height:{type:"number",description:"Video frame height."}},required:["width","height"],additionalProperties:false,description:"**DEPRECATED** Use `recordVideo` instead.",deprecated:true},videosPath:{type:"string",description:"**DEPRECATED** Use `recordVideo` instead.",deprecated:true},viewport:{type:"object",properties:{width:{type:"number",description:"page width in pixels."},height:{type:"number",description:"page height in pixels."}},required:["width","height"],additionalProperties:false,description:"Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. `null` disables the default viewport."},cursor:{type:"boolean"}};var Ct={type:{type:"string",enum:["png","jpeg"],description:"Specify screenshot type, defaults to `png`."},quality:{type:"number",description:"The quality of the image, between 0-100. Not applicable to `png` images."},fullPage:{type:"boolean",description:"When true, takes a screenshot of the full scrollable page, instead of the currently visibvle viewport. Defaults to `false`."},clip:{type:"object",properties:{x:{type:"number",description:"x-coordinate of top-left corner of clip area"},y:{type:"number",description:"y-coordinate of top-left corner of clip area"},width:{type:"number",description:"width of clipping area"},height:{type:"number",description:"height of clipping area"}},required:["x","y","width","height"],additionalProperties:false,description:"An object which specifies clipping of the resulting image. Should have the following fields:"},omitBackground:{type:"boolean",description:"Hides default white background and allows capturing screenshots with transparency. Not applicable to `jpeg` images. Defaults to `false`."},timeout:{type:"number",description:"Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the browserContext.setDefaultTimeout(timeout) or page.setDefaultTimeout(timeout) methods."}};function Rt(e){if(e==="browser-options")return jt;if(e==="screenshot-options")return Ct}var Wt=O({getActionsSchema:u.query(()=>te()),getSchema:u.input(q.z.object({schemaName:q.z.string()})).mutation(({input:e})=>Rt(e.schemaName))});async function zt(e){let t=g(e.filePath),o=await b(t.path,e.storyId),r=x(o,e.storyId,false);if(!r||!r.screenshots)return;let i=Ho__default.default(r.screenshots,e.oldIndex,e.newIndex);r.screenshots=i.map((s,n)=>(s.index=n,s)),await A(t,o);}function B(e){let t=g(e.filePath),o=pe__default.default(`${R__namespace.default.basename(e.storyId)}--${e.title}--${e.browserType}`),r=R__namespace.default.join(t.screenShotsDir,"__diff_output__"),i=R__namespace.default.join(t.screenShotsDir,`${o}-snap.png`);return {diffDir:r,filePath:i,screenshotIdentifier:o,screenshotsDir:t.screenShotsDir}}function or(e){let t=[e];return e.endsWith("-snap.png")?t.push(e.replace(/-snap\.png$/,".png")):e.endsWith(".png")&&t.push(e.replace(/\.png$/,"-snap.png")),[...new Set(t)]}async function _(e){let t=g(e.filePath),o=await b(t.path,e.storyId,false);if(!o)return;let r=x(o,e.storyId);if(!r||!r.screenshots||!r.screenshots.length)return [];let i=r.screenshots.find(n=>n.id===e.screenshotId);if(!i)return r.screenshots;let s=B({browserType:i.browserType,filePath:e.filePath,storyId:e.storyId,title:i.title});for(let n of or(s.filePath))N__namespace.existsSync(n)&&N__namespace.unlinkSync(n);return r.screenshots=r.screenshots.filter(n=>n.id!==e.screenshotId),r.screenshots.length||delete r.screenshots,be(o,"browserOptions",i.browserOptionsId),be(o,"screenshotOptions",i.screenshotOptionsId),await A(t,o),r.screenshots||[]}async function le(e){let t=g(e.filePath),o=await b(t.path,e.storyId),r=x(o,e.storyId);if(!(!r||!r.screenshots||!r.screenshots.length))return r.screenshots.map(i=>(o&&ie(o,i),i))}async function Lt(e){let t=await le(e);if(!(!t||!t.length))for(let o=0;o<t.length;o++){let r=t[o];r&&await _({filePath:e.filePath,screenshotId:r.id,storyId:e.storyId});}}async function Ut(e){let{getScreenshotTitle:t}=v();if(!t)throw new Error("getScreenshotTitle is not configured.");return t({...e})}function Bt(){return typeof v().getScreenshotTitle=="function"}async function _t(e,t={}){let{blur:o,timeout:r}=t;await this.fill(e,""),o&&await this.$eval(e,i=>i.blur()),r&&await this.waitForTimeout(r);}async function H(e,t){await e.waitForSelector(t);let o=await e.$(t);if(!o)throw new Error("Unable to find selector!");let r=await o.boundingBox();if(!r)throw new Error("Unable to get boundingBox!");return r}function F(e,t,o){return !o||!o[t]?e:o[t]}async function Ht(e,t,o,r){let{steps:i=1,skipMouseUp:s}=r||{},n=await H(this,e),a=F(n.width/2,"x",o),p=F(n.height/2,"y",o),l=F(0,"x",t),d=F(0,"y",t);await this.mouse.move(n.x+a,n.y+p,{steps:i}),await this.mouse.down(),await this.mouse.move(l,d,{steps:i}),s||await this.mouse.up();}async function E(e,t,o,r,i,s,n){await e.$eval(o,(a,p)=>{let l=a.getBoundingClientRect(),{client:d={},page:f={},screen:y={},type:m,options:I}=p,h=new Touch({clientX:d.x,clientY:d.y,identifier:Date.now(),pageX:f.x||(d.x!==void 0?l.left+d.x:void 0),pageY:f.y||(d.y!==void 0?l.top+d.y:void 0),screenX:y.x,screenY:y.y,target:a}),S=new TouchEvent(m,{bubbles:true,cancelable:true,...I,changedTouches:[h],targetTouches:[h],touches:[h]});return a.dispatchEvent(S)},{client:s,options:n,page:r,screen:i,type:t});}async function Nt(e,t,o,r,i,s,n,a){await E(this,"touchstart",e,t,s,r,a),await E(this,"touchmove",e,o,n,i,a),await E(this,"touchend",e,o,n,i,a);}function $t(e){let t=e;return t.dragDropSelector=Ht,t.scrollSelector=Zt,t.mouseDownOnSelector=Vt,t.mouseMoveToSelector=Yt,t.setSelectorSize=Gt,t.clearInput=_t,t.selectorMouseWheel=Xt,t.touchCancel=Qt,t.touchMove=eo,t.touchEnd=Jt,t.touchStart=to,t.touchFromTo=Nt,t.mouseFromTo=Kt,t}async function Vt(e,t,o){let{steps:r=1}=o||{},i=await H(this,e),s=F(i.width/2,"x",t),n=F(i.height/2,"y",t);await this.mouse.move(i.x+s,i.y+n,{steps:r}),await this.mouse.down();}async function Kt(e,t,o){let{skipMouseUp:r,steps:i=1}=o||{};if(e.x===void 0||e.y===void 0||t.x===void 0||t.y===void 0)throw new Error("mouseFromTo requires from/to coordinates (x and y).");await this.mouse.move(e.x,e.y,{steps:i}),await this.mouse.down(),await this.mouse.move(t.x,t.y,{steps:i}),r||await this.mouse.up();}async function Yt(e,t,o){let{steps:r=1}=o||{},i=await H(this,e),s=F(i.width/2,"x",t),n=F(i.height/2,"y",t);await this.mouse.move(i.x+s,i.y+n,{steps:r});}async function Zt(e,t){return await this.waitForSelector(e),await this.$eval(e,(r,i)=>{i.top&&(r.scrollTop=i.top),i.left&&(r.scrollLeft=i.left);},t)}async function Xt(e,t){return await this.waitForSelector(e),await this.$eval(e,(r,i)=>{let s=new WheelEvent("wheel",i);r.dispatchEvent(s);},t)}async function Gt(e,t,o){await this.$eval(e,(r,i)=>{i.width!==void 0&&(r.style.width=i.width),i.height!==void 0&&(r.style.height=i.height);},{height:o,width:t});}async function Qt(e,t,o,r,i){await E(this,"touchcancel",e,t,o,r,i);}async function Jt(e,t,o,r,i){await E(this,"touchend",e,t,o,r,i);}async function eo(e,t,o,r,i){await E(this,"touchmove",e,t,o,r,i);}async function to(e,t,o,r,i){await E(this,"touchstart",e,t,o,r,i);}async function Y(e,t,o,r){let i={...t,requestId:t.requestId||""};return o.beforeScreenshot&&await o.beforeScreenshot(e,i,i),r?r.screenshot(t.screenshotOptions):e.screenshot(t.screenshotOptions)}async function de(e,t){let o={...e,requestId:e.requestId||""},r=v(),{screenshotOptions:i={}}=r,s=e.browserOptions,n=await r.getPage(o.browserType,s,o);if(!n)throw new Error("Make sure to return an instance of a page from getPage.");$t(n);let a=j(e),p=Je(r.storybookEndpoint,e.storyId,e.props,a);r.afterUrlConstruction&&(p=r.afterUrlConstruction(p,o)),await n.goto(p,r.pageGotoOptions),r.afterNavigation&&await r.afterNavigation(n,o),s&&s.cursor&&await dt(n);let l=[],d,f;if(e.actionSets){let I=e.actionSets.reduce((w,P)=>(w=[...w,...P.actions],w),[]);f=I.slice(-1)[0];let h=I.find(w=>w.name==="takeScreenshotAll");d=I.find(w=>w.name==="takeScreenshotOptions");let S=I.filter(w=>!["takeScreenshotAll","takeScreenshotOptions"].includes(w.name));h&&S.filter(w=>ne(w)).length>0&&l.push({buffer:await Y(n,e,r),options:h.args});for(let w=0;w<S.length;w++){let P=S[w];if(P.name==="takeElementScreenshot"){if(P&&P.args&&P.args.selector){let W=await n.$(P.args.selector);l.push({buffer:await Y(n,e,r,W||void 0),options:P.args});}continue}if(P.name==="takeScreenshot"){l.push({buffer:await Y(n,e,r),options:P.args});continue}await pt(n,P),wt(S,w,!!h)&&l.push({buffer:await Y(n,e,r),options:h?.args||{}});}}let y=f&&(f.name==="takeElementScreenshot"||f.name==="takeScreenshot"),m;if(y||(m=await Y(n,e,r)),r.releaseModifierKey&&await gt(n,e.actionSets||[]),r.afterScreenshot&&await r.afterScreenshot(n,o),l.length){let I=e&&e.screenshotOptions&&e.screenshotOptions.type?e.screenshotOptions.type:"png",h=d&&d.args?d.args:{};if(h={mergeType:h.mergeType?h.mergeType:i.mergeType||"stitch",overlayOptions:{...i.overlayOptions,...h.overlayOptions},stitchOptions:{...i.stitchOptions,...h.stitchOptions}},h.mergeType==="stitch"){let S=l.map(w=>w.buffer);m&&S.push(m),m=await(await rr__default.default(S,{...h.stitchOptions})).toFormat(I).toBuffer();}else {let S=m||l[0]?.buffer;if(!S)throw new Error("Unable to create screenshot image buffer.");let P=(m===void 0&&l.length===1?l:l.filter((W,mo)=>!(m===void 0&&mo===0))).map(W=>({blend:"multiply",input:W.buffer,...h.overlayOptions,...W.options?W.options.stitchOptions:{}}));m=await ir__default.default(S).composite(P).toFormat(I).toBuffer();}}if(!m)throw new Error("Unable to create screenshot image buffer.");return {base64:t?m.toString("base64"):void 0,browserName:e.browserType,buffer:m}}async function $(e,t,o){return new Promise((r,i)=>{try{let s=B(e),n=v(),a=n.imageDiffOptions??{},p=R__namespace.default.resolve(process.cwd(),"__stories__",e.storyId,"__diff_output__");N__namespace.existsSync(p)||N__namespace.mkdirSync(p,{recursive:!0});let l=diffSnapshot.runDiffImageToSnapshot({blur:0,diffDir:p,diffDirection:n.diffDirection?n.diffDirection:"horizontal",failureThreshold:0,failureThresholdType:"pixel",receivedImageBuffer:t,snapshotIdentifier:s.screenshotIdentifier,snapshotsDir:s.screenshotsDir,updatePassedSnapshot:!1,updateSnapshot:!1,...a,...o});l.pass||N__namespace.rmdirSync(p,{recursive:!0}),l.added&&l.pass===!1&&delete l.pass,l.diffDirection=n.diffDirection,a.allowSizeMismatch&&(l.diffSize=!1),r(l);}catch(s){i(s);}})}async function oo(e){let t=g(e.filePath),o=await b(t.path,e.storyId);if(!o)throw new Error("Unable to load story data.");let r=x(o,e.storyId,true);if(!r)throw new Error("Story not found");if(e.updateScreenshot&&(r.screenshots=await _({filePath:e.filePath,screenshotId:e.updateScreenshot.id,storyId:e.storyId})),r.screenshots||(r.screenshots=[]),!e.base64)throw new Error("Unable to save screenshot without image data.");let i=r.screenshots.find(p=>p.id===e.id);if(!i){let p=r.screenshots.find(d=>d.title===e.title&&d.browserType===e.browserType);if(p)throw new Error(`Found screenshot with the same title, title must be unique.
|
|
132
132
|
Title: ${p.title}
|
|
133
133
|
Browser: ${e.browserType}`);let l=ft(o,r.screenshots,e);if(l)throw new Error(`Found screenshot with the same setting, Screenshot settings must be unique for each screenshot.
|
|
134
134
|
Title: ${l.title}
|
|
135
|
-
Browser: ${l.browserType}`)}let s=await $(e,Buffer.from(e.base64,"base64")),n=j(e),a=!e.args&&e.props&&Object.keys(e.props).length>0?e.props:void 0;if(s.added&&s.pass===false&&delete s.pass,i)s.oldScreenShotTitle=i.title;else {let p=e.updateScreenshot?e.updateScreenshot.index:r.screenshots.length;r.screenshots.push({actionSets:re(e.actionSets,{regenerateIds:true}),args:n,browserOptionsId:Se(o,"browserOptions",e.browserOptions),browserType:e.browserType,id:e.id,index:p,props:a,screenshotOptionsId:Se(o,"screenshotOptions",e.screenshotOptions),title:e.title}),s.index=p,await A(t,o);}return s}async function me(e){let t=e.requestId||"",{requestType:o="story-screenshot"}=e,r=v(),i=await se(e);if(!i)throw new Error("Unable to find screenshot data.");let s={},n;try{if(n=await de({actionSets:i.actionSets,args:j(i),browserOptions:i.browserOptions,browserType:i.browserType,props:i.props,requestId:e.requestId,requestType:o,screenshotOptions:i.screenshotOptions,storyId:e.storyId},!0),r.compareScreenshot!==void 0){let a=B({...e,browserType:i.browserType,title:i.title});if(!N__namespace.default.existsSync(a.filePath))throw new Error(`Unable to find the file for '${a.screenshotIdentifier}' screenshot in '${a.screenshotsDir}' directory!`);let p={...a,get base64(){return N__namespace.default.readFileSync(a.filePath,{encoding:"base64"})},get buffer(){return N__namespace.default.readFileSync(a.filePath)}},l=await r.compareScreenshot({...e,requestId:t,...i,baseImage:p,screenshot:n});if(l!==!1){let{diffImageString:d,...f}=l;s={imgSrcString:d,...f,newScreenshot:p.base64};}}Object.keys(s).length===0&&(s=await $({browserType:i.browserType,filePath:e.filePath,storyId:e.storyId,title:i.title},n.buffer)),s.added&&s.pass===!1&&delete s.pass,s.newScreenshot=n.base64;}catch(a){s.pass=false,s.error=typeof a=="string"?a:a.message;}return s.screenshotId=e.screenshotId,s.storyId=e.storyId,s.screenshotData=i,s.filePath=e.filePath,s}async function ro(e){return await
|
|
135
|
+
Browser: ${l.browserType}`)}let s=await $(e,Buffer.from(e.base64,"base64")),n=j(e),a=!e.args&&e.props&&Object.keys(e.props).length>0?e.props:void 0;if(s.added&&s.pass===false&&delete s.pass,i)s.oldScreenShotTitle=i.title;else {let p=e.updateScreenshot?e.updateScreenshot.index:r.screenshots.length;r.screenshots.push({actionSets:re(e.actionSets,{regenerateIds:true}),args:n,browserOptionsId:Se(o,"browserOptions",e.browserOptions),browserType:e.browserType,id:e.id,index:p,props:a,screenshotOptionsId:Se(o,"screenshotOptions",e.screenshotOptions),title:e.title}),s.index=p,await A(t,o);}return s}async function me(e){let t=e.requestId||"",{requestType:o="story-screenshot"}=e,r=v(),i=await se(e);if(!i)throw new Error("Unable to find screenshot data.");let s={},n;try{if(n=await de({actionSets:i.actionSets,args:j(i),browserOptions:i.browserOptions,browserType:i.browserType,props:i.props,requestId:e.requestId,requestType:o,screenshotOptions:i.screenshotOptions,storyId:e.storyId},!0),r.compareScreenshot!==void 0){let a=B({...e,browserType:i.browserType,title:i.title});if(!N__namespace.default.existsSync(a.filePath))throw new Error(`Unable to find the file for '${a.screenshotIdentifier}' screenshot in '${a.screenshotsDir}' directory!`);let p={...a,get base64(){return N__namespace.default.readFileSync(a.filePath,{encoding:"base64"})},get buffer(){return N__namespace.default.readFileSync(a.filePath)}},l=await r.compareScreenshot({...e,requestId:t,...i,baseImage:p,screenshot:n});if(l!==!1){let{diffImageString:d,...f}=l;s={imgSrcString:d,...f,newScreenshot:p.base64};}}Object.keys(s).length===0&&(s=await $({browserType:i.browserType,filePath:e.filePath,storyId:e.storyId,title:i.title},n.buffer)),s.added&&s.pass===!1&&delete s.pass,s.newScreenshot=n.base64;}catch(a){s.pass=false,s.error=typeof a=="string"?a:a.message;}return s.screenshotId=e.screenshotId,s.storyId=e.storyId,s.screenshotData=i,s.filePath=e.filePath,s}async function ro(e){return await ar__default.default(["**/*.playwright.json","!node_modules/**"])}async function he(e){let t=g(e.filePath),o=await b(t.path,e.storyId);e.requestType=e.requestType||"story";let r={...e,requestId:e.requestId||""},i=v(),s=x(o,e.storyId);if(!s||!s.screenshots)throw new Error("Unable to find story screenshots");let n=[];i.beforeStoryImageDiff&&await i.beforeStoryImageDiff(r);for(let a=0;a<s.screenshots.length;a++){let p=s.screenshots[a],l=await me({filePath:e.filePath,requestId:r.requestId,requestType:e.requestType,screenshotId:p.id,storyId:e.storyId});n.push(l);}return i.afterStoryImageDiff&&await i.afterStoryImageDiff(n,r),n}async function io(e){let{filePath:t,onComplete:o,storyId:r,requestType:i}=e,s=v(),n=await ct(t),a=(n.storyData[0]?.storyId??r??"").split("--")[0],p=pr__default.default(s.concurrencyLimit?.story??1);s.beforeFileImageDiff&&await s.beforeFileImageDiff({...e,storyId:a});let l=n.storyData.reduce((y,m)=>(i==="story"&&r&&m.storyId!==r||m.data.screenshots&&m.data.screenshots.length&&y.push(p(async()=>he({filePath:t,requestId:e.requestId,requestType:e.requestType?e.requestType:r?"story":"file",storyId:m.storyId}))),y),[]),f=(await Promise.all(l)).reduce((y,m)=>{let I=m.map(h=>{if(h.added&&h.pass===false){let S={...h};return delete S.pass,S}return h});return [...y,...I]},[]);return s.afterFileImageDiff&&await s.afterFileImageDiff(f,{...e,storyId:a}),o&&await o(f),f}async function so(e){let t={...e,requestId:e.requestId||""},{requestType:o}=e,r=await ro(),i=v(),s=pr__default.default(i.concurrencyLimit?.file??1);i.beforeAllImageDiff&&await i.beforeAllImageDiff(t);let n=r.reduce((l,d)=>(o!=="all"&&e.filePath&&!tt(d,e.filePath)||l.push(s(async()=>io({disableEvans:true,filePath:d,requestId:e.requestId??"",requestType:o,storyId:e.storyId}))),l),[]),p=(await Promise.all(n)).reduce((l,d)=>{let f=d.map(y=>{if(y.added&&y.pass===false){let m={...y};return delete m.pass,m}return y});return [...l,...f]},[]);return i.afterAllImageDiff&&await i.afterAllImageDiff(p,t),p}async function no(e){let t=await se(e);if(!t)throw new Error("Unable to find screenshot data.");if(!e.base64)throw new Error("Unable to update screenshot without image data.");let o=await $({browserType:t.browserType,filePath:e.filePath,storyId:e.storyId,title:t.title},Buffer.from(e.base64,"base64"),{updatePassedSnapshot:true,updateSnapshot:true}),r=o.added&&o.pass===false?(()=>{let i={...o};return delete i.pass,i})():o;return r.screenshotId=e.screenshotId,r.storyId=e.storyId,r}var ao=O({changeScreenshotIndex:u.input(ze).mutation(async({input:e})=>zt(e)),deleteScreenshot:u.input(Le).mutation(async({input:e})=>_(e)),deleteStoryScreenshots:u.input(Ue).mutation(async({input:e})=>Lt(e)),generateScreenshotTitle:u.input(Ze).mutation(async({input:e})=>Ut(e)),getStoryScreenshots:u.input(Z).mutation(async({input:e})=>le(e)),hasScreenshotTitleGenerator:u.query(()=>Bt()),saveScreenshot:u.input(Be).output(He).mutation(async({input:e})=>oo(e)),takeScreenshot:u.input(Ne).mutation(async({input:e})=>de(e,true)),testScreenshot:u.input($e).output(Q).mutation(async({input:e})=>me(e)),testScreenshots:u.input(Ke).output(Q.array()).mutation(async({input:e})=>so(e)),testStoryScreenshots:u.input(Ve).output(Q.array()).mutation(async({input:e})=>he(e)),updateScreenshot:u.input(Ye).mutation(async({input:e})=>no(e))});function po(){return v().theme??null}var co=O({getThemeData:u.query(()=>po())});var lo=O({actionSet:It,favouriteActions:At,fixTitle:qt,schema:Wt,screenshot:ao,theme:co});var vl=lo;module.exports=vl;//# sourceMappingURL=routes.js.map
|
|
136
136
|
//# sourceMappingURL=routes.js.map
|