Commit ee7c582 1 parent 9034099 commit ee7c582 Copy full SHA for ee7c582
File tree 5 files changed +18
-50
lines changed
lib/selenium/webdriver/common
integration/selenium/webdriver
unit/selenium/webdriver/common
5 files changed +18
-50
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ def text
44
44
end
45
45
46
46
def authenticate ( username , password )
47
+ WebDriver . logger . deprecate 'Alert#authenticate'
47
48
@bridge . authentication ( username : username , password : password )
48
49
accept
49
50
end
Original file line number Diff line number Diff line change @@ -101,13 +101,20 @@ def io
101
101
end
102
102
103
103
#
104
- # Marks code as deprecated with replacement.
104
+ # Marks code as deprecated with/without replacement.
105
105
#
106
106
# @param [String] old
107
- # @param [String] new
107
+ # @param [String, nil ] new
108
108
#
109
- def deprecate ( old , new )
110
- warn "[DEPRECATION] #{ old } is deprecated. Use #{ new } instead."
109
+ def deprecate ( old , new = nil )
110
+ message = "[DEPRECATION] #{ old } is deprecated"
111
+ message << if new
112
+ ". Use #{ new } instead."
113
+ else
114
+ ' and will be removed in the next releases.'
115
+ end
116
+
117
+ warn message
111
118
end
112
119
113
120
private
Original file line number Diff line number Diff line change @@ -123,29 +123,10 @@ def call(env)
123
123
body = req [ 'upload' ] [ :tempfile ] . read
124
124
125
125
[ 200 , { 'Content-Type' => 'text/html' } , [ body ] ]
126
- when '/basicAuth'
127
- if authorized? ( env )
128
- status = 200
129
- header = { 'Content-Type' => 'text/html' }
130
- body = '<h1>authorized</h1>'
131
- else
132
- status = 401
133
- header = { 'WWW-Authenticate' => 'Basic realm="basic-auth-test"' }
134
- body = 'Login please'
135
- end
136
-
137
- [ status , header , [ body ] ]
138
126
else
139
127
@static . call env
140
128
end
141
129
end
142
-
143
- private
144
-
145
- def authorized? ( env )
146
- auth = Rack ::Auth ::Basic ::Request . new ( env )
147
- auth . provided? && auth . basic? && auth . credentials && auth . credentials == BASIC_AUTH_CREDENTIALS
148
- end
149
130
end
150
131
end # RackServer
151
132
end # SpecSupport
Original file line number Diff line number Diff line change @@ -348,32 +348,6 @@ module WebDriver
348
348
end
349
349
end
350
350
end
351
-
352
- compliant_on browser : :ie do
353
- # Windows 10 changed the auth alert
354
- not_compliant_on browser : :ie do
355
- describe 'basic auth alerts' do
356
- after { reset_driver! }
357
-
358
- it 'allows the user to send valid credentials to an alert' do
359
- driver . navigate . to url_for ( 'basicAuth' )
360
- driver . switch_to . alert . authenticate ( 'test' , 'test' )
361
-
362
- expect ( driver . find_element ( tag_name : 'h1' ) . text ) . to eq ( 'authorized' )
363
- end
364
-
365
- it 'does not raise an error when invalid credentials are used' do
366
- driver . navigate . to url_for ( 'basicAuth' )
367
- driver . switch_to . alert . authenticate ( 'invalid' , 'invalid' )
368
-
369
- wait = Selenium ::WebDriver ::Wait . new ( timeout : 5 , ignore : Selenium ::WebDriver ::Error ::NoSuchAlertError )
370
- wait . until { driver . switch_to . alert }
371
-
372
- expect { driver . switch_to . alert . dismiss } . to_not raise_error
373
- end
374
- end
375
- end
376
- end
377
351
end
378
352
end # WebDriver
379
353
end # Selenium
Original file line number Diff line number Diff line change @@ -58,10 +58,15 @@ module WebDriver
58
58
end
59
59
end
60
60
61
- it 'allows to deprecate functionality' do
61
+ it 'allows to deprecate functionality with replacement ' do
62
62
message = /WARN Selenium \[ DEPRECATION\] #old is deprecated\. Use #new instead\. /
63
63
expect { WebDriver . logger . deprecate ( '#old' , '#new' ) } . to output ( message ) . to_stdout
64
64
end
65
+
66
+ it 'allows to deprecate functionality without replacement' do
67
+ message = /WARN Selenium \[ DEPRECATION\] #old is deprecated and will be removed in the next releases\. /
68
+ expect { WebDriver . logger . deprecate ( '#old' ) } . to output ( message ) . to_stdout
69
+ end
65
70
end
66
71
end # WebDriver
67
72
end # Selenium
You can’t perform that action at this time.
0 commit comments