剧作家开始使用现有浏览器 - 不清楚该做什么

发布于 2025-01-17 08:54:36 字数 1028 浏览 0 评论 0原文

我想为现有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频道(ChromeMSEDGE))

但我不清楚如何创建一个剧作家项目以及放置给定的何处配置行

// @ts-check

/** @type {import('@playwright/test').PlaywrightTestConfig} */
const config = {
  use: {
    channel: 'chrome',
  },
};

module.exports = config;

问题

  1. 使用现有浏览器我该怎么做才能创建剧作家项目?
  2. 我必须在哪里放置提供的配置行?
  3. 如何进行测试?

I want to write tests for an existing web application (for example vanilla todo mvc) with . 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

  1. What do i have to do to create a playwright project using existing browser?
  2. Where do i have to put the provided config lines?
  3. How do i run the tests?

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

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

发布评论

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

评论(2

喜你已久 2025-01-24 08:54:36

在您的playwright.config.ts文件(或JS,在这方面都不重要),您应该看到这些行,只不过是您的剧作作者配置。在“使用”中,添加'Chrome'作为频道,然后删除您在配置中指定的任何项目。应该没事的。您的配置文件具有非常最小的配置可能看起来像这样:

import type { PlaywrightTestConfig } from '@playwright/test'

const config: PlaywrightTestConfig = {
    testDir: './tests',
    timeout: 30 * 1000,
    expect: {
        timeout: 5000
    },
    use: {
        channel: 'chrome'
    }
};

export default config;

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:

import type { PlaywrightTestConfig } from '@playwright/test'

const config: PlaywrightTestConfig = {
    testDir: './tests',
    timeout: 30 * 1000,
    expect: {
        timeout: 5000
    },
    use: {
        channel: 'chrome'
    }
};

export default config;
£噩梦荏苒 2025-01-24 08:54:36

来自剧作家的全新安装:

。打开 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).

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