我正在嘗試從中匯入“And”關鍵字,@badeball/cypress-cucumber-preprocessor以便可以在 Cypress/Cucumber 中使用它,但出現此錯誤
模塊“@badeball/cypress-cucumber-preprocessor”沒有匯出成員 'And' - ts(2305)
我不知道為什么。
其他關鍵字,如“Given”、“When”和“Then”都可以很好地匯入。
uj5u.com熱心網友回復:
您不需要And步驟定義中的關鍵字。
對于這個功能
Feature: duckduckgo.com
Scenario: visiting the frontpage
When I visit duckduckgo.com
And I have another condition
Then I should see a search bar
And I have another assertion
根據需要使用 When 或 Given 或 Then 來匹配And。
import { When, Then } from "@badeball/cypress-cucumber-preprocessor";
When("I visit duckduckgo.com", () => {
cy.visit("https://www.duckduckgo.com");
});
When("I have another condition", () => {
console.log('When - I have another condition') // matched and logged to console
});
Then("I should see a search bar", () => {
cy.get("input")
.should(
"have.attr",
"placeholder",
"Search the web without being tracked"
);
});
Then("I have another assertion", () => {
console.log('Then - I have another assertion') // matched and logged to console
});
uj5u.com熱心網友回復:
從版本 13.0.0 開始,支持AND和BUT的支持被洗掉。
https://github.com/badeball/cypress-cucumber-preprocessor/issues/821
請參閱 v13.0.0 的發行說明 https://github.com/badeball/cypress-cucumber-preprocessor/releases
uj5u.com熱心網友回復:
我剛剛安裝并匯入了“cypress-cucumber-preprocessor/steps”庫,它包含“And”關鍵字。謝謝!
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/524065.html
