Path: blob/trunk/rb/spec/unit/selenium/devtools_spec.rb
1864 views
# frozen_string_literal: true12# Licensed to the Software Freedom Conservancy (SFC) under one3# or more contributor license agreements. See the NOTICE file4# distributed with this work for additional information5# regarding copyright ownership. The SFC licenses this file6# to you under the Apache License, Version 2.0 (the7# "License"); you may not use this file except in compliance8# with the License. You may obtain a copy of the License at9#10# http://www.apache.org/licenses/LICENSE-2.011#12# Unless required by applicable law or agreed to in writing,13# software distributed under the License is distributed on an14# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY15# KIND, either express or implied. See the License for the16# specific language governing permissions and limitations17# under the License.1819require File.expand_path('webdriver/spec_helper', __dir__)20require 'selenium/devtools'2122module Selenium23describe DevTools do24describe '.load_version' do25let(:current_version) { Gem::Version.new(Selenium::DevTools::VERSION).segments[1] }2627around do |example|28described_class.version = version29example.call30ensure31described_class.version = nil32end3334context 'when the version is too high' do35let(:version) { current_version + 1 }3637it 'can fall back to an older devtools if necessary' do38msg1 = /Could not load selenium-devtools v#{version}. Trying older versions/39msg2 = /Using selenium-devtools version v#{current_version}, some features may not work as expected/40expect { described_class.load_version }.to output(match(msg1).and(match(msg2))).to_stderr_from_any_process41end42end43end44end # DevTools45end # Selenium464748