2016-09-01 18:46:56 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
require 'spec_helper'
|
|
|
|
require "selenium-webdriver"
|
|
|
|
require 'shared_selenium_session'
|
2016-10-13 22:50:03 -04:00
|
|
|
require 'rspec/shared_spec_matchers'
|
|
|
|
|
|
|
|
Capybara.register_driver :selenium_marionette do |app|
|
|
|
|
Capybara::Selenium::Driver.new(
|
|
|
|
app,
|
|
|
|
browser: :firefox,
|
|
|
|
desired_capabilities: Selenium::WebDriver::Remote::Capabilities.firefox(marionette: true)
|
|
|
|
)
|
2016-09-01 18:46:56 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
module TestSessions
|
2016-10-13 22:50:03 -04:00
|
|
|
SeleniumMarionette = Capybara::Session.new(:selenium_marionette, TestApp)
|
2016-09-01 18:46:56 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
skipped_tests = [
|
|
|
|
:response_headers,
|
|
|
|
:status_code,
|
|
|
|
:trigger
|
|
|
|
]
|
|
|
|
skipped_tests << :windows if ENV['TRAVIS'] && !ENV['WINDOW_TEST']
|
|
|
|
|
2016-10-13 22:50:03 -04:00
|
|
|
Capybara::SpecHelper.run_specs TestSessions::SeleniumMarionette, "selenium", capybara_skip: skipped_tests
|
2016-09-01 18:46:56 -04:00
|
|
|
|
|
|
|
RSpec.describe "Capybara::Session with firefox" do
|
2016-10-13 22:50:03 -04:00
|
|
|
include_examples "Capybara::Session", TestSessions::SeleniumMarionette, :selenium_marionette
|
|
|
|
include_examples Capybara::RSpecMatchers, TestSessions::SeleniumMarionette, :selenium_marionette
|
2016-09-01 18:46:56 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
RSpec.describe Capybara::Selenium::Driver do
|
|
|
|
before do
|
|
|
|
@driver = Capybara::Selenium::Driver.new(TestApp, browser: :firefox)
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#quit' do
|
|
|
|
it "should reset browser when quit" do
|
|
|
|
expect(@driver.browser).to be
|
|
|
|
@driver.quit
|
|
|
|
#access instance variable directly so we don't create a new browser instance
|
|
|
|
expect(@driver.instance_variable_get(:@browser)).to be_nil
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|