[tv-behavior][6.0][eden add module] 53/281053/1
authorchen <chen89.chen@samsung.com>
Thu, 8 Sep 2022 10:43:29 +0000 (18:43 +0800)
committerchen <chen89.chen@samsung.com>
Thu, 8 Sep 2022 10:43:36 +0000 (18:43 +0800)
Change-Id: I5d2771b3e42e77873a9082207f4cd5da4f1d5b74
Signed-off-by: chen <chen89.chen@samsung.com>
tv/tct-behavior-tests/tests.full.xml
tv/tct-behavior-tests/tests.xml
tv/tct-behavior-tests/tests/PreviewWebAPITestSuite/index.html [new file with mode: 0755]
tv/tct-behavior-tests/tests/PreviewWebAPITestSuite/js/main.js [new file with mode: 0755]
tv/tct-behavior-tests/tests/PreviewWebAPITestSuite/res/PreviewWebAPITestSuite [new file with mode: 0755]

index 9ac282d53d9cf338bac5a4b3b817950f7d63c707..13d74b657d77e91094e9d241fd6fd5a4053df08d 100755 (executable)
           <test_script_entry test_script_expected_result="0"/>
         </description>
       </testcase>
+      <testcase purpose="PreviewWebAPI Test" type="functional_positive" status="approved" component="behavior" execution_type="manual" priority="P0" id="PreviewWebAPITestSuite">
+        <description>
+          <pre_condition/>
+          <steps>
+            <step order="1">
+              <step_desc>0</step_desc>
+              <expected>0</expected>
+            </step>
+          </steps>
+          <test_script_entry test_script_expected_result="0"/>
+        </description>
+      </testcase>
       <testcase purpose="Application Test" type="functional_positive" status="approved" component="behavior" execution_type="manual" priority="P0" id="Application">
         <description>
           <pre_condition/>
index 1f096cc4828d0f4a2b4a956b01e2aed55675a413..111c4246d866c13b1ce407a213bcc2588e158f93 100755 (executable)
           <test_script_entry test_script_expected_result="0"/>
         </description>
       </testcase>
+      <testcase component="behavior" execution_type="manual" id="PreviewWebAPITestSuite" priority="P0" purpose="PreviewWebAPI Test">
+        <description>
+          <pre_condition/>
+          <steps>
+            <step order="1">
+              <step_desc>0</step_desc>
+              <expected>0</expected>
+            </step>
+          </steps>
+          <test_script_entry test_script_expected_result="0"/>
+        </description>
+      </testcase>
      <!--  <testcase component="behavior" execution_type="manual" id="Application" priority="P0" purpose="Application Test">
         <description>
           <pre_condition/>
