storybook-addon-playwright 7.2.2 → 7.2.4
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.js +10 -10
- package/dist/api/server/routes.js.map +1 -1
- package/dist/api/server/routes.mjs +10 -10
- package/dist/api/server/routes.mjs.map +1 -1
- package/dist/get-screenshots.js +4 -4
- package/dist/get-screenshots.js.map +1 -1
- package/dist/get-screenshots.mjs +4 -4
- package/dist/get-screenshots.mjs.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -4
- 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 +4 -4
- package/dist/run-image-diff.js.map +1 -1
- package/dist/run-image-diff.mjs +4 -4
- package/dist/run-image-diff.mjs.map +1 -1
- package/dist/to-match-screenshots.js +4 -4
- package/dist/to-match-screenshots.js.map +1 -1
- package/dist/to-match-screenshots.mjs +4 -4
- package/dist/to-match-screenshots.mjs.map +1 -1
- package/dist/trpc/router.js +10 -10
- package/dist/trpc/router.js.map +1 -1
- package/dist/trpc/router.mjs +10 -10
- package/dist/trpc/router.mjs.map +1 -1
- package/package.json +4 -1
package/dist/get-screenshots.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import F from'fs';import {readFile}from'jsonfile';import*as S from'path';import S__default from'path';import Ee from'lodash/kebabCase';import Ge from'join-images';import Je from'sharp';import {buildArgsParam}from'@storybook/core/router';import ne from'normalize-url';import {get}from'object-path-immutable';import'@pixpilot/dom';import'@storybook/components';import'@storybook/icons';import'react';import'@pixpilot/hash';import'sonner';import {fileURLToPath}from'url';import tt from'fast-glob';async function U(e,t,o=true){return new Promise((i,s)=>{if(!F.existsSync(e)){if(!o){i(void 0);return}i({stories:{}});return}readFile(e,(n,r)=>{if(n){s(n);return}let p=r||{stories:{}};p.stories||(p.stories={}),!p.stories[t]&&t!=="*",i(p);});})}async function _(e){let t=await U(e,"*")||{stories:{}},o=t.stories||{},s=Object.keys(o).map(n=>({data:o[n],storyId:n}));return {playWrightData:t,storyData:s}}function B(e){let t=S.resolve(e),o=S.parse(t),i=o.ext===".json"?`${o.name}.json`:`${o.name}.playwright.json`;return {dir:o.dir,name:i,path:S.join(S.dirname(t),i),screenShotsDir:S.join(o.dir,"__screenshots__")}}function H(e){let t=B(e.filePath),o=Ee(`${S__default.basename(e.storyId)}--${e.title}--${e.browserType}`),i=S__default.join(t.screenShotsDir,"__diff_output__"),s=S__default.join(t.screenShotsDir,`${o}-snap.png`);return {diffDir:i,filePath:s,screenshotIdentifier:o,screenshotsDir:t.screenShotsDir}}async function N(e,t={}){let{blur:o,timeout:i}=t;await this.fill(e,""),o&&await this.$eval(e,s=>s.blur()),i&&await this.waitForTimeout(i);}async function O(e,t){await e.waitForSelector(t);let o=await e.$(t);if(!o)throw new Error("Unable to find selector!");let i=await o.boundingBox();if(!i)throw new Error("Unable to get boundingBox!");return i}function v(e,t,o){return !o||!o[t]?e:o[t]}async function $(e,t,o,i){let{steps:s=1,skipMouseUp:n}=i||{},r=await O(this,e),p=v(r.width/2,"x",o),a=v(r.height/2,"y",o),l=v(0,"x",t),c=v(0,"y",t);await this.mouse.move(r.x+p,r.y+a,{steps:s}),await this.mouse.down(),await this.mouse.move(l,c,{steps:s}),n||await this.mouse.up();}async function w(e,t,o,i,s,n,r){await e.$eval(o,(p,a)=>{let l=p.getBoundingClientRect(),{client:c={},page:b={},screen:x={},type:E,options:u}=a,f=new Touch({clientX:c.x,clientY:c.y,identifier:Date.now(),pageX:b.x||(c.x!==void 0?l.left+c.x:void 0),pageY:b.y||(c.y!==void 0?l.top+c.y:void 0),screenX:x.x,screenY:x.y,target:p}),h=new TouchEvent(E,{bubbles:true,cancelable:true,...u,changedTouches:[f],targetTouches:[f],touches:[f]});return p.dispatchEvent(h)},{client:n,options:r,page:i,screen:s,type:t});}async function z(e,t,o,i,s,n,r,p){await w(this,"touchstart",e,t,n,i,p),await w(this,"touchmove",e,o,r,s,p),await w(this,"touchend",e,o,r,s,p);}function Y(e){let t=e;return t.dragDropSelector=$,t.scrollSelector=X,t.mouseDownOnSelector=K,t.mouseMoveToSelector=Z,t.setSelectorSize=G,t.clearInput=N,t.selectorMouseWheel=Q,t.touchCancel=J,t.touchMove=te,t.touchEnd=ee,t.touchStart=oe,t.touchFromTo=z,t.mouseFromTo=V,t}async function K(e,t,o){let{steps:i=1}=o||{},s=await O(this,e),n=v(s.width/2,"x",t),r=v(s.height/2,"y",t);await this.mouse.move(s.x+n,s.y+r,{steps:i}),await this.mouse.down();}async function V(e,t,o){let{skipMouseUp:i,steps:s=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:s}),await this.mouse.down(),await this.mouse.move(t.x,t.y,{steps:s}),i||await this.mouse.up();}async function Z(e,t,o){let{steps:i=1}=o||{},s=await O(this,e),n=v(s.width/2,"x",t),r=v(s.height/2,"y",t);await this.mouse.move(s.x+n,s.y+r,{steps:i});}async function X(e,t){return await this.waitForSelector(e),await this.$eval(e,(i,s)=>{s.top&&(i.scrollTop=s.top),s.left&&(i.scrollLeft=s.left);},t)}async function Q(e,t){return await this.waitForSelector(e),await this.$eval(e,(i,s)=>{let n=new WheelEvent("wheel",s);i.dispatchEvent(n);},t)}async function G(e,t,o){await this.$eval(e,(i,s)=>{s.width!==void 0&&(i.style.width=s.width),s.height!==void 0&&(i.style.height=s.height);},{height:o,width:t});}async function J(e,t,o,i,s){await w(this,"touchcancel",e,t,o,i,s);}async function ee(e,t,o,i,s){await w(this,"touchend",e,t,o,i,s);}async function te(e,t,o,i,s){await w(this,"touchmove",e,t,o,i,s);}async function oe(e,t,o,i,s){await w(this,"touchstart",e,t,o,i,s);}function M(e){return !e||Object.keys(e).length===0?"":buildArgsParam({},e)}function ie(e){return M(e)}function se(e){return M(e)}function re(e){if(!e)return "";let o=Object.keys(e).map(i=>{let s=e[i];return Array.isArray(s)?s.length>0&&typeof s[0]=="object"?`knob-${i}=${JSON.stringify(s)}`:`knob-${i}=${s.join(",")}`:typeof s=="object"?`knob-${i}=${JSON.stringify(s)}`:`knob-${i}=${s}`});return encodeURI(o.join("&"))}function ae(e,t,o,i,s){let n;/^\.{0,2}[/\\]/.test(e)?n=`file:///${e.replace(/\\/g,"/").replace(/^\/+/,"")}`:/^https?:\/\//i.test(e)||/^file:\/\//i.test(e)?n=ne(e):n=ne(`http://${e}`);let r=`${n}/iframe.html?id=${t}`,p=ie(i);p&&(r=`${r}&args=${p}`);let a=se(s);if(a&&(r=`${r}&globals=${a}`),o){let l=re(o);l&&(r=`${r}&${l}`);}return r.replace(/\\/g,"/")}function j(e,t){if(!t)return;let o=t.split(".").join(".properties.");return get(e,o)}function pe(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 i=o.parameters||{};return Object.keys(i).reduce((n,r)=>{let p=o.required&&o.required.includes(r);if(e&&e.args&&e.args[r]!==void 0){let a=e.args[r];if(!p&&a!==null&&(a===void 0||typeof a=="object"&&Object.keys(a).length===0||Array.isArray(a)&&a.length===0))return n;n.push(e.args[r]);}else n.push(void 0);return n},[])}function q(...e){for(let t=0;t<e.length;t++){let o=e[t];if(o&&Object.keys(o).length>0)return o}}var ce=e=>{if(e)return q(e.globals)};var le=e=>{if(e)return q(e.args,e.props)};function Ke(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 s=[];for(let n=0;n<o.required.length;n++){let r=o.required[n];t.args[r]||s.push(r);}return {required:s.length===0?void 0:s}}function me(e,t){return Ke(e,t).required===void 0}function D(){throw new Error("Configuration has not been set.");}var ye={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."},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 than one element, the call throws an exception."},timeout:{type:"number",description:"Maximum time in milliseconds. Defaults to `0` - no timeout. The default value can be changed via `actionTimeout` option in the config, or 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:"**NOTE** Use web assertions that assert visibility or a locator-based [locator.waitFor([options])](https://playwright.dev/docs/api/class-locator#locator-wait-for) instead. Read more about [locators](https://playwright.dev/docs/locators).\n\nReturns when element specified by selector satisfies [`state`](https://playwright.dev/docs/api/class-page#page-wait-for-selector-option-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](https://playwright.dev/docs/api/class-locator) objects and web-first assertions makes the code wait-for-selector-free.\n\nWait for the [`selector`](https://playwright.dev/docs/api/class-page#page-wait-for-selector-option-selector) to satisfy [`state`](https://playwright.dev/docs/api/class-page#page-wait-for-selector-option-state) option (either appear/disappear from dom, or become visible/hidden). If at the moment of calling the method [`selector`](https://playwright.dev/docs/api/class-page#page-wait-for-selector-option-selector) already satisfies the condition, the method will return immediately. If the selector doesn't satisfy the condition for the [`timeout`](https://playwright.dev/docs/api/class-page#page-wait-for-selector-option-timeout) milliseconds, the function will throw.\n\n**Usage**\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 (const 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."},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:"This option has no effect.",deprecated:"This option has no effect."},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 than one element, the call throws an exception."},timeout:{type:"number",description:"Maximum time in milliseconds. Defaults to `0` - no timeout. The default value can be changed via `actionTimeout` option in the config, or 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:"**NOTE** Use locator-based [locator.check([options])](https://playwright.dev/docs/api/class-locator#locator-check) instead. Read more about [locators](https://playwright.dev/docs/locators).\n\nThis method checks an element matching [`selector`](https://playwright.dev/docs/api/class-page#page-check-option-selector) by performing the following steps: 1. Find an element matching [`selector`](https://playwright.dev/docs/api/class-page#page-check-option-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`](https://playwright.dev/docs/api/class-page#page-check-option-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. Ensure that the element is now checked. If not, this method throws.\n\nWhen all steps combined have not finished during the specified [`timeout`](https://playwright.dev/docs/api/class-page#page-check-option-timeout), this method throws a [TimeoutError](https://playwright.dev/docs/api/class-timeouterror). Passing zero timeout disables this."},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."},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","ControlOrMeta","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. "ControlOrMeta" resolves to "Control" on Windows and Linux and to "Meta" on macOS.'},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`.",deprecated:"This option will default to `true` in the future."},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 than one element, the call throws an exception."},timeout:{type:"number",description:"Maximum time in milliseconds. Defaults to `0` - no timeout. The default value can be changed via `actionTimeout` option in the config, or 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. Note that keyboard `modifiers` will be pressed regardless of `trial` to allow testing elements which are only visible when those keys are pressed."}},additionalProperties:false}},required:["selector"],description:"**NOTE** Use locator-based [locator.click([options])](https://playwright.dev/docs/api/class-locator#locator-click) instead. Read more about [locators](https://playwright.dev/docs/locators).\n\nThis method clicks an element matching [`selector`](https://playwright.dev/docs/api/class-page#page-click-option-selector) by performing the following steps: 1. Find an element matching [`selector`](https://playwright.dev/docs/api/class-page#page-click-option-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`](https://playwright.dev/docs/api/class-page#page-click-option-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`](https://playwright.dev/docs/api/class-page#page-click-option-position). 1. Wait for initiated navigations to either succeed or fail, unless [`noWaitAfter`](https://playwright.dev/docs/api/class-page#page-click-option-no-wait-after) option is set.\n\nWhen all steps combined have not finished during the specified [`timeout`](https://playwright.dev/docs/api/class-page#page-click-option-timeout), this method throws a [TimeoutError](https://playwright.dev/docs/api/class-timeouterror). Passing zero timeout disables this."},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."},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","ControlOrMeta","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. "ControlOrMeta" resolves to "Control" on Windows and Linux and to "Meta" on macOS.'},noWaitAfter:{type:"boolean",description:"This option has no effect.",deprecated:"This option has no effect."},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 than one element, the call throws an exception."},timeout:{type:"number",description:"Maximum time in milliseconds. Defaults to `0` - no timeout. The default value can be changed via `actionTimeout` option in the config, or 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. Note that keyboard `modifiers` will be pressed regardless of `trial` to allow testing elements which are only visible when those keys are pressed."}},additionalProperties:false}},required:["selector"],description:"**NOTE** Use locator-based [locator.dblclick([options])](https://playwright.dev/docs/api/class-locator#locator-dblclick) instead. Read more about [locators](https://playwright.dev/docs/locators).\n\nThis method double clicks an element matching [`selector`](https://playwright.dev/docs/api/class-page#page-dblclick-option-selector) by performing the following steps: 1. Find an element matching [`selector`](https://playwright.dev/docs/api/class-page#page-dblclick-option-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`](https://playwright.dev/docs/api/class-page#page-dblclick-option-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`](https://playwright.dev/docs/api/class-page#page-dblclick-option-position).\n\nWhen all steps combined have not finished during the specified [`timeout`](https://playwright.dev/docs/api/class-page#page-dblclick-option-timeout), this method throws a [TimeoutError](https://playwright.dev/docs/api/class-timeouterror). Passing zero timeout disables this.\n\n**NOTE** `page.dblclick()` dispatches two `click` events and a single `dblclick` event."},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."},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:"This option has no effect.",deprecated:"This option has no effect."},strict:{type:"boolean",description:"When true, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception."},timeout:{type:"number",description:"Maximum time in milliseconds. Defaults to `0` - no timeout. The default value can be changed via `actionTimeout` option in the config, or 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:"**NOTE** Use locator-based [locator.fill(value[, options])](https://playwright.dev/docs/api/class-locator#locator-fill) instead. Read more about [locators](https://playwright.dev/docs/locators).\n\nThis method waits for an element matching [`selector`](https://playwright.dev/docs/api/class-page#page-fill-option-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 [locator.pressSequentially(text[, options])](https://playwright.dev/docs/api/class-locator#locator-press-sequentially)."},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."},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 than one element, the call throws an exception."},timeout:{type:"number",description:"Maximum time in milliseconds. Defaults to `0` - no timeout. The default value can be changed via `actionTimeout` option in the config, or 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:"**NOTE** Use locator-based [locator.focus([options])](https://playwright.dev/docs/api/class-locator#locator-focus) instead. Read more about [locators](https://playwright.dev/docs/locators).\n\nThis method fetches an element with [`selector`](https://playwright.dev/docs/api/class-page#page-focus-option-selector) and focuses it. If there's no element matching [`selector`](https://playwright.dev/docs/api/class-page#page-focus-option-selector), the method waits until a matching element appears in the DOM."},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."},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","ControlOrMeta","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. "ControlOrMeta" resolves to "Control" on Windows and Linux and to "Meta" on macOS.'},noWaitAfter:{type:"boolean",description:"This option has no effect.",deprecated:"This option has no effect."},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 than one element, the call throws an exception."},timeout:{type:"number",description:"Maximum time in milliseconds. Defaults to `0` - no timeout. The default value can be changed via `actionTimeout` option in the config, or 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. Note that keyboard `modifiers` will be pressed regardless of `trial` to allow testing elements which are only visible when those keys are pressed."}},additionalProperties:false}},required:["selector"],description:"**NOTE** Use locator-based [locator.hover([options])](https://playwright.dev/docs/api/class-locator#locator-hover) instead. Read more about [locators](https://playwright.dev/docs/locators).\n\nThis method hovers over an element matching [`selector`](https://playwright.dev/docs/api/class-page#page-hover-option-selector) by performing the following steps: 1. Find an element matching [`selector`](https://playwright.dev/docs/api/class-page#page-hover-option-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`](https://playwright.dev/docs/api/class-page#page-hover-option-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`](https://playwright.dev/docs/api/class-page#page-hover-option-position).\n\nWhen all steps combined have not finished during the specified [`timeout`](https://playwright.dev/docs/api/class-page#page-hover-option-timeout), this method throws a [TimeoutError](https://playwright.dev/docs/api/class-timeouterror). Passing zero timeout disables this."},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."},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`.",deprecated:"This option will default to `true` in the future."},strict:{type:"boolean",description:"When true, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception."},timeout:{type:"number",description:"Maximum time in milliseconds. Defaults to `0` - no timeout. The default value can be changed via `actionTimeout` option in the config, or 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:"**NOTE** Use locator-based [locator.press(key[, options])](https://playwright.dev/docs/api/class-locator#locator-press) instead. Read more about [locators](https://playwright.dev/docs/locators).\n\nFocuses 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`](https://playwright.dev/docs/api/class-page#page-press-option-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`](https://playwright.dev/docs/api/class-page#page-press-option-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`, `ControlOrMeta`. `ControlOrMeta` resolves to `Control` on Windows and Linux and to `Meta` on macOS.\n\nHolding down `Shift` will type the text that corresponds to the [`key`](https://playwright.dev/docs/api/class-page#page-press-option-key) in the upper case.\n\nIf [`key`](https://playwright.dev/docs/api/class-page#page-press-option-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\"`, `key: \"Control++` 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**Usage**\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(); ```"},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."},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:"This option has no effect.",deprecated:"This option has no effect."},strict:{type:"boolean",description:"When true, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception."},timeout:{type:"number",description:"Maximum time in milliseconds. Defaults to `0` - no timeout. The default value can be changed via `actionTimeout` option in the config, or 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**Usage**",deprecated:`In most cases, you should use
|
|
1
|
+
import U from'fs';import {readFile}from'jsonfile';import*as T from'path';import T__default from'path';import Me from'lodash/kebabCase';import tt from'join-images';import ot from'sharp';import {buildArgsParam}from'@storybook/core/router';import pe from'normalize-url';import {get}from'object-path-immutable';import'@pixpilot/dom';import'@storybook/components';import'@storybook/icons';import'react';import'@pixpilot/hash';import'sonner';import {fileURLToPath}from'url';import st from'fast-glob';async function N(e,t,o=true){return new Promise((i,s)=>{if(!U.existsSync(e)){if(!o){i(void 0);return}i({stories:{}});return}readFile(e,(n,r)=>{if(n){s(n);return}let p=r||{stories:{}};p.stories||(p.stories={}),!p.stories[t]&&t!=="*",i(p);});})}async function H(e){let t=await N(e,"*")||{stories:{}},o=t.stories||{},s=Object.keys(o).map(n=>({data:o[n],storyId:n}));return {playWrightData:t,storyData:s}}function B(e){let t=T.resolve(e),o=T.parse(t),i=o.ext===".json"?`${o.name}.json`:`${o.name}.playwright.json`;return {dir:o.dir,name:i,path:T.join(T.dirname(t),i),screenShotsDir:T.join(o.dir,"__screenshots__")}}function $(e){let t=B(e.filePath),o=Me(`${T__default.basename(e.storyId)}--${e.title}--${e.browserType}`),i=T__default.join(t.screenShotsDir,"__diff_output__"),s=T__default.join(t.screenShotsDir,`${o}-snap.png`);return {diffDir:i,filePath:s,screenshotIdentifier:o,screenshotsDir:t.screenShotsDir}}async function z(e,t={}){let{blur:o,timeout:i}=t;await this.fill(e,""),o&&await this.$eval(e,s=>s.blur()),i&&await this.waitForTimeout(i);}async function E(e,t){await e.waitForSelector(t);let o=await e.$(t);if(!o)throw new Error("Unable to find selector!");let i=await o.boundingBox();if(!i)throw new Error("Unable to get boundingBox!");return i}function v(e,t,o){return !o||!o[t]?e:o[t]}async function Y(e,t,o,i){let{steps:s=1,skipMouseUp:n}=i||{},r=await E(this,e),p=v(r.width/2,"x",o),a=v(r.height/2,"y",o),l=v(0,"x",t),c=v(0,"y",t);await this.mouse.move(r.x+p,r.y+a,{steps:s}),await this.mouse.down(),await this.mouse.move(l,c,{steps:s}),n||await this.mouse.up();}async function w(e,t,o,i,s,n,r){await e.$eval(o,(p,a)=>{let l=p.getBoundingClientRect(),{client:c={},page:b={},screen:x={},type:C,options:u}=a,f=new Touch({clientX:c.x,clientY:c.y,identifier:Date.now(),pageX:b.x||(c.x!==void 0?l.left+c.x:void 0),pageY:b.y||(c.y!==void 0?l.top+c.y:void 0),screenX:x.x,screenY:x.y,target:p}),h=new TouchEvent(C,{bubbles:true,cancelable:true,...u,changedTouches:[f],targetTouches:[f],touches:[f]});return p.dispatchEvent(h)},{client:n,options:r,page:i,screen:s,type:t});}async function K(e,t,o,i,s,n,r,p){await w(this,"touchstart",e,t,n,i,p),await w(this,"touchmove",e,o,r,s,p),await w(this,"touchend",e,o,r,s,p);}function V(e){let t=e;return t.dragDropSelector=Y,t.scrollSelector=Q,t.mouseDownOnSelector=X,t.mouseMoveToSelector=Z,t.setSelectorSize=ee,t.clearInput=z,t.selectorMouseWheel=J,t.touchCancel=te,t.touchMove=ie,t.touchEnd=oe,t.touchStart=se,t.touchFromTo=K,t.mouseFromTo=G,t}async function X(e,t,o){let{steps:i=1}=o||{},s=await E(this,e),n=v(s.width/2,"x",t),r=v(s.height/2,"y",t);await this.mouse.move(s.x+n,s.y+r,{steps:i}),await this.mouse.down();}async function G(e,t,o){let{skipMouseUp:i,steps:s=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:s}),await this.mouse.down(),await this.mouse.move(t.x,t.y,{steps:s}),i||await this.mouse.up();}async function Z(e,t,o){let{steps:i=1}=o||{},s=await E(this,e),n=v(s.width/2,"x",t),r=v(s.height/2,"y",t);await this.mouse.move(s.x+n,s.y+r,{steps:i});}async function Q(e,t){return await this.waitForSelector(e),await this.$eval(e,(i,s)=>{s.top&&(i.scrollTop=s.top),s.left&&(i.scrollLeft=s.left);},t)}async function J(e,t){return await this.waitForSelector(e),await this.$eval(e,(i,s)=>{let n=new WheelEvent("wheel",s);i.dispatchEvent(n);},t)}async function ee(e,t,o){await this.$eval(e,(i,s)=>{s.width!==void 0&&(i.style.width=s.width),s.height!==void 0&&(i.style.height=s.height);},{height:o,width:t});}async function te(e,t,o,i,s){await w(this,"touchcancel",e,t,o,i,s);}async function oe(e,t,o,i,s){await w(this,"touchend",e,t,o,i,s);}async function ie(e,t,o,i,s){await w(this,"touchmove",e,t,o,i,s);}async function se(e,t,o,i,s){await w(this,"touchstart",e,t,o,i,s);}function R(e){return !e||Object.keys(e).length===0?"":buildArgsParam({},e)}function re(e){return R(e)}function ne(e){return R(e)}function ae(e){if(!e)return "";let o=Object.keys(e).map(i=>{let s=e[i];return Array.isArray(s)?s.length>0&&typeof s[0]=="object"?`knob-${i}=${JSON.stringify(s)}`:`knob-${i}=${s.join(",")}`:typeof s=="object"?`knob-${i}=${JSON.stringify(s)}`:`knob-${i}=${s}`});return encodeURI(o.join("&"))}function ce(e,t,o,i,s){let n;/^\.{0,2}[/\\]/.test(e)?n=`file:///${e.replace(/\\/g,"/").replace(/^\/+/,"")}`:/^https?:\/\//i.test(e)||/^file:\/\//i.test(e)?n=pe(e):n=pe(`http://${e}`);let r=`${n}/iframe.html?id=${t}`,p=re(i);p&&(r=`${r}&args=${p}`);let a=ne(s);if(a&&(r=`${r}&globals=${a}`),o){let l=ae(o);l&&(r=`${r}&${l}`);}return r.replace(/\\/g,"/")}function j(e,t){if(!t)return;let o=t.split(".").join(".properties.");return get(e,o)}function le(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 i=o.parameters||{};return Object.keys(i).reduce((n,r)=>{let p=o.required&&o.required.includes(r);if(e&&e.args&&e.args[r]!==void 0){let a=e.args[r];if(!p&&a!==null&&(a===void 0||typeof a=="object"&&Object.keys(a).length===0||Array.isArray(a)&&a.length===0))return n;n.push(e.args[r]);}else n.push(void 0);return n},[])}function _(...e){for(let t=0;t<e.length;t++){let o=e[t];if(o&&Object.keys(o).length>0)return o}}var de=e=>{if(e)return _(e.globals)};var he=e=>{if(e)return _(e.args,e.props)};function Xe(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 s=[];for(let n=0;n<o.required.length;n++){let r=o.required[n];t.args[r]||s.push(r);}return {required:s.length===0?void 0:s}}function ye(e,t){return Xe(e,t).required===void 0}function D(){throw new Error("Configuration has not been set.");}var we={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."},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 than one element, the call throws an exception."},timeout:{type:"number",description:"Maximum time in milliseconds. Defaults to `0` - no timeout. The default value can be changed via `actionTimeout` option in the config, or 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:"**NOTE** Use web assertions that assert visibility or a locator-based [locator.waitFor([options])](https://playwright.dev/docs/api/class-locator#locator-wait-for) instead. Read more about [locators](https://playwright.dev/docs/locators).\n\nReturns when element specified by selector satisfies [`state`](https://playwright.dev/docs/api/class-page#page-wait-for-selector-option-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](https://playwright.dev/docs/api/class-locator) objects and web-first assertions makes the code wait-for-selector-free.\n\nWait for the [`selector`](https://playwright.dev/docs/api/class-page#page-wait-for-selector-option-selector) to satisfy [`state`](https://playwright.dev/docs/api/class-page#page-wait-for-selector-option-state) option (either appear/disappear from dom, or become visible/hidden). If at the moment of calling the method [`selector`](https://playwright.dev/docs/api/class-page#page-wait-for-selector-option-selector) already satisfies the condition, the method will return immediately. If the selector doesn't satisfy the condition for the [`timeout`](https://playwright.dev/docs/api/class-page#page-wait-for-selector-option-timeout) milliseconds, the function will throw.\n\n**Usage**\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 (const 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."},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:"This option has no effect.",deprecated:"This option has no effect."},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 than one element, the call throws an exception."},timeout:{type:"number",description:"Maximum time in milliseconds. Defaults to `0` - no timeout. The default value can be changed via `actionTimeout` option in the config, or 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:"**NOTE** Use locator-based [locator.check([options])](https://playwright.dev/docs/api/class-locator#locator-check) instead. Read more about [locators](https://playwright.dev/docs/locators).\n\nThis method checks an element matching [`selector`](https://playwright.dev/docs/api/class-page#page-check-option-selector) by performing the following steps: 1. Find an element matching [`selector`](https://playwright.dev/docs/api/class-page#page-check-option-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`](https://playwright.dev/docs/api/class-page#page-check-option-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. Ensure that the element is now checked. If not, this method throws.\n\nWhen all steps combined have not finished during the specified [`timeout`](https://playwright.dev/docs/api/class-page#page-check-option-timeout), this method throws a [TimeoutError](https://playwright.dev/docs/api/class-timeouterror). Passing zero timeout disables this."},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."},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","ControlOrMeta","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. "ControlOrMeta" resolves to "Control" on Windows and Linux and to "Meta" on macOS.'},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`.",deprecated:"This option will default to `true` in the future."},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 than one element, the call throws an exception."},timeout:{type:"number",description:"Maximum time in milliseconds. Defaults to `0` - no timeout. The default value can be changed via `actionTimeout` option in the config, or 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. Note that keyboard `modifiers` will be pressed regardless of `trial` to allow testing elements which are only visible when those keys are pressed."}},additionalProperties:false}},required:["selector"],description:"**NOTE** Use locator-based [locator.click([options])](https://playwright.dev/docs/api/class-locator#locator-click) instead. Read more about [locators](https://playwright.dev/docs/locators).\n\nThis method clicks an element matching [`selector`](https://playwright.dev/docs/api/class-page#page-click-option-selector) by performing the following steps: 1. Find an element matching [`selector`](https://playwright.dev/docs/api/class-page#page-click-option-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`](https://playwright.dev/docs/api/class-page#page-click-option-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`](https://playwright.dev/docs/api/class-page#page-click-option-position). 1. Wait for initiated navigations to either succeed or fail, unless [`noWaitAfter`](https://playwright.dev/docs/api/class-page#page-click-option-no-wait-after) option is set.\n\nWhen all steps combined have not finished during the specified [`timeout`](https://playwright.dev/docs/api/class-page#page-click-option-timeout), this method throws a [TimeoutError](https://playwright.dev/docs/api/class-timeouterror). Passing zero timeout disables this."},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."},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","ControlOrMeta","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. "ControlOrMeta" resolves to "Control" on Windows and Linux and to "Meta" on macOS.'},noWaitAfter:{type:"boolean",description:"This option has no effect.",deprecated:"This option has no effect."},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 than one element, the call throws an exception."},timeout:{type:"number",description:"Maximum time in milliseconds. Defaults to `0` - no timeout. The default value can be changed via `actionTimeout` option in the config, or 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. Note that keyboard `modifiers` will be pressed regardless of `trial` to allow testing elements which are only visible when those keys are pressed."}},additionalProperties:false}},required:["selector"],description:"**NOTE** Use locator-based [locator.dblclick([options])](https://playwright.dev/docs/api/class-locator#locator-dblclick) instead. Read more about [locators](https://playwright.dev/docs/locators).\n\nThis method double clicks an element matching [`selector`](https://playwright.dev/docs/api/class-page#page-dblclick-option-selector) by performing the following steps: 1. Find an element matching [`selector`](https://playwright.dev/docs/api/class-page#page-dblclick-option-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`](https://playwright.dev/docs/api/class-page#page-dblclick-option-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`](https://playwright.dev/docs/api/class-page#page-dblclick-option-position).\n\nWhen all steps combined have not finished during the specified [`timeout`](https://playwright.dev/docs/api/class-page#page-dblclick-option-timeout), this method throws a [TimeoutError](https://playwright.dev/docs/api/class-timeouterror). Passing zero timeout disables this.\n\n**NOTE** `page.dblclick()` dispatches two `click` events and a single `dblclick` event."},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."},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:"This option has no effect.",deprecated:"This option has no effect."},strict:{type:"boolean",description:"When true, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception."},timeout:{type:"number",description:"Maximum time in milliseconds. Defaults to `0` - no timeout. The default value can be changed via `actionTimeout` option in the config, or 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:"**NOTE** Use locator-based [locator.fill(value[, options])](https://playwright.dev/docs/api/class-locator#locator-fill) instead. Read more about [locators](https://playwright.dev/docs/locators).\n\nThis method waits for an element matching [`selector`](https://playwright.dev/docs/api/class-page#page-fill-option-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 [locator.pressSequentially(text[, options])](https://playwright.dev/docs/api/class-locator#locator-press-sequentially)."},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."},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 than one element, the call throws an exception."},timeout:{type:"number",description:"Maximum time in milliseconds. Defaults to `0` - no timeout. The default value can be changed via `actionTimeout` option in the config, or 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:"**NOTE** Use locator-based [locator.focus([options])](https://playwright.dev/docs/api/class-locator#locator-focus) instead. Read more about [locators](https://playwright.dev/docs/locators).\n\nThis method fetches an element with [`selector`](https://playwright.dev/docs/api/class-page#page-focus-option-selector) and focuses it. If there's no element matching [`selector`](https://playwright.dev/docs/api/class-page#page-focus-option-selector), the method waits until a matching element appears in the DOM."},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."},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","ControlOrMeta","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. "ControlOrMeta" resolves to "Control" on Windows and Linux and to "Meta" on macOS.'},noWaitAfter:{type:"boolean",description:"This option has no effect.",deprecated:"This option has no effect."},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 than one element, the call throws an exception."},timeout:{type:"number",description:"Maximum time in milliseconds. Defaults to `0` - no timeout. The default value can be changed via `actionTimeout` option in the config, or 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. Note that keyboard `modifiers` will be pressed regardless of `trial` to allow testing elements which are only visible when those keys are pressed."}},additionalProperties:false}},required:["selector"],description:"**NOTE** Use locator-based [locator.hover([options])](https://playwright.dev/docs/api/class-locator#locator-hover) instead. Read more about [locators](https://playwright.dev/docs/locators).\n\nThis method hovers over an element matching [`selector`](https://playwright.dev/docs/api/class-page#page-hover-option-selector) by performing the following steps: 1. Find an element matching [`selector`](https://playwright.dev/docs/api/class-page#page-hover-option-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`](https://playwright.dev/docs/api/class-page#page-hover-option-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`](https://playwright.dev/docs/api/class-page#page-hover-option-position).\n\nWhen all steps combined have not finished during the specified [`timeout`](https://playwright.dev/docs/api/class-page#page-hover-option-timeout), this method throws a [TimeoutError](https://playwright.dev/docs/api/class-timeouterror). Passing zero timeout disables this."},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."},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`.",deprecated:"This option will default to `true` in the future."},strict:{type:"boolean",description:"When true, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception."},timeout:{type:"number",description:"Maximum time in milliseconds. Defaults to `0` - no timeout. The default value can be changed via `actionTimeout` option in the config, or 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:"**NOTE** Use locator-based [locator.press(key[, options])](https://playwright.dev/docs/api/class-locator#locator-press) instead. Read more about [locators](https://playwright.dev/docs/locators).\n\nFocuses 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`](https://playwright.dev/docs/api/class-page#page-press-option-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`](https://playwright.dev/docs/api/class-page#page-press-option-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`, `ControlOrMeta`. `ControlOrMeta` resolves to `Control` on Windows and Linux and to `Meta` on macOS.\n\nHolding down `Shift` will type the text that corresponds to the [`key`](https://playwright.dev/docs/api/class-page#page-press-option-key) in the upper case.\n\nIf [`key`](https://playwright.dev/docs/api/class-page#page-press-option-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\"`, `key: \"Control++` 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**Usage**\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(); ```"},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."},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:"This option has no effect.",deprecated:"This option has no effect."},strict:{type:"boolean",description:"When true, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception."},timeout:{type:"number",description:"Maximum time in milliseconds. Defaults to `0` - no timeout. The default value can be changed via `actionTimeout` option in the config, or 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**Usage**",deprecated:`In most cases, you should use
|
|
2
2
|
[locator.fill(value[, options])](https://playwright.dev/docs/api/class-locator#locator-fill) instead. You only need
|
|
3
3
|
to press keys one by one if there is special keyboard handling on the page - in this case use
|
|
4
|
-
[locator.pressSequentially(text[, options])](https://playwright.dev/docs/api/class-locator#locator-press-sequentially).`},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."},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:"This option has no effect.",deprecated:"This option has no effect."},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 than one element, the call throws an exception."},timeout:{type:"number",description:"Maximum time in milliseconds. Defaults to `0` - no timeout. The default value can be changed via `actionTimeout` option in the config, or 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:"**NOTE** Use locator-based [locator.uncheck([options])](https://playwright.dev/docs/api/class-locator#locator-uncheck) instead. Read more about [locators](https://playwright.dev/docs/locators).\n\nThis method unchecks an element matching [`selector`](https://playwright.dev/docs/api/class-page#page-uncheck-option-selector) by performing the following steps: 1. Find an element matching [`selector`](https://playwright.dev/docs/api/class-page#page-uncheck-option-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`](https://playwright.dev/docs/api/class-page#page-uncheck-option-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. Ensure that the element is now unchecked. If not, this method throws.\n\nWhen all steps combined have not finished during the specified [`timeout`](https://playwright.dev/docs/api/class-page#page-uncheck-option-timeout), this method throws a [TimeoutError](https://playwright.dev/docs/api/class-timeouterror). Passing zero timeout disables this."},waitForTimeout:{kind:"function",type:"Promise",parameters:{timeout:{type:"number",description:"A timeout to wait for"}},required:["timeout"],description:"**NOTE** Never wait for timeout in production. Tests that wait for time are inherently flaky. Use [Locator](https://playwright.dev/docs/api/class-locator) actions and web assertions that wait automatically.\n\nWaits for the given [`timeout`](https://playwright.dev/docs/api/class-page#page-wait-for-timeout-option-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**Usage**\n\n```js // wait for 1 second await page.waitForTimeout(1000); ```"},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`](https://playwright.dev/docs/api/class-keyboard#keyboard-down-option-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`](https://playwright.dev/docs/api/class-keyboard#keyboard-down-option-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`, `ControlOrMeta`. `ControlOrMeta` resolves to `Control` on Windows and Linux and to `Meta` on macOS.\n\nHolding down `Shift` will type the text that corresponds to the [`key`](https://playwright.dev/docs/api/class-keyboard#keyboard-down-option-key) in the upper case.\n\nIf [`key`](https://playwright.dev/docs/api/class-keyboard#keyboard-down-option-key) is a single character, it is case-sensitive, so the values `a` and `A` will generate different respective texts.\n\nIf [`key`](https://playwright.dev/docs/api/class-keyboard#keyboard-down-option-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**Usage**\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:"**NOTE** In most cases, you should use [locator.press(key[, options])](https://playwright.dev/docs/api/class-locator#locator-press) instead.\n\n[`key`](https://playwright.dev/docs/api/class-keyboard#keyboard-press-option-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`](https://playwright.dev/docs/api/class-keyboard#keyboard-press-option-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`, `ControlOrMeta`. `ControlOrMeta` resolves to `Control` on Windows and Linux and to `Meta` on macOS.\n\nHolding down `Shift` will type the text that corresponds to the [`key`](https://playwright.dev/docs/api/class-keyboard#keyboard-press-option-key) in the upper case.\n\nIf [`key`](https://playwright.dev/docs/api/class-keyboard#keyboard-press-option-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\"`, `key: \"Control++` 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**Usage**\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:"**NOTE** In most cases, you should use [locator.fill(value[, options])](https://playwright.dev/docs/api/class-locator#locator-fill) instead. You only need to press keys one by one if there is special keyboard handling on the page - in this case use [locator.pressSequentially(text[, options])](https://playwright.dev/docs/api/class-locator#locator-press-sequentially).\n\nSends 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**Usage**\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.\n\n**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 await page.keyboard.press('ControlOrMeta+A'); ```"},mouse:{type:"object",properties:{click:{kind:"function",type:"Promise",parameters:{x:{type:"number",description:"X coordinate relative to the main frame's viewport in CSS pixels."},y:{type:"number",description:"Y coordinate relative to the main frame's viewport in CSS pixels."},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",description:"X coordinate relative to the main frame's viewport in CSS pixels."},y:{type:"number",description:"Y coordinate relative to the main frame's viewport in CSS pixels."},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",description:"X coordinate relative to the main frame's viewport in CSS pixels."},y:{type:"number",description:"Y coordinate relative to the main frame's viewport in CSS pixels."},options:{type:"object",properties:{steps:{type:"number",description:"Defaults to 1. Sends `n` interpolated `mousemove` events to represent travel between Playwright's current cursor position and the provided destination. When set to 1, emits a single `mousemove` event at the destination location."}},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\n**NOTE** If you want to debug where the mouse moved, you can use the [Trace viewer](https://playwright.dev/docs/trace-viewer-intro) or [Playwright Inspector](https://playwright.dev/docs/running-tests). A red dot showing the location of the mouse will be shown for every mouse action.\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(); ```"},touchscreen:{type:"object",properties:{tap:{kind:"function",type:"Promise",parameters:{x:{type:"number",description:"X coordinate relative to the main frame's viewport in CSS pixels."},y:{type:"number",description:"Y coordinate relative to the main frame's viewport in CSS pixels."}},required:["x","y"],description:"Dispatches a `touchstart` and `touchend` event with a single touch at the position ([`x`](https://playwright.dev/docs/api/class-touchscreen#touchscreen-tap-option-x),[`y`](https://playwright.dev/docs/api/class-touchscreen#touchscreen-tap-option-y)).\n\n**NOTE** [page.tap(selector[, options])](https://playwright.dev/docs/api/class-page#page-tap) the method will throw if [`hasTouch`](https://playwright.dev/docs/api/class-browser#browser-new-context-option-has-touch) option of the browser context is false."}},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.\n\nThis class is limited to emulating tap gestures. For examples of other gestures simulated by manually dispatching touch events, see the [emulating legacy touch events](https://playwright.dev/docs/touch-events) page."},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 ge(){let e=ye,t=D().customActionSchema;return t&&(e={...e,...t}),e}async function we(e,t){let o=ge();if(!me(o,t))return;let i=pe(t,o),s=t.name.split("."),n=e,r=[n];for(let p=0;p<s.length;p++){let a=s[p];if(typeof n!="object"&&typeof n!="function"||n===null)break;let l=n[a];if(l===void 0)break;n=l,r.push(n);}if(r.length!==1&&typeof n=="function")return await n.call(r[r.length-2],...i)}async function be(e){await e.waitForLoadState("load"),await e.evaluate(`
|
|
4
|
+
[locator.pressSequentially(text[, options])](https://playwright.dev/docs/api/class-locator#locator-press-sequentially).`},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."},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:"This option has no effect.",deprecated:"This option has no effect."},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 than one element, the call throws an exception."},timeout:{type:"number",description:"Maximum time in milliseconds. Defaults to `0` - no timeout. The default value can be changed via `actionTimeout` option in the config, or 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:"**NOTE** Use locator-based [locator.uncheck([options])](https://playwright.dev/docs/api/class-locator#locator-uncheck) instead. Read more about [locators](https://playwright.dev/docs/locators).\n\nThis method unchecks an element matching [`selector`](https://playwright.dev/docs/api/class-page#page-uncheck-option-selector) by performing the following steps: 1. Find an element matching [`selector`](https://playwright.dev/docs/api/class-page#page-uncheck-option-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`](https://playwright.dev/docs/api/class-page#page-uncheck-option-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. Ensure that the element is now unchecked. If not, this method throws.\n\nWhen all steps combined have not finished during the specified [`timeout`](https://playwright.dev/docs/api/class-page#page-uncheck-option-timeout), this method throws a [TimeoutError](https://playwright.dev/docs/api/class-timeouterror). Passing zero timeout disables this."},waitForTimeout:{kind:"function",type:"Promise",parameters:{timeout:{type:"number",description:"A timeout to wait for"}},required:["timeout"],description:"**NOTE** Never wait for timeout in production. Tests that wait for time are inherently flaky. Use [Locator](https://playwright.dev/docs/api/class-locator) actions and web assertions that wait automatically.\n\nWaits for the given [`timeout`](https://playwright.dev/docs/api/class-page#page-wait-for-timeout-option-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**Usage**\n\n```js // wait for 1 second await page.waitForTimeout(1000); ```"},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`](https://playwright.dev/docs/api/class-keyboard#keyboard-down-option-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`](https://playwright.dev/docs/api/class-keyboard#keyboard-down-option-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`, `ControlOrMeta`. `ControlOrMeta` resolves to `Control` on Windows and Linux and to `Meta` on macOS.\n\nHolding down `Shift` will type the text that corresponds to the [`key`](https://playwright.dev/docs/api/class-keyboard#keyboard-down-option-key) in the upper case.\n\nIf [`key`](https://playwright.dev/docs/api/class-keyboard#keyboard-down-option-key) is a single character, it is case-sensitive, so the values `a` and `A` will generate different respective texts.\n\nIf [`key`](https://playwright.dev/docs/api/class-keyboard#keyboard-down-option-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**Usage**\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:"**NOTE** In most cases, you should use [locator.press(key[, options])](https://playwright.dev/docs/api/class-locator#locator-press) instead.\n\n[`key`](https://playwright.dev/docs/api/class-keyboard#keyboard-press-option-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`](https://playwright.dev/docs/api/class-keyboard#keyboard-press-option-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`, `ControlOrMeta`. `ControlOrMeta` resolves to `Control` on Windows and Linux and to `Meta` on macOS.\n\nHolding down `Shift` will type the text that corresponds to the [`key`](https://playwright.dev/docs/api/class-keyboard#keyboard-press-option-key) in the upper case.\n\nIf [`key`](https://playwright.dev/docs/api/class-keyboard#keyboard-press-option-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\"`, `key: \"Control++` 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**Usage**\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:"**NOTE** In most cases, you should use [locator.fill(value[, options])](https://playwright.dev/docs/api/class-locator#locator-fill) instead. You only need to press keys one by one if there is special keyboard handling on the page - in this case use [locator.pressSequentially(text[, options])](https://playwright.dev/docs/api/class-locator#locator-press-sequentially).\n\nSends 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**Usage**\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.\n\n**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 await page.keyboard.press('ControlOrMeta+A'); ```"},mouse:{type:"object",properties:{click:{kind:"function",type:"Promise",parameters:{x:{type:"number",description:"X coordinate relative to the main frame's viewport in CSS pixels."},y:{type:"number",description:"Y coordinate relative to the main frame's viewport in CSS pixels."},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",description:"X coordinate relative to the main frame's viewport in CSS pixels."},y:{type:"number",description:"Y coordinate relative to the main frame's viewport in CSS pixels."},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",description:"X coordinate relative to the main frame's viewport in CSS pixels."},y:{type:"number",description:"Y coordinate relative to the main frame's viewport in CSS pixels."},options:{type:"object",properties:{steps:{type:"number",description:"Defaults to 1. Sends `n` interpolated `mousemove` events to represent travel between Playwright's current cursor position and the provided destination. When set to 1, emits a single `mousemove` event at the destination location."}},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\n**NOTE** If you want to debug where the mouse moved, you can use the [Trace viewer](https://playwright.dev/docs/trace-viewer-intro) or [Playwright Inspector](https://playwright.dev/docs/running-tests). A red dot showing the location of the mouse will be shown for every mouse action.\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(); ```"},touchscreen:{type:"object",properties:{tap:{kind:"function",type:"Promise",parameters:{x:{type:"number",description:"X coordinate relative to the main frame's viewport in CSS pixels."},y:{type:"number",description:"Y coordinate relative to the main frame's viewport in CSS pixels."}},required:["x","y"],description:"Dispatches a `touchstart` and `touchend` event with a single touch at the position ([`x`](https://playwright.dev/docs/api/class-touchscreen#touchscreen-tap-option-x),[`y`](https://playwright.dev/docs/api/class-touchscreen#touchscreen-tap-option-y)).\n\n**NOTE** [page.tap(selector[, options])](https://playwright.dev/docs/api/class-page#page-tap) the method will throw if [`hasTouch`](https://playwright.dev/docs/api/class-browser#browser-new-context-option-has-touch) option of the browser context is false."}},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.\n\nThis class is limited to emulating tap gestures. For examples of other gestures simulated by manually dispatching touch events, see the [emulating legacy touch events](https://playwright.dev/docs/touch-events) page."},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 be(){let e=we,t=D().customActionSchema;return t&&(e={...e,...t}),e}async function ve(e,t){let o=be();if(!ye(o,t))return;let i=le(t,o),s=t.name.split("."),n=e,r=[n];for(let p=0;p<s.length;p++){let a=s[p];if(typeof n!="object"&&typeof n!="function"||n===null)break;let l=n[a];if(l===void 0)break;n=l,r.push(n);}if(r.length!==1&&typeof n=="function")return await n.call(r[r.length-2],...i)}async function xe(e){await e.waitForLoadState("load"),await e.evaluate(`
|
|
5
5
|
(() => {
|
|
6
6
|
if (window !== window.parent) return;
|
|
7
7
|
const box = document.createElement('playwright-mouse-pointer');
|
|
@@ -128,6 +128,6 @@ to press keys one by one if there is special keyboard handling on the page - in
|
|
|
128
128
|
true,
|
|
129
129
|
);
|
|
130
130
|
})();
|
|
131
|
-
`);}var Ze=["waitForSelector","waitForTimeout","takeScreenshot","takeScreenshotAll","takeScreenshotOptions"];function W(e){return !Ze.includes(e.name)}async function
|
|
132
|
-
export{
|
|
131
|
+
`);}var Ze=["waitForSelector","waitForTimeout","takeScreenshot","takeScreenshotAll","takeScreenshotOptions"];function W(e){return !Ze.includes(e.name)}async function ke(e,t){if(t){let o=["Shift","Meta","Control","Alt"];for(let i=0;i<t.length;i++){let s=t[i];for(let n=0;n<s.actions.length;n++){let r=s.actions[n];r.name==="keyboard.down"&&r.args&&r.args.key&&o.includes(r.args.key)&&await e.keyboard.up(r.args.key);}}}}function Se(e,t,o){let i=e[t+1];return o&&e.length>1&&e.length>t+1&&i&&W(i)}var F="storybook-root";var Qe=3e4;function Je({targetStoryId:e}){let o=globalThis.__STORYBOOK_PREVIEW__?.storyRenders||[],i=o.find(r=>r?.id===e)||o.find(r=>r?.phase==="completed"||r?.phase==="finished");return i?i.phase==="completed"||i.phase==="finished":(document.getElementById(F)?.childElementCount||0)>0?["interactive","complete"].includes(document.readyState):false}async function et(){let e=async()=>{await new Promise(t=>{requestAnimationFrame(()=>t());});};await e(),await e();try{let t=document.fonts;t?.ready&&await t.ready;}catch{}}async function Te(e,t,o=Qe){try{await e.waitForFunction(Je,{targetStoryId:t},{timeout:o}),await e.evaluate(et);}catch{}}async function M(e,t,o,i){let s={...t,requestId:t.requestId||""};return o.beforeScreenshot&&await o.beforeScreenshot(e,s,s),i?i.screenshot(t.screenshotOptions):e.screenshot(t.screenshotOptions)}async function Pe(e,t){let o={...e,requestId:e.requestId||""},i=D(),{screenshotOptions:s={}}=i,n=e.browserOptions,r=await i.getPage(o.browserType,n,o);if(!r)throw new Error("Make sure to return an instance of a page from getPage.");V(r);let p=he(e),a=de(e),l=ce(i.storybookEndpoint,e.storyId,e.props,p,a);i.afterUrlConstruction&&(l=i.afterUrlConstruction(l,o)),await r.goto(l,i.pageGotoOptions),i.waitForStoryRender!==false&&await Te(r,e.storyId,i.storyRenderTimeout),i.afterNavigation&&await i.afterNavigation(r,o),n&&n.cursor&&await xe(r);let c=[],b,x;if(e.actionSets){let f=e.actionSets.reduce((d,m)=>(d=[...d,...m.actions],d),[]);x=f.slice(-1)[0];let h=f.find(d=>d.name==="takeScreenshotAll");b=f.find(d=>d.name==="takeScreenshotOptions");let g=f.filter(d=>!["takeScreenshotAll","takeScreenshotOptions"].includes(d.name));h&&g.filter(d=>W(d)).length>0&&c.push({buffer:await M(r,e,i),options:h.args});for(let d=0;d<g.length;d++){let m=g[d];if(m.name==="takeElementScreenshot"){if(m&&m.args&&m.args.selector){let I=await r.$(m.args.selector);c.push({buffer:await M(r,e,i,I||void 0),options:m.args});}continue}if(m.name==="takeScreenshot"){c.push({buffer:await M(r,e,i),options:m.args});continue}await ve(r,m),Se(g,d,!!h)&&c.push({buffer:await M(r,e,i),options:h?.args||{}});}}let C=x&&(x.name==="takeElementScreenshot"||x.name==="takeScreenshot"),u;if(C||(u=await M(r,e,i)),i.releaseModifierKey&&await ke(r,e.actionSets||[]),i.afterScreenshot&&await i.afterScreenshot(r,o),c.length){let f=e&&e.screenshotOptions&&e.screenshotOptions.type?e.screenshotOptions.type:"png",h=b&&b.args?b.args:{};if(h={mergeType:h.mergeType?h.mergeType:s.mergeType||"stitch",overlayOptions:{...s.overlayOptions,...h.overlayOptions},stitchOptions:{...s.stitchOptions,...h.stitchOptions}},h.mergeType==="stitch"){let g=c.map(d=>d.buffer);u&&g.push(u),u=await(await tt(g,{...h.stitchOptions})).toFormat(f).toBuffer();}else {let g=u||c[0]?.buffer;if(!g)throw new Error("Unable to create screenshot image buffer.");let m=(u===void 0&&c.length===1?c:c.filter((I,Ae)=>!(u===void 0&&Ae===0))).map(I=>({blend:"multiply",input:I.buffer,...h.overlayOptions,...I.options?I.options.stitchOptions:{}}));u=await ot(g).composite(m).toFormat(f).toBuffer();}}if(!u)throw new Error("Unable to create screenshot image buffer.");return {base64:t?u.toString("base64"):void 0,browserName:e.browserType,buffer:u}}function Oe(e,t){e.browserOptions&&t.browserOptionsId&&(t.browserOptions=e.browserOptions[t.browserOptionsId]),e.screenshotOptions&&t.screenshotOptionsId&&(t.screenshotOptions=e.screenshotOptions[t.screenshotOptionsId]);}function rt(e){if(e.storybookEndpoint)return e.storybookEndpoint;try{return D().storybookEndpoint}catch{return}}function nt(e){return e.replace(/\\/g,"/")}function at(e){return e&&e!=="*"?e:"**/*.playwright.json"}function pt(e){return e.split("#")[0]?.split("?")[0]??""}function ct(e,t){return e.startsWith("/@fs/")?T__default.normalize(e.replace("/@fs/","")):T__default.resolve(t,e)}function lt(e){let t=T__default.parse(e);return T__default.join(t.dir,`${t.name}.playwright.json`)}function Ie(e){if(!e||typeof e!="object")return [];let t=e.entries;return t?Object.values(t).reduce((o,i)=>(typeof i.importPath=="string"&&i.importPath.length>0&&o.push(i.importPath),o),[]):[]}function dt(e){return /^https?:\/\//i.test(e)}async function ht(e){if(dt(e)){let n=e.endsWith("/")?e:`${e}/`,r=new URL("index.json",n).toString(),p=await fetch(r);if(!p.ok)return [];let a=await p.json();return Ie(a)}let t=e.startsWith("file://")?fileURLToPath(e):T__default.resolve(e),o=T__default.join(t,"index.json");if(!U.existsSync(o))return [];let i=await U.promises.readFile(o,"utf8"),s=JSON.parse(i);return Ie(s)}async function ut(e,t){try{let o=await ht(e),i=new Set;return o.forEach(s=>{let n=pt(s);if(!n)return;let r=ct(n,t),p=lt(r);if(!U.existsSync(p))return;let a=nt(T__default.relative(t,p));a.length>0&&i.add(a);}),Array.from(i)}catch{return []}}async function Ee(e,t={}){let o=t.cwd?T__default.resolve(t.cwd):process.cwd(),i=at(e),s=await st([i,"!node_modules/**"],{cwd:o});if(e&&e!=="*")return s;let n=rt(t);if(!n)return s;let r=await ut(n,o);return r.length?Array.from(new Set([...s,...r])):s}async function Js(e){let{onScreenshotReady:t,playwrightJsonPath:o,requestId:i}=e,s=o&&U.existsSync(o)?[o]:await Ee(o),n=[];for(let r of s){if(!r)continue;let p=await H(r);for(let a of p.storyData)if(a&&a.data.screenshots&&a.data.screenshots.length)for(let l of a.data.screenshots){if(!l)continue;Oe(p.playWrightData,l);let c=await Pe({requestId:i,storyId:a.storyId,...l},false),b=$({browserType:l.browserType,filePath:r,storyId:a.storyId,title:l.title});n.push({buffer:c.buffer,configFile:r,storyId:a.storyId}),t&&await t(c.buffer,b);}}return n}
|
|
132
|
+
export{Js as getScreenshots};//# sourceMappingURL=get-screenshots.mjs.map
|
|
133
133
|
//# sourceMappingURL=get-screenshots.mjs.map
|