From 7f4025e63ac9ac9a6bb4c2826af8f34d47c9b57b Mon Sep 17 00:00:00 2001 From: huyikai Date: Thu, 9 May 2024 12:56:24 +0800 Subject: [PATCH] i18n(zh-cn): Update `testing.mdx` (#8229) Co-authored-by: liruifengv --- src/content/docs/zh-cn/guides/testing.mdx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/content/docs/zh-cn/guides/testing.mdx b/src/content/docs/zh-cn/guides/testing.mdx index a4796e7a433f3..bb62bf075af08 100644 --- a/src/content/docs/zh-cn/guides/testing.mdx +++ b/src/content/docs/zh-cn/guides/testing.mdx @@ -225,23 +225,24 @@ Nightwatch.js 是一个测试自动化框架,它配备了一套强大的工具 你可以使用 [NightwatchJS VSCode Extension](https://marketplace.visualstudio.com/items?itemName=browserstackcom.nightwatch) 或以下的 CLI 步骤来运行测试: + 1. 要运行所有测试,在终端中输入以下命令。你也可以选择包含文件名来只运行单个测试: ```sh npx nightwatch test/index.js ``` - -2. 要查看完整的 HTML 测试报告,使用以下命令打开它: + 此外,你可以使用 `--environment` 或 `-e` CLI 参数针对特定浏览器运行测试。如果你没有安装相关浏览器,Nightwatch 将尝试使用 [Selenium Manager](https://www.selenium.dev/blog/2022/introducing-selenium-manager/) 为你配置: ```sh - npx nightwatch test/index.ts --open + npx nightwatch test/index.ts -e firefox ``` -3. 要对特定的浏览器运行测试,使用 `--environment` 或 `-e` CLI 参数。如果你没有安装相关的浏览器,Nightwatch 将尝试使用 [Selenium Manager](https://www.selenium.dev/blog/2022/introducing-selenium-manager/) 为你设置。 +2. 要查看完整的 HTML 测试报告,使用以下命令打开它: ```sh - npx nightwatch test/index.ts -e firefox + npx nightwatch test/index.ts --open ``` + :::tip 在你的生产代码上运行测试,以更接近你的实际、已部署的网站。 @@ -319,6 +320,7 @@ Playwright 是一个针对现代网络应用的端到端测试框架。使用 Ja 你可以同时运行单个测试或多个测试,测试一个或多个浏览器。默认情况下,你的测试结果将显示在终端中。或者,你可以打开 HTML Test Reporter 以显示完整的报告和筛选测试结果。 + 1. 若要使用命令行运行上面的测试示例,请使用 `test` 命令。可以选择,包含只运行单个测试的文件名: ```sh @@ -330,6 +332,7 @@ Playwright 是一个针对现代网络应用的端到端测试框架。使用 Ja ```sh npx playwright show-report ``` + :::tip 针对生产代码运行测试,以更接近于实时部署的站点。