Skip to content

Commit cbc8e85

Browse files
committed
Pass an AutomatedTesting extra in the app intent.
1 parent de4651a commit cbc8e85

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/main/java/org/thepalaceproject/ait/AppiumTestContext.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,17 @@ private static AppiumTestContext createForBrowserstack(
101101
caps.setCapability("platformName", "Android");
102102
caps.setCapability("bstack:options", browserstackOptions);
103103

104+
/*
105+
* Pass an extra option to the app: The app code checks for an
106+
* AutomatedTesting value on startup and configures itself to use
107+
* the special test library rather than Palace Bookshelf.
108+
*/
109+
110+
caps.setCapability(
111+
"appium:optionalIntentArguments",
112+
"--ez AutomatedTesting true"
113+
);
114+
104115
driver = new AndroidDriver(
105116
new URL("https://hub.browserstack.com/wd/hub"),
106117
caps);
@@ -128,9 +139,16 @@ private static AppiumTestContext createForLocal(
128139
try {
129140
LOG.debug("Opening local Android driver...");
130141

142+
/*
143+
* Pass an extra option to the app: The app code checks for an
144+
* AutomatedTesting value on startup and configures itself to use
145+
* the special test library rather than Palace Bookshelf.
146+
*/
147+
131148
final var opts =
132149
new UiAutomator2Options()
133150
.setPlatformName("Android")
151+
.setOptionalIntentArguments("--ez AutomatedTesting true")
134152
.setApp("/app.apk");
135153

136154
driver = new AndroidDriver(new URL("http://127.0.0.1:4723/"), opts);

0 commit comments

Comments
 (0)