Skip to content

Commit 7239a9d

Browse files
WasiqBsaikrishna321
authored andcommitted
Upgraded Selenium version to alpha 2. (appium#1210)
* Upgraded Selenium version to alpha 2. * Updated for changes for Selenium alpha 2. * Updated for compilation errors.
1 parent f4cdaf7 commit 7239a9d

File tree

13 files changed

+35
-24
lines changed

13 files changed

+35
-24
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ signing.secretKeyRingFile=PathToYourKeyRingFile
77
ossrhUsername=your-jira-id
88
ossrhPassword=your-jira-password
99

10-
selenium.version=3.141.59
10+
selenium.version=4.0.0-alpha-2

src/main/java/io/appium/java_client/remote/AppiumCommandExecutor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@
4444
import org.openqa.selenium.remote.ProtocolHandshake;
4545
import org.openqa.selenium.remote.Response;
4646
import org.openqa.selenium.remote.ResponseCodec;
47+
import org.openqa.selenium.remote.codec.w3c.W3CHttpCommandCodec;
4748
import org.openqa.selenium.remote.http.HttpClient;
4849
import org.openqa.selenium.remote.http.HttpRequest;
4950
import org.openqa.selenium.remote.http.HttpResponse;
50-
import org.openqa.selenium.remote.http.W3CHttpCommandCodec;
5151
import org.openqa.selenium.remote.service.DriverService;
5252

5353
import java.io.BufferedInputStream;

src/main/java/io/appium/java_client/remote/AppiumW3CHttpCommandCodec.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
import org.openqa.selenium.interactions.KeyInput;
3434
import org.openqa.selenium.interactions.Sequence;
35-
import org.openqa.selenium.remote.http.W3CHttpCommandCodec;
35+
import org.openqa.selenium.remote.codec.w3c.W3CHttpCommandCodec;
3636

3737
import java.util.Collection;
3838
import java.util.Map;

src/test/java/io/appium/java_client/android/OpenNotificationsTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package io.appium.java_client.android;
22

3+
import static java.time.Duration.ofSeconds;
34
import static org.junit.Assert.assertNotEquals;
45
import static org.openqa.selenium.By.id;
56

@@ -14,7 +15,7 @@ public class OpenNotificationsTest extends BaseAndroidTest {
1415
public void openNotification() {
1516
driver.closeApp();
1617
driver.openNotifications();
17-
WebDriverWait wait = new WebDriverWait(driver, 20);
18+
WebDriverWait wait = new WebDriverWait(driver, ofSeconds(20));
1819
assertNotEquals(0, wait.until(input -> {
1920
List<AndroidElement> result = input
2021
.findElements(id("com.android.systemui:id/settings_button"));

src/test/java/io/appium/java_client/android/UIAutomator2Test.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package io.appium.java_client.android;
22

3+
import static java.time.Duration.ofSeconds;
34
import static org.junit.Assert.assertEquals;
45
import static org.junit.Assert.assertNotNull;
56

@@ -23,7 +24,7 @@ public void afterMethod() {
2324

2425
@Test
2526
public void testLandscapeRightRotation() {
26-
new WebDriverWait(driver, 20).until(ExpectedConditions
27+
new WebDriverWait(driver, ofSeconds(20)).until(ExpectedConditions
2728
.elementToBeClickable(driver.findElementById("android:id/content")
2829
.findElement(MobileBy.AccessibilityId("Graphics"))));
2930
DeviceRotation landscapeRightRotation = new DeviceRotation(0, 0, 90);
@@ -33,7 +34,7 @@ public void testLandscapeRightRotation() {
3334

3435
@Test
3536
public void testLandscapeLeftRotation() {
36-
new WebDriverWait(driver, 20).until(ExpectedConditions
37+
new WebDriverWait(driver, ofSeconds(20)).until(ExpectedConditions
3738
.elementToBeClickable(driver.findElementById("android:id/content")
3839
.findElement(MobileBy.AccessibilityId("Graphics"))));
3940
DeviceRotation landscapeLeftRotation = new DeviceRotation(0, 0, 270);
@@ -43,7 +44,7 @@ public void testLandscapeLeftRotation() {
4344

4445
@Test
4546
public void testPortraitUpsideDown() {
46-
new WebDriverWait(driver, 20).until(ExpectedConditions
47+
new WebDriverWait(driver, ofSeconds(20)).until(ExpectedConditions
4748
.elementToBeClickable(driver.findElementById("android:id/content")
4849
.findElement(MobileBy.AccessibilityId("Graphics"))));
4950
DeviceRotation landscapeRightRotation = new DeviceRotation(0, 0, 180);
@@ -56,7 +57,7 @@ public void testPortraitUpsideDown() {
5657
*/
5758
@Ignore
5859
public void testToastMSGIsDisplayed() {
59-
final WebDriverWait wait = new WebDriverWait(driver, 30);
60+
final WebDriverWait wait = new WebDriverWait(driver, ofSeconds(30));
6061
Activity activity = new Activity("io.appium.android.apis", ".view.PopupMenu1");
6162
driver.startActivity(activity);
6263

src/test/java/io/appium/java_client/appium/element/generation/ios/IOSElementGenerationTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package io.appium.java_client.appium.element.generation.ios;
22

33
import static io.appium.java_client.MobileBy.AccessibilityId;
4+
import static java.time.Duration.ofSeconds;
45
import static org.junit.Assert.assertTrue;
56
import static org.openqa.selenium.By.id;
67
import static org.openqa.selenium.By.name;
@@ -84,11 +85,11 @@ public void whenIOSHybridAppIsLaunched() {
8485
Capabilities caps = commonAppCapabilitiesSupplier.get();
8586
return caps.merge(appFileSupplierFunction.apply(webViewApp).get());
8687
}, (by, aClass) -> {
87-
new WebDriverWait(driver, 30)
88+
new WebDriverWait(driver, ofSeconds(30))
8889
.until(ExpectedConditions.presenceOfElementLocated(id("login")))
8990
.click();
9091
driver.findElementByAccessibilityId("webView").click();
91-
new WebDriverWait(driver, 30)
92+
new WebDriverWait(driver, ofSeconds(30))
9293
.until(ExpectedConditions
9394
.presenceOfElementLocated(AccessibilityId("Webview")));
9495
try {

src/test/java/io/appium/java_client/ios/IOSAlertTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package io.appium.java_client.ios;
1818

19+
import static java.time.Duration.ofSeconds;
1920
import static junit.framework.TestCase.assertFalse;
2021
import static org.junit.Assert.assertTrue;
2122
import static org.openqa.selenium.support.ui.ExpectedConditions.alertIsPresent;
@@ -32,7 +33,7 @@
3233
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
3334
public class IOSAlertTest extends AppIOSTest {
3435

35-
private WebDriverWait waiting = new WebDriverWait(driver, 10000);
36+
private WebDriverWait waiting = new WebDriverWait(driver, ofSeconds(10000));
3637
private static final String iOSAutomationText = "show alert";
3738

3839
@Test public void acceptAlertTest() {

src/test/java/io/appium/java_client/ios/IOSDriverTest.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package io.appium.java_client.ios;
1818

19+
import static java.time.Duration.ofSeconds;
1920
import static org.hamcrest.Matchers.empty;
2021
import static org.hamcrest.Matchers.equalTo;
2122
import static org.hamcrest.Matchers.greaterThan;
@@ -56,7 +57,7 @@ public void getDeviceTimeTest() {
5657
}
5758

5859
@Test public void hideKeyboardWithParametersTest() {
59-
new WebDriverWait(driver, 30)
60+
new WebDriverWait(driver, ofSeconds(30))
6061
.until(ExpectedConditions.presenceOfElementLocated(By.id("IntegerA")))
6162
.click();
6263
driver.hideKeyboard(HideKeyboardStrategy.PRESS_KEY, "Done");
@@ -102,7 +103,7 @@ public void getDeviceTimeTest() {
102103

103104
@Test public void putAppIntoBackgroundAndRestoreTest() {
104105
final long msStarted = System.currentTimeMillis();
105-
driver.runAppInBackground(Duration.ofSeconds(4));
106+
driver.runAppInBackground(ofSeconds(4));
106107
assertThat(System.currentTimeMillis() - msStarted, greaterThan(3000L));
107108
}
108109

@@ -119,7 +120,7 @@ public void getDeviceTimeTest() {
119120
}
120121
assertThat(driver.queryAppState(BUNDLE_ID), equalTo(ApplicationState.RUNNING_IN_FOREGROUND));
121122
Thread.sleep(500);
122-
driver.runAppInBackground(Duration.ofSeconds(-1));
123+
driver.runAppInBackground(ofSeconds(-1));
123124
assertThat(driver.queryAppState(BUNDLE_ID), lessThan(ApplicationState.RUNNING_IN_FOREGROUND));
124125
Thread.sleep(500);
125126
driver.activateApp(BUNDLE_ID);
@@ -128,7 +129,7 @@ public void getDeviceTimeTest() {
128129

129130
@Test public void putAIntoBackgroundWithoutRestoreTest() {
130131
assertThat(driver.findElementsById("IntegerA"), is(not(empty())));
131-
driver.runAppInBackground(Duration.ofSeconds(-1));
132+
driver.runAppInBackground(ofSeconds(-1));
132133
assertThat(driver.findElementsById("IntegerA"), is(empty()));
133134
driver.launchApp();
134135
}

src/test/java/io/appium/java_client/ios/IOSElementTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package io.appium.java_client.ios;
22

3+
import static java.time.Duration.ofSeconds;
34
import static org.hamcrest.core.Is.is;
45
import static org.hamcrest.core.IsNot.not;
56
import static org.junit.Assert.assertEquals;
@@ -25,7 +26,7 @@ public void findByAccessibilityIdTest() {
2526
@Ignore
2627
@Test
2728
public void setValueTest() {
28-
WebDriverWait wait = new WebDriverWait(driver, 20);
29+
WebDriverWait wait = new WebDriverWait(driver, ofSeconds(20));
2930

3031
IOSElement slider = wait.until(
3132
driver1 -> driver1.findElement(By.className("XCUIElementTypeSlider")));

src/test/java/io/appium/java_client/ios/IOSNativeWebTapSettingTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package io.appium.java_client.ios;
22

3+
import static java.time.Duration.ofSeconds;
34
import static org.junit.Assert.assertTrue;
45

56
import org.junit.Test;
@@ -16,17 +17,17 @@ public class IOSNativeWebTapSettingTest extends BaseSafariTest {
1617
driver.nativeWebTap(true);
1718
WebElement el = driver.findElementById("i am a link");
1819
el.click();
19-
assertTrue(new WebDriverWait(driver, 30)
20+
assertTrue(new WebDriverWait(driver, ofSeconds(30))
2021
.until(ExpectedConditions.titleIs("I am another page title - Sauce Labs")));
2122
driver.navigate().back();
2223

2324
// now do a click with it turned off and assert the same behavior
24-
assertTrue(new WebDriverWait(driver, 30)
25+
assertTrue(new WebDriverWait(driver, ofSeconds(30))
2526
.until(ExpectedConditions.titleIs("I am a page title - Sauce Labs")));
2627
driver.nativeWebTap(false);
2728
el = driver.findElementById("i am a link");
2829
el.click();
29-
assertTrue(new WebDriverWait(driver, 30)
30+
assertTrue(new WebDriverWait(driver, ofSeconds(30))
3031
.until(ExpectedConditions.titleIs("I am another page title - Sauce Labs")));
3132
}
3233
}

0 commit comments

Comments
 (0)