黄瓜webrat单击第二个删除链接
|
我有一种情况,我想在页面上为表中的第二项选择\'Delete \'链接。我一直在查看click_link_within或在内部使用,但无法正常工作。
Scenario: User deletes a staff member from the listing
Given a staff exists with name: \"Michael\"
And a staff exists with name: \"Joe\"
And I am on the listing staff index page
When I follow \"Delete\" for row containing \"Joe\"
Then I should be on the listing staff index page
And I should not see \"Joe\"
And I should see \"Michael\"
这是我尝试使用的步骤:
When /^I follow \"([^\"]*)\" for row containing \"([^\"]*)\"$/ do |button, text|
click_link_within \"//*[.//td[contains(.,#{text})]]\", button
end
这是haml中的清单代码:
%h1 Staff Listing
%table
%th Username
%th Surname
%th First Name
- @staff.each do |staff|
%tr
%td= staff.username
%td= staff.surname
%td= staff.firstname
%td= link_to \"Edit\", edit_staff_path(staff)
%td= link_to \"Delete\", staff, :method => :delete
没有找到相关结果
已邀请:
1 个回复
屑凉赦