繁体   English   中英

Nightwatch/Cucumber - 场景大纲和示例表不起作用

[英]Nightwatch/Cucumber - Scenario Outline and Example table not working

我不是开发人员,所以仍在学习 javascript 等。我使用 Nightwatch/Cucumber 启动并运行了一些自动化脚本。 我现在正在尝试更复杂的步骤。 带有示例表的场景大纲。 我面临的问题是,我无法通过测试从表格中获取数据。 它到达步骤,然后重新开始而没有实际填充。 看起来我的步骤没有定义。 我正在使用 PageObjects,除了在这种情况下,这一切都正常工作。 我不确定如何正确编码步骤

情景大纲

When I create a new Lot 
Then I can create multiple Lots using a different <postcode>

Examples:
|postcode|
|WF4 5HQ |
|SA11 1DJ|

步骤定义

Then(/^I can create multiple lots using a different ([^\"]*)$/, (postcode) => {
return pageLotsMultiple
    .useXpath()
    .waitForElementVisible('//*[@id="__06a943c59f33a34bb5924aaf72cd2995"]/input')
    .pause(1000)
    .setPostcode(postcode)

我尝试了各种方法,都做同样的事情

Then(/^I can create multiple lots using a different ([^\"]*)$/, (postcode) => {
return pageLotsMultiple
    .setPostcode(postcode)
    .addProperty()
    .waitForElementVisible('@newPostcode')
    .newPostcode()

没有表格和编码邮政编码,测试运行良好,但我想避免这种情况

这是我们每个人都会经历的愚蠢错误。 我会用引号写你的如下。

Scenario Outline: Scenario Name
When I create a new Lot
Then I can create multiple Lots using a different <postcode>

Examples:
  | postcode   |
  | "WF4 5HQ"  |
  | "SA11 1DJ" |

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM