cirandas.net

ref: master

features/step_definitions/media_panel.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Then /^I should (not )?see an element "([^"]*)"$/ do |negate, selector|
  expectation = negate ? :should_not : :should
  page.html.send(expectation, have_css(selector))
end

Then /^"([^"]*)" should be selected for "([^"]*)"(?: within "([^"]*)")?$/ do |value, field, selector|
  with_scope(selector) do
    field_labeled(field).find(:xpath, ".//option[@selected = 'selected'][text() = '#{value}']").should be_present
  end
end

Then /^(?:|I )should see div with title "([^"]*)"(?: within "([^"]*)")?$/ do |name, selector|
  with_scope(selector) do
    if page.respond_to? :should
      page.should have_xpath(".//div[@title='#{name}']")
    else
      assert page.has_xpath?(".//div[@title='#{name}']")
    end
  end
end

Then /^(?:|I )should not see div with title "([^"]*)"(?: within "([^"]*)")?$/ do |name, selector|
  with_scope(selector) do
    if page.respond_to? :should
      page.should have_no_xpath(".//div[@title='#{name}']")
    else
      assert page.has_no_xpath?(".//div[@title='#{name}']")
    end
  end
end