report charging time, discharging time and level as part of the test name in applicable tests
authorAnssi Kostiainen <anssi.kostiainen@nokia.com>
Wed, 31 Oct 2012 14:31:52 +0100
changeset 267 3aff84243990
parent 266 62e0b2b6fd1c
child 268 999605452b3b
report charging time, discharging time and level as part of the test name in applicable tests
battery/tests/submissions/anssik/battery-charging.html
battery/tests/submissions/anssik/battery-discharging.html
battery/tests/submissions/anssik/battery-full.html
battery/tests/submissions/anssik/battery-plugged-in.html
battery/tests/submissions/anssik/battery-unplugged.html
--- a/battery/tests/submissions/anssik/battery-charging.html	Wed Oct 31 12:08:27 2012 +0100
+++ b/battery/tests/submissions/anssik/battery-charging.html	Wed Oct 31 14:31:52 2012 +0100
@@ -13,7 +13,7 @@
     <h2>Preconditions</h2>
     <ol>
       <li>
-        The device is plugged in to the charger before this test case is run.
+        The device is plugged in to the charger before this test is run.
       </li>
       <li>
         The battery must neither be empty or full, nor reach empty or full capacity during the test.
@@ -27,24 +27,24 @@
 
       test(function() {
         assert_true(navigator.battery.charging);
-      }, 'The charging attribute must be set to true if the battery is charging.');
+      }, 'The charging attribute must be set to true.');
       
       test(function() {
         assert_true(navigator.battery.chargingTime < Infinity);
-      }, 'The chargingTime attribute must be set to the time remaining in seconds until the system\'s battery is completely charged.');
+      }, 'The chargingTime attribute must be set to the time remaining in seconds until the system\'s battery is completely charged. If the reported charging time ' + navigator.battery.chargingTime + ' seconds or ' + Math.round(navigator.battery.chargingTime/60) + ' minutes is not correct, please indicate that the test has failed.');
       
       test(function() {
         assert_true(navigator.battery.dischargingTime === Infinity);
-      }, 'The dischargingTime attribute must be set to the value positive Infinity, if the battery is charging.');
+      }, 'The dischargingTime attribute must be set to the value positive Infinity.');
       
       test(function() {
         assert_true(0 < navigator.battery.level && navigator.battery.level < 1.0);
-      }, 'The level attribute must be set to the current battery level scaled from 0 to 1.0.');
+      }, 'The level attribute must be set to the current battery level scaled from 0 to 1.0. If the reported battery level ' + navigator.battery.level + ' is not correct, please indicate that the test has failed.');
       
-      var onlevelchange_test = async_test('When the battery\'s level changes, must increase the level attribute\'s value and fire a levelchange event.');
+      var onlevelchange_test = async_test('When the battery level is updated, must increase the level attribute\'s value and fire a levelchange event.');
       var battery_level = navigator.battery.level;
       navigator.battery.onlevelchange = onlevelchange_test.step_func(function (e) {
-        assert_true(navigator.battery.level > battery_level, 'The value of the level attribute must increase, if the battery is charging.');
+        assert_true(navigator.battery.level > battery_level, 'The value of the level attribute must increase.');
         onlevelchange_test.done();
       });
       
--- a/battery/tests/submissions/anssik/battery-discharging.html	Wed Oct 31 12:08:27 2012 +0100
+++ b/battery/tests/submissions/anssik/battery-discharging.html	Wed Oct 31 14:31:52 2012 +0100
@@ -13,7 +13,7 @@
     <h2>Preconditions</h2>
     <ol>
       <li>
-        The device is unplugged from the charger before this test case is run.
+        The device is unplugged from the charger before this test is run.
       </li>
       <li>
         The battery must neither be empty or full, nor reach empty or full capacity during the test.
@@ -30,21 +30,21 @@
       
       test(function() {
         assert_false(navigator.battery.charging);
-      }, 'The charging attribute must be set to false if the battery is discharging.');
+      }, 'The charging attribute must be set to false.');
       
       test(function() {
         assert_true(navigator.battery.chargingTime === Infinity);
-      }, 'The chargingTime attribute must be set to the value positive Infinity if the battery is discharging');
+      }, 'The chargingTime attribute must be set to the value positive Infinity.');
       
       test(function() {
         assert_true(navigator.battery.dischargingTime < Infinity);
-      }, 'The dischargingTime attribute must be set to the time remaining in seconds until the system\'s battery is completely discharged.');
+      }, 'The dischargingTime attribute must be set to the time remaining in seconds until the system\'s battery is completely discharged. If the reported discharging time ' + navigator.battery.dischargingTime + ' seconds or ' + Math.round(navigator.battery.dischargingTime/60) + ' minutes is not correct, please indicate that the test has failed.');
       
       test(function() {
         assert_true(0 <= navigator.battery.level && navigator.battery.level <= 1.0);
       }, 'The level attribute must be set to the current battery level scaled from 0 to 1.0');
       
