Battery

Set the battery level and charging state, to test low-power banners and charging-only work.

device.battery sets the level and charging state. On an Android emulator the app sees it; on an iOS simulator only the status bar changes.

await device.battery({ level: 5, charging: false });
await device.battery(null); // the real battery back
OptionTakes
level0-100
chargingboolean
iOS simulatorAndroid emulator
What changesthe status bar only: the result has cosmetic: true and a warningthe battery the app reads (dumpsys battery)

By hand

warden ui battery set --level 5 --no-charging
warden ui battery status
warden ui battery reset

Release puts the real battery back.

On this page