[TCT Web] Removed most user interactions from manual tests. 74/189674/1
authorMichal Michalski <m.michalski2@partner.samsung.com>
Wed, 19 Sep 2018 14:01:33 +0000 (16:01 +0200)
committerMichal Michalski <m.michalski2@partner.samsung.com>
Wed, 19 Sep 2018 14:02:30 +0000 (16:02 +0200)
There was race condition in push messages manual tests that
caused them to be unstable. This commit attempts to fix it
and in doing so also removes unneccessary user interactions.

[Verification] All tct-push-tizen-tests pass.

Change-Id: Ie64f03f48ec1c490ffce8507b66d0778356688a0
Signed-off-by: Michal Michalski <m.michalski2@partner.samsung.com>
common/tct-push-tizen-tests/push/PushMessage_alertMessage_attribute.html
common/tct-push-tizen-tests/push/PushMessage_appData_attribute.html
common/tct-push-tizen-tests/push/PushMessage_date_attribute.html
common/tct-push-tizen-tests/push/PushMessage_message_attribute.html
common/tct-push-tizen-tests/push/PushMessage_requestId_attribute.html
common/tct-push-tizen-tests/push/PushMessage_sender_attribute.html
common/tct-push-tizen-tests/push/PushMessage_sessionInfo_attribute.html
common/tct-push-tizen-tests/push/PushNotificationCallback_onsuccess.html
common/tct-push-tizen-tests/push/support/push_common.js
common/tct-push-tizen-tests/tests.full.xml
common/tct-push-tizen-tests/tests.xml

index 6adbd54c5825873277c473c98f97925400314488..0ef6dcb4d5b715b7c4b696e742538a86d3c35492 100755 (executable)
@@ -29,20 +29,6 @@ Authors:
 <body>
 <div id="log"></div>
 <div id="content">
-    <ul>
-        <li>Message</li>
-        <li>
-            <input type="text" id="msgbox" value=""/>
-        </li>
-        <li>Send Message</li>
-        <li>
-            <button type="button" onclick=send()>Push</button>
-        </li>
-        <li>Push Message</li> 
-        <li> 
-            <label id="message"></label>
-        </li> 
-    </ul>
 </div>
 <script>
 //==== TEST: PushMessage_alertMessage_attribute
@@ -51,15 +37,13 @@ Authors:
 //==== SPEC Tizen Web API:TBD:Push:PushMessage:alertMessage A
 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/push.html
 //==== EXECUTION_TYPE manual
-//==== STEP Fill in the message box and click the "Push" button.
-//==== EXPECT Push message is displayed and test case PASS.
 //==== ONLOAD_DELAY 90
 //==== TEST_CRITERIA AE AT ARO
 
 setup({timeout: 90000});
 
 var t = async_test(document.title, {timeout: 90000}), stateChangeCallback, notificationCallback,
