剧作家开始使用现有浏览器 - 不清楚该做什么
我想为现有Web应用程序编写测试(例如 nofollow noreferrer“> vanilla todo mvc ) =“/问题/标记/剧作家” class =“ post-tag” title =“显示问题标记为'playwright'“ rel =“ tag”> playwright 。所以我开始 playwright开始,
npm init playwright@latest new-project
但它对我不起作用,因为浏览器的安装失败:
Downloading browsers (npx playwright install)…
Failed to install browsers
我我们的公司防火墙阻止下载浏览器。幸运的是
当前的剧作家版本将支持这些浏览器的稳定和beta频道(
Chrome
,MSEDGE
))
但我不清楚如何创建一个剧作家项目以及放置给定的何处配置行
// @ts-check
/** @type {import('@playwright/test').PlaywrightTestConfig} */
const config = {
use: {
channel: 'chrome',
},
};
module.exports = config;
问题
- 使用现有浏览器我该怎么做才能创建剧作家项目?
- 我必须在哪里放置提供的配置行?
- 如何进行测试?
I want to write tests for an existing web application (for example vanilla todo mvc) with playwright. So i started playwright getting started with
npm init playwright@latest new-project
But it does not work for me because the installation of browsers fails:
Downloading browsers (npx playwright install)…
Failed to install browsers
I quess that our corporate firewall prevents to download browsers. Luckily playwright also offers to use existing browsers
current Playwright version will support Stable and Beta channels of these browsers (
chrome
,msedge
)
But it is unclear to me how i can create a playwright project and where to put the given configuration lines
// @ts-check
/** @type {import('@playwright/test').PlaywrightTestConfig} */
const config = {
use: {
channel: 'chrome',
},
};
module.exports = config;
Questions
- What do i have to do to create a playwright project using existing browser?
- Where do i have to put the provided config lines?
- How do i run the tests?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在您的playwright.config.ts文件(或JS,在这方面都不重要),您应该看到这些行,只不过是您的剧作作者配置。在“使用”中,添加'Chrome'作为频道,然后删除您在配置中指定的任何项目。应该没事的。您的配置文件具有非常最小的配置可能看起来像这样:
In your playwright.config.ts file (or js, it does not matter on this regard) you should see those lines, which are nothing but your playwright configuration. In "use", add 'chrome' as channel and remove any projects you may have specified in your config. It should be fine. Your config file with a very minimal configuration could look something like this:
来自剧作家的全新安装:
。打开 playwright.config.js
。转到“/*为主要浏览器配置项目*/”部分
。删除与您不感兴趣的浏览器相关的小节(或者取消注释您感兴趣的浏览器)。
。重新启动您的测试(该测试将针对每个未注释的浏览器运行)。
from a fresh install of playwright :
. open playwright.config.js
. go to section " /* Configure projects for major browsers */"
. remove the subsections related to browsers that do not interest you (or, uncommment the ones that interest you).
. relaunch your test (The test will be run against each of your uncommented browsers).