File tree 1 file changed +7
-3
lines changed
1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -132,16 +132,20 @@ Vitest exposes several `playwright` specific properties on the command context.
132
132
- ` context ` refers to the unique [ BrowserContext] ( https://playwright.dev/docs/api/class-browsercontext ) .
133
133
134
134
``` ts
135
- import { defineCommand } from ' @ vitest/browser '
135
+ import { BrowserCommand } from ' vitest/node '
136
136
137
- export const myCommand = defineCommand (async (ctx , arg1 , arg2 ) => {
137
+ export const myCommand: BrowserCommand <[string , number ]> = async (
138
+ ctx ,
139
+ arg1 : string ,
140
+ arg2 : number
141
+ ) => {
138
142
if (ctx .provider .name === ' playwright' ) {
139
143
const element = await ctx .iframe .findByRole (' alert' )
140
144
const screenshot = await element .screenshot ()
141
145
// do something with the screenshot
142
146
return difference
143
147
}
144
- })
148
+ }
145
149
```
146
150
147
151
::: tip
You can’t perform that action at this time.
0 commit comments