如何使用Cucumber和Webrat/Selenium的页面对象模式?
我正在看一个黄瓜测试套件,它现在有点脆弱;很多小步骤,而且不了解页面本身 我想在一系列Selenium PageObject中分析步骤定义中涉及的逻辑 然而,因为我使用的是Webrat而不是Selenium,所以一切都必须通过Webrat模型。所以我做不到如何使用Cucumber和Webrat/Selenium的页面对象模式?,selenium,cucumber,webrat,Selenium,Cucumber,Webrat,我正在看一个黄瓜测试套件,它现在有点脆弱;很多小步骤,而且不了解页面本身 我想在一系列Selenium PageObject中分析步骤定义中涉及的逻辑 然而,因为我使用的是Webrat而不是Selenium,所以一切都必须通过Webrat模型。所以我做不到 class MyPage < Selenium::WebPage end class MyPage
class MyPage < Selenium::WebPage
end
class MyPage
因为这增加了直接依赖性
因此,我必须通过Webrat路由所有内容,同时仍然保持Selenium页面对象。我看不到关于这方面的文档:如果有人在Webrat+PageModel上有任何东西,我很想看看。结果是:
class MyPage < BasePage
def visit
@world.visit "/"
end
end
class BasePage
def initialize(world)
@world = world
end
end
我们刚刚发布了一些听起来像你想要的东西。 看看Gizmo- 与(webrat | capybara),(cucumber | rspec)等合作
Given /I am awesome/ do
page = MyPage.new(self)
page.visit
end