Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ signing.secretKeyRingFile=PathToYourKeyRingFile
ossrhUsername=your-jira-id
ossrhPassword=your-jira-password

selenium.version=3.141.59
selenium.version=4.0.0-alpha-2
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@
import org.openqa.selenium.remote.ProtocolHandshake;
import org.openqa.selenium.remote.Response;
import org.openqa.selenium.remote.ResponseCodec;
import org.openqa.selenium.remote.codec.w3c.W3CHttpCommandCodec;
import org.openqa.selenium.remote.http.HttpClient;
import org.openqa.selenium.remote.http.HttpRequest;
import org.openqa.selenium.remote.http.HttpResponse;
import org.openqa.selenium.remote.http.W3CHttpCommandCodec;
import org.openqa.selenium.remote.service.DriverService;

import java.io.BufferedInputStream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

import org.openqa.selenium.interactions.KeyInput;
import org.openqa.selenium.interactions.Sequence;
import org.openqa.selenium.remote.http.W3CHttpCommandCodec;
import org.openqa.selenium.remote.codec.w3c.W3CHttpCommandCodec;

import java.util.Collection;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.appium.java_client.android;

import static java.time.Duration.ofSeconds;
import static org.junit.Assert.assertNotEquals;
import static org.openqa.selenium.By.id;

