Skip to content

Commit 5560a56

Browse files
authored
fix: Make unit tests compatible with Selenium 4.33.0+ (#2293)
1 parent 3e5f9e2 commit 5560a56

File tree

1 file changed

+56
-3
lines changed

1 file changed

+56
-3
lines changed

src/test/java/io/appium/java_client/pagefactory_tests/widget/tests/AbstractStubWebDriver.java

Lines changed: 56 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import org.openqa.selenium.logging.Logs;
1212
import org.openqa.selenium.remote.Response;
1313

14+
import java.time.Duration;
1415
import java.util.HashSet;
1516
import java.util.List;
1617
import java.util.Map;
@@ -155,20 +156,72 @@ public Cookie getCookieNamed(String name) {
155156
@Override
156157
public Timeouts timeouts() {
157158
return new Timeouts() {
158-
@Override
159+
/**
160+
* Does nothing.
161+
*
162+
* @param time The amount of time to wait.
163+
* @param unit The unit of measure for {@code time}.
164+
* @return A self reference.
165+
* @deprecated Kept for the backward compatibility, should be removed when a minimum Selenium
166+
* version is bumped to 4.33.0 or higher.
167+
*/
168+
@Deprecated
159169
public Timeouts implicitlyWait(long time, TimeUnit unit) {
160170
return this;
161171
}
162172

163-
@Override
173+
public Timeouts implicitlyWait(Duration duration) {
174+
return this;
175+
}
176+
177+
/**
178+
* Does nothing.
179+
*
180+
* @param time The timeout value.
181+
* @param unit The unit of time.
182+
* @return A self reference.
183+
* @deprecated Kept for the backward compatibility, should be removed when Selenium client removes
184+
* this method from its interface.
185+
*/
186+
@Deprecated
164187
public Timeouts setScriptTimeout(long time, TimeUnit unit) {
165188
return this;
166189
}
167190

168-
@Override
191+
/**
192+
* Does nothing.
193+
*
194+
* @param duration The timeout value.
195+
* @return A self reference.
196+
* @deprecated Kept for the backward compatibility, should be removed when Selenium client removes
197+
* this method from its interface.
198+
*/
199+
@Deprecated
200+
public Timeouts setScriptTimeout(Duration duration) {
201+
return this;
202+
}
203+
204+
public Timeouts scriptTimeout(Duration duration) {
205+
return this;
206+
}
207+
208+
/**
209+
* Does nothing.
210+
*
211+
* @param time The timeout value.
212+
* @param unit The unit of time.
213+
* @return A self reference.
214+
* @deprecated Kept for the backward compatibility, should be removed when Selenium client removes
215+
* this method from its interface.
216+
*/
217+
@Deprecated
169218
public Timeouts pageLoadTimeout(long time, TimeUnit unit) {
170219
return this;
171220
}
221+
222+
public Timeouts pageLoadTimeout(Duration duration) {
223+
return this;
224+
}
172225
};
173226
}
174227

0 commit comments

Comments
 (0)