Skip to content

Commit 374b301

Browse files
test: Update the security flag format for Appium3 (#2348)
1 parent 0b4a430 commit 374b301

File tree

4 files changed

+20
-7
lines changed

4 files changed

+20
-7
lines changed

src/e2eFlutterTest/java/io/appium/java_client/android/BaseFlutterTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public static void beforeClass() {
4848
// Flutter driver mocking command requires adb_shell permission to set certain permissions
4949
// to the AUT. This can be removed once the server logic is updated to use a different approach
5050
// for setting the permission
51-
.withArgument(GeneralServerFlag.ALLOW_INSECURE, "adb_shell")
51+
.withArgument(GeneralServerFlag.ALLOW_INSECURE, "*:adb_shell")
5252
.build();
5353
service.start();
5454
}

src/e2eIosTest/java/io/appium/java_client/ios/BaseIOSTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import io.appium.java_client.service.local.AppiumDriverLocalService;
2020
import io.appium.java_client.service.local.AppiumServiceBuilder;
21+
import io.appium.java_client.service.local.flags.GeneralServerFlag;
2122
import org.junit.jupiter.api.AfterAll;
2223

2324
import java.time.Duration;
@@ -49,6 +50,7 @@ public static AppiumDriverLocalService startAppiumServer() {
4950
.withIPAddress("127.0.0.1")
5051
.usingPort(PORT)
5152
.withTimeout(SERVER_START_TIMEOUT)
53+
.withArgument(GeneralServerFlag.ALLOW_INSECURE, "*:session_discovery")
5254
.build();
5355
service.start();
5456
return service;

src/e2eIosTest/java/io/appium/java_client/ios/IOSContextTest.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
package io.appium.java_client.ios;
1818

1919
import io.appium.java_client.NoSuchContextException;
20+
import io.appium.java_client.TestUtils;
21+
import org.junit.jupiter.api.Assumptions;
2022
import org.junit.jupiter.api.Test;
2123

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

3436
@Test public void testGetContextHandles() {
35-
assertEquals(driver.getContextHandles().size(), 2);
37+
// this test is not stable in the CI env due to simulator slowness
38+
Assumptions.assumeFalse(TestUtils.isCiEnv());
39+
40+
assertEquals(2, driver.getContextHandles().size());
3641
}
3742

3843
@Test public void testSwitchContext() throws InterruptedException {
44+
// this test is not stable in the CI env due to simulator slowness
45+
Assumptions.assumeFalse(TestUtils.isCiEnv());
46+
3947
driver.getContextHandles();
4048
findAndSwitchToWebView();
4149
assertThat(driver.getContext(), containsString("WEBVIEW"));
4250
driver.context(NATIVE_CONTEXT);
4351
}
4452

4553
@Test public void testContextError() {
54+
// this test is not stable in the CI env due to simulator slowness
55+
Assumptions.assumeFalse(TestUtils.isCiEnv());
56+
4657
assertThrows(NoSuchContextException.class, () -> driver.context("Planet of the Ape-ium"));
4758
}
4859
}

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,17 @@ public void setupEach() {
5050

5151
@Test
5252
public void addCustomCommandTest() {
53-
driver.addCommand(HttpMethod.GET, "/sessions", "getSessions");
53+
driver.addCommand(HttpMethod.GET, "/appium/sessions", "getSessions");
5454
final Response getSessions = driver.execute("getSessions");
5555
assertNotNull(getSessions.getSessionId());
5656
}
5757

5858
@Test
5959
public void addCustomCommandWithSessionIdTest() {
60-
driver.addCommand(HttpMethod.POST, "/session/" + driver.getSessionId() + "/appium/app/strings",
61-
"getAppStrings");
62-
final Response getStrings = driver.execute("getAppStrings");
63-
assertNotNull(getStrings.getSessionId());
60+
driver.addCommand(HttpMethod.GET, "/session/" + driver.getSessionId() + "/appium/settings",
61+
"getSessionSettings");
62+
final Response getSessionSettings = driver.execute("getSessionSettings");
63+
assertNotNull(getSessionSettings.getSessionId());
6464
}
6565

6666
@Test

0 commit comments

Comments
 (0)