Created
May 30, 2009 05:49
-
-
Save adzap/120398 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Then /^I should see "([^\"]*)" value updated to "([^\"]*)"$/ do |dom_id, value| | |
current_value_of(dom_id).should == value | |
end | |
Then /^I should see "([^\"]*)" text updated to "([^\"]*)"$/ do |dom_id, value| | |
current_text_of(dom_id).should == value | |
end | |
def current_value_of(dom_id) | |
dom_id = "##{dom_id}" unless dom_id.starts_with?('#') | |
eval_javascript("$('#{dom_id}').val()") | |
end | |
def current_text_of(dom_id) | |
dom_id = "##{dom_id}" unless dom_id.starts_with?('#') | |
eval_javascript("$('#{dom_id}').text()") | |
end | |
def eval_javascript(javascript) | |
selenium.wait_for :wait_for => :ajax, :javascript_framework => :jquery | |
selenium.get_eval("window.#{javascript}") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment