diff --git a/src/e2eIosTest/java/io/appium/java_client/ios/AppIOSTest.java b/src/e2eIosTest/java/io/appium/java_client/ios/AppIOSTest.java index 316b05d08..58461127b 100644 --- a/src/e2eIosTest/java/io/appium/java_client/ios/AppIOSTest.java +++ b/src/e2eIosTest/java/io/appium/java_client/ios/AppIOSTest.java @@ -1,26 +1,54 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * See the NOTICE file distributed with this work for additional + * information regarding copyright ownership. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.appium.java_client.ios; import io.appium.java_client.ios.options.XCUITestOptions; -import io.appium.java_client.utils.TestUtils; import org.junit.jupiter.api.BeforeAll; +import org.openqa.selenium.By; import org.openqa.selenium.SessionNotCreatedException; +import java.net.MalformedURLException; +import java.net.URL; import java.time.Duration; -public class AppIOSTest extends BaseIOSTest { - protected static final String BUNDLE_ID = "io.appium.TestApp"; +import static io.appium.java_client.AppiumBy.accessibilityId; +import static io.appium.java_client.AppiumBy.iOSClassChain; +import static io.appium.java_client.AppiumBy.iOSNsPredicateString; +import static io.appium.java_client.utils.TestUtils.IOS_SIM_VODQA_RELEASE_URL; - private static final String TEST_APP_ZIP = TestUtils.resourcePathToAbsolutePath("TestApp.app.zip").toString(); +public class AppIOSTest extends BaseIOSTest { + protected static final String BUNDLE_ID = "org.reactjs.native.example.VodQAReactNative"; + protected static final By LOGIN_LINK_ID = accessibilityId("login"); + protected static final By USERNAME_EDIT_PREDICATE = iOSNsPredicateString("name == \"username\""); + protected static final By PASSWORD_EDIT_PREDICATE = iOSNsPredicateString("name == \"password\""); + protected static final By SLIDER_MENU_ITEM_PREDICATE = iOSNsPredicateString("name == \"slider1\""); + protected static final By VODQA_LOGO_CLASS_CHAIN = iOSClassChain( + "**/XCUIElementTypeImage[`name CONTAINS \"vodqa\"`]" + ); @BeforeAll - public static void beforeClass() { + public static void beforeClass() throws MalformedURLException { startAppiumServer(); XCUITestOptions options = new XCUITestOptions() .setPlatformVersion(PLATFORM_VERSION) .setDeviceName(DEVICE_NAME) .setCommandTimeouts(Duration.ofSeconds(240)) - .setApp(TEST_APP_ZIP) + .setApp(new URL(IOS_SIM_VODQA_RELEASE_URL)) .enableBiDi() .setWdaLaunchTimeout(WDA_LAUNCH_TIMEOUT); if (PREBUILT_WDA_PATH != null) { diff --git a/src/e2eIosTest/java/io/appium/java_client/ios/BaseIOSTest.java b/src/e2eIosTest/java/io/appium/java_client/ios/BaseIOSTest.java index 8fa488750..baee302da 100644 --- a/src/e2eIosTest/java/io/appium/java_client/ios/BaseIOSTest.java +++ b/src/e2eIosTest/java/io/appium/java_client/ios/BaseIOSTest.java @@ -22,6 +22,7 @@ import org.junit.jupiter.api.AfterAll; import java.time.Duration; +import java.util.Optional; @SuppressWarnings("checkstyle:HideUtilityClassConstructor") public class BaseIOSTest { @@ -29,12 +30,10 @@ public class BaseIOSTest { protected static AppiumDriverLocalService service; protected static IOSDriver driver; protected static final int PORT = 4723; - public static final String DEVICE_NAME = System.getenv("IOS_DEVICE_NAME") != null - ? System.getenv("IOS_DEVICE_NAME") - : "iPhone 12"; - public static final String PLATFORM_VERSION = System.getenv("IOS_PLATFORM_VERSION") != null - ? System.getenv("IOS_PLATFORM_VERSION") - : "14.5"; + public static final String DEVICE_NAME = Optional.ofNullable(System.getenv("IOS_DEVICE_NAME")) + .orElse("iPhone 17"); + public static final String PLATFORM_VERSION = Optional.ofNullable(System.getenv("IOS_PLATFORM_VERSION")) + .orElse("26.0"); public static final Duration WDA_LAUNCH_TIMEOUT = Duration.ofMinutes(4); public static final Duration SERVER_START_TIMEOUT = Duration.ofMinutes(3); protected static String PREBUILT_WDA_PATH = System.getenv("PREBUILT_WDA_PATH"); diff --git a/src/e2eIosTest/java/io/appium/java_client/ios/ClipboardTest.java b/src/e2eIosTest/java/io/appium/java_client/ios/ClipboardTest.java index b8ed26a44..b3a58e588 100644 --- a/src/e2eIosTest/java/io/appium/java_client/ios/ClipboardTest.java +++ b/src/e2eIosTest/java/io/appium/java_client/ios/ClipboardTest.java @@ -25,6 +25,6 @@ public class ClipboardTest extends AppIOSTest { @Test public void verifySetAndGetClipboardText() { final String text = "Happy testing"; driver.setClipboardText(text); - assertEquals(driver.getClipboardText(), text); + assertEquals(text, driver.getClipboardText()); } } diff --git a/src/e2eIosTest/java/io/appium/java_client/ios/IOSAlertTest.java b/src/e2eIosTest/java/io/appium/java_client/ios/IOSAlertTest.java index 7d91e596a..eea8899b5 100644 --- a/src/e2eIosTest/java/io/appium/java_client/ios/IOSAlertTest.java +++ b/src/e2eIosTest/java/io/appium/java_client/ios/IOSAlertTest.java @@ -16,7 +16,6 @@ package io.appium.java_client.ios; -import io.appium.java_client.AppiumBy; import org.apache.commons.lang3.StringUtils; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.MethodOrderer; @@ -35,34 +34,10 @@ @TestMethodOrder(MethodOrderer.MethodName.class) public class IOSAlertTest extends AppIOSTest { - private static final Duration ALERT_TIMEOUT = Duration.ofSeconds(5); private static final int CLICK_RETRIES = 2; - private static final String IOS_AUTOMATION_TEXT = "show alert"; - private final WebDriverWait waiter = new WebDriverWait(driver, ALERT_TIMEOUT); - private void ensureAlertPresence() { - int retry = 0; - // CI might not be performant enough, so we need to retry - while (true) { - try { - driver.findElement(AppiumBy.accessibilityId(IOS_AUTOMATION_TEXT)).click(); - } catch (WebDriverException e) { - // ignore - } - try { - waiter.until(alertIsPresent()); - return; - } catch (TimeoutException e) { - retry++; - if (retry >= CLICK_RETRIES) { - throw e; - } - } - } - } - @AfterEach public void afterEach() { try { @@ -97,4 +72,26 @@ public void getAlertTextTest() { ensureAlertPresence(); assertFalse(StringUtils.isBlank(driver.switchTo().alert().getText())); } + + private void ensureAlertPresence() { + int retry = 0; + // CI might not be performant enough, so we need to retry + while (true) { + try { + driver.findElement(PASSWORD_EDIT_PREDICATE).sendKeys("foo"); + driver.findElement(LOGIN_LINK_ID).click(); + } catch (WebDriverException e) { + // ignore + } + try { + waiter.until(alertIsPresent()); + return; + } catch (TimeoutException e) { + retry++; + if (retry >= CLICK_RETRIES) { + throw e; + } + } + } + } } diff --git a/src/e2eIosTest/java/io/appium/java_client/ios/IOSAppStringsTest.java b/src/e2eIosTest/java/io/appium/java_client/ios/IOSAppStringsTest.java deleted file mode 100644 index dc552dc91..000000000 --- a/src/e2eIosTest/java/io/appium/java_client/ios/IOSAppStringsTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * See the NOTICE file distributed with this work for additional - * information regarding copyright ownership. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.appium.java_client.ios; - -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertNotEquals; - -public class IOSAppStringsTest extends AppIOSTest { - - @Test public void getAppStrings() { - assertNotEquals(0, driver.getAppStringMap().size()); - } - - @Test public void getGetAppStringsUsingLang() { - assertNotEquals(0, driver.getAppStringMap("en").size()); - } - - @Test public void getAppStringsUsingLangAndFileStrings() { - assertNotEquals(0, driver.getAppStringMap("en", "Localizable.strings").size()); - } -} diff --git a/src/e2eIosTest/java/io/appium/java_client/ios/IOSDriverTest.java b/src/e2eIosTest/java/io/appium/java_client/ios/IOSDriverTest.java index aa0a66f2a..097e852f9 100644 --- a/src/e2eIosTest/java/io/appium/java_client/ios/IOSDriverTest.java +++ b/src/e2eIosTest/java/io/appium/java_client/ios/IOSDriverTest.java @@ -21,9 +21,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; -import org.openqa.selenium.By; import org.openqa.selenium.ScreenOrientation; -import org.openqa.selenium.WebElement; import org.openqa.selenium.remote.RemoteWebElement; import org.openqa.selenium.remote.Response; import org.openqa.selenium.remote.http.HttpMethod; @@ -65,13 +63,12 @@ public void addCustomCommandWithSessionIdTest() { @Test public void addCustomCommandWithElementIdTest() { - WebElement intA = driver.findElement(By.id("IntegerA")); - intA.clear(); + var usernameEdit = driver.findElement(USERNAME_EDIT_PREDICATE); driver.addCommand(HttpMethod.POST, String.format("/session/%s/appium/element/%s/value", driver.getSessionId(), - ((RemoteWebElement) intA).getId()), "setNewValue"); + ((RemoteWebElement) usernameEdit).getId()), "setNewValue"); final Response setNewValue = driver.execute("setNewValue", - Map.of("id", ((RemoteWebElement) intA).getId(), "text", "8")); + Map.of("id", ((RemoteWebElement) usernameEdit).getId(), "text", "foo")); assertNotNull(setNewValue.getSessionId()); } @@ -114,17 +111,15 @@ public void getDeviceTimeTest() { } @Test public void pullFileTest() { - byte[] data = driver.pullFile(String.format("@%s/TestApp", BUNDLE_ID)); + byte[] data = driver.pullFile(String.format("@%s/VodQAReactNative", BUNDLE_ID)); assertThat(data.length, greaterThan(0)); } @Test public void keyboardTest() { - WebElement element = driver.findElement(By.id("IntegerA")); - element.click(); + driver.findElement(USERNAME_EDIT_PREDICATE).click(); assertTrue(driver.isKeyboardShown()); } - @Disabled("The app crashes when restored from the background") @Test public void putAppIntoBackgroundAndRestoreTest() { final long msStarted = System.currentTimeMillis(); @@ -132,7 +127,6 @@ public void putAppIntoBackgroundAndRestoreTest() { assertThat(System.currentTimeMillis() - msStarted, greaterThan(3000L)); } - @Disabled("The app crashes when restored from the background") @Test public void applicationsManagementTest() { driver.runAppInBackground(Duration.ofSeconds(-1)); @@ -144,24 +138,4 @@ public void applicationsManagementTest() { () -> driver.queryAppState(BUNDLE_ID) == ApplicationState.RUNNING_IN_FOREGROUND, Duration.ofSeconds(10), Duration.ofSeconds(1)); } - - @Disabled("The app crashes when restored from the background") - @Test - public void putAIntoBackgroundWithoutRestoreTest() { - waitUntilTrue(() -> !driver.findElements(By.id("IntegerA")).isEmpty(), - Duration.ofSeconds(10), Duration.ofSeconds(1)); - driver.runAppInBackground(Duration.ofSeconds(-1)); - waitUntilTrue(() -> driver.findElements(By.id("IntegerA")).isEmpty(), - Duration.ofSeconds(10), Duration.ofSeconds(1)); - driver.activateApp(BUNDLE_ID); - } - - @Disabled - @Test public void touchIdTest() { - driver.toggleTouchIDEnrollment(true); - driver.performTouchID(true); - driver.performTouchID(false); - //noinspection SimplifiableAssertion,EqualsWithItself - assertEquals(true, true); - } } diff --git a/src/e2eIosTest/java/io/appium/java_client/ios/IOSElementTest.java b/src/e2eIosTest/java/io/appium/java_client/ios/IOSElementTest.java index 5d3d943a5..873155e6a 100644 --- a/src/e2eIosTest/java/io/appium/java_client/ios/IOSElementTest.java +++ b/src/e2eIosTest/java/io/appium/java_client/ios/IOSElementTest.java @@ -1,37 +1,38 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * See the NOTICE file distributed with this work for additional + * information regarding copyright ownership. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.appium.java_client.ios; -import io.appium.java_client.AppiumBy; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.MethodOrderer; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.TestMethodOrder; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.support.ui.WebDriverWait; - -import java.time.Duration; +import org.openqa.selenium.By; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; -import static org.hamcrest.core.IsNot.not; -import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.openqa.selenium.By.className; -@TestMethodOrder(MethodOrderer.MethodName.class) public class IOSElementTest extends AppIOSTest { + private static final By SLIDER_CLASS = className("XCUIElementTypeSlider"); - @Test - public void findByAccessibilityIdTest() { - assertThat(driver.findElements(AppiumBy.accessibilityId("Compute Sum")).size(), not(is(0))); - } - - // FIXME: Stabilize the test on CI - @Disabled @Test public void setValueTest() { - WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(20)); + driver.findElement(LOGIN_LINK_ID).click(); + driver.findElement(SLIDER_MENU_ITEM_PREDICATE).click(); - WebElement slider = wait.until( - driver1 -> driver1.findElement(AppiumBy.className("XCUIElementTypeSlider"))); - slider.sendKeys("0%"); - assertEquals("0%", slider.getAttribute("value")); + var slider = driver.findElement(SLIDER_CLASS); + var previousValue = slider.getAttribute("value"); + slider.sendKeys("0.5"); + assertNotEquals(slider.getAttribute("value"), previousValue); } } diff --git a/src/e2eIosTest/java/io/appium/java_client/ios/IOSSearchingTest.java b/src/e2eIosTest/java/io/appium/java_client/ios/IOSSearchingTest.java index 5af445b0b..e3fa303e6 100644 --- a/src/e2eIosTest/java/io/appium/java_client/ios/IOSSearchingTest.java +++ b/src/e2eIosTest/java/io/appium/java_client/ios/IOSSearchingTest.java @@ -16,37 +16,25 @@ package io.appium.java_client.ios; -import io.appium.java_client.AppiumBy; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; public class IOSSearchingTest extends AppIOSTest { - - @Test public void findByAccessibilityIdTest() { - assertNotEquals(driver - .findElement(AppiumBy.accessibilityId("ComputeSumButton")) - .getText(), null); - assertNotEquals(driver - .findElements(AppiumBy.accessibilityId("ComputeSumButton")) - .size(), 0); + @Test + public void findByAccessibilityIdTest() { + assertNotNull(driver.findElement(LOGIN_LINK_ID).getText()); + assertNotEquals(0, driver.findElements(LOGIN_LINK_ID).size()); } - @Test public void findByByIosPredicatesTest() { - assertNotEquals(driver - .findElement(AppiumBy.iOSNsPredicateString("name like 'Answer'")) - .getText(), null); - assertNotEquals(driver - .findElements(AppiumBy.iOSNsPredicateString("name like 'Answer'")) - .size(), 0); + @Test + public void findByByIosPredicatesTest() { + assertNotNull(driver.findElement(USERNAME_EDIT_PREDICATE).getText()); + assertNotEquals(0, driver.findElements(USERNAME_EDIT_PREDICATE).size()); } @Test public void findByByIosClassChainTest() { - assertNotEquals(driver - .findElement(AppiumBy.iOSClassChain("**/XCUIElementTypeButton")) - .getText(), null); - assertNotEquals(driver - .findElements(AppiumBy.iOSClassChain("**/XCUIElementTypeButton")) - .size(), 0); + assertNotEquals(0, driver.findElements(VODQA_LOGO_CLASS_CHAIN).size()); } } diff --git a/src/e2eIosTest/java/io/appium/java_client/pagefactory_tests/XCUITModeTest.java b/src/e2eIosTest/java/io/appium/java_client/pagefactory_tests/XCUITModeTest.java index 9660da6a4..7d89bd331 100644 --- a/src/e2eIosTest/java/io/appium/java_client/pagefactory_tests/XCUITModeTest.java +++ b/src/e2eIosTest/java/io/appium/java_client/pagefactory_tests/XCUITModeTest.java @@ -32,12 +32,8 @@ import static io.appium.java_client.pagefactory.LocatorGroupStrategy.ALL_POSSIBLE; import static io.appium.java_client.pagefactory.LocatorGroupStrategy.CHAIN; import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.greaterThan; import static org.hamcrest.Matchers.is; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; @TestMethodOrder(MethodOrderer.MethodName.class) @@ -46,52 +42,40 @@ public class XCUITModeTest extends AppIOSTest { private boolean populated = false; @HowToUseLocators(iOSXCUITAutomation = ALL_POSSIBLE) - @iOSXCUITFindBy(iOSNsPredicate = "label contains 'Compute'") - @iOSXCUITFindBy(className = "XCUIElementTypeButton") - private WebElement computeButton; + @iOSXCUITFindBy(iOSNsPredicate = "name == \"assets/assets/vodqa.png\"") + @iOSXCUITFindBy(className = "XCUIElementTypeImage") + private WebElement logoImageAllPossible; @HowToUseLocators(iOSXCUITAutomation = CHAIN) - @iOSXCUITFindBy(iOSNsPredicate = "name like 'Answer'") - private WebElement answer; + @iOSXCUITFindBy(iOSNsPredicate = "name CONTAINS 'vodqa'") + private WebElement logoImageChain; - @iOSXCUITFindBy(iOSNsPredicate = "name = 'IntegerA'") - private WebElement textField1; + @iOSXCUITFindBy(iOSNsPredicate = "name == 'username'") + private WebElement usernameFieldPredicate; - @HowToUseLocators(iOSXCUITAutomation = ALL_POSSIBLE) - @iOSXCUITFindBy(iOSNsPredicate = "name = 'IntegerB'") - @iOSXCUITFindBy(accessibility = "IntegerB") - private WebElement textField2; - - @iOSXCUITFindBy(iOSNsPredicate = "name ENDSWITH 'Gesture'") - private WebElement gesture; - - @iOSXCUITFindBy(className = "XCUIElementTypeSlider") - private WebElement slider; + @iOSXCUITFindBy(iOSNsPredicate = "name ENDSWITH '.png'") + private WebElement logoImagePredicate; - @iOSXCUITFindBy(id = "locationStatus") - private WebElement locationStatus; - - @HowToUseLocators(iOSXCUITAutomation = CHAIN) - @iOSXCUITFindBy(iOSNsPredicate = "name BEGINSWITH 'contact'") - private WebElement contactAlert; + @iOSXCUITFindBy(className = "XCUIElementTypeImage") + private WebElement logoImageClass; - @HowToUseLocators(iOSXCUITAutomation = ALL_POSSIBLE) - @iOSXCUITFindBy(iOSNsPredicate = "name BEGINSWITH 'location'") - private WebElement locationAlert; + @iOSXCUITFindBy(accessibility = "login") + private WebElement loginLinkAccId; - @iOSXCUITFindBy(iOSClassChain = "XCUIElementTypeWindow/*/XCUIElementTypeTextField[2]") - private WebElement secondTextField; + @iOSXCUITFindBy(iOSClassChain = "**/XCUIElementTypeTextField[`name == \"username\"`]") + private WebElement usernameFieldClassChain; - @iOSXCUITFindBy(iOSClassChain = "XCUIElementTypeWindow/*/XCUIElementTypeButton[-1]") - private WebElement lastButton; + @iOSXCUITFindBy(iOSClassChain = "**/XCUIElementTypeSecureTextField[`name == \"password\"`][-1]") + private WebElement passwordFieldClassChain; - @iOSXCUITFindBy(iOSClassChain = "XCUIElementTypeWindow/*/XCUIElementTypeButton") - private List allButtons; + @iOSXCUITFindBy(iOSClassChain = "**/*[`type CONTAINS \"TextField\"`]") + private List allTextFields; /** * The setting up. */ - @BeforeEach public void setUp() { + @BeforeEach + public void setUp() { if (!populated) { PageFactory.initElements(new AppiumFieldDecorator(driver), this); } @@ -99,51 +83,48 @@ public class XCUITModeTest extends AppIOSTest { populated = true; } - @Test public void findByXCUITSelectorTest() { - assertNotEquals(null, computeButton.getText()); - } - - @Test public void findElementByNameTest() { - assertEquals("TextField1", textField1.getText()); - } - - @Test public void findElementByClassNameTest() { - assertEquals("50%", slider.getAttribute("value")); + @Test + public void findByXCUITSelectorTest() { + assertTrue(logoImageAllPossible.isDisplayed()); } - @Test public void pageObjectChainingTest() { - assertTrue(contactAlert.isDisplayed()); + @Test + public void findElementByNameTest() { + assertTrue(usernameFieldPredicate.isDisplayed()); } - @Test public void findElementByIdTest() { - assertTrue(locationStatus.isDisplayed()); + @Test + public void findElementByClassNameTest() { + assertTrue(logoImageClass.isDisplayed()); } - @Test public void nativeSelectorTest() { - assertTrue(locationAlert.isDisplayed()); + @Test + public void pageObjectChainingTest() { + assertTrue(logoImageChain.isDisplayed()); } - @Test public void findElementByClassChain() { - assertThat(secondTextField.getAttribute("name"), equalTo("IntegerB")); + @Test + public void findElementByIdTest() { + assertTrue(loginLinkAccId.isDisplayed()); } - @Test public void findElementByClassChainWithNegativeIndex() { - assertThat(lastButton.getAttribute("name"), equalTo("Check calendar authorized")); + @Test + public void nativeSelectorTest() { + assertTrue(logoImagePredicate.isDisplayed()); } - @Test public void findMultipleElementsByClassChain() { - assertThat(allButtons.size(), is(greaterThan(1))); + @Test + public void findElementByClassChain() { + assertTrue(usernameFieldClassChain.isDisplayed()); } - @Test public void findElementByXUISelectorTest() { - assertNotNull(gesture.getText()); + @Test + public void findElementByClassChainWithNegativeIndex() { + assertTrue(passwordFieldClassChain.isDisplayed()); } - @Test public void setValueTest() { - textField1.sendKeys("2"); - textField2.sendKeys("4"); - driver.hideKeyboard(); - computeButton.click(); - assertEquals("6", answer.getText()); + @Test + public void findMultipleElementsByClassChain() { + assertThat(allTextFields.size(), is(greaterThan(1))); } } diff --git a/src/e2eIosTest/resources/TestApp.app.zip b/src/e2eIosTest/resources/TestApp.app.zip deleted file mode 100644 index 9bce35781..000000000 Binary files a/src/e2eIosTest/resources/TestApp.app.zip and /dev/null differ diff --git a/src/test/java/io/appium/java_client/utils/TestUtils.java b/src/test/java/io/appium/java_client/utils/TestUtils.java index da1dd0cd5..bfe587ee1 100644 --- a/src/test/java/io/appium/java_client/utils/TestUtils.java +++ b/src/test/java/io/appium/java_client/utils/TestUtils.java @@ -1,3 +1,19 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * See the NOTICE file distributed with this work for additional + * information regarding copyright ownership. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.appium.java_client.utils; import org.jspecify.annotations.Nullable;