* removed wait_until where possible * replaced wait_until with DOM obersavtions * added match: :first to all finders that assumed getting the first element * replaced evaluate_script with execute_script where possible * replaced a few execute_script with DOM observations through Capybara * removed sleep where possible * replaced sleep with DOM obersvations * replaced "wait for ajax" with DOM obersavations * replaced alert confirmation with new selenium API * bump selenium webdriver * made any other fixes to get green again
24 lines
875 B
Ruby
24 lines
875 B
Ruby
When /^I press the "([^\"]*)" key somewhere$/ do |key|
|
|
within("#main_stream") do
|
|
find("div.stream_element", match: :first).native.send_keys(key)
|
|
end
|
|
end
|
|
|
|
When /^I press the "([^\"]*)" key in the publisher$/ do |key|
|
|
find("#status_message_fake_text", visible: false).native.send_keys(key)
|
|
end
|
|
|
|
Then /^post (\d+) should be highlighted$/ do |position|
|
|
find(".shortcut_selected .post-content").text.should == stream_element_numbers_content(position).text
|
|
end
|
|
|
|
And /^I should have navigated to the highlighted post$/ do
|
|
find(".shortcut_selected")["offsetTop"].to_i.should == page.evaluate_script("window.pageYOffset + 50").to_i
|
|
end
|
|
|
|
When /^I scroll to post (\d+)$/ do |position|
|
|
page.should have_css("div.stream_element")
|
|
page.driver.browser.execute_script("
|
|
window.scrollTo(window.pageXOffset, $('div.stream_element')[#{position}-1].offsetTop-50);
|
|
")
|
|
end
|