-      var onlevelchange_test = async_test('When the battery\'s level changes, must decrease the level attribute\'s value and fire a levelchange event.');
+      var onlevelchange_test = async_test('When the battery level is updated, must decrease the level attribute\'s value and fire a levelchange event. If the reported battery level ' + navigator.battery.level + ' is not correct, please indicate that the test has failed.');
       var battery_level = navigator.battery.level;
       
       // compute primes to deplete the battery faster
@@ -55,7 +55,7 @@
       };
       
       navigator.battery.onlevelchange = onlevelchange_test.step_func(function (e) {
-        assert_true(navigator.battery.level < battery_level, 'The value of the level attribute must decrease, if the battery is discharging.');
+        assert_true(navigator.battery.level < battery_level, 'The value of the level attribute must decrease.');
         onlevelchange_test.done();
         w.terminate();
       });
--- a/battery/tests/submissions/anssik/battery-full.html	Wed Oct 31 12:08:27 2012 +0100
+++ b/battery/tests/submissions/anssik/battery-full.html	Wed Oct 31 14:31:52 2012 +0100
@@ -13,7 +13,7 @@
     <h2>Preconditions</h2>
     <ol>
       <li>
-        The device is plugged in to the charger before this test case is run.
+        The device is plugged in to the charger before this test is run.
       </li>
       <li>
         The battery is full.
