Confirmed users
1,905
edits
Line 104: | Line 104: | ||
self.assertEquals(0.4, marionette.execute_script("return navigator.mozBattery.level;")) | self.assertEquals(0.4, marionette.execute_script("return navigator.mozBattery.level;")) | ||
</pre> | </pre> | ||
This test checks the current battery state, then tells the emulator to set the battery to 40 percent capacity, and then verifies that the change is detected by content. This test will run with marionette right now, but we may add helper wrappers for the webAPI calls, so you wouldn't have to inject your own scripts to retrieve the value. | |||
To run emulator tests, you should pass the --emulator and --homedir parameters to runtests.py; --homedir is the B2G homedir. Then runtests.py will launch the emulator and connect to it before running tests. | To run emulator tests, you should pass the --emulator and --homedir parameters to runtests.py; --homedir is the B2G homedir. Then runtests.py will launch the emulator and connect to it before running tests. | ||
python runtests.py --emulator --homedir=/path/to/B2G_HOME <test path> | python runtests.py --emulator --homedir=/path/to/B2G_HOME <test path> | ||
=== Example JS Tests === | === Example JS Tests === |