[TCT-Sound]Automating manual tests 58/190158/11
authorMateusz Plesinski <m.plesinski@samsung.com>
Thu, 27 Sep 2018 07:31:59 +0000 (09:31 +0200)
committerPiotr Kosko <p.kosko@samsung.com>
Fri, 2 Nov 2018 11:29:36 +0000 (12:29 +0100)
Changed implementation of manual tests to fully automate them.
Tests that has been changed:
+ SoundManager_setSoundModeChangeListener
+ SoundManager_unsetSoundModeChangeListener
+ SoundModeChangeCallback_onsuccess

Added method executeCommand to unitcommon.js.
Updated documentation on changed tests.

Change-Id: I44c0948645dc2dc516aaa0ce373775ec5662cd0e
Signed-off-by: Mateusz Plesinski <m.plesinski@samsung.com>
common/tct-sound-tizen-tests/sound/SoundManager_setSoundModeChangeListener.html
common/tct-sound-tizen-tests/sound/SoundManager_unsetSoundModeChangeListener.html
common/tct-sound-tizen-tests/sound/SoundModeChangeCallback_onsuccess.html
common/tct-sound-tizen-tests/sound/support/sound_common.js
common/tct-sound-tizen-tests/sound/support/unitcommon.js
common/tct-sound-tizen-tests/tests.full.xml
common/tct-sound-tizen-tests/tests.xml

index d1b9d8b80e32600671d2f27e15f58d1265fa664c..4a0653a95a5f9620a4cd3e758f170f7d6e7ee9d7 100755 (executable)
@@ -23,6 +23,7 @@ Authors:
 <title>SoundManager_setSoundModeChangeListener</title>
 <meta charset="utf-8"/>
 <script src="support/unitcommon.js"></script>
+<script src="support/sound_common.js"></script>
 </head>
 <body>
 <div id="log"></div>
@@ -34,6 +35,9 @@ Authors:
 //==== PRIORITY P1
 //==== TEST_CRITERIA MR
 
+executeCommand(setSoundStateCommand(true));
+executeCommand(setVibrationStateCommand(true));
+
 setup({timeout: 30000});
 
 var t = async_test(document.title, {timeout: 30000}), successCallback, retValue;
@@ -47,8 +51,8 @@ t.step(function () {
     });
 
     retValue = tizen.sound.setSoundModeChangeListener(successCallback);
-    alert("1. Goto Settings -> Sound -> Sound mode -> Vibration" +
-          "2. Then swich back to testing page\n");
+
+    executeCommand(setSoundStateCommand(false));
 });
 
 </script>
index c6489fc449ca432a56fe6bce984c53c63859d3a4..33fcee46aa7afd0a13f754236ae9c4a875f16d34 100755 (executable)
@@ -23,6 +23,7 @@ Authors:
 <title>SoundManager_unsetSoundModeChangeListener</title>
 <meta charset="utf-8"/>
 <script src="support/unitcommon.js"></script>
+<script src="support/sound_common.js"></script>
 </head>
 <body>
 <div id="log"></div>
@@ -34,6 +35,9 @@ Authors:
 //==== PRIORITY: P1
 //==== TEST_CRITERIA MR MAST
 
+executeCommand(setSoundStateCommand(true));
+executeCommand(setVibrationStateCommand(true));
+
 setup({timeout: 30000});
 
 var t = async_test(document.title, {timeout: 30000}), successCallback, retValue = null;
@@ -46,8 +50,8 @@ t.step(function () {
         t.done();
     });
     tizen.sound.setSoundModeChangeListener(successCallback);
-    alert("1. Goto Settings -> Sound -> Sound mode -> Vibrate" +
-          "2. Then swich back to testing page\n");
+
+    executeCommand(setSoundStateCommand(false));
 });
 
 </script>
index f76eba931d332348bd2dea4ec9d64201fc180ad8..3937837e29be8368967ffbce7a8aaa75189de152 100755 (executable)
@@ -22,6 +22,7 @@ Authors:
 <head>
 <title>SoundModeChangeCallback_onsuccess</title>
 <meta charset="utf-8"/>
+<script src="support/sound_common.js"></script>
 <script src="support/unitcommon.js"></script>
 </head>
 <body>