@@ -25,15 +25,15 @@
 
       test(function() {
         assert_true(navigator.battery.charging);
-      }, 'The charging attribute must be set to true if the battery is charging ("or otherwise" condition).');
+      }, 'The charging attribute must be set to true if the battery is full (the "otherwise" condition).');
       
       test(function() {
         assert_true(navigator.battery.chargingTime === 0);
-      }, 'The chargingTime attribute must be set to 0, if the battery is full.');
+      }, 'The chargingTime attribute must be set to 0.');
       
       test(function() {
         assert_true(navigator.battery.dischargingTime === Infinity);
-      }, 'The dischargingTime attribute must be set to the value positive Infinity if the battery is charging ("or otherwise" condition).');
+      }, 'The dischargingTime attribute must be set to the value positive Infinity (the "otherwise" condition).');
       
       test(function() {
         assert_true(navigator.battery.level === 1.0);
--- a/battery/tests/submissions/anssik/battery-plugged-in.html	Wed Oct 31 12:08:27 2012 +0100
+++ b/battery/tests/submissions/anssik/battery-plugged-in.html	Wed Oct 31 14:31:52 2012 +0100
@@ -13,7 +13,7 @@
     <h2>Preconditions</h2>
     <ol>
       <li>
-        The device is unplugged from the charger before this test case is run.
+        The device is unplugged from the charger before this test is run.
       </li>
       <li>
         The battery must not be full or reach full capacity during the time the test is run.
@@ -27,30 +27,30 @@
       
       alert('Unplug the device from its charger (if not already unplugged), and click OK.');
       
-      var onchargingchange_test = async_test('When the battery charging state is updated, must fire a chargingchange event.');
+      var onchargingchange_test = async_test('When the device is plugged in and its charging state is updated, must set the level attribute\'s value to true and fire a chargingchange event.');
       navigator.battery.onchargingchange = onchargingchange_test.step_func(function (e) {
-        assert_true(navigator.battery.charging, 'The charging attribute must be set to true, if the battery is charging.')
+        assert_true(navigator.battery.charging, 'The charging attribute must be set to true.')
         onchargingchange_test.done();
       });
       
-      var onchargingtimechange_test = async_test('When the battery charging time is updated, must fire a chargingtimechange event.');
+      var onchargingtimechange_test = async_test('When the device is plugged in and its charging time is updated, must set the chargingTime attribute\'s value and fire a chargingtimechange event. If the reported charging time ' + navigator.battery.chargingTime + ' seconds or ' + Math.round(navigator.battery.chargingTime/60) + ' minutes is not correct, please indicate that the test has failed.');
       var battery_chargingtime = navigator.battery.chargingTime;
       navigator.battery.onchargingtimechange = onchargingtimechange_test.step_func(function (e) {
-        assert_true(navigator.battery.chargingTime < battery_chargingtime, 'The value of the chargingTime attribute must decrease, if the battery is charging.');
+        assert_true(navigator.battery.chargingTime < battery_chargingtime, 'The value of the chargingTime attribute must decrease.');
         onchargingtimechange_test.done();
       });
       
-      var ondischargingtimechange_test = async_test('When the battery discharging time is updated, must fire a dischargingtimechange event.');
+      var ondischargingtimechange_test = async_test('When the device is plugged in and its discharging time is updated, must set the dischargingTime attribute\'s value to Infinity and fire a dischargingtimechange event.');
       var battery_dischargingtime = navigator.battery.dischargingTime;
       navigator.battery.ondischargingtimechange = ondischargingtimechange_test.step_func(function (e) {
-        assert_true(navigator.battery.dischargingTime === Infinity, 'The value of the dischargingTime attribute must be set to Infinity, if the battery is charging.');
+        assert_true(navigator.battery.dischargingTime === Infinity, 'The value of the dischargingTime attribute must be set to Infinity.');
         ondischargingtimechange_test.done();
       });
       
-      var onlevelchange_test = async_test('When the battery\'s level changes, must fire a levelchange event.');
+      var onlevelchange_test = async_test('When the device is plugged in and the battery level is updated, must set the level attribute\'s value and fire a levelchange event.');
       var battery_level = navigator.battery.level;
       navigator.battery.onlevelchange = onlevelchange_test.step_func(function (e) {
-        assert_true(navigator.battery.level > 0 && navigator.battery.level < 1.0, 'The level attribute must be set to the current battery level scaled from 0 to 1.0.');
+        assert_true(navigator.battery.level > 0 && navigator.battery.level < 1.0, 'The level attribute must be set to the current battery level scaled from 0 to 1.0. If the reported battery level ' + navigator.battery.level + ' is not correct, please indicate that the test has failed.');
         onlevelchange_test.done();
       });
 
--- a/battery/tests/submissions/anssik/battery-unplugged.html	Wed Oct 31 12:08:27 2012 +0100
+++ b/battery/tests/submissions/anssik/battery-unplugged.html	Wed Oct 31 14:31:52 2012 +0100
@@ -13,7 +13,7 @@
     <h2>Preconditions</h2>
     <ol>
       <li>
-        The device is plugged in to the charger before this test case is run.
+        The device is plugged in to the charger before this test is run.
       </li>
       <li>
         The battery must not be full or reach full capacity during the time the test is run.
@@ -27,27 +27,27 @@
       
       alert('Plug the device into its charger (if not already plugged in), and click OK.');
       
-      var onchargingchange_test = async_test('When the battery charging state is updated, must fire a chargingchange event.');
+      var onchargingchange_test = async_test('When the device is unplugged in and its charging state is updated, must set the level attribute\'s value to false and fire a chargingchange event.');
       navigator.battery.onchargingchange = onchargingchange_test.step_func(function (e) {
-        assert_false(navigator.battery.charging, 'The charging attribute must be set to false, if the battery is discharging.')
+        assert_false(navigator.battery.charging, 'The charging attribute must be set to false.')
         onchargingchange_test.done();
       });
       
-      var onchargingtimechange_test = async_test('When the battery charging time is updated, must fire a chargingtimechange event.');
+      var onchargingtimechange_test = async_test('When the device is unplugged in and its charging time is updated, must set the chargingTime attribute\'s value to Infinity and fire a chargingtimechange event.');
       var battery_chargingtime = navigator.battery.chargingTime;
       navigator.battery.onchargingtimechange = onchargingtimechange_test.step_func(function (e) {
-        assert_true(navigator.battery.chargingTime === Infinity, 'The value of the chargingTime attribute must be set to Infinity, if the battery is discharging.');
+        assert_true(navigator.battery.chargingTime === Infinity, 'The value of the chargingTime attribute must be set to Infinity.');
         onchargingtimechange_test.done();
       });
       
-      var ondischargingtimechange_test = async_test('When the battery discharging time is updated, must fire a dischargingtimechange event.');
+      var ondischargingtimechange_test = async_test('When the device is unplugged in and its discharging time is updated, must set the dischargingTime attribute\'s value and fire a dischargingtimechange event.  If the reported discharging time ' + navigator.battery.dischargingTime + ' seconds or ' + Math.round(navigator.battery.dischargingTime/60) + ' minutes is not correct, please indicate that the test has failed.');
       var battery_dischargingtime = navigator.battery.dischargingTime;
       navigator.battery.ondischargingtimechange = ondischargingtimechange_test.step_func(function (e) {
-        assert_true(navigator.battery.dischargingTime < Infinity, 'The value of the dischargingTime attribute must be set to the remaining discharging time, if the battery is discharging.');
+        assert_true(navigator.battery.dischargingTime < Infinity, 'The value of the dischargingTime attribute must be set to the remaining discharging time.');
         ondischargingtimechange_test.done();
       });
       
-      var onlevelchange_test = async_test('When the battery\'s level changes, must fire a levelchange event.');
+      var onlevelchange_test = async_test('When the device is plugged in and the battery level is updated, must set the level attribute\'s value and fire a levelchange event.');
       var battery_level = navigator.battery.level;
       
       // compute primes to deplete the battery faster