我正在使用cucumber-js 我在同一个网址中有一些幻灯片。对于我的功能,我想为测试人员提供一种打开网址的方法,然后在同一个网址上有多个方案:
以下解决方案的问题是,网址会针对每个方案重新打开,将幻灯片重置为开头。我永远不能将每个幻灯片步骤作为单独的场景进行测试。
感谢任何帮助或建议:例如:
功能:评估幻灯片用户旅程 - pre-reqisite作为开发人员,我想打开网址/评估/
Background:
Given I open the url "/valuation/"
Scenario: Test valuation slide button
Given the element "valuationIntro" is visible
When I click on the button "valuationIntro.cta"
Then I expect that element "valuationSlide1" becomes visible
Scenario: Test valuation autocomplete
Given the element "valuationSlide1.cta" has the class "invalid"
When I set "jk5 7kj" to the inputfield "valuationSlide1.autocomplete"
Then I expect that element "valuationSlide1.cta" does not have the class "invalid"
我知道我可以使用标签,但不能完全确定如何使用标签来运行背景。
答案 0 :(得分:0)
var executed = false;
var myStepDefinitionsWrapper = function () {
this.Given(/^I open the url "([^"]*)"$/, function (url) {
if (!executed)
// do some work with url
executed = true;
});
};
module.exports = myStepDefinitionsWrapper;
只是简化一点来说明问题。我会将单身人士与州一起使用。