1
0
Fork 0
mirror of https://github.com/teamcapybara/capybara.git synced 2022-11-09 12:08:07 -05:00
teamcapybara--capybara/lib/capybara/spec/session/execute_script_spec.rb

14 lines
569 B
Ruby
Raw Normal View History

2016-03-07 19:52:19 -05:00
# frozen_string_literal: true
2016-10-04 14:10:29 -04:00
Capybara::SpecHelper.spec "#execute_script", requires: [:js] do
it "should execute the given script and return nothing" do
@session.visit('/with_js')
expect(@session.execute_script("document.getElementById('change').textContent = 'Funky Doodle'")).to be_nil
2016-10-04 14:10:29 -04:00
expect(@session).to have_css('#change', text: 'Funky Doodle')
end
it "should be able to call functions defined in the page" do
@session.visit('/with_js')
expect{ @session.execute_script("$('#change').text('Funky Doodle')") }.not_to raise_error
end
end