gherkin-testcafe安装异常:版本依赖问题求助
使用gherkin-testcafe执行测试时遭遇版本依赖错误,官方修复方案无效
问题详情
我正在搭建新测试项目,使用gherkin-testcafe包编写BDD测试用例。执行启动命令:
gherkin-testcafe chrome ./tests/**/*.ts ./tests/**/*.feature
时触发版本依赖错误。我从未全局安装过cucumber,且已尝试cucumber官方文档提供的无效安装修复方案,但问题仍未解决。该问题在MacOS和Ubuntu系统中均可复现。
环境与尝试操作
- 当前使用依赖版本:
gherkin-testcafe@6.0.0、testcafe@2.3.1 - 已尝试的解决动作:
- 不手动安装
@cucumber/cucumber包 - 升级
gherkin-testcafe和testcafe到更高版本
以上操作均未解决问题。
- 不手动安装
项目相关信息
项目结构

已安装包版本

错误信息截图

测试代码(firstTests.ts)
import { Given, When, Then } from '@cucumber/cucumber'; import { Selector } from 'testcafe'; Given('I load the testpage', async (t) => { await t.navigateTo('https://devexpress.github.io/testcafe/example/'); }); When('I type in a text', async (t, params) => { await t .typeText('#developer-name', 'John Smith') }); When('I click on submit', async (t, [param1, param2]) => { await t .click('#submit-button') }); Then('It should thank me', async (t) => { await t .expect(Selector('#article-header').innerText).eql('Thank you, John Smith!'); }); Then( 'use Cucumber Expressions to get {int}, {float}, {word}, {string}, etc', async (t, [intParam, floatParam, singleWordParam, stringParam]) => { await t.expect(typeof intParam).eql('number'); } );
Feature文件(firstTests.feature)
Feature: FirstTest Feature Name# Enter feature name here # Enter feature description here Scenario: FirstTest scenario name# Enter scenario name here # Enter steps here Given I load the testpage When I type in a text When I click on submit Then It should thank me
内容的提问来源于stack exchange,提问作者behzad k.
相关产品推荐
相关产品推荐

