Skip to content

Commit 476243b

Browse files
authored
Apply detox's (20.46.0) native support for Android's demo mode (#8149)
1 parent 213c881 commit 476243b

File tree

3 files changed

+14
-25
lines changed

3 files changed

+14
-25
lines changed

e2e/AndroidUtils.js

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,28 +16,6 @@ const utils = {
1616
// TODO Change to use Detox's ADB (see keyboard driver)
1717
exec.execSync(`adb -s ${device.id} shell ${command}`);
1818
},
19-
setDemoMode: () => {
20-
// enter demo mode
21-
utils.executeShellCommand('settings put global sysui_demo_allowed 1');
22-
// display time 12:00
23-
utils.executeShellCommand(
24-
'am broadcast -a com.android.systemui.demo -e command clock -e hhmm 1200'
25-
);
26-
// Display full mobile data with 4g type and no wifi
27-
utils.executeShellCommand(
28-
'am broadcast -a com.android.systemui.demo -e command network -e mobile show -e level 4 -e datatype 4g -e wifi false'
29-
);
30-
// Hide notifications
31-
utils.executeShellCommand(
32-
'am broadcast -a com.android.systemui.demo -e command notifications -e visible false'
33-
);
34-
// Disable pointer location
35-
utils.executeShellCommand('settings put system pointer_location 0');
36-
// Show full battery but not in charging state
37-
utils.executeShellCommand(
38-
'am broadcast -a com.android.systemui.demo -e command battery -e plugged false -e level 100'
39-
);
40-
},
4119
};
4220

4321
export default utils;

e2e/Overlay.test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,6 @@ describe('Overlay', () => {
5959
it.e2e(':android: should show banner overlay and not block the screen', async () => {
6060
const snapshottedImagePath = './e2e/assets/overlay_banner_padding.png';
6161

62-
Android.setDemoMode();
63-
6462
let expected = await device.takeScreenshot('without_banner');
6563
await elementById(TestIDs.SHOW_BANNER_OVERLAY).tap();
6664
await expect(elementById(TestIDs.BANNER_OVERLAY)).toBeVisible();

package.json

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
"@typescript-eslint/eslint-plugin": "8.21.0",
9898
"@typescript-eslint/parser": "8.21.0",
9999
"clang-format": "^1.4.0",
100-
"detox": "20.34.4",
100+
"detox": "20.46.0",
101101
"detox-testing-library-rnn-adapter": "^2.0.3",
102102
"eslint": "^8.19.0",
103103
"eslint-config-prettier": "6.11.0",
@@ -166,6 +166,19 @@
166166
"type": "android.emulator",
167167
"device": {
168168
"avdName": "Pixel_3a_API_35"
169+
},
170+
"systemUI": {
171+
"pointerLocationBar": "hide",
172+
"touches": "show",
173+
"navigationMode": "3-button",
174+
"statusBar": {
175+
"notifications": "hide",
176+
"clock": "1200",
177+
"wifiSignal": "none",
178+
"mobileSignal": "none",
179+
"battery": "full",
180+
"charging": false
181+
}
169182
}
170183
}
171184
},

0 commit comments

Comments
 (0)