Path: blob/trunk/rb/spec/unit/selenium/webdriver/common/service_spec.rb
1865 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('../spec_helper', __dir__)2021module Selenium22module WebDriver23describe Service do24let(:service_path) { '/path/to/service' }2526before do27allow(Platform).to receive(:assert_executable)28stub_const('Selenium::WebDriver::Service::DEFAULT_PORT', 1234)29stub_const('Selenium::WebDriver::Service::EXECUTABLE', 'service')30end3132describe 'browser shortcuts' do33let(:args) { %w[--foo --bar] }3435it 'creates Chrome instance' do36service = described_class.chrome(args: args)37expect(service).to be_a(Chrome::Service)38expect(service.args).to eq args39end4041it 'creates Edge instance' do42service = described_class.edge(args: args)43expect(service).to be_a(Edge::Service)44expect(service.args).to eq args45end4647it 'creates Firefox instance' do48service = described_class.firefox(args: args)49expect(service).to be_a(Firefox::Service)50expect(service.args).to eq args51end5253it 'creates IE instance' do54service = described_class.internet_explorer(args: args)55expect(service).to be_a(IE::Service)56expect(service.args).to eq args57end5859it 'creates Safari instance' do60service = described_class.safari(args: args)61expect(service).to be_a(Safari::Service)62expect(service.args).to eq args63end64end65end66end # WebDriver67end # Selenium686970