ruby-on-rails – 黄瓜硒随机失败
发布时间:2020-12-17 03:43:23 所属栏目:百科 来源:网络整理
导读:我的硒测试喜欢随机失败.作为一个例子,我有这个场景 Scenario: I should be able to edit a user Given I created a user with the login "test@example.com" And I am viewing the user with login "test@example.com" Then I should see "Edit this user"
我的硒测试喜欢随机失败.作为一个例子,我有这个场景
Scenario: I should be able to edit a user Given I created a user with the login "test@example.com" And I am viewing the user with login "test@example.com" Then I should see "Edit this user" When I click "Edit this user" Then I should be editing the user with login "test@example.com" When I press "Update" Then I should be viewing the user with login "test@example.com" And I should see "User was successfully updated." 这与其他人一起使用基本webrat:rails模式正常工作.在硒,线 Then I should be editing the user with login "test@example.com" 和 Then I should be viewing the user with login "test@example.com" 随机失败,有时第一次失败,有时秒失败.手动使用网站会导致正确的操作,就像我说的那样,webrat / rails模式运行正常. Rails 2.2.2 一些额外的信息: Scenario: I should be able to edit a user # features/admin_priviledges.feature:26 Given I created a user with the login "test@example.com" # features/step_definitions/global_steps.rb:18 And I am viewing the user with login "test@example.com" # features/step_definitions/global_steps.rb:60 Then I should see "Edit this user" # features/step_definitions/webrat_steps.rb:93 When I click "Edit this user" # features/step_definitions/webrat_steps.rb:18 Then I should be editing the user with login "test@example.com" # features/step_definitions/global_steps.rb:66 expected: "/users/8/edit",got: "/users/8" (using ==) Diff: @@ -1,2 +1,2 @@ -/users/8/edit +/users/8 (Spec::Expectations::ExpectationNotMetError) features/admin_priviledges.feature:31:in `Then I should be editing the user with login "test@example.com"' When I press "Update" # features/step_definitions/webrat_steps.rb:14 Then I should be viewing the user with login "test@example.com" # features/step_definitions/global_steps.rb:66 And I should see "User was successfully updated." Then /^I should be (editing|viewing) the (w+) with (w+) "([^"]*)"$/ do |action,model,field,value| func = make_func(action,model) m = find_model_by_field_and_value(model,value) URI.parse(current_url).path.should == eval("#{func}(m)") end 这些都是相关的步骤.按“更新”一个是标准的webrat步骤(click_button) 解决方法
改变webrat步骤
When /^I press "([^"]*)"$/ do |button| click_button(button) end 至 When /^I press "([^"]*)"$/ do |button| click_button(button) selenium.wait_for_page_to_load end 有用.告诉硒等待修复! (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |