Skip to content

Commit 9975b39

Browse files
committed
Move the integration tests to unit tests
1 parent 18a140a commit 9975b39

File tree

10 files changed

+110
-85
lines changed

10 files changed

+110
-85
lines changed

rb/spec/integration/selenium/webdriver/chrome/service_spec.rb

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,23 +37,6 @@ module Chrome
3737
it 'can be started outside driver' do
3838
expect(service_manager.uri).to be_a(URI)
3939
end
40-
41-
context 'with a path env variable' do
42-
before { ENV['SE_CHROMEDRIVER'] = DriverFinder.new(Options.new, described_class.new).driver_path }
43-
44-
after { ENV.delete('SE_CHROMEDRIVER') }
45-
46-
it 'uses the path from the environment' do
47-
expect(service.executable_path).to match(/chromedriver/)
48-
end
49-
50-
it 'updates the path after setting the environment variable' do
51-
ENV['SE_CHROMEDRIVER'] = '/foo/bar'
52-
service.executable_path = DriverFinder.new(Options.new, described_class.new).driver_path
53-
54-
expect(service.executable_path).to match(/chromedriver/)
55-
end
56-
end
5740
end
5841
end # Chrome
5942
end # WebDriver

rb/spec/integration/selenium/webdriver/edge/service_spec.rb

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,23 +37,6 @@ module Edge
3737
it 'can be started outside driver' do
3838
expect(service_manager.uri).to be_a(URI)
3939
end
40-
41-
context 'with a path env variable' do
42-
before { ENV['SE_EDGEDRIVER'] = DriverFinder.new(Options.new, described_class.new).driver_path }
43-
44-
after { ENV.delete('SE_EDGEDRIVER') }
45-
46-
it 'uses the path from the environment' do
47-
expect(service.executable_path).to match(/edgedriver/)
48-
end
49-
50-
it 'updates the path after setting the environment variable' do
51-
ENV['SE_EDGEDRIVER'] = '/foo/bar'
52-
service.executable_path = DriverFinder.new(Options.new, described_class.new).driver_path
53-
54-
expect(service.executable_path).to match(/edgedriver/)
55-
end
56-
end
5740
end
5841
end # Edge
5942
end # WebDriver

rb/spec/integration/selenium/webdriver/firefox/service_spec.rb

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,23 +37,6 @@ module Firefox
3737
it 'can be started outside driver' do
3838
expect(service_manager.uri).to be_a(URI)
3939
end
40-
41-
context 'with a path env variable' do
42-
before { ENV['SE_GECKODRIVER'] = DriverFinder.new(Options.new, described_class.new).driver_path }
43-
44-
after { ENV.delete('SE_GECKODRIVER') }
45-
46-
it 'uses the path from the environment' do
47-
expect(service.executable_path).to match(/geckodriver/)
48-
end
49-
50-
it 'updates the path after setting the environment variable' do
51-
ENV['SE_GECKODRIVER'] = '/foo/bar'
52-
service.executable_path = DriverFinder.new(Options.new, described_class.new).driver_path
53-
54-
expect(service.executable_path).to match(/geckodriver/)
55-
end
56-
end
5740
end
5841
end # Firefox
5942
end # WebDriver

rb/spec/integration/selenium/webdriver/ie/service_spec.rb

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,23 +37,6 @@ module IE
3737
it 'can be started outside driver' do
3838
expect(service_manager.uri).to be_a(URI)
3939
end
40-
41-
context 'with a path env variable' do
42-
before { ENV['SE_IEDRIVER'] = DriverFinder.new(Options.new, described_class.new).driver_path }
43-
44-
after { ENV.delete('SE_IEDRIVER') }
45-
46-
it 'uses the path from the environment' do
47-
expect(service.executable_path).to match(/iedriver/)
48-
end
49-
50-
it 'updates the path after setting the environment variable' do
51-
ENV['SE_IEDRIVER'] = '/foo/bar'
52-
service.executable_path = DriverFinder.new(Options.new, described_class.new).driver_path
53-
54-
expect(service.executable_path).to match(/iedriver/)
55-
end
56-
end
5740
end
5841
end # IE
5942
end # WebDriver

rb/spec/integration/selenium/webdriver/safari/service_spec.rb

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,23 +37,6 @@ module Safari
3737
it 'can be started outside driver' do
3838
expect(service_manager.uri).to be_a(URI)
3939
end
40-
41-
context 'with a path env variable' do
42-
before { ENV['SE_SAFARIDRIVER'] = DriverFinder.new(Options.new, described_class.new).driver_path }
43-
44-
after { ENV.delete('SE_SAFARIDRIVER') }
45-
46-
it 'uses the path from the environment' do
47-
expect(service.executable_path).to match(/safaridriver/)
48-
end
49-
50-
it 'updates the path after setting the environment variable' do
51-
ENV['SE_SAFARIDRIVER'] = '/foo/bar'
52-
service.executable_path = DriverFinder.new(Options.new, described_class.new).driver_path
53-
54-
expect(service.executable_path).to match(/safaridriver/)
55-
end
56-
end
5740
end
5841
end # Safari
5942
end # WebDriver

