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
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public static void beforeClass() {
// Flutter driver mocking command requires adb_shell permission to set certain permissions
// to the AUT. This can be removed once the server logic is updated to use a different approach
// for setting the permission
.withArgument(GeneralServerFlag.ALLOW_INSECURE, "adb_shell")
.withArgument(GeneralServerFlag.ALLOW_INSECURE, "*:adb_shell")
.build();
service.start();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import io.appium.java_client.service.local.AppiumDriverLocalService;
import io.appium.java_client.service.local.AppiumServiceBuilder;
import io.appium.java_client.service.local.flags.GeneralServerFlag;
import org.junit.jupiter.api.AfterAll;

import java.time.Duration;
Expand Down Expand Up @@ -49,6 +50,7 @@ public static AppiumDriverLocalService startAppiumServer() {
.withIPAddress("127.0.0.1")
.usingPort(PORT)
.withTimeout(SERVER_START_TIMEOUT)
.withArgument(GeneralServerFlag.ALLOW_INSECURE, "*:session_discovery")
.build();
service.start();
return service;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
package io.appium.java_client.ios;

import io.appium.java_client.NoSuchContextException;
import io.appium.java_client.TestUtils;
import org.junit.jupiter.api.Assumptions;
import org.junit.jupiter.api.Test;

import static io.appium.java_client.HasBrowserCheck.NATIVE_CONTEXT;
Expand All @@ -32,17 +34,26 @@ public class IOSContextTest extends BaseIOSWebViewTest {
}

@Test public void testGetContextHandles() {
assertEquals(driver.getContextHandles().size(), 2);
// this test is not stable in the CI env due to simulator slowness
Assumptions.assumeFalse(TestUtils.isCiEnv());

assertEquals(2, driver.getContextHandles().size());
}

@Test public void testSwitchContext() throws InterruptedException {
// this test is not stable in the CI env due to simulator slowness
Assumptions.assumeFalse(TestUtils.isCiEnv());

driver.getContextHandles();
findAndSwitchToWebView();
assertThat(driver.getContext(), containsString("WEBVIEW"));
driver.context(NATIVE_CONTEXT);
}

@Test public void testContextError() {
// this test is not stable in the CI env due to simulator slowness
Assumptions.assumeFalse(TestUtils.isCiEnv());

assertThrows(NoSuchContextException.class, () -> driver.context("Planet of the Ape-ium"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,17 @@ public void setupEach() {

@Test
public void addCustomCommandTest() {
driver.addCommand(HttpMethod.GET, "/sessions", "getSessions");
driver.addCommand(HttpMethod.GET, "/appium/sessions", "getSessions");
final Response getSessions = driver.execute("getSessions");
assertNotNull(getSessions.getSessionId());
}

@Test
public void addCustomCommandWithSessionIdTest() {
driver.addCommand(HttpMethod.POST, "/session/" + driver.getSessionId() + "/appium/app/strings",
"getAppStrings");
final Response getStrings = driver.execute("getAppStrings");
assertNotNull(getStrings.getSessionId());
driver.addCommand(HttpMethod.GET, "/session/" + driver.getSessionId() + "/appium/settings",
"getSessionSettings");
final Response getSessionSettings = driver.execute("getSessionSettings");
assertNotNull(getSessionSettings.getSessionId());
}

@Test
Expand Down