@@ -34,6 +35,9 @@ Authors:
 //==== PRIORITY P1
 //==== TEST_CRITERIA CBOA CBT
 
+executeCommand(setSoundStateCommand(true));
+executeCommand(setVibrationStateCommand(true));
+
 setup({timeout: 30000});
 
 var t = async_test(document.title, {timeout: 30000}), getSuccess, successCallback;
@@ -46,8 +50,8 @@ t.step(function () {
     });
 
     tizen.sound.setSoundModeChangeListener(successCallback);
-    alert("1. Goto Settings -> Sound -> Sound mode -> Vibration" +
-          "2. Then swich back to testing page\n");
+
+    executeCommand(setSoundStateCommand(false));
 });
 
 </script>
index 4b2d2586ac9eac4e8cb166af99dbe01cf3121046..766bff111a33dda499c94318cfdf44af219e8944 100755 (executable)
@@ -28,4 +28,26 @@ var SECURITY_ERR        = "SecurityError";
 var NOT_FOUND_ERR       = "NotFoundError";
 var NOT_SUPPORT_ERR     = "NotSupportedError";
 
-var APPLICATION_ID = "testalar00.alarmTestApp";
\ No newline at end of file
+var APPLICATION_ID = "testalar00.alarmTestApp";
+
+function setSoundStateCommand(turnOn){
+    var TCT_SET_SOUND_COMMAND = "vconftool set -f -t bool db/setting/sound/sound_on";
+
+    if (turnOn){
+        return TCT_SET_SOUND_COMMAND + " 1";
+    } else {
+        return TCT_SET_SOUND_COMMAND + " 0";
+    }
+}
+
+function setVibrationStateCommand(turnOn){
+    var TCT_SET_VIBRATION_COMMAND = "vconftool set -f -t bool db/setting/sound/vibration_on";
+
+    if (turnOn){
+        return TCT_SET_VIBRATION_COMMAND + " 1";
+    } else {
+        return TCT_SET_VIBRATION_COMMAND + " 0";
+    }
+}
+
+document.write('<script src="../webrunner/jquery-1.10.2.min.js"></script>');
\ No newline at end of file
index e53a7ecd4106e06593d6e966d47e0116473aaf58..2d323a894e3987abc2feb81782443cda34a65730 100755 (executable)
@@ -588,3 +588,17 @@ function getListenerConversionExceptions(callbackNames) {
 
     return result;
 }
+
+function executeCommand(command) {
+    var toSend = {'cmd' : command};
+    var response =  $.ajax({
+        type: "POST",
+        url: 'http://127.0.0.1:8000/execute_command',
+        async: false,
+        dataType: 'json',
+        data: toSend
+    });
+    //This log provides console output after executing shell command.
+    console.log(JSON.stringify(response));
+    return response
+}
\ No newline at end of file
index e6cc75f83bc69b15e490eec2d58e8d1fbd252028..217274f31b07eb148c63028633e5ecebc068be7d 100755 (executable)
           </spec>
         </specs>
       </testcase>
-      <testcase purpose="Check if SoundManager::setSoundModeChangeListener() method can be called" type="compliance" status="approved" onload_delay="30" component="Tizen Device APIs/Multimedia/Sound" execution_type="manual" priority="P1" id="SoundManager_setSoundModeChangeListener">
+      <testcase purpose="Check if SoundManager::setSoundModeChangeListener() method can be called" type="compliance" status="approved" onload_delay="30" component="Tizen Device APIs/Multimedia/Sound" execution_type="auto" priority="P1" id="SoundManager_setSoundModeChangeListener">
         <description>
