2018-03-17 07:55:00 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
2018-07-10 17:18:39 -04:00
|
|
|
require 'selenium-webdriver'
|
2018-03-17 07:55:00 -04:00
|
|
|
require 'shared_selenium_session'
|
2019-05-02 21:57:14 -04:00
|
|
|
require 'shared_selenium_node'
|
2018-03-17 07:55:00 -04:00
|
|
|
require 'rspec/shared_spec_matchers'
|
|
|
|
|
2019-06-01 21:17:59 -04:00
|
|
|
Selenium::WebDriver::Edge::Service.driver_path = '/usr/local/bin/msedgedriver'
|
|
|
|
# Not yet implemented in the selenium-webdriver edge driver
|
|
|
|
# Selenium::WebDriver::Edge.path = '/Applications/Microsoft Edge Canary.app/Contents/MacOS/Microsoft Edge Canary'
|
|
|
|
|
2018-03-17 07:55:00 -04:00
|
|
|
Capybara.register_driver :selenium_edge do |app|
|
|
|
|
# ::Selenium::WebDriver.logger.level = "debug"
|
2019-06-01 21:17:59 -04:00
|
|
|
Capybara::Selenium::Driver.new(app, browser: :edge).tap do |driver|
|
|
|
|
driver.browser
|
|
|
|
driver.download_path = Capybara.save_path
|
|
|
|
end
|
2018-03-17 07:55:00 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
module TestSessions
|
|
|
|
SeleniumEdge = Capybara::Session.new(:selenium_edge, TestApp)
|
|
|
|
end
|
|
|
|
|
2019-06-01 21:17:59 -04:00
|
|
|
skipped_tests = %i[response_headers status_code trigger]
|
2018-03-17 07:55:00 -04:00
|
|
|
|
2019-04-19 15:22:17 -04:00
|
|
|
Capybara::SpecHelper.log_selenium_driver_version(Selenium::WebDriver::Edge) if ENV['CI']
|
2018-03-17 07:55:00 -04:00
|
|
|
|
2018-07-10 17:18:39 -04:00
|
|
|
Capybara::SpecHelper.run_specs TestSessions::SeleniumEdge, 'selenium', capybara_skip: skipped_tests do |example|
|
2018-07-05 14:50:43 -04:00
|
|
|
case example.metadata[:description]
|
|
|
|
when /#refresh it reposts$/
|
2018-07-10 17:18:39 -04:00
|
|
|
skip 'Edge insists on prompting without providing a way to suppress'
|
2019-06-01 21:17:59 -04:00
|
|
|
when /should be able to open non-http url/
|
|
|
|
skip 'Crashes'
|
|
|
|
when /when Capybara.always_include_port is true/
|
|
|
|
skip 'Crashes'
|
2018-07-05 14:50:43 -04:00
|
|
|
end
|
|
|
|
end
|
2018-03-17 07:55:00 -04:00
|
|
|
|
2018-07-10 17:18:39 -04:00
|
|
|
RSpec.describe 'Capybara::Session with Edge', capybara_skip: skipped_tests do
|
2018-03-17 07:55:00 -04:00
|
|
|
include Capybara::SpecHelper
|
2019-05-02 21:57:14 -04:00
|
|
|
['Capybara::Session', 'Capybara::Node', Capybara::RSpecMatchers].each do |examples|
|
|
|
|
include_examples examples, TestSessions::SeleniumEdge, :selenium_edge
|
|
|
|
end
|
2018-03-17 07:55:00 -04:00
|
|
|
end
|