正在尝试运行以下代码片段
const { it, expect } = require('@playwright/test');
it('is a basic test with the page', async ({ page }) => {
await page.goto('https://playwright.dev/');
const home = await page.waitForSelector('home-navigation');
expect(await home.innerText()).toBe(' Playwright');
});但会得到以下错误:
TypeError: test_runner_1.fixtures.defineParameter is not a function指向我的require语句,我已经运行了npm i -D @playwright/test @playwright/test-runner并提供了模块。为什么这会失败呢?正在尝试使用节点'filename.js‘运行它
发布于 2021-03-18 17:38:58
使用playwright-test测试运行器时:运行命令,如使用npx
文件应以*.ts格式存储,如下所示:
foo.spec.ts在Chromium、火狐和WebKit上运行所有测试
npx folio在单个浏览器上运行测试
npx folio --param browserName=chromium在headful模式下运行所有测试
npx folio --param headful使用slowMo运行测试(使播放编写器操作速度减慢n毫秒)
npx folio --param slowMo=100将失败的屏幕截图保存在test-result目录中
npx folio --param screenshotOnFailure查看所有选项
npx folio --help要使用多个参数运行您的代码:
npx foo.spec.ts --param browserName=chromium --param headfulhttps://stackoverflow.com/questions/64320859
复制相似问题