-    pushRegisterSuccessCallback, isFirstStateChange = true;
+    pushRegisterSuccessCallback, isFirstStateChange = true, testmsg = "tizen";
 
 t.step(function () {
     add_result_callback(function () {
@@ -67,18 +51,20 @@ t.step(function () {
             tizen.push.unregister();
             tizen.push.disconnect();
         } catch (err) {
+            console.log("error occured during result callback: ");
+            console.log(err);
         }
     });
 
     pushRegisterSuccessCallback = t.step_func(function (registrationId) {
-        REG_ID = registrationId;
+        send(registrationId, testmsg);
     });
 
     stateChangeCallback = t.step_func(function (state) {
         if(state == "UNREGISTERED") {
             tizen.push.register(pushRegisterSuccessCallback);
         } else if (state == "REGISTERED" && isFirstStateChange) {
-            REG_ID = tizen.push.getRegistrationId();
+            send(tizen.push.getRegistrationId(), testmsg);
         }
         isFirstStateChange = false;
     });
@@ -86,7 +72,6 @@ t.step(function () {
     notificationCallback = t.step_func(function (message) {
         assert_own_property(message, "alertMessage", "pushMessage does not own alertMessage property.");
         check_readonly(message, "alertMessage", message.alertMessage, "string", "message");
-        document.getElementById("message").innerHTML = message.appData;
         t.done();
     });
 
index c892a259c2450663d0f11b8f9b5cace351eb133f..249473bb79bdaf18d5f746d5d6735014b7bee8d2 100755 (executable)
@@ -29,20 +29,6 @@ Authors:
 <body>
 <div id="log"></div>
 <div id="content">
-    <ul>
-        <li>Message</li>
-        <li>
-            <input type="text" id="msgbox" value=""/>
-        </li>
-        <li>Send Message</li>
-        <li>
-            <button type="button" onclick=send()>Push</button>
-        </li>
-        <li>Push Message</li> 
-        <li> 
-            <label id="message"></label>
-        </li> 
-    </ul>
 </div>
 <script>
 //==== TEST: PushMessage_appData_attribute
@@ -51,15 +37,13 @@ Authors:
 //==== SPEC Tizen Web API:TBD:Push:PushMessage:appData A
 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/push.html
 //==== EXECUTION_TYPE manual
-//==== STEP Fill in the message box and click the "Push" button.
-//==== EXPECT Push message is displayed and test case PASS.
 //==== ONLOAD_DELAY 90
 //==== TEST_CRITERIA AE AT ARO
 
 setup({timeout: 90000});
 
 var t = async_test(document.title, {timeout: 90000}), stateChangeCallback, notificationCallback,
-    pushRegisterSuccessCallback, isFirstStateChange = true;
+    pushRegisterSuccessCallback, isFirstStateChange = true, testmsg = "tizen";
 
 t.step(function () {
     add_result_callback(function () {
@@ -67,18 +51,20 @@ t.step(function () {
             tizen.push.unregister();
             tizen.push.disconnect();
         } catch (err) {
+            console.log("error occured in result callback: ");
+            console.log(err);
         }
     });
 
     pushRegisterSuccessCallback = t.step_func(function (registrationId) {
-        REG_ID = registrationId;
+        send(registrationId, testmsg);
     });
 
     stateChangeCallback = t.step_func(function (state) {
         if(state == "UNREGISTERED") {
             tizen.push.register(pushRegisterSuccessCallback);
         } else if (state == "REGISTERED" && isFirstStateChange) {
-            REG_ID = tizen.push.getRegistrationId();
+            send(tizen.push.getRegistrationId(), testmsg);
         }
         isFirstStateChange = false;
     });
@@ -86,7 +72,6 @@ t.step(function () {
     notificationCallback = t.step_func(function (message) {
         assert_own_property(message, "appData" , "pushMessage does not own appData property.");
         check_readonly(message, "appData", message.appData, "string", "message");
-        document.getElementById("message").innerHTML = message.appData;
         t.done();
     });
 
index 73f634f62c863d49c7dc9847b58622bc596ace2b..a3939fb7d50c1ac612d7bbfe0c35979c16599460 100755 (executable)
@@ -29,20 +29,6 @@ Authors:
 <body>
 <div id="log"></div>
 <div id="content">
-    <ul>
-        <li>Message</li>
-        <li>
-            <input type="text" id="msgbox" value=""/>
-        </li>
-        <li>Send Message</li>
-        <li>
-            <button type="button" onclick=send()>Push</button>
-        </li>
-        <li>Push Message</li> 
-        <li> 
-            <label id="message"></label>
-        </li> 
-    </ul>
 </div>
 <script>
 //==== TEST: PushMessage_date_attribute
@@ -51,15 +37,13 @@ Authors:
 //==== SPEC Tizen Web API:TBD:Push:PushMessage:date A
 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/push.html
 //==== EXECUTION_TYPE manual
-//==== STEP Fill in the message box and click the "Push" button.
-//==== EXPECT Push message is displayed and test case PASS.
 //==== ONLOAD_DELAY 90
 //==== TEST_CRITERIA AE AT ARO
 
 setup({timeout: 90000});
 
 var t = async_test(document.title, {timeout: 90000}), stateChangeCallback, notificationCallback,
-    pushRegisterSuccessCallback, isFirstStateChange = true;
+    pushRegisterSuccessCallback, isFirstStateChange = true, testmsg = "tizen";
 
 t.step(function () {
     add_result_callback(function () {
@@ -67,11 +51,14 @@ t.step(function () {
             tizen.push.unregister();
             tizen.push.disconnect();
         } catch (err) {
+            console.log("result_callback_failed with error: ");
+            console.log(err);
         }
     });
 
     pushRegisterSuccessCallback = t.step_func(function (registrationId) {
         REG_ID = registrationId;
+        send(REG_ID, testmsg);
     });
 
     stateChangeCallback = t.step_func(function (state) {
@@ -79,6 +66,7 @@ t.step(function () {
             tizen.push.register(pushRegisterSuccessCallback);
         } else if (state == "REGISTERED" && isFirstStateChange) {
             REG_ID = tizen.push.getRegistrationId();
+            send(REG_ID, testmsg);
         }
         isFirstStateChange = false;
     });
@@ -86,7 +74,6 @@ t.step(function () {
     notificationCallback = t.step_func(function (message) {
         assert_own_property(message, "date", "pushMessage does not own date property.");
         check_readonly(message, "date", message.date, 'date', new Date());
-        document.getElementById("message").innerHTML = message.appData;
         t.done();
     });
 
index 010216d0af41a3c43375b29d74598c3ad7a54d25..5aa1dd94ae551697f5a60dd3337937a4bf4e2ba1 100755 (executable)
@@ -29,20 +29,6 @@ Authors:
 <body>
 <div id="log"></div>
 <div id="content">
-    <ul>
-        <li>Message</li>
-        <li>
-            <input type="text" id="msgbox" value=""/>
-        </li>
-        <li>Send Message</li>
-        <li>
-            <button type="button" onclick=send()>Push</button>
-        </li>
-        <li>Push Message</li> 
-        <li> 
-            <label id="message"></label>
-        </li> 
-    </ul>
 </div>
 <script>
 //==== TEST: PushMessage_message_attribute
@@ -50,8 +36,6 @@ Authors:
 //==== SPEC Tizen Web API:TBD:Push:PushMessage:message A
 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/push.html
 //==== EXECUTION_TYPE manual
-//==== STEP Fill in the message box and click the "Push" button.
-//==== EXPECT Push message is displayed and test case PASS.
 //==== ONLOAD_DELAY 90
 //==== PRIORITY P1
 //==== TEST_CRITERIA AE AT ARO
@@ -59,7 +43,7 @@ Authors:
 setup({timeout: 90000});
 
 var t = async_test(document.title, {timeout: 90000}), stateChangeCallback, notificationCallback,
-    pushRegisterSuccessCallback, isFirstStateChange = true;
+    pushRegisterSuccessCallback, isFirstStateChange = true, testmsg = "tizen";
 
 t.step(function () {
     add_result_callback(function () {
@@ -67,18 +51,20 @@ t.step(function () {
             tizen.push.unregister();
             tizen.push.disconnect();
         } catch (err) {
+            console.log("error occured on result callback: ");
+            console.log(err);
         }
     });
 
     pushRegisterSuccessCallback = t.step_func(function (registrationId) {
-        REG_ID = registrationId;
+        send(registrationId, testmsg);
     });
 
     stateChangeCallback = t.step_func(function (state) {
         if(state == "UNREGISTERED") {
             tizen.push.register(pushRegisterSuccessCallback);
         } else if (state == "REGISTERED" && isFirstStateChange) {
-            REG_ID = tizen.push.getRegistrationId();
+            send(tizen.push.getRegistrationId(), testmsg);
         }
         isFirstStateChange = false;
     });
@@ -86,7 +72,6 @@ t.step(function () {
     notificationCallback = t.step_func(function (message) {
         assert_own_property(message, "message", "pushMessage does not own message property.");
         check_readonly(message, "message", message.message, "string", message.message + "new");
-        document.getElementById("message").innerHTML = message.appData;
         t.done();
     });
 
index 30f1ccad47f7edbb3a7cfd34baaf45af565f7a0b..5b7c6ec9931c3c443fdd4e2c29c0c6a99032e06a 100755 (executable)
@@ -29,20 +29,6 @@ Authors:
 <body>
 <div id="log"></div>
 <div id="content">
-    <ul>
-        <li>Message</li>
-        <li>
-            <input type="text" id="msgbox" value=""/>
-        </li>
-        <li>Send Message</li>
-        <li>
-            <button type="button" onclick=send()>Push</button>
-        </li>
-        <li>Push Message</li> 
-        <li> 
-            <label id="message"></label>
-        </li> 
-    </ul>
 </div>
 <script>
 //==== TEST: PushMessage_requestId_attribute
@@ -50,8 +36,6 @@ Authors:
 //==== SPEC Tizen Web API:TBD:Push:PushMessage:requestId A
 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/push.html
 //==== EXECUTION_TYPE manual
-//==== STEP Fill in the message box and click the "Push" button.
-//==== EXPECT Push message is displayed and test case PASS.
 //==== ONLOAD_DELAY 90
 //==== PRIORITY P1
 //==== TEST_CRITERIA AE AT ARO
@@ -59,7 +43,7 @@ Authors:
 setup({timeout: 90000});
 
 var t = async_test(document.title, {timeout: 90000}), stateChangeCallback, notificationCallback,
-    pushRegisterSuccessCallback, isFirstStateChange = true;
+    pushRegisterSuccessCallback, isFirstStateChange = true, testmsg = "tizen";
 
 t.step(function () {
     add_result_callback(function () {
@@ -67,18 +51,20 @@ t.step(function () {
             tizen.push.unregister();
             tizen.push.disconnect();
         } catch (err) {
+            console.log("error occured during result callback: ");
+            console.log(err);
         }
     });
 
     pushRegisterSuccessCallback = t.step_func(function (registrationId) {
-        REG_ID = registrationId;
+        send(registrationId, testmsg);
     });
 
     stateChangeCallback = t.step_func(function (state) {
         if(state == "UNREGISTERED") {
             tizen.push.register(pushRegisterSuccessCallback);
         } else if (state == "REGISTERED" && isFirstStateChange) {
-            REG_ID = tizen.push.getRegistrationId();
+            send(tizen.push.getRegistrationId(), testmsg);
         }
         isFirstStateChange = false;
     });
@@ -86,7 +72,6 @@ t.step(function () {
     notificationCallback = t.step_func(function (message) {
         assert_own_property(message, "requestId", "pushMessage does not own requestId property.");
         check_readonly(message, "requestId", message.requestId, "string", "newid");
-        document.getElementById("message").innerHTML = message.appData;
         t.done();
     });
 
index 4faa8198e8bec284324e76ebdc5bdeb26af49ba5..05e5253bc1ce9787ddf3e3799b8bbe071f89e34b 100755 (executable)
@@ -29,20 +29,6 @@ Authors:
 <body>
 <div id="log"></div>
 <div id="content">
-    <ul>
-        <li>Message</li>
-        <li>
-            <input type="text" id="msgbox" value=""/>
-        </li>
-        <li>Send Message</li>
-        <li>
-            <button type="button" onclick=send()>Push</button>
-        </li>
-        <li>Push Message</li> 
-        <li> 
-            <label id="message"></label>
-        </li> 
-    </ul>
 </div>
 <script>
 //==== TEST: PushMessage_sender_attribute
@@ -50,8 +36,6 @@ Authors:
 //==== SPEC Tizen Web API:TBD:Push:PushMessage:sender A
 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/push.html
 //==== EXECUTION_TYPE manual
-//==== STEP Fill in the message box and click the "Push" button.
-//==== EXPECT Push message is displayed and test case PASS.
 //==== ONLOAD_DELAY 90
 //==== PRIORITY P1
 //==== TEST_CRITERIA AE AT ARO
@@ -59,7 +43,7 @@ Authors:
 setup({timeout: 90000});
 
 var t = async_test(document.title, {timeout: 90000}), stateChangeCallback, notificationCallback,
-    pushRegisterSuccessCallback, isFirstStateChange = true;
+    pushRegisterSuccessCallback, isFirstStateChange = true, testmsg = "tizen";
 
 t.step(function () {
     add_result_callback(function () {
@@ -67,18 +51,20 @@ t.step(function () {
             tizen.push.unregister();
             tizen.push.disconnect();
         } catch (err) {
+            console.log("error occured during result callback: ");
+            console.log(err);
         }
     });
 
     pushRegisterSuccessCallback = t.step_func(function (registrationId) {
-        REG_ID = registrationId;
+        send(registrationId, testmsg);
     });
 
     stateChangeCallback = t.step_func(function (state) {
         if(state == "UNREGISTERED") {
             tizen.push.register(pushRegisterSuccessCallback);
         } else if (state == "REGISTERED" && isFirstStateChange) {
-            REG_ID = tizen.push.getRegistrationId();
+            send(tizen.push.getRegistrationId(), testmsg);
         }
         isFirstStateChange = false;
     });
@@ -86,7 +72,6 @@ t.step(function () {
     notificationCallback = t.step_func(function (message) {
         assert_own_property(message, "sender", "pushMessage does not own sender property.");
         check_readonly(message, "sender", message.sender, "string", "newsender");
-        document.getElementById("message").innerHTML = message.appData;
         t.done();
     });
 
index 9e90404109f81ea2bae1f1a0a35dcfb3ba428191..0bc486a906fcf5c44197807191417174016ccf82 100755 (executable)
@@ -29,20 +29,6 @@ Authors:
 <body>
 <div id="log"></div>
 <div id="content">
-    <ul>
-        <li>Message</li>
-        <li>
-            <input type="text" id="msgbox" value=""/>
-        </li>
-        <li>Send Message</li>
-        <li>
-            <button type="button" onclick=send()>Push</button>
-        </li>
-        <li>Push Message</li> 
-        <li> 
-            <label id="message"></label>
-        </li> 
-    </ul>
 </div>
 <script>
 //==== TEST: PushMessage_sessionInfo_attribute
@@ -50,8 +36,6 @@ Authors:
 //==== SPEC Tizen Web API:TBD:Push:PushMessage:sessionInfo A
 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/push.html
 //==== EXECUTION_TYPE manual
-//==== STEP Fill in the message box and click the "Push" button.
-//==== EXPECT Push message is displayed and test case PASS.
 //==== ONLOAD_DELAY 90
 //==== PRIORITY P1
 //==== TEST_CRITERIA AE AT ARO
@@ -59,7 +43,7 @@ Authors:
 setup({timeout: 90000});
 
 var t = async_test(document.title, {timeout: 90000}), stateChangeCallback, notificationCallback,
-    pushRegisterSuccessCallback, isFirstStateChange = true;
+    pushRegisterSuccessCallback, isFirstStateChange = true, testmsg = "tizen";
 
 t.step(function () {
     add_result_callback(function () {
@@ -67,18 +51,20 @@ t.step(function () {
             tizen.push.unregister();
             tizen.push.disconnect();
         } catch (err) {
+            console.log("error occured during result callback: ");
+            console.log(err);
         }
     });
 
     pushRegisterSuccessCallback = t.step_func(function (registrationId) {
-        REG_ID = registrationId;
+        send(registrationId, testmsg);
     });
 
     stateChangeCallback = t.step_func(function (state) {
         if(state == "UNREGISTERED") {
             tizen.push.register(pushRegisterSuccessCallback);
         } else if (state == "REGISTERED" && isFirstStateChange) {
-            REG_ID = tizen.push.getRegistrationId();
+            send(tizen.push.getRegistrationId(), testmsg);
         }
         isFirstStateChange = false;
     });
@@ -86,7 +72,6 @@ t.step(function () {
     notificationCallback = t.step_func(function (message) {
         assert_own_property(message, "sessionInfo", "pushMessage does not own sessionInfo property.");
         check_readonly(message, "sessionInfo", message.sessionInfo, "string", "newsession");
-        document.getElementById("message").innerHTML = message.appData;
         t.done();
     });
 
index 5602727fb71ba7e17134434b26602355a2999278..b6d4ca05c09fb43e4a2d06cc95028712f199dec0 100755 (executable)
@@ -30,20 +30,6 @@ Authors:
 <body>
 <div id="log"></div>
 <div id="content">
-    <ul>
-        <li>Message</li>
-        <li>
-            <input type="text" id="msgbox" value=""/>
-        </li>
-        <li>Send Message</li>
-        <li>
-            <button type="button" onclick=send()>Push</button>
-        </li>
-        <li>Push Message</li> 
-        <li> 
-            <label id="message"></label>
-        </li> 
-    </ul>
 </div>
 <script>
 //==== TEST: PushNotificationCallback_onsuccess
@@ -52,15 +38,13 @@ Authors:
 //==== SPEC Tizen Web API:TBD:Push:PushNotificationCallback:onsuccess U
 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/push.html
 //==== EXECUTION_TYPE manual
-//==== STEP Fill in the message box and click the "Push" button.
-//==== EXPECT Push message is displayed and test case PASS.
 //==== ONLOAD_DELAY 90
 //==== TEST_CRITERIA CBT CBOA
 
 setup({timeout: 90000});
 
 var t = async_test(document.title, {timeout: 90000}), stateChangeCallback, notificationCallback,
-    pushRegisterSuccessCallback, isFirstStateChange = true;
+    pushRegisterSuccessCallback, isFirstStateChange = true, testmsg = "tizen";
 
 t.step(function () {
     add_result_callback(function () {
@@ -68,18 +52,20 @@ t.step(function () {
             tizen.push.unregister();
             tizen.push.disconnect();
         } catch (err) {
+            console.log("error occured in result callback: ");
+            console.log(err);
         }
     });
 
     pushRegisterSuccessCallback = t.step_func(function (registrationId) {
-        REG_ID = registrationId;
+        send(registrationId, testmsg);
     });
 
     stateChangeCallback = t.step_func(function (state) {
         if(state == "UNREGISTERED") {
             tizen.push.register(pushRegisterSuccessCallback);
         } else if (state == "REGISTERED" && isFirstStateChange) {
-            REG_ID = tizen.push.getRegistrationId();;
+            send(tizen.push.getRegistrationId(), testmsg);
         }
         isFirstStateChange = false;
     });
@@ -90,7 +76,6 @@ t.step(function () {
         assert_own_property(msg, "alertMessage", "msg doesn't have alertMessage property");
         assert_own_property(msg, "date", "msg doesn't have date property");
         assert_not_equals(msg, undefined, "msg should not be undefined.");
-        document.getElementById("message").innerHTML = msg.appData;
         tizen.push.unregister();
         tizen.push.disconnect();
         t.done();
index 4d698e86691ad84353f50d3e3fa0c16789656e87..fe6bfbfc5110fca88100fecd4810ef201ece2120 100755 (executable)
@@ -19,8 +19,6 @@ Authors:
 
  */
 
-var REG_ID;
-
 function checkNum(i) {
     if (i < 10) {
         i = "0" + i;
@@ -28,12 +26,20 @@ function checkNum(i) {
     return i;
 }
 
-function send() {
-    //var appId = "api1push00.WebAPITizenPushTests";
+function send(registeredId, msg) {
+    if (registeredId == undefined || msg == undefined || msg == "") {
+        alert({
+            "error": "invalid arguments",
+            "values": {
+                "registeredId": registeredId,
+                "msg": msg
+        }});
+        return;
+    }
+
     var appId = "api1push00";
-    var msg = document.getElementById("msgbox").value;
-    //var sec = "27A91C190007B2E7987627A9392C6291";
     var sec = "C94E6F7C781B3624017401C320DE35D9";
+
     var h = new Date().getHours();
     var m = new Date().getMinutes();
     var s = new Date().getSeconds();
@@ -41,72 +47,42 @@ function send() {
     m = checkNum(m);
     s = checkNum(s);
 
-    if(msg == "")
-    {
-        alert("Message is empty");
-    }
-   // else if(REG_ID == "")
-   // {
-   //     alert("Registration ID is empty")
-   // }
-    else
-    {
-        var request = new XMLHttpRequest();
-        var data = {"regID":REG_ID, "requestID":"000001", "message":"action=ALERT&alertMessage="+msg, "appData":msg+"("+h+":"+m+":"+s+")"};
-        var regID = REG_ID.substring(0, 2);
-        switch(regID)
-        {
-        case "00":
-            request.open("POST", "https://useast.push.samsungosp.com:8088/spp/pns/api/push", true);
-            break;
-        case "01":
-            request.open("POST", "https://uswest.push.samsungosp.com:8088/spp/pns/api/push", true);
-            break;
-        case "02":
-            request.open("POST", "https://apsoutheast.push.samsungosp.com:8088/spp/pns/api/push", true);
-            break;
-        case "03":
-            request.open("POST", "https://euwest.push.samsungosp.com:8088/spp/pns/api/push", true);
-            break;
-        case "04":
-            request.open("POST", "https://apnortheast.push.samsungosp.com:8088/spp/pns/api/push", true);
-            break;
-        case "05":
-            request.open("POST", "https://apkorea.push.samsungosp.com:8088/spp/pns/api/push", true);
-            break;
-        case "06":
-            request.open("POST", "https://apchina.push.samsungosp.com.cn:8088/spp/pns/api/push", true);
-            break;
-        case "7c":
-            request.open("POST", "https://175.41.248.50:8088/spp/pns/api/push", true);
-        case "50":
-            request.open("POST", "https://useast.gateway.push.samsungosp.com:8090/spp/pns/api/push", true);
-            break;
-        case "52":
-            request.open("POST", "https://apsoutheast.gateway.push.samsungosp.com:8090/spp/pns/api/push", true);
-            break;
-        case "53":
-            request.open("POST", "https://euwest.gateway.push.samsungosp.com:8090/spp/pns/api/push", true);
-            break;
-        case "54":
-            request.open("POST", "https://apnortheast.gateway.push.samsungosp.com:8090/spp/pns/api/push", true);
-            break;
-        case "55":
-            request.open("POST", "https://apkorea.gateway.push.samsungosp.com:8090/spp/pns/api/push", true);
-            break;
-        case "56":
-            request.open("POST", "https://apchina.gateway.push.samsungosp.com.cn:8090/spp/pns/api/push", true);
+    var request = new XMLHttpRequest();
+    var data = {
+        "regID": registeredId,
+        "requestID": "000001",
+        "message": "action=ALERT&alertMessage="+msg,
+        "appData": msg + "(" + h + ":" + m + ":" + s + ")"
+    };
+
+    var idToUrlMap = {
+        "00": "https://useast.push.samsungosp.com:8088/spp/pns/api/push",
+        "01": "https://uswest.push.samsungosp.com:8088/spp/pns/api/push",
+        "02": "https://apsoutheast.push.samsungosp.com:8088/spp/pns/api/push",
+        "03": "https://euwest.push.samsungosp.com:8088/spp/pns/api/push",
+        "04": "https://apnortheast.push.samsungosp.com:8088/spp/pns/api/push",
+        "05": "https://apkorea.push.samsungosp.com:8088/spp/pns/api/push",
+        "06": "https://apchina.push.samsungosp.com.cn:8088/spp/pns/api/push",
+        "7c": "https://175.41.248.50:8088/spp/pns/api/push",
+        "50": "https://useast.gateway.push.samsungosp.com:8090/spp/pns/api/push",
+        "52": "https://apsoutheast.gateway.push.samsungosp.com:8090/spp/pns/api/push",
+        "53": "https://euwest.gateway.push.samsungosp.com:8090/spp/pns/api/push",
+        "54": "https://apnortheast.gateway.push.samsungosp.com:8090/spp/pns/api/push",
+        "55": "https://apkorea.gateway.push.samsungosp.com:8090/spp/pns/api/push",
+        "56": "https://apchina.gateway.push.samsungosp.com.cn:8090/spp/pns/api/push"
+    };
+
+    var url = idToUrlMap[registeredId.substring(0,2)];
+    request.open("POST", url, true);
+
+    request.setRequestHeader("Content-Type", "application/json");
+    request.setRequestHeader("appID", appId);
+    request.setRequestHeader("appSecret", sec);
+    request.onreadystatechange = function() {
+        if (request.readyState == 4 && request.status == 200) {
+            console.log(request.responseText);
+            alert("Push Success");
         }
-        request.setRequestHeader("Content-Type", "application/json");
-        request.setRequestHeader("appID", appId);
-        request.setRequestHeader("appSecret", sec);
-        request.onreadystatechange = function() {
-            if (request.readyState == 4 && request.status == 200) {
-                console.log(request.responseText);
-                //alert(request.responseText);
-                alert("Push Success");
-            }
-        };
-        request.send(JSON.stringify(data));
-    }
+    };
+    request.send(JSON.stringify(data));
 }
index 6823f89e85808fc1b5d383e01ee1029e344e9ada..1578f79efd05c54a6426f7ac808505f7a9fb9075 100755 (executable)
       </testcase>
       <testcase purpose="Check if alertMessage attribute of PushMessage is readOnly." type="compliance" onload_delay="90" status="approved" component="Tizen Device APIs/TBD/Push" execution_type="manual" priority="P1" id="PushMessage_alertMessage_attribute">
         <description>
-          <steps>
-            <step order="1">
-              <step_desc>Fill in the message box and click the "Push" button.</step_desc>
-              <expected>Push message is displayed and test case PASS.</expected>
-            </step>
-          </steps>
           <test_script_entry>/opt/tct-push-tizen-tests/push/PushMessage_alertMessage_attribute.html</test_script_entry>
         </description>
         <specs>
       </testcase>
       <testcase purpose="Check if appData attribute of PushMessage is readOnly." type="compliance" onload_delay="90" status="approved" component="Tizen Device APIs/TBD/Push" execution_type="manual" priority="P1" id="PushMessage_appData_attribute">
         <description>
-          <steps>
-            <step order="1">
-              <step_desc>Fill in the message box and click the "Push" button.</step_desc>
-              <expected>Push message is displayed and test case PASS.</expected>
-            </step>
-          </steps>
           <test_script_entry>/opt/tct-push-tizen-tests/push/PushMessage_appData_attribute.html</test_script_entry>
         </description>
         <specs>
       </testcase>
       <testcase purpose="Check if date attribute of PushMessage is readOnly." type="compliance" onload_delay="90" status="approved" component="Tizen Device APIs/TBD/Push" execution_type="manual" priority="P1" id="PushMessage_date_attribute">
         <description>
-          <steps>
-            <step order="1">
-              <step_desc>Fill in the message box and click the "Push" button.</step_desc>
-              <expected>Push message is displayed and test case PASS.</expected>
-            </step>
-          </steps>
           <test_script_entry>/opt/tct-push-tizen-tests/push/PushMessage_date_attribute.html</test_script_entry>
         </description>
         <specs>
       </testcase>
       <testcase purpose="Check if PushNotificationCallback works" type="compliance" onload_delay="90" status="approved" component="Tizen Device APIs/TBD/Push" execution_type="manual" priority="P3" id="PushNotificationCallback_onsuccess">
         <description>
-          <steps>
-            <step order="1">
-              <step_desc>Fill in the message box and click the "Push" button.</step_desc>
-              <expected>Push message is displayed and test case PASS.</expected>
-            </step>
-          </steps>
           <test_script_entry>/opt/tct-push-tizen-tests/push/PushNotificationCallback_onsuccess.html</test_script_entry>
         </description>
         <specs>
       </testcase>
       <testcase purpose="Check if message attribute of PushMessage is readOnly." type="compliance" onload_delay="90" status="approved" component="Tizen Device APIs/TBD/Push" execution_type="manual" priority="P1" id="PushMessage_message_attribute">
         <description>
-          <steps>
-            <step order="1">
-              <step_desc>Fill in the message box and click the "Push" button.</step_desc>
-              <expected>Push message is displayed and test case PASS.</expected>
-            </step>
-          </steps>
           <test_script_entry>/opt/tct-push-tizen-tests/push/PushMessage_message_attribute.html</test_script_entry>
         </description>
         <specs>
       </testcase>
       <testcase purpose="Check if requestId attribute of PushMessage is readOnly." type="compliance" onload_delay="90" status="approved" component="Tizen Device APIs/TBD/Push" execution_type="manual" priority="P1" id="PushMessage_requestId_attribute">
         <description>
-          <steps>
-            <step order="1">
-              <step_desc>Fill in the message box and click the "Push" button.</step_desc>
-              <expected>Push message is displayed and test case PASS.</expected>
-            </step>
-          </steps>
           <test_script_entry>/opt/tct-push-tizen-tests/push/PushMessage_requestId_attribute.html</test_script_entry>
         </description>
         <specs>
       </testcase>
       <testcase purpose="Check if sender attribute of PushMessage is readOnly." type="compliance" onload_delay="90" status="approved" component="Tizen Device APIs/TBD/Push" execution_type="manual" priority="P1" id="PushMessage_sender_attribute">
         <description>
-          <steps>
-            <step order="1">
-              <step_desc>Fill in the message box and click the "Push" button.</step_desc>
-              <expected>Push message is displayed and test case PASS.</expected>
-            </step>
-          </steps>
           <test_script_entry>/opt/tct-push-tizen-tests/push/PushMessage_sender_attribute.html</test_script_entry>
         </description>
         <specs>
       </testcase>
       <testcase purpose="Check if sessionInfo attribute of PushMessage is readOnly." type="compliance" onload_delay="90" status="approved" component="Tizen Device APIs/TBD/Push" execution_type="manual" priority="P1" id="PushMessage_sessionInfo_attribute">
         <description>
-          <steps>
-            <step order="1">
-              <step_desc>Fill in the message box and click the "Push" button.</step_desc>
-              <expected>Push message is displayed and test case PASS.</expected>
-            </step>
-          </steps>
           <test_script_entry>/opt/tct-push-tizen-tests/push/PushMessage_sessionInfo_attribute.html</test_script_entry>
         </description>
         <specs>
index 5eb24b13030d0c79c5606fb8609de96de72bc6ca..faad1a910c200df35747723bfd29f5d27b31e4fd 100755 (executable)
       </testcase>
       <testcase purpose="Check if alertMessage attribute of PushMessage is readOnly." onload_delay="90" component="Tizen Device APIs/TBD/Push" execution_type="manual" id="PushMessage_alertMessage_attribute">
         <description>
-          <steps>
-            <step order="1">
-              <step_desc>Fill in the message box and click the "Push" button.</step_desc>
-              <expected>Push message is displayed and test case PASS.</expected>
-            </step>
-          </steps>
           <test_script_entry>/opt/tct-push-tizen-tests/push/PushMessage_alertMessage_attribute.html</test_script_entry>
         </description>
       </testcase>
       <testcase purpose="Check if appData attribute of PushMessage is readOnly." onload_delay="90" component="Tizen Device APIs/TBD/Push" execution_type="manual" id="PushMessage_appData_attribute">
         <description>
-          <steps>
-            <step order="1">
-              <step_desc>Fill in the message box and click the "Push" button.</step_desc>
-              <expected>Push message is displayed and test case PASS.</expected>
-            </step>
-          </steps>
           <test_script_entry>/opt/tct-push-tizen-tests/push/PushMessage_appData_attribute.html</test_script_entry>
         </description>
       </testcase>
       <testcase purpose="Check if date attribute of PushMessage is readOnly." onload_delay="90" component="Tizen Device APIs/TBD/Push" execution_type="manual" id="PushMessage_date_attribute">
         <description>
-          <steps>
-            <step order="1">
-              <step_desc>Fill in the message box and click the "Push" button.</step_desc>
-              <expected>Push message is displayed and test case PASS.</expected>
-            </step>
-          </steps>
           <test_script_entry>/opt/tct-push-tizen-tests/push/PushMessage_date_attribute.html</test_script_entry>
         </description>
       </testcase>
       </testcase>
       <testcase purpose="Check if PushNotificationCallback works" onload_delay="90" component="Tizen Device APIs/TBD/Push" execution_type="manual" id="PushNotificationCallback_onsuccess">
         <description>
-          <steps>
-            <step order="1">
-              <step_desc>Fill in the message box and click the "Push" button.</step_desc>
-              <expected>Push message is displayed and test case PASS.</expected>
-            </step>
-          </steps>
           <test_script_entry>/opt/tct-push-tizen-tests/push/PushNotificationCallback_onsuccess.html</test_script_entry>
         </description>
       </testcase>
       </testcase>
       <testcase purpose="Check if message attribute of PushMessage is readOnly." onload_delay="90" component="Tizen Device APIs/TBD/Push" execution_type="manual" id="PushMessage_message_attribute">
         <description>
-          <steps>
-            <step order="1">
-              <step_desc>Fill in the message box and click the "Push" button.</step_desc>
-              <expected>Push message is displayed and test case PASS.</expected>
-            </step>
-          </steps>
           <test_script_entry>/opt/tct-push-tizen-tests/push/PushMessage_message_attribute.html</test_script_entry>
         </description>
       </testcase>
       <testcase purpose="Check if requestId attribute of PushMessage is readOnly." onload_delay="90" component="Tizen Device APIs/TBD/Push" execution_type="manual" id="PushMessage_requestId_attribute">
         <description>
-          <steps>
-            <step order="1">
-              <step_desc>Fill in the message box and click the "Push" button.</step_desc>
-              <expected>Push message is displayed and test case PASS.</expected>
-            </step>
-          </steps>
           <test_script_entry>/opt/tct-push-tizen-tests/push/PushMessage_requestId_attribute.html</test_script_entry>
         </description>
       </testcase>
       <testcase purpose="Check if sender attribute of PushMessage is readOnly." onload_delay="90" component="Tizen Device APIs/TBD/Push" execution_type="manual" id="PushMessage_sender_attribute">
         <description>
-          <steps>
-            <step order="1">
-              <step_desc>Fill in the message box and click the "Push" button.</step_desc>
-              <expected>Push message is displayed and test case PASS.</expected>
-            </step>
-          </steps>
           <test_script_entry>/opt/tct-push-tizen-tests/push/PushMessage_sender_attribute.html</test_script_entry>
         </description>
       </testcase>
       <testcase purpose="Check if sessionInfo attribute of PushMessage is readOnly." onload_delay="90" component="Tizen Device APIs/TBD/Push" execution_type="manual" id="PushMessage_sessionInfo_attribute">
         <description>
-          <steps>
-            <step order="1">
-              <step_desc>Fill in the message box and click the "Push" button.</step_desc>
-              <expected>Push message is displayed and test case PASS.</expected>
-            </step>
-          </steps>
           <test_script_entry>/opt/tct-push-tizen-tests/push/PushMessage_sessionInfo_attribute.html</test_script_entry>
         </description>
       </testcase>