Skip to content

Commit 88fdb88

Browse files
committed
rb - update spec guards from legacy safari to apple safari
1 parent 6d52426 commit 88fdb88

File tree

7 files changed

+194
-163
lines changed

7 files changed

+194
-163
lines changed

rb/spec/integration/selenium/webdriver/element_spec.rb

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,14 @@ module WebDriver
6262
driver.find_element(id: 'working').send_keys('foo', 'bar')
6363
end
6464

65-
it 'should send key presses' do
66-
driver.navigate.to url_for('javascriptPage.html')
67-
key_reporter = driver.find_element(id: 'keyReporter')
65+
not_compliant_on browser: :safari do
66+
it 'should send key presses' do
67+
driver.navigate.to url_for('javascriptPage.html')
68+
key_reporter = driver.find_element(id: 'keyReporter')
6869

69-
key_reporter.send_keys('Tet', :arrow_left, 's')
70-
expect(key_reporter.attribute('value')).to eq('Test')
70+
key_reporter.send_keys('Tet', :arrow_left, 's')
71+
expect(key_reporter.attribute('value')).to eq('Test')
72+
end
7173
end
7274

7375
# PhantomJS on windows issue: https://github.com/ariya/phantomjs/issues/10993
@@ -130,9 +132,11 @@ module WebDriver
130132
expect(driver.find_element(class: 'header').text).to eq('XHTML Might Be The Future')
131133
end
132134

133-
it 'should get displayed' do
134-
driver.navigate.to url_for('xhtmlTest.html')
135-
expect(driver.find_element(class: 'header')).to be_displayed
135+
not_compliant_on browser: :safari do
136+
it 'should get displayed' do
137+
driver.navigate.to url_for('xhtmlTest.html')
138+
expect(driver.find_element(class: 'header')).to be_displayed
139+
end
136140
end
137141

138142
it 'should get location' do

rb/spec/integration/selenium/webdriver/navigation_spec.rb

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,31 +20,29 @@
2020
require_relative 'spec_helper'
2121

2222
describe 'Navigation' do
23-
not_compliant_on browser: :safari do
24-
it 'should navigate back and forward' do
25-
form_title = 'We Leave From Here'
26-
result_title = 'We Arrive Here'
27-
form_url = url_for 'formPage.html'
28-
result_url = url_for 'resultPage.html'
23+
it 'should navigate back and forward' do
24+
form_title = 'We Leave From Here'
25+
result_title = 'We Arrive Here'
26+
form_url = url_for 'formPage.html'
27+
result_url = url_for 'resultPage.html'
2928

30-
driver.navigate.to form_url
31-
expect(driver.title).to eq(form_title)
29+
driver.navigate.to form_url
30+
expect(driver.title).to eq(form_title)
3231

33-
driver.find_element(id: 'imageButton').click
34-
wait.until { driver.title != form_title }
32+
driver.find_element(id: 'imageButton').click
33+
wait.until { driver.title != form_title }
3534

36-
expect(driver.current_url).to include(result_url)
37-
expect(driver.title).to eq(result_title)
35+
expect(driver.current_url).to include(result_url)
36+
expect(driver.title).to eq(result_title)
3837

39-
driver.navigate.back
38+
driver.navigate.back
4039

41-
expect(driver.current_url).to include(form_url)
42-
expect(driver.title).to eq(form_title)
40+
expect(driver.current_url).to include(form_url)
41+
expect(driver.title).to eq(form_title)
4342

44-
driver.navigate.forward
45-
expect(driver.current_url).to include(result_url)
46-
expect(driver.title).to eq(result_title)
47-
end
43+
driver.navigate.forward
44+
expect(driver.current_url).to include(result_url)
45+
expect(driver.title).to eq(result_title)
4846
end
4947

5048
it 'should refresh the page' do

rb/spec/integration/selenium/webdriver/options_spec.rb

Lines changed: 68 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -21,97 +21,100 @@
2121

2222
module Selenium
2323
module WebDriver
24-
describe Options do
25-
not_compliant_on browser: [:firefox, :ie, :edge] do
26-
describe 'logs' do
27-
compliant_on driver: :remote do
28-
it 'can fetch remote log types' do
29-
expect(driver.manage.logs.available_types).to include(:server, :client)
24+
# Safari bug - no logs or cookies
25+
not_compliant_on browser: :safari do
26+
describe Options do
27+
not_compliant_on browser: [:firefox, :ie, :edge] do
28+
describe 'logs' do
29+
compliant_on driver: :remote do
30+
it 'can fetch remote log types' do
31+
expect(driver.manage.logs.available_types).to include(:server, :client)
32+
end
3033
end
31-
end
3234

33-
# Phantomjs Returns har instead of driver
34-
not_compliant_on browser: :phantomjs do
35-
it 'can fetch available log types' do
36-
expect(driver.manage.logs.available_types).to include(:browser, :driver)
35+
# Phantomjs Returns har instead of driver
36+
not_compliant_on browser: :phantomjs do
37+
it 'can fetch available log types' do
38+
expect(driver.manage.logs.available_types).to include(:browser, :driver)
39+
end
3740
end
38-
end
3941

40-
# All other browsers show empty
41-
compliant_on browser: [:firefox, :ff_legacy] do
42-
it 'can get the browser log' do
43-
driver.navigate.to url_for('simpleTest.html')
42+
# All other browsers show empty
43+
compliant_on browser: [:firefox, :ff_legacy] do
44+
it 'can get the browser log' do
45+
driver.navigate.to url_for('simpleTest.html')
4446

