Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
SeleniumHQ
GitHub Repository: SeleniumHQ/Selenium
Path: blob/trunk/rb/spec/unit/selenium/webdriver/common/service_spec.rb
1865 views
1
# frozen_string_literal: true
2
3
# Licensed to the Software Freedom Conservancy (SFC) under one
4
# or more contributor license agreements. See the NOTICE file
5
# distributed with this work for additional information
6
# regarding copyright ownership. The SFC licenses this file
7
# to you under the Apache License, Version 2.0 (the
8
# "License"); you may not use this file except in compliance
9
# with the License. You may obtain a copy of the License at
10
#
11
# http://www.apache.org/licenses/LICENSE-2.0
12
#
13
# Unless required by applicable law or agreed to in writing,
14
# software distributed under the License is distributed on an
15
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
# KIND, either express or implied. See the License for the
17
# specific language governing permissions and limitations
18
# under the License.
19
20
require File.expand_path('../spec_helper', __dir__)
21
22
module Selenium
23
module WebDriver
24
describe Service do
25
let(:service_path) { '/path/to/service' }
26
27
before do
28
allow(Platform).to receive(:assert_executable)
29
stub_const('Selenium::WebDriver::Service::DEFAULT_PORT', 1234)
30
stub_const('Selenium::WebDriver::Service::EXECUTABLE', 'service')
31
end
32
33
describe 'browser shortcuts' do
34
let(:args) { %w[--foo --bar] }
35
36
it 'creates Chrome instance' do
37
service = described_class.chrome(args: args)
38
expect(service).to be_a(Chrome::Service)
39
expect(service.args).to eq args
40
end
41
42
it 'creates Edge instance' do
43
service = described_class.edge(args: args)
44
expect(service).to be_a(Edge::Service)
45
expect(service.args).to eq args
46
end
47
48
it 'creates Firefox instance' do
49
service = described_class.firefox(args: args)
50
expect(service).to be_a(Firefox::Service)
51
expect(service.args).to eq args
52
end
53
54
it 'creates IE instance' do
55
service = described_class.internet_explorer(args: args)
56
expect(service).to be_a(IE::Service)
57
expect(service.args).to eq args
58
end
59
60
it 'creates Safari instance' do
61
service = described_class.safari(args: args)
62
expect(service).to be_a(Safari::Service)
63
expect(service.args).to eq args
64
end
65
end
66
end
67
end # WebDriver
68
end # Selenium
69
70