您如何使用剧作家指定测试文件夹/路径?

发布于 2025-02-10 12:38:21 字数 69 浏览 2 评论 0原文

我希望能够指定我的测试现场的文件夹,以便剧作家不会尝试从所有文件夹中运行测试。有没有办法告诉剧作家只能从特定文件夹进行测试?

I want to be able to specify a folder where my tests live so that Playwright doesn't try to run tests from all folders. Is there a way to tell Playwright to only run tests from a specific folder?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

冰雪梦之恋 2025-02-17 12:38:22

您可以使用 testdir 配置选项。例如:

// playwright.config.ts
import { PlaywrightTestConfig } from '@playwright/test';

const config: PlaywrightTestConfig = {
  testDir: './tests/playwright',
};

export default config;

从命令行运行playwright时,也可​​以通过提供文件夹来执行此操作:

npx playwright test path/to/tests/playwright

You can do this using the testDir config option. For example:

// playwright.config.ts
import { PlaywrightTestConfig } from '@playwright/test';

const config: PlaywrightTestConfig = {
  testDir: './tests/playwright',
};

export default config;

It's also possible to do this by providing a folder when running playwright from the command line:

npx playwright test path/to/tests/playwright
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文