45-
entries = driver.manage.logs.get(:browser)
46-
expect(entries).not_to be_empty
47-
expect(entries.first).to be_kind_of(LogEntry)
47+
entries = driver.manage.logs.get(:browser)
48+
expect(entries).not_to be_empty
49+
expect(entries.first).to be_kind_of(LogEntry)
50+
end
4851
end
49-
end
5052

51-
# Phantomjs Returns har instead of driver
52-
not_compliant_on browser: :phantomjs do
53-
it 'can get the driver log' do
54-
driver.navigate.to url_for('simpleTest.html')
53+
# Phantomjs Returns har instead of driver
54+
not_compliant_on browser: :phantomjs do
55+
it 'can get the driver log' do
56+
driver.navigate.to url_for('simpleTest.html')
5557

56-
entries = driver.manage.logs.get(:driver)
57-
expect(entries).not_to be_empty
58-
expect(entries.first).to be_kind_of(LogEntry)
58+
entries = driver.manage.logs.get(:driver)
59+
expect(entries).not_to be_empty
60+
expect(entries.first).to be_kind_of(LogEntry)
61+
end
5962
end
6063
end
6164
end
62-
end
6365

64-
not_compliant_on browser: :phantomjs do
65-
describe 'cookie management' do
66-
it 'should get all' do
67-
driver.navigate.to url_for('xhtmlTest.html')
68-
driver.manage.add_cookie name: 'foo', value: 'bar'
66+
not_compliant_on browser: :phantomjs do
67+
describe 'cookie management' do
68+
it 'should get all' do
69+
driver.navigate.to url_for('xhtmlTest.html')
70+
driver.manage.add_cookie name: 'foo', value: 'bar'
6971

70-
cookies = driver.manage.all_cookies
72+
cookies = driver.manage.all_cookies
7173

72-
expect(cookies.size).to eq(1)
73-
expect(cookies.first[:name]).to eq('foo')
74-
expect(cookies.first[:value]).to eq('bar')
75-
end
74+
expect(cookies.size).to eq(1)
75+
expect(cookies.first[:name]).to eq('foo')
76+
expect(cookies.first[:value]).to eq('bar')
77+
end
7678

77-
# Edge BUG - https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/5751773/
78-
not_compliant_on browser: :edge do
79-
it 'should delete one' do
80-
driver.navigate.to url_for('xhtmlTest.html')
81-
driver.manage.add_cookie name: 'foo', value: 'bar'
79+
# Edge BUG - https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/5751773/
80+
not_compliant_on browser: :edge do
81+
it 'should delete one' do
82+
driver.navigate.to url_for('xhtmlTest.html')
83+
driver.manage.add_cookie name: 'foo', value: 'bar'
8284

83-
driver.manage.delete_cookie('foo')
85+
driver.manage.delete_cookie('foo')
86+
end
8487
end
85-
end
8688

87-
# Edge BUG - https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/5751773/
88-
not_compliant_on browser: :edge do
89-
it 'should delete all' do
90-
driver.navigate.to url_for('xhtmlTest.html')
89+
# Edge BUG - https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/5751773/
90+
not_compliant_on browser: :edge do
91+
it 'should delete all' do
92+
driver.navigate.to url_for('xhtmlTest.html')
9193

92-
driver.manage.add_cookie name: 'foo', value: 'bar'
93-
driver.manage.delete_all_cookies
94-
expect(driver.manage.all_cookies).to be_empty
94+
driver.manage.add_cookie name: 'foo', value: 'bar'
95+
driver.manage.delete_all_cookies
96+
expect(driver.manage.all_cookies).to be_empty
97+
end
9598
end
96-
end
9799

98-
# Firefox - https://bugzilla.mozilla.org/show_bug.cgi?id=1256007
99-
not_compliant_on browser: [:safari, :firefox] do
100-
it 'should use DateTime for expires' do
101-
driver.navigate.to url_for('xhtmlTest.html')
100+
# Firefox - https://bugzilla.mozilla.org/show_bug.cgi?id=1256007
101+
not_compliant_on browser: :firefox do
102+
it 'should use DateTime for expires' do
103+
driver.navigate.to url_for('xhtmlTest.html')
102104

103-
expected = DateTime.new(2039)
104-
driver.manage.add_cookie name: 'foo',
105-
value: 'bar',
106-
expires: expected
105+
expected = DateTime.new(2039)
106+
driver.manage.add_cookie name: 'foo',
107+
value: 'bar',
108+
expires: expected
107109

108-
actual = driver.manage.cookie_named('foo')[:expires]
109-
expect(actual).to be_kind_of(DateTime)
110-
expect(actual).to eq(expected)
110+
actual = driver.manage.cookie_named('foo')[:expires]
111+
expect(actual).to be_kind_of(DateTime)
112+
expect(actual).to eq(expected)
113+
end
111114
end
112115
end
113116
end
114-
end
117+
end # Options
115118
end
116119
end # WebDriver
117120
end # Selenium

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ module Selenium
2323
module WebDriver
2424
module Safari
2525
compliant_on browser: :safari do
26-
describe Driver do
27-
it_behaves_like 'driver that can be started concurrently', :safari
26+
not_compliant_on browser: :safari do
27+
describe Driver do
28+
it_behaves_like 'driver that can be started concurrently', :safari
29+
end
2830
end
2931
end
3032
end # Safari

0 commit comments

Comments
 (0)