我在尝试使用 siteprism 创建可重用的步骤定义时遇到一些问题,比如说功能文件是
Given that im on the site
Then i should see a "stack over" text
And i should see a "ask" text
And i should see a "question" text
然后我的步骤定义将是
我想让 arg1 是动态的,这个逻辑将检查它是否为真
Then (/^i should see a "(.*?)" text$/) do |arg1|
@common_page = CommonLib.new
@ref = arg1.gsub(/\s+/,'')
expect(@common_page.*@ref*.text).to eq (arg1)
end
然后在我的页面 def 将是
class CommonLib < siteprism::page
element :stackover, "#text_header"
element :ask, "#text_ask"
element :question, "#text_question"
我遇到的问题是这个expect(@common_page. @ref .text) .to eq (arg1)
映射错误@ref 需要使用它得到的数据,如“stackover”、“ask”和“question”,并在 CommonLib 页面 def 中映射