mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
IE test updates
This commit is contained in:
parent
679548cea1
commit
2a35dc5b94
5 changed files with 28 additions and 9 deletions
|
@ -312,7 +312,7 @@ private
|
|||
end
|
||||
|
||||
def ie?
|
||||
browser_name == :ie
|
||||
%i[internet_explorer ie].include?(browser_name)
|
||||
end
|
||||
|
||||
def browser_name
|
||||
|
|
|
@ -176,7 +176,14 @@ class Capybara::Selenium::Node < Capybara::Driver::Node
|
|||
|
||||
if parent
|
||||
siblings = parent.find_xpath(selector)
|
||||
selector += "[#{siblings.index(node) + 1}]" unless siblings.size == 1
|
||||
selector += case siblings.size
|
||||
when 0
|
||||
'[ERROR]' # IE doesn't support full XPath (namespace-uri, etc)
|
||||
when 1
|
||||
'' # index not necessary when only one matching element
|
||||
else
|
||||
"[#{siblings.index(node) + 1}]"
|
||||
end
|
||||
end
|
||||
result.push selector
|
||||
end
|
||||
|
|
10
lib/capybara/spec/public/jquery.js
vendored
10
lib/capybara/spec/public/jquery.js
vendored
File diff suppressed because one or more lines are too long
|
@ -22,10 +22,18 @@ skipped_tests = %i[response_headers status_code trigger modals hover form_attrib
|
|||
|
||||
$stdout.puts `#{Selenium::WebDriver::IE.driver_path} --version` if ENV['CI']
|
||||
|
||||
TestSessions::SeleniumIE.current_window.resize_to(1600, 1200)
|
||||
|
||||
Capybara::SpecHelper.run_specs TestSessions::SeleniumIE, 'selenium', capybara_skip: skipped_tests do |example|
|
||||
case example.metadata[:description]
|
||||
case example.metadata[:full_description]
|
||||
when /#refresh it reposts$/
|
||||
skip 'Firefox and Edge insist on prompting without providing a way to suppress'
|
||||
when /#click_link can download a file$/
|
||||
skip 'Not sure how to configure IE for automatic downloading'
|
||||
when /#fill_in with Date /
|
||||
pending "IE 11 doesn't support date input types"
|
||||
when /#click_link_or_button with :disabled option happily clicks on links which incorrectly have the disabled attribute$/
|
||||
pending "IE 11 obeys non-standard disabled attribute on anchor tag"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -169,11 +169,13 @@ RSpec.shared_examples 'Capybara::Session' do |session, mode|
|
|||
end
|
||||
|
||||
it 'should generate standard events on changing value' do
|
||||
pending "IE 11 doesn't support date input type" if ie?(session)
|
||||
session.fill_in('form_date', with: Date.today)
|
||||
expect(session.evaluate_script('window.capybara_formDateFiredEvents')).to eq %w[focus input change]
|
||||
end
|
||||
|
||||
it 'should not generate input and change events if the value is not changed' do
|
||||
pending "IE 11 doesn't support date input type" if ie?(session)
|
||||
session.fill_in('form_date', with: Date.today)
|
||||
session.fill_in('form_date', with: Date.today)
|
||||
# Chrome adds an extra focus for some reason - ok for now
|
||||
|
@ -202,13 +204,15 @@ RSpec.shared_examples 'Capybara::Session' do |session, mode|
|
|||
end
|
||||
|
||||
it 'handles namespaces' do
|
||||
pending "IE 11 doesn't handle all XPath querys (namespace-uri, etc)" if ie?(session)
|
||||
session.visit '/with_namespace'
|
||||
rect = session.find(:css, 'div svg rect')
|
||||
rect = session.find(:css, 'div svg rect:first-of-type')
|
||||
expect(rect.path).to eq("/HTML/BODY/DIV/./*[((local-name(.) = 'svg') and (namespace-uri(.) = 'http://www.w3.org/2000/svg'))]/./*[((local-name(.) = 'rect') and (namespace-uri(.) = 'http://www.w3.org/2000/svg'))][1]")
|
||||
expect(session.find(:xpath, rect.path)).to eq rect
|
||||
end
|
||||
|
||||
it 'handles case sensitive element names' do
|
||||
pending "IE 11 doesn't handle all XPath querys (namespace-uri, etc)" if ie?(session)
|
||||
session.visit '/with_namespace'
|
||||
els = session.all(:css, 'div *', visible: :all)
|
||||
expect { els.map(&:path) }.not_to raise_error
|
||||
|
|
Loading…
Reference in a new issue