-           <pre_condition>before Click run,set "sound" in sound mode(without sound mode changes,the change callback won't be invoked</pre_condition>
-          <steps>
-            <step order="1">
-              <step_desc>Settings -> Sound -> Sound mode ->"Vibration"</step_desc>
-              <expected>Pass</expected>
-            </step>
-          </steps>
           <test_script_entry>/opt/tct-sound-tizen-tests/sound/SoundManager_setSoundModeChangeListener.html</test_script_entry>
         </description>
         <specs>
           </spec>
         </specs>
       </testcase>
-      <testcase purpose="Check if SoundManager::unsetSoundModeChangeListener() method can be called" type="compliance" status="approved" component="Tizen Device APIs/Multimedia/Sound" execution_type="manual" onload_delay="30" priority="P1" id="SoundManager_unsetSoundModeChangeListener">
+      <testcase purpose="Check if SoundManager::unsetSoundModeChangeListener() method can be called" type="compliance" status="approved" component="Tizen Device APIs/Multimedia/Sound" execution_type="auto" onload_delay="30" priority="P1" id="SoundManager_unsetSoundModeChangeListener">
         <description>
-          <pre_condition>before Click run,set "sound" in sound mode(without sound mode changes,the change callback won't be invoked</pre_condition>
-          <steps>
-            <step order="1">
-              <step_desc>Settings -> Sound -> Sound mode ->"mute"</step_desc>
-              <expected>Pass</expected>
-            </step>
-          </steps>
           <test_script_entry>/opt/tct-sound-tizen-tests/sound/SoundManager_unsetSoundModeChangeListener.html</test_script_entry>
         </description>
         <specs>
           </spec>
         </specs>
       </testcase>
-      <testcase purpose="Test whether SoundModeChangeCallback::onsuccess is called with argument of proper type" type="compliance" status="approved" component="Tizen Device APIs/Multimedia/Sound" execution_type="manual" onload_delay="30" priority="P1" id="SoundModeChangeCallback_onsuccess">
+      <testcase purpose="Test whether SoundModeChangeCallback::onsuccess is called with argument of proper type" type="compliance" status="approved" component="Tizen Device APIs/Multimedia/Sound" execution_type="auto" onload_delay="30" priority="P1" id="SoundModeChangeCallback_onsuccess">
         <description>
-          <pre_condition>before Click run,set "sound" in sound mode(without sound mode changes,the change callback won't be invoked</pre_condition>
-          <steps>
-            <step order="1">
-              <step_desc>Settings -> Sound -> Sound mode ->"Vibration"</step_desc>
-              <expected>Pass</expected>
-            </step>
-          </steps>
           <test_script_entry>/opt/tct-sound-tizen-tests/sound/SoundModeChangeCallback_onsuccess.html</test_script_entry>
         </description>
         <specs>
           </spec>
         </specs>
       </testcase>
-      <testcase purpose="Check if SoundManager::setSoundModeChangeListener() method can be called" type="compliance" status="approved" onload_delay="30" component="Tizen Device APIs/Multimedia/Sound" execution_type="manual" priority="P1" id="SoundManager_setSoundModeChangeListener">
+      <testcase purpose="Check if SoundManager::setSoundModeChangeListener() method can be called" type="compliance" status="approved" onload_delay="30" component="Tizen Device APIs/Multimedia/Sound" execution_type="auto" priority="P1" id="SoundManager_setSoundModeChangeListener">
         <description>
-           <pre_condition>before Click run,set "sound" in sound mode(without sound mode changes,the change callback won't be invoked</pre_condition>
-          <steps>
-            <step order="1">
-              <step_desc>Settings -> Sound -> Sound mode ->"Vibration"</step_desc>
-              <expected>Pass</expected>
-            </step>
-          </steps>
           <test_script_entry>/opt/tct-sound-tizen-tests/sound/SoundManager_setSoundModeChangeListener.html</test_script_entry>
         </description>
         <specs>
           </spec>
         </specs>
       </testcase>
-      <testcase purpose="Check if SoundManager::unsetSoundModeChangeListener() method can be called" type="compliance" status="approved" component="Tizen Device APIs/Multimedia/Sound" execution_type="manual" onload_delay="30" priority="P1" id="SoundManager_unsetSoundModeChangeListener">
+      <testcase purpose="Check if SoundManager::unsetSoundModeChangeListener() method can be called" type="compliance" status="approved" component="Tizen Device APIs/Multimedia/Sound" execution_type="auto" onload_delay="30" priority="P1" id="SoundManager_unsetSoundModeChangeListener">
         <description>
-          <pre_condition>before Click run,set "sound" in sound mode(without sound mode changes,the change callback won't be invoked</pre_condition>
-          <steps>
-            <step order="1">
-              <step_desc>Settings -> Sound -> Sound mode ->"mute"</step_desc>
-              <expected>Pass</expected>
-            </step>
-          </steps>
           <test_script_entry>/opt/tct-sound-tizen-tests/sound/SoundManager_unsetSoundModeChangeListener.html</test_script_entry>
         </description>
         <specs>
           </spec>
         </specs>
       </testcase>
-      <testcase purpose="Test whether SoundModeChangeCallback::onsuccess is called with argument of proper type" type="compliance" status="approved" component="Tizen Device APIs/Multimedia/Sound" execution_type="manual" onload_delay="30" priority="P1" id="SoundModeChangeCallback_onsuccess">
+      <testcase purpose="Test whether SoundModeChangeCallback::onsuccess is called with argument of proper type" type="compliance" status="approved" component="Tizen Device APIs/Multimedia/Sound" execution_type="auto" onload_delay="30" priority="P1" id="SoundModeChangeCallback_onsuccess">
         <description>
-          <pre_condition>before Click run,set "sound" in sound mode(without sound mode changes,the change callback won't be invoked</pre_condition>
-          <steps>
-            <step order="1">
-              <step_desc>Settings -> Sound -> Sound mode ->"Vibration"</step_desc>
-              <expected>Pass</expected>
-            </step>
-          </steps>
           <test_script_entry>/opt/tct-sound-tizen-tests/sound/SoundModeChangeCallback_onsuccess.html</test_script_entry>
         </description>
         <specs>
index 63dc2ec01315e3bf9178ff793bdb1a151647cb5c..fd5f3c094244877e6a0865df2319aff8e1c2653d 100755 (executable)
           <test_script_entry>/opt/tct-sound-tizen-tests/sound/SoundManager_getSoundMode_extra_argument.html</test_script_entry>
         </description>
       </testcase>
-      <testcase component="Tizen Device APIs/Multimedia/Sound" execution_type="manual" id="SoundManager_setSoundModeChangeListener" onload_delay="30" priority="P1" purpose="Check if SoundManager::setSoundModeChangeListener() method can be called">
+      <testcase component="Tizen Device APIs/Multimedia/Sound" execution_type="auto" id="SoundManager_setSoundModeChangeListener" onload_delay="30" priority="P1" purpose="Check if SoundManager::setSoundModeChangeListener() method can be called">
         <description>
-          <pre_condition>before Click run,set "sound" in sound mode(without sound mode changes,the change callback won't be invoked</pre_condition>
-          <steps>
-            <step order="1">
-              <step_desc>Settings -> Sound -> Sound mode ->"Vibration"</step_desc>
-              <expected>Pass</expected>
-            </step>
-          </steps>
           <test_script_entry>/opt/tct-sound-tizen-tests/sound/SoundManager_setSoundModeChangeListener.html</test_script_entry>
         </description>
       </testcase>
           <test_script_entry>/opt/tct-sound-tizen-tests/sound/SoundManager_setSoundModeChangeListener_misarg.html</test_script_entry>
         </description>
       </testcase>
-      <testcase component="Tizen Device APIs/Multimedia/Sound" execution_type="manual" id="SoundManager_unsetSoundModeChangeListener" onload_delay="30" priority="P1" purpose="Check if SoundManager::unsetSoundModeChangeListener() method can be called">
+      <testcase component="Tizen Device APIs/Multimedia/Sound" execution_type="auto" id="SoundManager_unsetSoundModeChangeListener" onload_delay="30" priority="P1" purpose="Check if SoundManager::unsetSoundModeChangeListener() method can be called">
         <description>
-          <pre_condition>before Click run,set "sound" in sound mode(without sound mode changes,the change callback won't be invoked</pre_condition>
-          <steps>
-            <step order="1">
-              <step_desc>Settings -> Sound -> Sound mode ->"vibrate"</step_desc>
-              <expected>Pass</expected>
-            </step>
-          </steps>
           <test_script_entry>/opt/tct-sound-tizen-tests/sound/SoundManager_unsetSoundModeChangeListener.html</test_script_entry>
         </description>
       </testcase>
           <test_script_entry>/opt/tct-sound-tizen-tests/sound/SoundModeChangeCallback_notexist.html</test_script_entry>
         </description>
       </testcase>
-      <testcase component="Tizen Device APIs/Multimedia/Sound" execution_type="manual" id="SoundModeChangeCallback_onsuccess" onload_delay="30" priority="P1" purpose="Test whether SoundModeChangeCallback::onsuccess is called with argument of proper type">
+      <testcase component="Tizen Device APIs/Multimedia/Sound" execution_type="auto" id="SoundModeChangeCallback_onsuccess" onload_delay="30" priority="P1" purpose="Test whether SoundModeChangeCallback::onsuccess is called with argument of proper type">
         <description>
-          <pre_condition>before Click run,set "sound" in sound mode(without sound mode changes,the change callback won't be invoked</pre_condition>
-          <steps>
-            <step order="1">
-              <step_desc>Settings -> Sound -> Sound mode ->"Vibration"</step_desc>
-              <expected>Pass</expected>
-            </step>
-          </steps>
           <test_script_entry>/opt/tct-sound-tizen-tests/sound/SoundModeChangeCallback_onsuccess.html</test_script_entry>
         </description>
       </testcase>
           <test_script_entry>/opt/tct-sound-tizen-tests/sound/SoundManager_getSoundMode_extra_argument.html</test_script_entry>
         </description>
       </testcase>
-      <testcase component="Tizen Device APIs/Multimedia/Sound" execution_type="manual" id="SoundManager_setSoundModeChangeListener" onload_delay="30" priority="P1" purpose="Check if SoundManager::setSoundModeChangeListener() method can be called">
+      <testcase component="Tizen Device APIs/Multimedia/Sound" execution_type="auto" id="SoundManager_setSoundModeChangeListener" onload_delay="30" priority="P1" purpose="Check if SoundManager::setSoundModeChangeListener() method can be called">
         <description>
-          <pre_condition>before Click run,set "sound" in sound mode(without sound mode changes,the change callback won't be invoked</pre_condition>
-          <steps>
-            <step order="1">
-              <step_desc>Settings -> Sound -> Sound mode ->"Vibration"</step_desc>
-              <expected>Pass</expected>
-            </step>
-          </steps>
           <test_script_entry>/opt/tct-sound-tizen-tests/sound/SoundManager_setSoundModeChangeListener.html</test_script_entry>
         </description>
       </testcase>
           <test_script_entry>/opt/tct-sound-tizen-tests/sound/SoundManager_setSoundModeChangeListener_misarg.html</test_script_entry>
         </description>
       </testcase>
-      <testcase component="Tizen Device APIs/Multimedia/Sound" execution_type="manual" id="SoundManager_unsetSoundModeChangeListener" onload_delay="30" priority="P1" purpose="Check if SoundManager::unsetSoundModeChangeListener() method can be called">
+      <testcase component="Tizen Device APIs/Multimedia/Sound" execution_type="auto" id="SoundManager_unsetSoundModeChangeListener" onload_delay="30" priority="P1" purpose="Check if SoundManager::unsetSoundModeChangeListener() method can be called">
         <description>
-          <pre_condition>before Click run,set "sound" in sound mode(without sound mode changes,the change callback won't be invoked</pre_condition>
-          <steps>
-            <step order="1">
-              <step_desc>Settings -> Sound -> Sound mode ->"vibrate"</step_desc>
-              <expected>Pass</expected>
-            </step>
-          </steps>
           <test_script_entry>/opt/tct-sound-tizen-tests/sound/SoundManager_unsetSoundModeChangeListener.html</test_script_entry>
         </description>
       </testcase>
           <test_script_entry>/opt/tct-sound-tizen-tests/sound/SoundModeChangeCallback_notexist.html</test_script_entry>
         </description>
       </testcase>
-      <testcase component="Tizen Device APIs/Multimedia/Sound" execution_type="manual" id="SoundModeChangeCallback_onsuccess" onload_delay="30" priority="P1" purpose="Test whether SoundModeChangeCallback::onsuccess is called with argument of proper type">
+      <testcase component="Tizen Device APIs/Multimedia/Sound" execution_type="auto" id="SoundModeChangeCallback_onsuccess" onload_delay="30" priority="P1" purpose="Test whether SoundModeChangeCallback::onsuccess is called with argument of proper type">
         <description>
-          <pre_condition>before Click run,set "sound" in sound mode(without sound mode changes,the change callback won't be invoked</pre_condition>
-          <steps>
-            <step order="1">
-              <step_desc>Settings -> Sound -> Sound mode ->"Vibration"</step_desc>
-              <expected>Pass</expected>
-            </step>
-          </steps>
           <test_script_entry>/opt/tct-sound-tizen-tests/sound/SoundModeChangeCallback_onsuccess.html</test_script_entry>
         </description>
       </testcase>
           <test_script_entry>/opt/tct-sound-tizen-tests/sound/SoundManager_getSoundMode_extra_argument.html</test_script_entry>
         </description>
       </testcase>
-      <testcase component="Tizen Device APIs/Multimedia/Sound" execution_type="manual" id="SoundManager_setSoundModeChangeListener" onload_delay="30" priority="P1" purpose="Check if SoundManager::setSoundModeChangeListener() method can be called">
+      <testcase component="Tizen Device APIs/Multimedia/Sound" execution_type="auto" id="SoundManager_setSoundModeChangeListener" onload_delay="30" priority="P1" purpose="Check if SoundManager::setSoundModeChangeListener() method can be called">
         <description>
-          <pre_condition>before Click run,set "sound" in sound mode(without sound mode changes,the change callback won't be invoked</pre_condition>
-          <steps>
-            <step order="1">
-              <step_desc>Settings -> Sound -> Sound mode ->"Vibration"</step_desc>
-              <expected>Pass</expected>
-            </step>
-          </steps>
           <test_script_entry>/opt/tct-sound-tizen-tests/sound/SoundManager_setSoundModeChangeListener.html</test_script_entry>
         </description>
       </testcase>
           <test_script_entry>/opt/tct-sound-tizen-tests/sound/SoundManager_setSoundModeChangeListener_misarg.html</test_script_entry>
         </description>
       </testcase>
-      <testcase component="Tizen Device APIs/Multimedia/Sound" execution_type="manual" id="SoundManager_unsetSoundModeChangeListener" onload_delay="30" priority="P1" purpose="Check if SoundManager::unsetSoundModeChangeListener() method can be called">
+      <testcase component="Tizen Device APIs/Multimedia/Sound" execution_type="auto" id="SoundManager_unsetSoundModeChangeListener" onload_delay="30" priority="P1" purpose="Check if SoundManager::unsetSoundModeChangeListener() method can be called">
         <description>
-          <pre_condition>before Click run,set "sound" in sound mode(without sound mode changes,the change callback won't be invoked</pre_condition>
-          <steps>
-            <step order="1">
-              <step_desc>Settings -> Sound -> Sound mode ->"vibrate"</step_desc>
-              <expected>Pass</expected>
-            </step>
-          </steps>
           <test_script_entry>/opt/tct-sound-tizen-tests/sound/SoundManager_unsetSoundModeChangeListener.html</test_script_entry>
         </description>
       </testcase>
           <test_script_entry>/opt/tct-sound-tizen-tests/sound/SoundModeChangeCallback_notexist.html</test_script_entry>
         </description>
       </testcase>
-      <testcase component="Tizen Device APIs/Multimedia/Sound" execution_type="manual" id="SoundModeChangeCallback_onsuccess" onload_delay="30" priority="P1" purpose="Test whether SoundModeChangeCallback::onsuccess is called with argument of proper type">
+      <testcase component="Tizen Device APIs/Multimedia/Sound" execution_type="auto" id="SoundModeChangeCallback_onsuccess" onload_delay="30" priority="P1" purpose="Test whether SoundModeChangeCallback::onsuccess is called with argument of proper type">
         <description>
-          <pre_condition>before Click run,set "sound" in sound mode(without sound mode changes,the change callback won't be invoked</pre_condition>
-          <steps>
-            <step order="1">
-              <step_desc>Settings -> Sound -> Sound mode ->"Vibration"</step_desc>
-              <expected>Pass</expected>
-            </step>
-          </steps>
           <test_script_entry>/opt/tct-sound-tizen-tests/sound/SoundModeChangeCallback_onsuccess.html</test_script_entry>
         </description>
       </testcase>