Ani*_*uja 2 selenium ruby-on-rails cucumber capybara
我正在为注册表单编写一个场景.
@abc
@selenium
Scenario:Non registered user signs up
Given I am on the sign-up page
When I fill in the following:
|first_name|Anidhya|
|last_name|Ahuja|
|email|anidhya@gmail.com|
|password|123456|
And I press "submit"
Then I should see "Registration complete"
Run Code Online (Sandbox Code Playgroud)
对于我在env.rb文件中的内容,我写道:
begin
require 'database_cleaner'
require 'database_cleaner/cucumber'
DatabaseCleaner.strategy = :transaction
Cucumber::Rails::World.use_transactional_fixtures = true
rescue NameError
raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it."
end
Before('@abc') do
DatabaseCleaner.start
end
After('@abc') do
DatabaseCleaner.clean
end
Run Code Online (Sandbox Code Playgroud)
现在,当我运行场景时,用户将被保存在数据库中,并且数据库清理器将失败.我没有看到任何错误消息
您无法使用selenium运行事务,因为测试在应用程序AFAIK的两个单独实例上运行
| 归档时间: |
|
| 查看次数: |
1946 次 |
| 最近记录: |