我有一个rspec和页面对象的问题.我有
cell(:balance_type_tab_element, :id => 'a')
Run Code Online (Sandbox Code Playgroud)
然后我的下线了
def check_all
check_navigation_to_and_from_balance_page
check_printer_friendly_link
end
Run Code Online (Sandbox Code Playgroud)
然后我也有
def check_allocation_by_balance_type
balance_type_tab?
puts "found tab"
puts balance_type_tab_element.visible?
balance_type_tab_element.visible?.should be_true
end
Run Code Online (Sandbox Code Playgroud)
和
def check_navigation_to_and_from_balance_page
//some other checks
check_allocation_by_balance_type
end
Run Code Online (Sandbox Code Playgroud)
然后在一个步骤文件中
on_page(ParticipantBalanceDetailsPage).check_all
Run Code Online (Sandbox Code Playgroud)
但我一直得到错误NameError:undefined局部变量或方法`be_true'
我试过谷歌搜索但到目前为止没有运气,有人可以帮助我吗?
各种匹配器方法不会在每个上下文中自动提供.考虑一下,当你打电话时be_true,你正在发送be_true消息self.为了使所有匹配器在每个上下文中都可用,RSpec必须将所有匹配器对象添加到系统中的每个对象,这将是一个糟糕的主意.
要在此上下文中使用匹配器,您只需要混合RSpec::Matchers到您的类:
class MyPageObject
include RSpec::Matchers
def check_allocation_by_balance_type
balance_type_tab?
puts "found tab"
puts balance_type_tab_element.visible?
balance_type_tab_element.visible?.should be_true
end
end
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
536 次 |
| 最近记录: |