From: Pawel Kaczmarczyk Date: Tue, 3 Jul 2018 05:50:31 +0000 (+0200) Subject: [Application] Change application tests into automated X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c20a27c5fc3b2e6f5661d735462dde4b6d7f1629;p=test%2Ftct%2Fweb%2Fapi.git [Application] Change application tests into automated [Verification] tct-application-tizen-tests 100% (242 tcs) testkit-stub built with: https://review.tizen.org/gerrit/183170/ Change-Id: Id0ac2350f05088fcd5e022f7b820e0b001c8c3fe Signed-off-by: Pawel Kaczmarczyk --- diff --git a/common/tct-application-tizen-tests/application/ApplicationInformationEventCallback_oninstalled.html b/common/tct-application-tizen-tests/application/ApplicationInformationEventCallback_oninstalled.html index a2f9c5a17..0a8357881 100755 --- a/common/tct-application-tizen-tests/application/ApplicationInformationEventCallback_oninstalled.html +++ b/common/tct-application-tizen-tests/application/ApplicationInformationEventCallback_oninstalled.html @@ -48,6 +48,8 @@ Authors: //==== PRIORITY P1 //==== TEST_CRITERIA CBT CBOA +executeCommand(TCT_APPINFO_UNINSTALL_COMMAND); + setup({timeout: 300000}); var t = async_test(document.title, {timeout: 300000}), appEventCallback, watchId; @@ -80,6 +82,7 @@ t.step(function () { watchId = tizen.application.addAppInfoEventListener(appEventCallback); assert_type(watchId, "long", "wrong listener ID"); + executeCommand(TCT_APPINFOv1_INSTALL_COMMAND); }); diff --git a/common/tct-application-tizen-tests/application/ApplicationInformationEventCallback_onuninstalled.html b/common/tct-application-tizen-tests/application/ApplicationInformationEventCallback_onuninstalled.html index f5819910f..e54b632d8 100755 --- a/common/tct-application-tizen-tests/application/ApplicationInformationEventCallback_onuninstalled.html +++ b/common/tct-application-tizen-tests/application/ApplicationInformationEventCallback_onuninstalled.html @@ -48,6 +48,8 @@ Authors: //==== PRIORITY P1 //==== TEST_CRITERIA CBT CBOA +executeCommand(TCT_APPINFOv1_INSTALL_COMMAND); + setup({timeout: 300000}); var t = async_test(document.title, {timeout: 300000}), appEventCallback, watchId; @@ -71,6 +73,8 @@ t.step(function () { watchId = tizen.application.addAppInfoEventListener(appEventCallback); assert_type(watchId, "long", "wrong listener ID"); + executeCommand(TCT_APPINFO_UNINSTALL_COMMAND); + }); diff --git a/common/tct-application-tizen-tests/application/ApplicationInformationEventCallback_onupdated.html b/common/tct-application-tizen-tests/application/ApplicationInformationEventCallback_onupdated.html index aa5bb7e67..e34787c61 100755 --- a/common/tct-application-tizen-tests/application/ApplicationInformationEventCallback_onupdated.html +++ b/common/tct-application-tizen-tests/application/ApplicationInformationEventCallback_onupdated.html @@ -48,6 +48,9 @@ Authors: //==== PRIORITY P1 //==== TEST_CRITERIA CBT CBOA +executeCommand(TCT_APPINFO_UNINSTALL_COMMAND); +executeCommand(TCT_APPINFOv1_INSTALL_COMMAND); + setup({timeout: 300000}); var t = async_test(document.title, {timeout: 300000}), appEventCallback, watchId; @@ -80,6 +83,8 @@ t.step(function () { watchId = tizen.application.addAppInfoEventListener(appEventCallback); assert_type(watchId, "long", "wrong listener ID"); + executeCommand(TCT_APPINFOv2_INSTALL_COMMAND); + }); diff --git a/common/tct-application-tizen-tests/application/ApplicationManager_addAppInfoEventListener_oninstalled.html b/common/tct-application-tizen-tests/application/ApplicationManager_addAppInfoEventListener_oninstalled.html index 49e3059dd..29a8993e4 100755 --- a/common/tct-application-tizen-tests/application/ApplicationManager_addAppInfoEventListener_oninstalled.html +++ b/common/tct-application-tizen-tests/application/ApplicationManager_addAppInfoEventListener_oninstalled.html @@ -48,6 +48,8 @@ Authors: //==== PRIORITY P1 //==== TEST_CRITERIA MMINA MAST MR +executeCommand(TCT_APPINFO_UNINSTALL_COMMAND); + setup({timeout: 300000}); var t = async_test(document.title, {timeout: 300000}), appEventCallback, watchId; @@ -67,6 +69,8 @@ t.step(function () { watchId = tizen.application.addAppInfoEventListener(appEventCallback); assert_type(watchId, "long", "wrong listener ID"); + + executeCommand(TCT_APPINFOv1_INSTALL_COMMAND); }); diff --git a/common/tct-application-tizen-tests/application/ApplicationManager_addAppInfoEventListener_onuninstalled.html b/common/tct-application-tizen-tests/application/ApplicationManager_addAppInfoEventListener_onuninstalled.html index 9b80cb213..8d1c7b535 100755 --- a/common/tct-application-tizen-tests/application/ApplicationManager_addAppInfoEventListener_onuninstalled.html +++ b/common/tct-application-tizen-tests/application/ApplicationManager_addAppInfoEventListener_onuninstalled.html @@ -48,6 +48,8 @@ Authors: //==== PRIORITY P1 //==== TEST_CRITERIA MMINA MAST MR +executeCommand(TCT_APPINFOv1_INSTALL_COMMAND); + setup({timeout: 300000}); var t = async_test(document.title, {timeout: 300000}), appEventCallback, watchId; @@ -67,6 +69,8 @@ t.step(function () { watchId = tizen.application.addAppInfoEventListener(appEventCallback); assert_type(watchId, "long", "wrong listener ID"); + + executeCommand(TCT_APPINFO_UNINSTALL_COMMAND); }); diff --git a/common/tct-application-tizen-tests/application/ApplicationManager_addAppInfoEventListener_onupdated.html b/common/tct-application-tizen-tests/application/ApplicationManager_addAppInfoEventListener_onupdated.html index f63f552d2..c349464e6 100755 --- a/common/tct-application-tizen-tests/application/ApplicationManager_addAppInfoEventListener_onupdated.html +++ b/common/tct-application-tizen-tests/application/ApplicationManager_addAppInfoEventListener_onupdated.html @@ -48,6 +48,9 @@ Authors: //==== PRIORITY P1 //==== TEST_CRITERIA MMINA MAST MR +executeCommand(TCT_APPINFO_UNINSTALL_COMMAND); +executeCommand(TCT_APPINFOv1_INSTALL_COMMAND); + setup({timeout: 300000}); var t = async_test(document.title, {timeout: 300000}), appEventCallback, watchId; @@ -68,6 +71,7 @@ t.step(function () { watchId = tizen.application.addAppInfoEventListener(appEventCallback); assert_type(watchId, "long", "wrong listener ID"); + executeCommand(TCT_APPINFOv2_INSTALL_COMMAND); }); diff --git a/common/tct-application-tizen-tests/application/ApplicationManager_addAppStatusChangeListener.html b/common/tct-application-tizen-tests/application/ApplicationManager_addAppStatusChangeListener.html index 01e06c56a..3b159528e 100644 --- a/common/tct-application-tizen-tests/application/ApplicationManager_addAppStatusChangeListener.html +++ b/common/tct-application-tizen-tests/application/ApplicationManager_addAppStatusChangeListener.html @@ -47,6 +47,8 @@ Authors: //==== PRIORITY P1 //==== TEST_CRITERIA MMINA MR +executeCommand(TCT_DEACTIVATE_APP_COMMAND); + setup({timeout: 300000}); var t = async_test(document.title, {timeout: 300000}), statusEventCallback, watchId; @@ -59,6 +61,9 @@ t.step(function () { watchId = tizen.application.addAppStatusChangeListener(statusEventCallback); assert_type(watchId, "long", "wrong listener ID"); + + executeCommand(TCT_ACTIVATE_APP_COMMAND); + }); diff --git a/common/tct-application-tizen-tests/application/ApplicationManager_addAppStatusChangeListener_with_appId.html b/common/tct-application-tizen-tests/application/ApplicationManager_addAppStatusChangeListener_with_appId.html index 951e3eb64..bba8ab85a 100644 --- a/common/tct-application-tizen-tests/application/ApplicationManager_addAppStatusChangeListener_with_appId.html +++ b/common/tct-application-tizen-tests/application/ApplicationManager_addAppStatusChangeListener_with_appId.html @@ -47,6 +47,8 @@ Authors: //==== PRIORITY P1 //==== TEST_CRITERIA MOA MR +executeCommand(TCT_DEACTIVATE_APP_COMMAND); + setup({timeout: 300000}); var t = async_test(document.title, {timeout: 300000}), statusEventCallback, watchId; @@ -59,6 +61,8 @@ t.step(function () { watchId = tizen.application.addAppStatusChangeListener(statusEventCallback, "api1appli1.TCTAppControl"); assert_type(watchId, "long", "wrong listener ID"); + + executeCommand(TCT_ACTIVATE_APP_COMMAND); }); diff --git a/common/tct-application-tizen-tests/application/StatusEventCallback_onchange.html b/common/tct-application-tizen-tests/application/StatusEventCallback_onchange.html index 32a665179..ebbc6d220 100644 --- a/common/tct-application-tizen-tests/application/StatusEventCallback_onchange.html +++ b/common/tct-application-tizen-tests/application/StatusEventCallback_onchange.html @@ -47,6 +47,8 @@ Authors: //==== PRIORITY P1 //==== TEST_CRITERIA CBT CBOA +executeCommand(TCT_DEACTIVATE_APP_COMMAND); + setup({timeout: 300000}); var t = async_test(document.title, {timeout: 300000}), appEventCallback, watchId; @@ -60,6 +62,7 @@ t.step(function () { watchId = tizen.application.addAppStatusChangeListener(appEventCallback); + executeCommand(TCT_ACTIVATE_APP_COMMAND); }); diff --git a/common/tct-application-tizen-tests/application/support/app_common.js b/common/tct-application-tizen-tests/application/support/app_common.js index 41bb9c1e4..8ebd0aa41 100755 --- a/common/tct-application-tizen-tests/application/support/app_common.js +++ b/common/tct-application-tizen-tests/application/support/app_common.js @@ -60,6 +60,18 @@ var TCT_APPCONTROL_EXIT_OPERATION = "http://tizen.org/appcontrol/operation/tct/e var TYPE_MISMATCH_ERR = {name: 'TypeMismatchError'}; +var TCT_APPINFO_WGT_LOCATION = "/home/owner/share/Others/"; +var TCT_APPINFOv1_WGT_PATH = TCT_APPINFO_WGT_LOCATION + "TCTAppInfoEventTest1.wgt"; +var TCT_APPINFOv2_WGT_PATH = TCT_APPINFO_WGT_LOCATION + "TCTAppInfoEventTest2.wgt"; +var TCT_APPINFOv1_INSTALL_COMMAND = "pkgcmd -i -t wgt -p " + TCT_APPINFOv1_WGT_PATH; +var TCT_APPINFOv2_INSTALL_COMMAND = "pkgcmd -i -t wgt -p " + TCT_APPINFOv2_WGT_PATH; + +var TCT_APPINFO_PACKAGE_ID = "api1appli3"; +var TCT_APPINFO_UNINSTALL_COMMAND = "pkgcmd -u -n " + TCT_APPINFO_PACKAGE_ID; + +var TCT_ACTIVATE_APP_COMMAND = "pkgcmd -A -t app -n api1appli1.TCTAppControl --global"; +var TCT_DEACTIVATE_APP_COMMAND = "pkgcmd -D -t app -n api1appli1.TCTAppControl --global"; + var TIMEOUT_AUTO_TEST = 30000; setup({timeout: TIMEOUT_AUTO_TEST}); @@ -205,3 +217,5 @@ function assert_not_kill(t, appId, onsuccess) { function assert_exit(t, appId, onsuccess) { assert_kill(t, appId, onsuccess); } + +document.write(""); \ No newline at end of file diff --git a/common/tct-application-tizen-tests/application/support/unitcommon.js b/common/tct-application-tizen-tests/application/support/unitcommon.js index 59e2b11ff..615edb622 100755 --- a/common/tct-application-tizen-tests/application/support/unitcommon.js +++ b/common/tct-application-tizen-tests/application/support/unitcommon.js @@ -562,3 +562,16 @@ 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)); +} \ No newline at end of file diff --git a/common/tct-application-tizen-tests/tests.xml b/common/tct-application-tizen-tests/tests.xml index 4382f0407..d70a96451 100755 --- a/common/tct-application-tizen-tests/tests.xml +++ b/common/tct-application-tizen-tests/tests.xml @@ -148,7 +148,7 @@ /opt/tct-application-tizen-tests/application/ApplicationInformationArraySuccessCallback_onsuccess.html - + Make sure that TCTAppInfoEventTest1 application is not installed (uninstall it) @@ -160,7 +160,7 @@ /opt/tct-application-tizen-tests/application/ApplicationInformationEventCallback_oninstalled.html - + Make sure that TCTAppInfoEventTest1 application is installed (you can install it using command "pkgcmd –i –t wgt -q –p {DEVICE_SUITE_TARGET_30}/Others/TCTAppInfoEventTest1.wgt"). @@ -172,7 +172,7 @@ /opt/tct-application-tizen-tests/application/ApplicationInformationEventCallback_onuninstalled.html - + Make sure that TCTAppInfoEventTest1 application is installed (you can install it using command "pkgcmd –i –t wgt -q –p {DEVICE_SUITE_TARGET_30}/Others/TCTAppInfoEventTest1.wgt"). @@ -264,7 +264,7 @@ /opt/tct-application-tizen-tests/application/ApplicationManager_addAppInfoEventListener_missarg.html - + Make sure that TCTAppInfoEventTest1 application is not installed (uninstall it) @@ -276,7 +276,7 @@ /opt/tct-application-tizen-tests/application/ApplicationManager_addAppInfoEventListener_oninstalled.html - + Make sure that TCTAppInfoEventTest1 application is installed (you can install it using command "pkgcmd –i –t wgt -q –p {DEVICE_SUITE_TARGET_30}/Others/TCTAppInfoEventTest1.wgt"). @@ -288,7 +288,7 @@ /opt/tct-application-tizen-tests/application/ApplicationManager_addAppInfoEventListener_onuninstalled.html - + Make sure that TCTAppInfoEventTest1 application is installed (you can install it using command "pkgcmd –i –t wgt -q –p {DEVICE_SUITE_TARGET_30}/Others/TCTAppInfoEventTest1.wgt"). @@ -870,7 +870,7 @@ /opt/tct-application-tizen-tests/application/EventCallback_notexist.html - + @@ -914,7 +914,7 @@ /opt/tct-application-tizen-tests/application/ApplicationManager_addAppStatusChangeListener_misarg.html - + @@ -948,7 +948,7 @@ /opt/tct-application-tizen-tests/application/StatusEventCallback_notexist.html - +