rb/spec/unit/selenium/webdriver/chrome/service_spec.rb

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,28 @@ module Chrome
119119
driver.new(service: service)
120120
expect(described_class).not_to have_received(:new)
121121
end
122+
123+
context 'with a path env variable' do
124+
let(:service) { described_class.new }
125+
let(:service_path) { "/path/to/#{Service::EXECUTABLE}" }
126+
127+
before do
128+
ENV['SE_CHROMEDRIVER'] = service_path
129+
end
130+
131+
after { ENV.delete('SE_CHROMEDRIVER') }
132+
133+
it 'uses the path from the environment' do
134+
expect(service.executable_path).to match(/chromedriver/)
135+
end
136+
137+
it 'updates the path after setting the environment variable' do
138+
ENV['SE_CHROMEDRIVER'] = '/foo/bar'
139+
service.executable_path = service_path
140+
141+
expect(service.executable_path).to match(/chromedriver/)
142+
end
143+
end
122144
end
123145
end
124146
end # Chrome

rb/spec/unit/selenium/webdriver/edge/service_spec.rb

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,28 @@ module Edge
129129
expect(service.log).to be_nil
130130
expect(service.args).to eq ['--log-path=/path/to/log.txt']
131131
end
132+
133+
context 'with a path env variable' do
134+
let(:service) { described_class.new }
135+
let(:service_path) { "/path/to/#{Service::EXECUTABLE}" }
136+
137+
before do
138+
ENV['SE_EDGEDRIVER'] = service_path
139+
end
140+
141+
after { ENV.delete('SE_EDGEDRIVER') }
142+
143+
it 'uses the path from the environment' do
144+
expect(service.executable_path).to match(/edgedriver/)
145+
end
146+
147+
it 'updates the path after setting the environment variable' do
148+
ENV['SE_EDGEDRIVER'] = '/foo/bar'
149+
service.executable_path = service_path
150+
151+
expect(service.executable_path).to match(/edgedriver/)
152+
end
153+
end
132154
end
133155
end
134156
end # Edge

rb/spec/unit/selenium/webdriver/firefox/service_spec.rb

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,28 @@ module Firefox
117117

118118
expect(described_class).not_to have_received(:new)
119119
end
120+
121+
context 'with a path env variable' do
122+
let(:service) { described_class.new }
123+
let(:service_path) { "/path/to/#{Service::EXECUTABLE}" }
124+
125+
before do
126+
ENV['SE_GECKODRIVER'] = service_path
127+
end
128+
129+
after { ENV.delete('SE_GECKODRIVER') }
130+
131+
it 'uses the path from the environment' do
132+
expect(service.executable_path).to match(/geckodriver/)
133+
end
134+
135+
it 'updates the path after setting the environment variable' do
136+
ENV['SE_GECKODRIVER'] = '/foo/bar'
137+
service.executable_path = service_path
138+
139+
expect(service.executable_path).to match(/geckodriver/)
140+
end
141+
end
120142
end
121143
end
122144
end # Firefox

rb/spec/unit/selenium/webdriver/ie/service_spec.rb

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,28 @@ module IE
119119

120120
expect(described_class).not_to have_received(:new)
121121
end
122+
123+
context 'with a path env variable' do
124+
let(:service) { described_class.new }
125+
let(:service_path) { "/path/to/#{Service::EXECUTABLE}" }
126+
127+
before do
128+
ENV['SE_IEDRIVER'] = service_path
129+
end
130+
131+
after { ENV.delete('SE_IEDRIVER') }
132+
133+
it 'uses the path from the environment' do
134+
expect(service.executable_path).to match(/IEDriver/)
135+
end
136+
137+
it 'updates the path after setting the environment variable' do
138+
ENV['SE_IEDRIVER'] = '/foo/bar'
139+
service.executable_path = service_path
140+
141+
expect(service.executable_path).to match(/IEDriver/)
142+
end
143+
end
122144
end
123145
end
124146
end # IE

rb/spec/unit/selenium/webdriver/safari/service_spec.rb

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,28 @@ module Safari
114114

115115
expect(described_class).not_to have_received(:new)
116116
end
117+
118+
context 'with a path env variable' do
119+
let(:service) { described_class.new }
120+
let(:service_path) { "/path/to/#{Service::EXECUTABLE}" }
121+
122+
before do
123+
ENV['SE_SAFARIDRIVER'] = service_path
124+
end
125+
126+
after { ENV.delete('SE_SAFARIDRIVER') }
127+
128+
it 'uses the path from the environment' do
129+
expect(service.executable_path).to match(/safaridriver/)
130+
end
131+
132+
it 'updates the path after setting the environment variable' do
133+
ENV['SE_SAFARIDRIVER'] = '/foo/bar'
134+
service.executable_path = service_path
135+
136+
expect(service.executable_path).to match(/safaridriver/)
137+
end
138+
end
117139
end
118140
end
119141
end # Safari

0 commit comments

Comments
 (0)