File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1001,7 +1001,7 @@ await expect.element(queryByTestId('prev')).not.toHaveSelection()
10011001await expect.element(queryByTestId('next')).toHaveSelection('ne')
10021002` ` `
10031003
1004- ## toMatchScreenshot < Badge type = " warning" > 实验性< / Badge >
1004+ ## toMatchScreenshot < Badge type = " warning" > 实验性< / Badge > {# tomatchscreenshot }
10051005
10061006` ` ` ts
10071007function toMatchScreenshot(
Original file line number Diff line number Diff line change @@ -7,9 +7,9 @@ outline: deep
77
88命令是一个函数,它调用服务器上的另一个函数并将结果传递回浏览器。Vitest 公开了几个可以在浏览器测试中使用的内置命令。
99
10- ## 内置命令
10+ ## 内置命令 {#built-in-commands}
1111
12- ### 文件处理
12+ ### 文件处理 {#files-handling}
1313
1414在浏览器测试中,可借助 ` readFile ` 、` writeFile ` 与 ` removeFile ` 三个 API 完成文件操作。自 Vitest 3.2 起,所有路径均以 [ project] ( /guide/projects ) 根目录为基准解析(根目录默认为 ` process.cwd() ` ,可手动重写);旧版本则以当前测试文件所在目录为基准。
1515
@@ -122,7 +122,7 @@ declare module 'vitest/browser' {
122122如果自定义命令具有相同的名称,则它们将覆盖内置命令。
123123:::
124124
125- ### 自定义命令 ` playwright `
125+ ### 自定义命令 ` playwright ` {#custom-playwright-commands}
126126
127127Vitest 在命令上下文中公开了几个` playwright ` 特定属性。
128128
Original file line number Diff line number Diff line change 22title : Context API | Browser Mode
33---
44
5- # 上下文
5+ # 上下文 {#context-api}
66
77Vitest 通过 ` vitest/browser ` 入口点公开上下文模块。从 2.0 开始,它公开了一小部分实用程序,这些实用程序可能在测试中对你有用。
88
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ title: Locators | Browser Mode
33outline : [2, 3]
44---
55
6- # 定位
6+ # 定位 {#locators}
77
88定位器是表示一个或多个元素的方式。每个定位器都由一个称为选择器的字符串定义。Vitest 通过提供方便的方法在后台生成这些选择器,从而抽象了选择器。
99
You can’t perform that action at this time.
0 commit comments