Expand All @@ -14,7 +15,7 @@ public class OpenNotificationsTest extends BaseAndroidTest {
public void openNotification() {
driver.closeApp();
driver.openNotifications();
WebDriverWait wait = new WebDriverWait(driver, 20);
WebDriverWait wait = new WebDriverWait(driver, ofSeconds(20));
assertNotEquals(0, wait.until(input -> {
List<AndroidElement> result = input
.findElements(id("com.android.systemui:id/settings_button"));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.appium.java_client.android;

import static java.time.Duration.ofSeconds;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;

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

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

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

@Test
public void testPortraitUpsideDown() {
new WebDriverWait(driver, 20).until(ExpectedConditions
new WebDriverWait(driver, ofSeconds(20)).until(ExpectedConditions
.elementToBeClickable(driver.findElementById("android:id/content")
.findElement(MobileBy.AccessibilityId("Graphics"))));
DeviceRotation landscapeRightRotation = new DeviceRotation(0, 0, 180);
Expand All @@ -56,7 +57,7 @@ public void testPortraitUpsideDown() {
*/
@Ignore
public void testToastMSGIsDisplayed() {
final WebDriverWait wait = new WebDriverWait(driver, 30);
final WebDriverWait wait = new WebDriverWait(driver, ofSeconds(30));
Activity activity = new Activity("io.appium.android.apis", ".view.PopupMenu1");
driver.startActivity(activity);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.appium.java_client.appium.element.generation.ios;

import static io.appium.java_client.MobileBy.AccessibilityId;
import static java.time.Duration.ofSeconds;
import static org.junit.Assert.assertTrue;
import static org.openqa.selenium.By.id;
import static org.openqa.selenium.By.name;
Expand Down Expand Up @@ -84,11 +85,11 @@ public void whenIOSHybridAppIsLaunched() {
Capabilities caps = commonAppCapabilitiesSupplier.get();
return caps.merge(appFileSupplierFunction.apply(webViewApp).get());
}, (by, aClass) -> {
new WebDriverWait(driver, 30)
new WebDriverWait(driver, ofSeconds(30))
.until(ExpectedConditions.presenceOfElementLocated(id("login")))
.click();
driver.findElementByAccessibilityId("webView").click();
new WebDriverWait(driver, 30)
new WebDriverWait(driver, ofSeconds(30))
.until(ExpectedConditions
.presenceOfElementLocated(AccessibilityId("Webview")));
try {
Expand Down
3 changes: 2 additions & 1 deletion src/test/java/io/appium/java_client/ios/IOSAlertTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package io.appium.java_client.ios;

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

private WebDriverWait waiting = new WebDriverWait(driver, 10000);
private WebDriverWait waiting = new WebDriverWait(driver, ofSeconds(10000));
private static final String iOSAutomationText = "show alert";

@Test public void acceptAlertTest() {
Expand Down
9 changes: 5 additions & 4 deletions src/test/java/io/appium/java_client/ios/IOSDriverTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package io.appium.java_client.ios;

import static java.time.Duration.ofSeconds;
import static org.hamcrest.Matchers.empty;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.greaterThan;
Expand Down Expand Up @@ -56,7 +57,7 @@ public void getDeviceTimeTest() {
}

@Test public void hideKeyboardWithParametersTest() {
new WebDriverWait(driver, 30)
new WebDriverWait(driver, ofSeconds(30))
.until(ExpectedConditions.presenceOfElementLocated(By.id("IntegerA")))
.click();
driver.hideKeyboard(HideKeyboardStrategy.PRESS_KEY, "Done");
Expand Down Expand Up @@ -102,7 +103,7 @@ public void getDeviceTimeTest() {

@Test public void putAppIntoBackgroundAndRestoreTest() {
final long msStarted = System.currentTimeMillis();
driver.runAppInBackground(Duration.ofSeconds(4));
driver.runAppInBackground(ofSeconds(4));
assertThat(System.currentTimeMillis() - msStarted, greaterThan(3000L));
}

Expand All @@ -119,7 +120,7 @@ public void getDeviceTimeTest() {
}
assertThat(driver.queryAppState(BUNDLE_ID), equalTo(ApplicationState.RUNNING_IN_FOREGROUND));
Thread.sleep(500);
driver.runAppInBackground(Duration.ofSeconds(-1));
driver.runAppInBackground(ofSeconds(-1));
assertThat(driver.queryAppState(BUNDLE_ID), lessThan(ApplicationState.RUNNING_IN_FOREGROUND));
Thread.sleep(500);
driver.activateApp(BUNDLE_ID);
Expand All @@ -128,7 +129,7 @@ public void getDeviceTimeTest() {

@Test public void putAIntoBackgroundWithoutRestoreTest() {
assertThat(driver.findElementsById("IntegerA"), is(not(empty())));
driver.runAppInBackground(Duration.ofSeconds(-1));
driver.runAppInBackground(ofSeconds(-1));
assertThat(driver.findElementsById("IntegerA"), is(empty()));
driver.launchApp();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.appium.java_client.ios;

import static java.time.Duration.ofSeconds;
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsNot.not;
import static org.junit.Assert.assertEquals;
Expand All @@ -25,7 +26,7 @@ public void findByAccessibilityIdTest() {
@Ignore
@Test
public void setValueTest() {
WebDriverWait wait = new WebDriverWait(driver, 20);
WebDriverWait wait = new WebDriverWait(driver, ofSeconds(20));

IOSElement slider = wait.until(
driver1 -> driver1.findElement(By.className("XCUIElementTypeSlider")));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.appium.java_client.ios;

import static java.time.Duration.ofSeconds;
import static org.junit.Assert.assertTrue;

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

// now do a click with it turned off and assert the same behavior
assertTrue(new WebDriverWait(driver, 30)
assertTrue(new WebDriverWait(driver, ofSeconds(30))
.until(ExpectedConditions.titleIs("I am a page title - Sauce Labs")));
driver.nativeWebTap(false);
el = driver.findElementById("i am a link");
el.click();
assertTrue(new WebDriverWait(driver, 30)
assertTrue(new WebDriverWait(driver, ofSeconds(30))
.until(ExpectedConditions.titleIs("I am another page title - Sauce Labs")));
}
}
4 changes: 2 additions & 2 deletions src/test/java/io/appium/java_client/ios/IOSTouchTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void touchWithPressureTest() {
}

@Test public void swipeTest() {
WebDriverWait webDriverWait = new WebDriverWait(driver, 30);
WebDriverWait webDriverWait = new WebDriverWait(driver, ofSeconds(30));
IOSElement slider = webDriverWait.until(driver1 -> driver.findElementByClassName("XCUIElementTypeSlider"));
Dimension size = slider.getSize();

Expand All @@ -82,7 +82,7 @@ public void touchWithPressureTest() {

new MultiTouchAction(driver).add(tap1).add(tap2).perform();

WebDriverWait waiting = new WebDriverWait(driver, 10000);
WebDriverWait waiting = new WebDriverWait(driver, ofSeconds(10000));
assertNotNull(waiting.until(alertIsPresent()));
driver.switchTo().alert().accept();
}
Expand Down
7 changes: 5 additions & 2 deletions src/test/java/io/appium/java_client/ios/IOSWebViewTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.appium.java_client.ios;

import static java.time.Duration.ofSeconds;
import static org.junit.Assert.assertTrue;

import io.appium.java_client.MobileBy;
Expand All @@ -9,14 +10,16 @@
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;

import java.time.Duration;

public class IOSWebViewTest extends BaseIOSWebViewTest {

@Test public void webViewPageTestCase() throws InterruptedException {
new WebDriverWait(driver, 30)
new WebDriverWait(driver, ofSeconds(30))
.until(ExpectedConditions.presenceOfElementLocated(By.id("login")))
.click();
driver.findElementByAccessibilityId("webView").click();
new WebDriverWait(driver, 30)
new WebDriverWait(driver, ofSeconds(30))
.until(ExpectedConditions.presenceOfElementLocated(MobileBy.AccessibilityId("Webview")));
findAndSwitchToWebView();
WebElement el = driver.findElementByPartialLinkText("login");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import static io.appium.java_client.pagefactory.LocatorGroupStrategy.ALL_POSSIBLE;
import static io.appium.java_client.pagefactory.LocatorGroupStrategy.CHAIN;
import static java.time.Duration.ofSeconds;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.greaterThan;
Expand Down Expand Up @@ -47,7 +48,7 @@
public class XCUITModeTest extends AppIOSTest {

private boolean populated = false;
private WebDriverWait waiting = new WebDriverWait(driver, 10000);
private WebDriverWait waiting = new WebDriverWait(driver, ofSeconds(10000));

@HowToUseLocators(iOSXCUITAutomation = ALL_POSSIBLE)
@iOSXCUITFindBy(iOSNsPredicate = "label contains 'Compute'")
Expand Down