diff --git a/tv/tct-behavior-tests/tests/PreviewWebAPITestSuite/index.html b/tv/tct-behavior-tests/tests/PreviewWebAPITestSuite/index.html
new file mode 100755 (executable)
index 0000000..fdbc1d9
--- /dev/null
@@ -0,0 +1,84 @@
+<!DOCTYPE html>
+<!--
+Copyright (c) 2013 Intel Corporation.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+* Redistributions of works must retain the original copyright notice, this list
+  of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the original copyright notice,
+  this list of conditions and the following disclaimer in the documentation
+  and/or other materials provided with the distribution.
+* Neither the name of Intel Corporation nor the names of its contributors
+  may be used to endorse or promote products derived from this work without
+  specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+Authors:
+        Tan, Shiyou <shiyoux.tan@intel.com>
+
+-->
+<html>
+  <head>
+    <meta charset="utf-8" />
+    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, width=device-width" />
+    <link rel="stylesheet" type="text/css" href="../../css/jquery.mobile.css" />
+    <link rel="stylesheet" type="text/css" href="../../css/main.css" />
+    <script src="../../js/thirdparty/jquery.js"></script>
+    <script src="../../js/thirdparty/jquery.mobile.js"></script>
+    <script src="../../js/tests.js"></script>
+    <script src="js/main.js"></script>
+  </head>
+  <body bgcolor="FFFFFF" >
+    <div data-role="page" id="main">
+      <div data-role="header" data-position="fixed" data-tap-toggle="false">
+        <h1 id="main_page_title"></h1>
+      </div>
+      <div id="content">
+        <ul data-role="listview">
+          <li data-role="list-divider">Package Install</li>
+          <li>
+              <div data-role="button" id="install" class="wgtButton">Install</div>
+          </li>
+          <li data-role="list-divider">Package Launch</li>
+          <li>
+              <div data-role="button" id="launch1" class="wgtButton">Launch</div>
+          </li>
+          <li data-role="list-divider">Package Uninstall</li>
+          <li>
+              <div data-role="button" id="uninstall" class="wgtButton">Uninstall</div>
+          </li>
+        </ul>
+      </div>
+      <div data-role="footer" data-position="fixed" data-tap-toggle="false">
+      </div>
+      <div data-role="popup" id="popup_info" data-theme="a">
+        <font class="fontSize">
+          <p>Test Purpose: </p>
+          <p>Verifies the device supports set preview data functions.</p>
+          <p>Pre-condition: </p>
+          <p>Ensure the PreviewWebAPITest widget is installed successfully.</p>
+          <p>Test Step: </p>
+          <ol>
+            <li>Click the "Install" button to install the widget.</li>
+            <li>Click the "Launch" button to launch the widget.</li>
+            <li>Click the "Uninstall" button to uninstall the widget.</li>
+          </ol>
+          <p>Expected Result: </p>
+          <p>Test passes if all the "SetPreviewData", "SetPreviewData(delete)", "GetVersion" can work normally.</p>
+        </font>
+      </div>
+    </div>
+  </body>
+</html>
diff --git a/tv/tct-behavior-tests/tests/PreviewWebAPITestSuite/js/main.js b/tv/tct-behavior-tests/tests/PreviewWebAPITestSuite/js/main.js
new file mode 100755 (executable)
index 0000000..42458b6
--- /dev/null
@@ -0,0 +1,229 @@
+/*
+Copyright (c) 2013 Intel Corporation.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+* Redistributions of works must retain the original copyright notice, this list
+  of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the original copyright notice,
+  this list of conditions and the following disclaimer in the documentation
+  and/or other materials provided with the distribution.
+* Neither the name of Intel Corporation nor the names of its contributors
+  may be used to endorse or promote products derived from this work without
+  specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+Authors:
+        Tan, Shiyou <shiyoux.tan@intel.com>
+*/
+
+var RESOURCE_DIR;
+$.ajax({
+  url:"/opt/usr/home/owner/share/TCT_CONFIG",
+  data:{},
+  async:false,
+  success:function(data){
+    var regEx = /DEVICE_SUITE_TARGET_30=(.+)/i;
+    var path = regEx.exec(data);
+    RESOURCE_DIR = path[1];
+  }
+});
+var installUrl;
+$(document).delegate("#main", "pageinit", function() {
+    DisablePassButton();
+
+    $("#install").bind("vclick", function() {
+        install(installUrl, "install");
+    });
+    $("#launch1").bind("vclick", function() {
+        launch();
+       $("#uninstall").removeClass("ui-disabled");
+    });
+    $("#uninstall").bind("vclick", function() {
+        uninstall();
+    });
+    try {
+        tizen.package.setPackageInfoEventListener(packageEventCallback);
+    } catch (e) {
+        alert("Exception: " + e.message);
+    }
+
+    packagePre();
+    $("#launch1").addClass("ui-disabled");
+    $("#uninstall").addClass("ui-disabled");
+
+    if(checkInstalledPkg("g3rSasdgsA")) {
+        $("#install").addClass("ui-disabled");
+        $("#launch1").removeClass("ui-disabled");
+    }
+});
+
+var packageEventCallback = {
+        oninstalled: function(packageInfo) {
+            hideProcess();
+            alert("The application " + packageInfo.name + " is installed");
+        },
+        onuninstalled: function(packageId) {
+            hideProcess();
+            alert("The application PreviewWebAPITest is uninstalled");
+        }
+};
+
+function fileURI() {
+    var documentsDir;
+    function onsuccess(files) {
+        for (var i = 0; i < files.length; i++)
+        {
+            if(files[i].name == "PreviewWebAPITestSuite.wgt")
+            {
+                var Url1 = files[i].toURI();
+                installUrl = Url1.replace("file:///", "/");
+            }
+        }
+    }
+
+    function onerror(error) {
+        alert("The error " + error.message + " occurred when listing the files in the selected folder");
+    }
+
+    tizen.filesystem.resolve(
+            'file://' + RESOURCE_DIR + '/Documents',
+            function(dir){
+                documentsDir = dir;
+                dir.listFiles(onsuccess, onerror);
+            }, function(e) {
+                alert("Error" + e.message);
+            }, "r"
+    );
+}
+
+function install(url, type) {
+    var onInstallationSuccess = {
+            onprogress: function(packageId, percentage)
+            {
+                console.log("On installation(" + packageId + "): progress(" + percentage + ")");
+                showProcess();
+            },
+            oncomplete: function(packageId)
+            {
+                console.log("Installation(" + packageId + ") Complete");
+                if(checkInstalledPkg("g3rSasdgsA")) {
+                    $("#install").addClass("ui-disabled");
+                    $("#launch1").removeClass("ui-disabled");
+                }
+            }
+    }
+
+    var onError = function (err) {
+        alert("Error occured on installation : " + err.message);
+        $.mobile.hidePageLoadingMsg();
+    }
+
+    try {
+        tizen.package.install(url, onInstallationSuccess, onError);
+    } catch(e) {
+        alert("Exception: " + e.name);
+    }
+}
+
+function uninstall() {
+
+    var onUninstallationSuccess = {
+
+            onprogress: function(packageId, percentage)
+            {
+                showProcess();
+                console.log("On uninstallation(" + packageId + "): progress(" + percentage + ")");
+            },
+            oncomplete: function(packageId)
+            {
+                console.log("Uninstallation(" + packageId + ") Complete");
+                $("#launch1").addClass("ui-disabled");
+                $("#uninstall").addClass("ui-disabled");
+                EnablePassButton();
+            }
+    }
+
+    var onError = function (err) {
+        alert("Error occured on uninstallation : " + err.name);
+        $.mobile.hidePageLoadingMsg();
+    }
+
+    try {
+        tizen.package.uninstall("g3rSasdgsA", onUninstallationSuccess, onError);
+    } catch (e) {
+        alert("Exception: " + e.name);
+    }
+}
+
+function launch() {
+    function onSuccess() {
+        console.log(id + " launched successfully!");
+    }
+
+    function onError(err) {
+        alert("launch failed : PreviewWebAPITest application is already uninstalled or not installed");
+    }
+    try {
+        tizen.application.launch("g3rSasdgsA.PreviewWebAPITestSuite", onSuccess, onError);
+    } catch (exc) {
+        alert("launch exc:" + exc.message);
+    }
+}
+
+function packagePre() {
+    var documentsDir;
+    function onsuccess(files) {
+        for (var i = 0; i < files.length; i++)
+        {
+            if(files[i].name == "PreviewWebAPITestSuite")
+            {
+                documentsDir.copyTo(
+                    files[i].fullPath,
+                    "file://" + RESOURCE_DIR + "/Documents/PreviewWebAPITestSuite.wgt",
+                    true,
+                    function() {
+                        console.log("PreviewWebAPITestSuite Precondition Success(2)!");
+                    });
+            }
+        }
+        fileURI();
+    }
+
+    function onerror(error) {
+        alert("The error " + error.message + " occurred when listing the files in the selected folder");
+    }
+
+    tizen.filesystem.resolve(
+        'wgt-package/tests/PreviewWebAPITestSuite/res/',
+        function(dir){
+            documentsDir = dir;
+            dir.listFiles(onsuccess, onerror);
+        }, function(e) {
+            alert("Error" + e.message);
+        }, "r"
+    );
+}
+
+function hideProcess() {
+    $.mobile.hidePageLoadingMsg();
+    $("#popup_info-screen").addClass("ui-screen-hidden");
+    $("#popup_info-screen").removeClass("in");
+}
+
+function showProcess() {
+    $.mobile.showPageLoadingMsg();
+    $("#popup_info-screen").removeClass("ui-screen-hidden");
+    $("#popup_info-screen").addClass("in");
+}
diff --git a/tv/tct-behavior-tests/tests/PreviewWebAPITestSuite/res/PreviewWebAPITestSuite b/tv/tct-behavior-tests/tests/PreviewWebAPITestSuite/res/PreviewWebAPITestSuite
new file mode 100755 (executable)
index 0000000..1216972
Binary files /dev/null and b/tv/tct-behavior-tests/tests/PreviewWebAPITestSuite/res/PreviewWebAPITestSuite differ