我正在使用Cucumber和Capybara进行自动化前端测试.
我有两个环境,我想运行我的测试.一个是临时环境,另一个是生产环境.
目前,我已将我的测试编写为直接访问分段.
visit('https://staging.somewhere.com')
Run Code Online (Sandbox Code Playgroud)
我想重新使用生产中的测试(https://production.somewhere.com).
是否可以将URL存储在我的步骤定义中的变量中
visit(domain)
Run Code Online (Sandbox Code Playgroud)
并使用从命令行调用的环境变量定义域?喜欢
$> bundle exec cucumber features DOMAIN=staging
Run Code Online (Sandbox Code Playgroud)
如果我想将测试指向我的暂存环境,或者
$> bundle exec cucumber features DOMAIN=production
Run Code Online (Sandbox Code Playgroud)
如果我想让它在生产中运行?
我该如何设置呢?我是Ruby的新手,我一直在论坛上搜索直接的信息,但找不到任何信息.如果我能提供更多信息,请告诉我.谢谢你的帮助!
我试图从selenium-webdriver(ruby)实现以下方法
require "rubygems"
require "selenium-webdriver"
require "test/unit"
class SwitchToPopup3 < Test::Unit::TestCase
def setup
@driver = Selenium::WebDriver.for :firefox
@base_url = (URL of my test website)
@driver.manage.timeouts.implicit_wait = 30
@verification_errors = []
end
def teardown
@driver.quit
assert_equal [], @verification_errors
end
def test_switch_to_popup3
.
.
puts @driver.get_all_window_ids()
puts @driver.get_all_window_titles()
puts @driver.get_all_window_names()
.
.
end
Run Code Online (Sandbox Code Playgroud)
我一直得到的错误是
NoMethodError: undefined method `get_all_window_ids' for # <Selenium::WebDriver::Driver:0x101e4b040 browser=:chrome>
/Users/rsucgang/Documents/Aptana Studio 3 Workspace/Testing/SwitchToPopup2.rb:37:in `test_switch_to_popup3'
Run Code Online (Sandbox Code Playgroud)
我研究了selenium-webdriver的ruby绑定文档 …