如何传递PageObject来定义黄瓜步骤



我在noraUI源代码中看到以下步骤

@And("I expect to have {page-element} with the text {string}(\?)")
public void expectText(Page.PageElement pageElement, String textOrKey, List<GherkinStepCondition> conditions) throws FailureException, TechnicalException {
this.expectText(pageElement, textOrKey, new Object[0]);
}

我想使用这个步骤,但是我不能为这个步骤传递{page-element}。它应该是什么样子?

根据文档,我看到它应该以$开头,但这一步在功能文件

中没有定义。

阅读文档后,我得到了解决方案我们仍然不能在cucumber文件中传递object,因为step会被标记为&;undefined&;因为它是,noraUI有它自己的步骤解析器,如果我写这一步在我的功能文件:当我点击$google。GoogleHomePage-searchButton此步骤将在noraUi中定义,并且此pageObject将从nora configs的.ini文件中解析

这样怎么样?

@Conditioned
@And("I expect to have {page-element} with the text {string}(\?)")
public void expectText(PageElement pageElement, String textOrKey, List<GherkinStepCondition> conditions) throws FailureException, TechnicalException {
// code to check if the pageElement exists and if it matches the string
}

最新更新