From 10207b39465fa383e81b245b0ca5e8161e5b0fba Mon Sep 17 00:00:00 2001 From: Daniel Cunha Date: Thu, 29 Nov 2012 13:44:18 -0300 Subject: [PATCH] removing selenium steps --- features/step_definitions/selenium_steps.rb | 133 ------------------------------------------------------------------------------------------------------------------------------------- 1 file changed, 0 insertions(+), 133 deletions(-) delete mode 100644 features/step_definitions/selenium_steps.rb diff --git a/features/step_definitions/selenium_steps.rb b/features/step_definitions/selenium_steps.rb deleted file mode 100644 index f4ae7a4..0000000 --- a/features/step_definitions/selenium_steps.rb +++ /dev/null @@ -1,133 +0,0 @@ -require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths")) - -def string_to_element_locator(selector) - if selector.gsub!(/^\./, '') - "css=[class='#{selector}']" - elsif selector.gsub!(/^value[.=]/, '') - "xpath=//input[@value='#{selector}']" - elsif selector.gsub!(/^option=/, '') - "xpath=//option[@value='#{selector}']" - elsif selector.gsub!(/^#/, '') - "css=[id='#{selector}']" - elsif selector.gsub!(/^content=/, '') - "xpath=//*[.='#{selector}']" - elsif selector.gsub!(/^li=/, '') - "xpath=//li[contains(.,'#{selector}')]" - else - selector - end -end - -Then /^the "([^\"]*)" should be visible$/ do |selector| - (selenium.is_element_present(string_to_element_locator(selector)) && selenium.is_visible(string_to_element_locator(selector))).should be_true -end -Then /^the content "([^\"]*)" should be visible$/ do |selector| - selenium.is_visible(string_to_element_locator("content=#{selector}")).should be_true -end - -Then /^the "([^\"]*)" should not be visible$/ do |selector| - (selenium.is_element_present(string_to_element_locator(selector)) && selenium.is_visible(string_to_element_locator(selector))).should be_false -end -Then /^the content "([^\"]*)" should not be visible$/ do |selector| - selenium.is_visible(string_to_element_locator("content=#{selector}")).should be_false -end - -When /^I click "([^\"]*)"$/ do |selector| - selenium.click(string_to_element_locator(selector)) -end - -Then /^the "([^\"]*)" button should not be enabled$/ do |text| - selenium.is_editable(string_to_element_locator(text)).should be_false -end - -Then /^the "([^\"]*)" button should be enabled$/ do |text| - selenium.is_editable(string_to_element_locator("value.#{text}")).should be_true -end - -Then /^I should see "([^\"]*)" above of "([^\"]*)"$/ do |above, below| - above_position = selenium.get_element_position_top(string_to_element_locator("li=#{above}")) - below_position = selenium.get_element_position_top(string_to_element_locator("li=#{below}")) - above_position.to_i.should < below_position.to_i -end - -When /^I drag "([^\"]*)" to "([^\"]*)"$/ do |from, to| - selenium.drag_and_drop_to_object(string_to_element_locator("li=#{from}"), string_to_element_locator("li=#{to}")) - selenium.wait_for_ajax -end - -When /^I select "([^\"]*)" and wait for (jquery)$/ do |value, framework| - select(value) - # FIXME ugly hack to make selenium tests waiting to render page - # "select(value, :wait_for => :ajax)" did not effect - selenium.wait_for(:wait_for => :ajax, :javascript_framework => framework) -end - -When /^I select window "([^\"]*)"$/ do |selector| - selenium.select_window(selector) -end - -When /^I fill in "([^\"]*)" within "([^\"]*)" with "([^\"]*)"$/ do |field_label, parent_class, value| - selenium.type("xpath=//*[contains(@class, '#{parent_class}')]//*[@id=//label[contains(., '#{field_label}')]/@for]", value) -end - -When /^I press "([^\"]*)" within "([^\"]*)"$/ do |button_value, selector| - selenium.click("css=#{selector} input[value=#{button_value}]") - selenium.wait_for_page_to_load(10000) -end - -Then /^there should be ([1-9][0-9]*) "([^\"]*)" within "([^\"]*)"$/ do |number, child_class, parent_class| - # Using xpath is the only way to count - response.selenium.get_xpath_count("//*[contains(@class,'#{parent_class}')]//*[contains(@class,'#{child_class}')]").to_i.should be(number.to_i) -end - -Then /^"([^\"]*)" should be (left|right) aligned$/ do |element_class, align| - # Using xpath is the only way to count - response.selenium.get_xpath_count("//*[contains(@class,'#{element_class}') and contains(@style,'float: #{align}')]").to_i.should be(1) -end - -When /^I confirm$/ do - selenium.get_confirmation -end - -When /^I type "([^\"]*)" in TinyMCE field "([^\"]*)"$/ do |value, field_id| - response.selenium.type("dom=document.getElementById('#{field_id}_ifr').contentDocument.body", value) -end - -When /^I refresh the page$/ do - response.selenium.refresh -end - -When /^I click on the logo$/ do - selenium.click("css=h1#site-title a") - selenium.wait_for_page_to_load(10000) -end - -When /^I open (.*)$/ do |url| - selenium.open(URI.join(response.selenium.get_location, url)) -end - -Then /^the page title should be "([^"]+)"$/ do |text| - selenium.get_text("//title").should == text -end - -#### Noosfero specific steps #### - -Then /^the select for category "([^\"]*)" should be visible$/ do |name| - sleep 2 # FIXME horrible hack to wait categories selection scolling to right - category = Category.find_by_name(name) - selenium.is_visible(string_to_element_locator("option=#{category.id}")).should be_true -end - -When /^I follow "([^\"]*)" and sleep ([^\"]*) seconds?$/ do |link, time| - click_link(link) - sleep time.to_i -end - -When /^I follow "([^\"]*)" and wait for jquery$/ do |link| - click_link(link) - selenium.wait_for(:wait_for => :ajax, :javascript_framework => framework) -end - -When /^I leave the "([^\"]+)" field$/ do |field| - selenium.fire_event("css=#{field}", "blur") -end -- libgit2 0.21.2