我们正在使用:
"cypress": "^9.6.1",
"cypress-cucumber-preprocessor": "^4.3.1",使用TypeScript:
"ts-node": "^10.8.0",
"tsify": "^5.0.4",
"typescript": "^4.6.4"据我所知,柏树预处理器没有任何before挂钩,这将在整个测试套件之前进行。有什么办法实现这样的钩吗?
发布于 2022-05-23 14:00:17
为此,我将background添加到每个特性文件中。这将在您的特性文件中的每个场景之前执行。
示例:
Feature: Doing some this
Background:
Given This will run before each scenario
Scenario:
Given Will run after the background process
Scenario:
This Will also run after the background run发布于 2022-05-23 21:45:01
我不是柏树专家-黄瓜=预处理器,但是看看ordering.feature,Mocha before()和beforeEach()钩子的正常使用似乎是正常的。
黄瓜Before()是一个不同的钩,因为资本"B“。
And a file named "cypress/support/step_definitions/steps.js" with:
"""
const {
Given,
Before,
After
} = require("@badeball/cypress-cucumber-preprocessor")
let counter;
before(function() {
counter = 0;
})
beforeEach(function() {
expect(counter++, "Expected beforeEach() to be called after before()").to.equal(0)
})
Before(function() {
expect(counter++, "Expected Before() to be called after beforeEach()").to.equal(1)
})https://stackoverflow.com/questions/72349682
复制相似问题