The source for this document can be gotten from Bazaar:

{{{
bzr cat lp:indicator-power/tests/manual
}}}

The source is in the standard manual testing format for Ubuntu QA: [[Testing/TestCaseFormat]]


'''Notes on Battery Testing'''

Mock battery propreties are available for testing purposes.

The testing properties are DBus properties published on busname "com.canonical.indicator.power", object path "/com/canonical/indicator/power/Testing", and interface "com.canonical.indicator.power.Testing". The four properties are "MockBatteryEnabled" (boolean, default false), "MockBatteryLevel" (uint32 [0-100], default 50), "MockBatteryState" (string, default 'discharging'), "MockBatteryMinutesLeft" (minutes remaining to charge/discharge, uint32, default 30).

Example use:

'''To show the testing properties:'''

{{{
$ gdbus call --session --dest "com.canonical.indicator.power" \
             --object-path /com/canonical/indicator/power/Testing \
             --method org.freedesktop.DBus.Properties.GetAll \
             com.canonical.indicator.power.Testing
}}}

'''To enable the mock battery:'''

{{{
$ gdbus call --session --dest "com.canonical.indicator.power" \
             --object-path /com/canonical/indicator/power/Testing \
             --method org.freedesktop.DBus.Properties.Set \
             com.canonical.indicator.power.Testing \
             MockBatteryEnabled \
             "<true>"
}}}

'''To set the mock battery's charge to 10%:'''

{{{
$ gdbus call --session --dest "com.canonical.indicator.power" \
             --object-path /com/canonical/indicator/power/Testing \
             --method org.freedesktop.DBus.Properties.Set \
             com.canonical.indicator.power.Testing \
             MockBatteryLevel \
             "<uint32 10>"
}}}

== Test Case: indicator-power/unity7-items-check ==
=== Procedure ===
 * Log in to a Unity 7 user session
 * Go to the panel and click on the Power indicator
   * Ensure there are items in the menu


== Test Case: indicator-power/unity7-greeter-items-check ==
=== Procedure ===
 * Start a system and wait for the greeter or logout of the current user session
 * Go to the panel and click on the Power indicator
   * Ensure there are items in the menu


== Test Case: indicator-power/unity8-items-check ==
=== Procedure ===
 * Login to a user session running Unity 8
 * Pull down the top panel until it sticks open
 * Navigate through the tabs until "Battery" is shown
   * Battery is at the top of the menu
   * The menu is populated with items


== Test Case: indicator-power/detect-charging-or-discharging ==
=== Procedure ===
 * Begin with a discharging device
   * The indicator's icon should denote a discharging battery; e.g. an icon without the '⚡' sign
 * Plug it in so that its battery is charging
   * The indicator's icon should change to show a charging battery 
 * Unplug it again
   * The indicator's icon should revert back to the same one in step one


== Test Case: indicator-power/low-power-notifications ==
=== Procedure ===
 * Wait for the system's battery level to drop to 10% (or fake it, see 'Notes on Battery Testing' above)
   * A notification should appear
   * Its title should read "Battery Low"
   * Its text should read "10% charge remaining"
   * The icon should be a low power icon
   * It should have two actions, "Battery settings" and "OK". 
   * A warning sound should play
 * Tap OK to dismiss the popup
 * Wait (or fake) the battery level to drop to 9%
   * No new notification should appear -- we're still at the "Low" level 
 * Wait (or fake) the battery level to drop to 4%
   * A notification should appear
   * Its title should read "Battery Critical"
   * Its text should read "4% charge remaining"
   * The icon should be a critical power icon
   * It should have two actions, "Battery settings" and "OK". 
   * A warning sound should play
 * Tap 'Battery Settings'
   * ubuntu-system-settings should be launched to the Battery page 

== Test Case: indicator-power/low-power-icon ==
=== Procedure ===
 * Wait for the system's battery level to drop to 21% (or fake it, see 'Notes on Battery Testing' above)
   * The indicator's icon should use the non-critical coloring (eg, grey)
 * Wait for the system's battery level to drop to 20% (or fake it, see 'Notes on Battery Testing' above)
   * The indicator's icon should use the critical coloring (eg, red)

== Test Case: indicator-power/device-brightness-slider ==
=== Procedure ===
 * On a device, pull down the power indicator's menu
   * The menu should include a brightness slider with icons
 * Make sure "Adjust brightness automatically" is not checked. Uncheck it if it's not.
 * Slide the brightness slider back and forth
   * The screen should get brighter and darker in sync with the slider's position
 * Launch unity-system-settings' Brightness panel
 * Move both the indicator's and the settings panel's sliders
   * Both sliders' positions should stay in sync with each other
   * Both should have the same effect on the screen's brightness
 * Make a note of the current brightness level and slider position
 * Reboot the device
   * The screen brightness should be the same as it was before rebooting
   * The indicator's brightness slider should be in the same position as it was before rebooting

== Test Case: indicator-power/device-brightness-slider-auto ==
=== Procedure ===
 * On a device, pull down the power indicator's menu
   * The menu should include a brightness slider with icons
 * Tap the "Adjust brightness automatically" button to enable auto-adjustment
 * Expose the phone to different brightness levels; e.g. walking inside and outside, shining a flashlight on the device's light sensors, and so on
   * The screen should get brighter and darker in sync with the varying lighting conditions
   * The slider in the power indicator's menu should move to reflect the adjusted brightness
 * Launch unity-system-settings' Brightness panel
 * Expose the phone again to different brightness levels
   * The screen should get brighter and darker in sync with the varying lighting conditions
   * The slider in the Brightness panel should move too