From 374621fd72da307f4d74db03d8e9dda872d186f4 Mon Sep 17 00:00:00 2001 From: wangfenging Date: Thu, 27 Mar 2025 14:30:32 +0800 Subject: [PATCH] add auto test for appspawn cgroup Signed-off-by: wangfenging --- .../SUB_STARTUP_APPSPAWN_CGROUPS_0100.json | 14 ++++ .../SUB_STARTUP_APPSPAWN_CGROUPS_0100.py | 71 +++++++++++++++++++ .../SUB_STARTUP_APPSPAWN_CGROUPS_0200.json | 14 ++++ .../SUB_STARTUP_APPSPAWN_CGROUPS_0200.py | 69 ++++++++++++++++++ .../SUB_STARTUP_APPSPAWN_CGROUPS_0300.json | 14 ++++ .../SUB_STARTUP_APPSPAWN_CGROUPS_0300.py | 69 ++++++++++++++++++ ...STARTUP_APPSPAWN_FILEMGR_SANDBOX_0100.json | 14 ++++ ...B_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0100.py | 56 +++++++++++++++ ...STARTUP_APPSPAWN_FILEMGR_SANDBOX_0200.json | 14 ++++ ...B_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0200.py | 56 +++++++++++++++ ...STARTUP_APPSPAWN_FILEMGR_SANDBOX_0300.json | 14 ++++ ...B_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0300.py | 56 +++++++++++++++ ...STARTUP_APPSPAWN_FILEMGR_SANDBOX_0400.json | 14 ++++ ...B_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0400.py | 56 +++++++++++++++ ...STARTUP_APPSPAWN_FILEMGR_SANDBOX_0500.json | 14 ++++ ...B_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0500.py | 59 +++++++++++++++ ...STARTUP_APPSPAWN_FILEMGR_SANDBOX_0600.json | 14 ++++ ...B_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0600.py | 54 ++++++++++++++ ...STARTUP_APPSPAWN_FILEMGR_SANDBOX_0700.json | 14 ++++ ...B_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0700.py | 58 +++++++++++++++ ...STARTUP_APPSPAWN_FILEMGR_SANDBOX_0800.json | 14 ++++ ...B_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0800.py | 58 +++++++++++++++ ...STARTUP_APPSPAWN_FILEMGR_SANDBOX_0900.json | 14 ++++ ...B_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0900.py | 58 +++++++++++++++ ...STARTUP_APPSPAWN_FILEMGR_SANDBOX_1000.json | 14 ++++ ...B_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1000.py | 56 +++++++++++++++ ...STARTUP_APPSPAWN_FILEMGR_SANDBOX_1100.json | 14 ++++ ...B_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1100.py | 56 +++++++++++++++ ...STARTUP_APPSPAWN_FILEMGR_SANDBOX_1200.json | 14 ++++ ...B_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1200.py | 56 +++++++++++++++ ...STARTUP_APPSPAWN_FILEMGR_SANDBOX_1300.json | 14 ++++ ...B_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1300.py | 54 ++++++++++++++ ...STARTUP_APPSPAWN_FILEMGR_SANDBOX_1400.json | 14 ++++ ...B_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1400.py | 56 +++++++++++++++ ...STARTUP_APPSPAWN_FILEMGR_SANDBOX_1500.json | 14 ++++ ...B_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1500.py | 56 +++++++++++++++ ...STARTUP_APPSPAWN_FILEMGR_SANDBOX_1600.json | 14 ++++ ...B_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1600.py | 59 +++++++++++++++ ...STARTUP_APPSPAWN_FILEMGR_SANDBOX_1700.json | 14 ++++ ...B_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1700.py | 55 ++++++++++++++ 40 files changed, 1448 insertions(+) create mode 100644 test/autotest/sub_startup_appspawn_cgroup/SUB_STARTUP_APPSPAWN_CGROUPS_0100.json create mode 100644 test/autotest/sub_startup_appspawn_cgroup/SUB_STARTUP_APPSPAWN_CGROUPS_0100.py create mode 100644 test/autotest/sub_startup_appspawn_cgroup/SUB_STARTUP_APPSPAWN_CGROUPS_0200.json create mode 100644 test/autotest/sub_startup_appspawn_cgroup/SUB_STARTUP_APPSPAWN_CGROUPS_0200.py create mode 100644 test/autotest/sub_startup_appspawn_cgroup/SUB_STARTUP_APPSPAWN_CGROUPS_0300.json create mode 100644 test/autotest/sub_startup_appspawn_cgroup/SUB_STARTUP_APPSPAWN_CGROUPS_0300.py create mode 100644 test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0100.json create mode 100644 test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0100.py create mode 100644 test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0200.json create mode 100644 test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0200.py create mode 100644 test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0300.json create mode 100644 test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0300.py create mode 100644 test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0400.json create mode 100644 test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0400.py create mode 100644 test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0500.json create mode 100644 test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0500.py create mode 100644 test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0600.json create mode 100644 test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0600.py create mode 100644 test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0700.json create mode 100644 test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0700.py create mode 100644 test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0800.json create mode 100644 test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0800.py create mode 100644 test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0900.json create mode 100644 test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0900.py create mode 100644 test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1000.json create mode 100644 test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1000.py create mode 100644 test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1100.json create mode 100644 test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1100.py create mode 100644 test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1200.json create mode 100644 test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1200.py create mode 100644 test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1300.json create mode 100644 test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1300.py create mode 100644 test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1400.json create mode 100644 test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1400.py create mode 100644 test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1500.json create mode 100644 test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1500.py create mode 100644 test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1600.json create mode 100644 test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1600.py create mode 100644 test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1700.json create mode 100644 test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1700.py diff --git a/test/autotest/sub_startup_appspawn_cgroup/SUB_STARTUP_APPSPAWN_CGROUPS_0100.json b/test/autotest/sub_startup_appspawn_cgroup/SUB_STARTUP_APPSPAWN_CGROUPS_0100.json new file mode 100644 index 00000000..b2815cde --- /dev/null +++ b/test/autotest/sub_startup_appspawn_cgroup/SUB_STARTUP_APPSPAWN_CGROUPS_0100.json @@ -0,0 +1,14 @@ +{ + "description": "Config for OpenHarmony devicetest test cases", + "environment": [ + { + "type": "device" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "SUB_STARTUP_APPSPAWN_CGROUPS/SUB_STARTUP_APPSPAWN_CGROUPS_0100.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_cgroup/SUB_STARTUP_APPSPAWN_CGROUPS_0100.py b/test/autotest/sub_startup_appspawn_cgroup/SUB_STARTUP_APPSPAWN_CGROUPS_0100.py new file mode 100644 index 00000000..e5ec2b7b --- /dev/null +++ b/test/autotest/sub_startup_appspawn_cgroup/SUB_STARTUP_APPSPAWN_CGROUPS_0100.py @@ -0,0 +1,71 @@ +# -*- coding: utf-8 -*- +''' +#!!================================================================ +#版权 (C) 2024, Huawei Technologies Co., HUTAF xDevice +#================================================================== +#文 件 名: SUB_STARTUP_APPSPAWN_CGROUPS_0100.py +#文件说明: +#作 者: lWX1283052 +#生成日期: 2024-05-11 +#!!================================================================ +''' +import time +from devicetest.core.test_case import TestCase, Step +from hypium import * + +from aw import Common + +class SUB_STARTUP_APPSPAWN_CGROUPS_0100(TestCase): + + def __init__(self, controllers): + self.TAG = self.__class__.__name__ + TestCase.__init__(self, self.TAG, controllers) + self.driver = UiDriver(self.device1) + + def setup(self): + Step(self.devices[0].device_id) + global device + device = self.driver.shell("param get const.product.model") + device = device.replace("\n", "").replace(" ", "") + device = str(device) + Step(device) + # 解锁屏幕 + wake = self.driver.Screen.is_on() + time.sleep(0.5) + if wake: + self.driver.ScreenLock.unlock() + else: + self.driver.Screen.wake_up() + self.driver.ScreenLock.unlock() + self.driver.shell("power-shell setmode 602") + + def process(self): + hap_path = Common.sourcepath('ForkTest1.hap', "SUB_STARTUP_APPSPAWN_CGROUPS") + global bundle_name + bundle_name = "com.example.exe_sys_cmd" + hap = self.driver.AppManager.has_app(bundle_name) + if hap: + self.driver.AppManager.clear_app_data(bundle_name) + self.driver.AppManager.uninstall_app(bundle_name) + self.driver.AppManager.install_app(hap_path) + else: + self.driver.AppManager.install_app(hap_path) + self.driver.AppManager.start_app(bundle_name) + pid = self.driver.System.get_pid(bundle_name) + result1 = self.driver.shell("ps -ef |grep %s" % bundle_name) + cgroup1 = self.driver.shell("cat /dev/pids/100/%s/app_%d/cgroup.procs" %(bundle_name, pid)).split() + count = 0 + for i in cgroup1: + self.driver.Assert.contains(result1.split(), i) + if result1.count(i) == 2: + count += 1 + self.driver.Assert.equal(count, 1) + result2 = self.driver.shell("kill -9 %d" % pid) + self.driver.Assert.equal(result2, '') + result3 = self.driver.shell("ps -ef |grep %s|grep -v grep " % bundle_name) + self.driver.Assert.equal(result3, '') + + def teardown(self): + Step("收尾工作.................") + self.driver.AppManager.clear_app_data(bundle_name) + self.driver.AppManager.uninstall_app(bundle_name) \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_cgroup/SUB_STARTUP_APPSPAWN_CGROUPS_0200.json b/test/autotest/sub_startup_appspawn_cgroup/SUB_STARTUP_APPSPAWN_CGROUPS_0200.json new file mode 100644 index 00000000..6a03b4bf --- /dev/null +++ b/test/autotest/sub_startup_appspawn_cgroup/SUB_STARTUP_APPSPAWN_CGROUPS_0200.json @@ -0,0 +1,14 @@ +{ + "description": "Config for OpenHarmony devicetest test cases", + "environment": [ + { + "type": "device" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "SUB_STARTUP_APPSPAWN_CGROUPS/SUB_STARTUP_APPSPAWN_CGROUPS_0200.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_cgroup/SUB_STARTUP_APPSPAWN_CGROUPS_0200.py b/test/autotest/sub_startup_appspawn_cgroup/SUB_STARTUP_APPSPAWN_CGROUPS_0200.py new file mode 100644 index 00000000..e65b75cc --- /dev/null +++ b/test/autotest/sub_startup_appspawn_cgroup/SUB_STARTUP_APPSPAWN_CGROUPS_0200.py @@ -0,0 +1,69 @@ +# -*- coding: utf-8 -*- +''' +#!!================================================================ +#版权 (C) 2024, Huawei Technologies Co., HUTAF xDevice +#================================================================== +#文 件 名: SUB_STARTUP_APPSPAWN_CGROUPS_0200.py +#文件说明: +#作 者: lWX1283052 +#生成日期: 2024-05-21 +#!!================================================================ +''' +import time +from devicetest.core.test_case import TestCase, Step +from hypium import * + +from aw import Common + +class SUB_STARTUP_APPSPAWN_CGROUPS_0200(TestCase): + + def __init__(self, controllers): + self.TAG = self.__class__.__name__ + TestCase.__init__(self, self.TAG, controllers) + self.driver = UiDriver(self.device1) + + def setup(self): + Step(self.devices[0].device_id) + global device + device = self.driver.shell("param get const.product.model") + device = device.replace("\n", "").replace(" ", "") + device = str(device) + Step(device) + # 解锁屏幕 + wake = self.driver.Screen.is_on() + time.sleep(0.5) + if wake: + self.driver.ScreenLock.unlock() + else: + self.driver.Screen.wake_up() + self.driver.ScreenLock.unlock() + self.driver.shell("power-shell timeout -o 86400000") + + def process(self): + hap_path = Common.sourcepath('ForkTest2.hap', "SUB_STARTUP_APPSPAWN_CGROUPS") + bundle_name = "com.example.exe_sys_cmd" + hap = self.driver.AppManager.has_app(bundle_name) + if hap: + self.driver.AppManager.clear_app_data(bundle_name) + self.driver.AppManager.uninstall_app(bundle_name) + self.driver.AppManager.install_app(hap_path) + else: + self.driver.AppManager.install_app(hap_path) + self.driver.AppManager.start_app(bundle_name) + pid = self.driver.System.get_pid(bundle_name) + result1 = self.driver.shell("ps -ef |grep %s" % bundle_name) + cgroup1 = self.driver.shell("cat /dev/pids/100/%s/app_%d/cgroup.procs" %(bundle_name, pid)).split() + count = 0 + for i in cgroup1: + self.driver.Assert.contains(result1.split(), i) + if result1.count(i) == 3: + count += 1 + self.driver.Assert.equal(count, 1) + result2 = self.driver.shell("kill -9 %d" % pid) + self.driver.Assert.equal(result2, '') + result3 = self.driver.shell("ps -ef |grep %s|grep -v grep " % bundle_name) + self.driver.Assert.equal(result3, '') + + def teardown(self): + Step("收尾工作.................") + self.driver.AppManager.uninstall_app("com.example.exe_sys_cmd") \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_cgroup/SUB_STARTUP_APPSPAWN_CGROUPS_0300.json b/test/autotest/sub_startup_appspawn_cgroup/SUB_STARTUP_APPSPAWN_CGROUPS_0300.json new file mode 100644 index 00000000..cf292725 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_cgroup/SUB_STARTUP_APPSPAWN_CGROUPS_0300.json @@ -0,0 +1,14 @@ +{ + "description": "Config for OpenHarmony devicetest test cases", + "environment": [ + { + "type": "device" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "SUB_STARTUP_APPSPAWN_CGROUPS/SUB_STARTUP_APPSPAWN_CGROUPS_0300.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_cgroup/SUB_STARTUP_APPSPAWN_CGROUPS_0300.py b/test/autotest/sub_startup_appspawn_cgroup/SUB_STARTUP_APPSPAWN_CGROUPS_0300.py new file mode 100644 index 00000000..701d0cb9 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_cgroup/SUB_STARTUP_APPSPAWN_CGROUPS_0300.py @@ -0,0 +1,69 @@ +# -*- coding: utf-8 -*- +''' +#!!================================================================ +#版权 (C) 2024, Huawei Technologies Co., HUTAF xDevice +#================================================================== +#文 件 名: SUB_STARTUP_APPSPAWN_CGROUPS_0300.py +#文件说明: +#作 者: lWX1283052 +#生成日期: 2024-05-21 +#!!================================================================ +''' +import time +from devicetest.core.test_case import TestCase, Step +from hypium import * + +from aw import Common + +class SUB_STARTUP_APPSPAWN_CGROUPS_0300(TestCase): + + def __init__(self, controllers): + self.TAG = self.__class__.__name__ + TestCase.__init__(self, self.TAG, controllers) + self.driver = UiDriver(self.device1) + + def setup(self): + Step(self.devices[0].device_id) + global device + device = self.driver.shell("param get const.product.model") + device = device.replace("\n", "").replace(" ", "") + device = str(device) + Step(device) + # 解锁屏幕 + wake = self.driver.Screen.is_on() + time.sleep(0.5) + if wake: + self.driver.ScreenLock.unlock() + else: + self.driver.Screen.wake_up() + self.driver.ScreenLock.unlock() + self.driver.shell("power-shell timeout -o 86400000") + + def process(self): + hap_path = Common.sourcepath('ForkTest3.hap', "SUB_STARTUP_APPSPAWN_CGROUPS") + bundle_name = "com.example.exe_sys_cmd" + hap = self.driver.AppManager.has_app(bundle_name) + if hap: + self.driver.AppManager.clear_app_data(bundle_name) + self.driver.AppManager.uninstall_app(bundle_name) + self.driver.AppManager.install_app(hap_path) + else: + self.driver.AppManager.install_app(hap_path) + self.driver.AppManager.start_app(bundle_name) + pid = self.driver.System.get_pid(bundle_name) + result1 = self.driver.shell("ps -ef |grep %s" % bundle_name) + cgroup1 = self.driver.shell("cat /dev/pids/100/%s/app_%d/cgroup.procs" %(bundle_name, pid)).split() + count = 0 + for i in cgroup1: + self.driver.Assert.contains(result1.split(), i) + if result1.count(i) == 2: + count += 1 + self.driver.Assert.equal(count, 2) + result2 = self.driver.shell("kill -9 %d" % pid) + self.driver.Assert.equal(result2, '') + result3 = self.driver.shell("ps -ef |grep %s|grep -v grep " % bundle_name) + self.driver.Assert.equal(result3, '') + + def teardown(self): + Step("收尾工作.................") + self.driver.AppManager.uninstall_app("com.example.exe_sys_cmd") \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0100.json b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0100.json new file mode 100644 index 00000000..056e50eb --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0100.json @@ -0,0 +1,14 @@ +{ + "description": "Config for OpenHarmony devicetest test cases", + "environment": [ + { + "type": "device" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0100.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0100.py b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0100.py new file mode 100644 index 00000000..6d4965ef --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0100.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +''' +#!!================================================================ +#版权 (C) 2024, Huawei Technologies Co., HUTAF xDevice +#================================================================== +#文 件 名: SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0100.py +#文件说明: +#作 者: lWX1283052 +#生成日期: 2024-07-17 +#!!================================================================ +''' +import time +from devicetest.core.test_case import TestCase, Step +from hypium import * + +class SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0100(TestCase): + + def __init__(self, controllers): + self.TAG = self.__class__.__name__ + TestCase.__init__(self, self.TAG, controllers) + self.driver = UiDriver(self.device1) + + def setup(self): + Step(self.devices[0].device_id) + global device + device = self.driver.shell("param get const.product.model") + device = device.replace("\n", "").replace(" ", "") + device = str(device) + Step(device) + # 解锁屏幕 + wake = self.driver.Screen.is_on() + time.sleep(0.5) + if wake: + self.driver.ScreenLock.unlock() + else: + self.driver.Screen.wake_up() + self.driver.ScreenLock.unlock() + self.driver.Screen.enable_stay_awake() + + def process(self): + global file_mgr + file_mgr = "com.huawei.hmos.filemanager" + self.driver.shell("echo 0 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.start_app(file_mgr) + time.sleep(3) + pid = self.driver.System.get_pid(file_mgr) + result = self.driver.shell("ls /proc/%d/root/storage" % pid).split() + content = ["External", "Users", "hmdfs"] + for i in content: + self.driver.Assert.contains(result, i) + + def teardown(self): + Step("收尾工作.................") + self.driver.shell("echo 1 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.clear_app_data(file_mgr) + self.driver.AppManager.stop_app(file_mgr) \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0200.json b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0200.json new file mode 100644 index 00000000..e2427eb8 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0200.json @@ -0,0 +1,14 @@ +{ + "description": "Config for OpenHarmony devicetest test cases", + "environment": [ + { + "type": "device" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0200.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0200.py b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0200.py new file mode 100644 index 00000000..a93edb85 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0200.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +''' +#!!================================================================ +#版权 (C) 2024, Huawei Technologies Co., HUTAF xDevice +#================================================================== +#文 件 名: SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0200.py +#文件说明: +#作 者: lWX1283052 +#生成日期: 2024-07-17 +#!!================================================================ +''' +import time +from devicetest.core.test_case import TestCase, Step +from hypium import * + +class SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0200(TestCase): + + def __init__(self, controllers): + self.TAG = self.__class__.__name__ + TestCase.__init__(self, self.TAG, controllers) + self.driver = UiDriver(self.device1) + + def setup(self): + Step(self.devices[0].device_id) + global device + device = self.driver.shell("param get const.product.model") + device = device.replace("\n", "").replace(" ", "") + device = str(device) + Step(device) + # 解锁屏幕 + wake = self.driver.Screen.is_on() + time.sleep(0.5) + if wake: + self.driver.ScreenLock.unlock() + else: + self.driver.Screen.wake_up() + self.driver.ScreenLock.unlock() + self.driver.Screen.enable_stay_awake() + + def process(self): + global file_mgr + file_mgr = "com.huawei.hmos.filemanager" + self.driver.shell("echo 0 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.start_app(file_mgr) + time.sleep(3) + pid = self.driver.System.get_pid(file_mgr) + result = self.driver.shell("ls /proc/%d/root/storage/Users/currentUser" % pid).split() + content = ["Desktop", "Documents", "Download", "appdata"] + for i in content: + self.driver.Assert.contains(result, i) + + def teardown(self): + Step("收尾工作.................") + self.driver.shell("echo 1 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.clear_app_data(file_mgr) + self.driver.AppManager.stop_app(file_mgr) \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0300.json b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0300.json new file mode 100644 index 00000000..c4442d41 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0300.json @@ -0,0 +1,14 @@ +{ + "description": "Config for OpenHarmony devicetest test cases", + "environment": [ + { + "type": "device" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0300.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0300.py b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0300.py new file mode 100644 index 00000000..3389fbd1 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0300.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +''' +#!!================================================================ +#版权 (C) 2024, Huawei Technologies Co., HUTAF xDevice +#================================================================== +#文 件 名: SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0300.py +#文件说明: +#作 者: lWX1283052 +#生成日期: 2024-07-17 +#!!================================================================ +''' +import time +from devicetest.core.test_case import TestCase, Step +from hypium import * + +class SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0300(TestCase): + + def __init__(self, controllers): + self.TAG = self.__class__.__name__ + TestCase.__init__(self, self.TAG, controllers) + self.driver = UiDriver(self.device1) + + def setup(self): + Step(self.devices[0].device_id) + global device + device = self.driver.shell("param get const.product.model") + device = device.replace("\n", "").replace(" ", "") + device = str(device) + Step(device) + # 解锁屏幕 + wake = self.driver.Screen.is_on() + time.sleep(0.5) + if wake: + self.driver.ScreenLock.unlock() + else: + self.driver.Screen.wake_up() + self.driver.ScreenLock.unlock() + self.driver.Screen.enable_stay_awake() + + def process(self): + global file_mgr + file_mgr = "com.huawei.hmos.filemanager" + self.driver.shell("echo 0 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.start_app(file_mgr) + time.sleep(3) + pid = self.driver.System.get_pid(file_mgr) + result = self.driver.shell("ls -Z /proc/%d/root/storage/Users/currentUser/appdata" % pid) + content = ["el1", "el2"] + for i in content: + self.driver.Assert.contains(result, "u:object_r:sharefs:s0 %s" % i) + + def teardown(self): + Step("收尾工作.................") + self.driver.shell("echo 1 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.clear_app_data(file_mgr) + self.driver.AppManager.stop_app(file_mgr) \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0400.json b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0400.json new file mode 100644 index 00000000..76bbf588 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0400.json @@ -0,0 +1,14 @@ +{ + "description": "Config for OpenHarmony devicetest test cases", + "environment": [ + { + "type": "device" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0400.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0400.py b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0400.py new file mode 100644 index 00000000..59bac839 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0400.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +''' +#!!================================================================ +#版权 (C) 2024, Huawei Technologies Co., HUTAF xDevice +#================================================================== +#文 件 名: SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0400.py +#文件说明: +#作 者: lWX1283052 +#生成日期: 2024-07-17 +#!!================================================================ +''' +import time +from devicetest.core.test_case import TestCase, Step +from hypium import * + +class SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0400(TestCase): + + def __init__(self, controllers): + self.TAG = self.__class__.__name__ + TestCase.__init__(self, self.TAG, controllers) + self.driver = UiDriver(self.device1) + + def setup(self): + Step(self.devices[0].device_id) + global device + device = self.driver.shell("param get const.product.model") + device = device.replace("\n", "").replace(" ", "") + device = str(device) + Step(device) + # 解锁屏幕 + wake = self.driver.Screen.is_on() + time.sleep(0.5) + if wake: + self.driver.ScreenLock.unlock() + else: + self.driver.Screen.wake_up() + self.driver.ScreenLock.unlock() + self.driver.Screen.enable_stay_awake() + + def process(self): + global file_mgr + file_mgr = "com.huawei.hmos.filemanager" + self.driver.shell("echo 0 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.start_app(file_mgr) + time.sleep(3) + pid = self.driver.System.get_pid(file_mgr) + result = self.driver.shell("ls -Z /proc/%d/root/storage/Users/currentUser/appdata/el2" % pid) + content = ["base", "distributedfiles", "cloud"] + for i in content: + self.driver.Assert.contains(result, "u:object_r:sharefs:s0 %s" % i) + + def teardown(self): + Step("收尾工作.................") + self.driver.shell("echo 1 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.clear_app_data(file_mgr) + self.driver.AppManager.stop_app(file_mgr) \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0500.json b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0500.json new file mode 100644 index 00000000..fbc89d1b --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0500.json @@ -0,0 +1,14 @@ +{ + "description": "Config for OpenHarmony devicetest test cases", + "environment": [ + { + "type": "device" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0500.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0500.py b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0500.py new file mode 100644 index 00000000..ecdf8e43 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0500.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +''' +#!!================================================================ +#版权 (C) 2024, Huawei Technologies Co., HUTAF xDevice +#================================================================== +#文 件 名: SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0500.py +#文件说明: +#作 者: lWX1283052 +#生成日期: 2024-07-17 +#!!================================================================ +''' +import time +from devicetest.core.test_case import TestCase, Step +from hypium import * + +class SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0500(TestCase): + + def __init__(self, controllers): + self.TAG = self.__class__.__name__ + TestCase.__init__(self, self.TAG, controllers) + self.driver = UiDriver(self.device1) + + def setup(self): + Step(self.devices[0].device_id) + global device + device = self.driver.shell("param get const.product.model") + device = device.replace("\n", "").replace(" ", "") + device = str(device) + Step(device) + # 解锁屏幕 + wake = self.driver.Screen.is_on() + time.sleep(0.5) + if wake: + self.driver.ScreenLock.unlock() + else: + self.driver.Screen.wake_up() + self.driver.ScreenLock.unlock() + self.driver.Screen.enable_stay_awake() + + def process(self): + global file_mgr + count = 0 + file_mgr = "com.huawei.hmos.filemanager" + self.driver.shell("echo 0 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.start_app(file_mgr) + time.sleep(3) + pid = self.driver.System.get_pid(file_mgr) + for i in range(1, 3): + result = self.driver.shell("ls /proc/%d/root/storage/Users/currentUser/appdata/el%d/base" % (pid, i)).split() + for bundle_name in result: + if "com.huawei" in bundle_name or "com.ohos" in bundle_name: + count += 1 + self.driver.Assert.greater(count, 0) + + def teardown(self): + Step("收尾工作.................") + self.driver.shell("echo 1 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.clear_app_data(file_mgr) + self.driver.AppManager.stop_app(file_mgr) \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0600.json b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0600.json new file mode 100644 index 00000000..c22f0cac --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0600.json @@ -0,0 +1,14 @@ +{ + "description": "Config for OpenHarmony devicetest test cases", + "environment": [ + { + "type": "device" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0600.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0600.py b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0600.py new file mode 100644 index 00000000..f8e6dddc --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0600.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +''' +#!!================================================================ +#版权 (C) 2024, Huawei Technologies Co., HUTAF xDevice +#================================================================== +#文 件 名: SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0600.py +#文件说明: +#作 者: lWX1283052 +#生成日期: 2024-07-17 +#!!================================================================ +''' +import time +from devicetest.core.test_case import TestCase, Step +from hypium import * + +class SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0600(TestCase): + + def __init__(self, controllers): + self.TAG = self.__class__.__name__ + TestCase.__init__(self, self.TAG, controllers) + self.driver = UiDriver(self.device1) + + def setup(self): + Step(self.devices[0].device_id) + global device + device = self.driver.shell("param get const.product.model") + device = device.replace("\n", "").replace(" ", "") + device = str(device) + Step(device) + # 解锁屏幕 + wake = self.driver.Screen.is_on() + time.sleep(0.5) + if wake: + self.driver.ScreenLock.unlock() + else: + self.driver.Screen.wake_up() + self.driver.ScreenLock.unlock() + self.driver.Screen.enable_stay_awake() + + def process(self): + global file_mgr + file_mgr = "com.huawei.hmos.filemanager" + self.driver.shell("echo 0 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.start_app(file_mgr) + time.sleep(3) + pid = self.driver.System.get_pid(file_mgr) + result = self.driver.shell("ls -Z /proc/%d/root/storage/Users/currentUser/appdata/el1" % pid) + self.driver.Assert.contains(result, "u:object_r:sharefs:s0 base") + + def teardown(self): + Step("收尾工作.................") + self.driver.shell("echo 1 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.clear_app_data(file_mgr) + self.driver.AppManager.stop_app(file_mgr) \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0700.json b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0700.json new file mode 100644 index 00000000..8955a87b --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0700.json @@ -0,0 +1,14 @@ +{ + "description": "Config for OpenHarmony devicetest test cases", + "environment": [ + { + "type": "device" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0700.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0700.py b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0700.py new file mode 100644 index 00000000..451ae272 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0700.py @@ -0,0 +1,58 @@ +# -*- coding: utf-8 -*- +''' +#!!================================================================ +#版权 (C) 2024, Huawei Technologies Co., HUTAF xDevice +#================================================================== +#文 件 名: SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0700.py +#文件说明: +#作 者: lWX1283052 +#生成日期: 2024-07-17 +#!!================================================================ +''' +import time +from devicetest.core.test_case import TestCase, Step +from hypium import * + +class SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0700(TestCase): + + def __init__(self, controllers): + self.TAG = self.__class__.__name__ + TestCase.__init__(self, self.TAG, controllers) + self.driver = UiDriver(self.device1) + + def setup(self): + Step(self.devices[0].device_id) + global device + device = self.driver.shell("param get const.product.model") + device = device.replace("\n", "").replace(" ", "") + device = str(device) + Step(device) + # 解锁屏幕 + wake = self.driver.Screen.is_on() + time.sleep(0.5) + if wake: + self.driver.ScreenLock.unlock() + else: + self.driver.Screen.wake_up() + self.driver.ScreenLock.unlock() + self.driver.Screen.enable_stay_awake() + + def process(self): + global file_mgr + count = 0 + file_mgr = "com.huawei.hmos.filemanager" + self.driver.shell("echo 0 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.start_app(file_mgr) + time.sleep(3) + pid = self.driver.System.get_pid(file_mgr) + result = self.driver.shell("ls /proc/%d/root/storage/Users/currentUser/appdata/el2/distributedfiles" % pid,).split() + for bundle_name in result: + if "com.huawei" in bundle_name or "com.ohos" in bundle_name: + count += 1 + self.driver.Assert.greater(count, 0) + + def teardown(self): + Step("收尾工作.................") + self.driver.shell("echo 1 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.clear_app_data(file_mgr) + self.driver.AppManager.stop_app(file_mgr) \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0800.json b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0800.json new file mode 100644 index 00000000..6fbb5955 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0800.json @@ -0,0 +1,14 @@ +{ + "description": "Config for OpenHarmony devicetest test cases", + "environment": [ + { + "type": "device" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0800.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0800.py b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0800.py new file mode 100644 index 00000000..4e413e4d --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0800.py @@ -0,0 +1,58 @@ +# -*- coding: utf-8 -*- +''' +#!!================================================================ +#版权 (C) 2024, Huawei Technologies Co., HUTAF xDevice +#================================================================== +#文 件 名: SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0800.py +#文件说明: +#作 者: lWX1283052 +#生成日期: 2024-07-17 +#!!================================================================ +''' +import time +from devicetest.core.test_case import TestCase, Step +from hypium import * + +class SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0800(TestCase): + + def __init__(self, controllers): + self.TAG = self.__class__.__name__ + TestCase.__init__(self, self.TAG, controllers) + self.driver = UiDriver(self.device1) + + def setup(self): + Step(self.devices[0].device_id) + global device + device = self.driver.shell("param get const.product.model") + device = device.replace("\n", "").replace(" ", "") + device = str(device) + Step(device) + # 解锁屏幕 + wake = self.driver.Screen.is_on() + time.sleep(0.5) + if wake: + self.driver.ScreenLock.unlock() + else: + self.driver.Screen.wake_up() + self.driver.ScreenLock.unlock() + self.driver.Screen.enable_stay_awake() + + def process(self): + global file_mgr + count = 0 + file_mgr = "com.huawei.hmos.filemanager" + self.driver.shell("echo 0 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.start_app(file_mgr) + time.sleep(3) + pid = self.driver.System.get_pid(file_mgr) + result = self.driver.shell("ls /proc/%d/root/storage/Users/currentUser/appdata/el2/cloud" % pid,).split() + for bundle_name in result: + if "com.huawei" in bundle_name or "com.ohos" in bundle_name: + count += 1 + self.driver.Assert.greater(count, 0) + + def teardown(self): + Step("收尾工作.................") + self.driver.shell("echo 1 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.clear_app_data(file_mgr) + self.driver.AppManager.stop_app(file_mgr) \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0900.json b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0900.json new file mode 100644 index 00000000..8de19a7f --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0900.json @@ -0,0 +1,14 @@ +{ + "description": "Config for OpenHarmony devicetest test cases", + "environment": [ + { + "type": "device" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0900.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0900.py b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0900.py new file mode 100644 index 00000000..aafedee1 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0900.py @@ -0,0 +1,58 @@ +# -*- coding: utf-8 -*- +''' +#!!================================================================ +#版权 (C) 2024, Huawei Technologies Co., HUTAF xDevice +#================================================================== +#文 件 名: SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0900.py +#文件说明: +#作 者: lWX1283052 +#生成日期: 2024-07-17 +#!!================================================================ +''' +import time +from devicetest.core.test_case import TestCase, Step +from hypium import * + +class SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0900(TestCase): + + def __init__(self, controllers): + self.TAG = self.__class__.__name__ + TestCase.__init__(self, self.TAG, controllers) + self.driver = UiDriver(self.device1) + + def setup(self): + Step(self.devices[0].device_id) + global device + device = self.driver.shell("param get const.product.model") + device = device.replace("\n", "").replace(" ", "") + device = str(device) + Step(device) + # 解锁屏幕 + wake = self.driver.Screen.is_on() + time.sleep(0.5) + if wake: + self.driver.ScreenLock.unlock() + else: + self.driver.Screen.wake_up() + self.driver.ScreenLock.unlock() + self.driver.Screen.enable_stay_awake() + + def process(self): + global file_mgr + count = 0 + file_mgr = "com.huawei.hmos.filemanager" + self.driver.shell("echo 0 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.start_app(file_mgr) + time.sleep(3) + pid = self.driver.System.get_pid(file_mgr) + result = self.driver.shell("ls -Z /proc/%d/root/storage" % pid,).split() + for i in result: + if "sharefs" in i: + count += 1 + self.driver.Assert.equal(count, 0) + + def teardown(self): + Step("收尾工作.................") + self.driver.shell("echo 1 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.clear_app_data(file_mgr) + self.driver.AppManager.stop_app(file_mgr) \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1000.json b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1000.json new file mode 100644 index 00000000..e9f90e7f --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1000.json @@ -0,0 +1,14 @@ +{ + "description": "Config for OpenHarmony devicetest test cases", + "environment": [ + { + "type": "device" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1000.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1000.py b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1000.py new file mode 100644 index 00000000..34959aa6 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1000.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +''' +#!!================================================================ +#版权 (C) 2024, Huawei Technologies Co., HUTAF xDevice +#================================================================== +#文 件 名: SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1000.py +#文件说明: +#作 者: lWX1283052 +#生成日期: 2024-07-17 +#!!================================================================ +''' +import time +from devicetest.core.test_case import TestCase, Step +from hypium import * + +class SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1000(TestCase): + + def __init__(self, controllers): + self.TAG = self.__class__.__name__ + TestCase.__init__(self, self.TAG, controllers) + self.driver = UiDriver(self.device1) + + def setup(self): + Step(self.devices[0].device_id) + global device + device = self.driver.shell("param get const.product.model") + device = device.replace("\n", "").replace(" ", "") + device = str(device) + Step(device) + # 解锁屏幕 + wake = self.driver.Screen.is_on() + time.sleep(0.5) + if wake: + self.driver.ScreenLock.unlock() + else: + self.driver.Screen.wake_up() + self.driver.ScreenLock.unlock() + self.driver.Screen.enable_stay_awake() + + def process(self): + global notepad + notepad = "com.huawei.hmos.notepad" + self.driver.shell("echo 0 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.start_app(notepad) + time.sleep(3) + pid = self.driver.System.get_pid(notepad) + result = self.driver.shell("ls /proc/%d/root/storage" % pid) + content = ["External", "Users", "hmdfs"] + for i in content: + self.driver.Assert.contains(result, i) + + def teardown(self): + Step("收尾工作.................") + self.driver.shell("echo 1 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.clear_app_data(notepad) + self.driver.AppManager.stop_app(notepad) \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1100.json b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1100.json new file mode 100644 index 00000000..702fa658 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1100.json @@ -0,0 +1,14 @@ +{ + "description": "Config for OpenHarmony devicetest test cases", + "environment": [ + { + "type": "device" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1100.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1100.py b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1100.py new file mode 100644 index 00000000..86895c78 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1100.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +''' +#!!================================================================ +#版权 (C) 2024, Huawei Technologies Co., HUTAF xDevice +#================================================================== +#文 件 名: SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1100.py +#文件说明: +#作 者: lWX1283052 +#生成日期: 2024-07-17 +#!!================================================================ +''' +import time +from devicetest.core.test_case import TestCase, Step +from hypium import * + +class SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1100(TestCase): + + def __init__(self, controllers): + self.TAG = self.__class__.__name__ + TestCase.__init__(self, self.TAG, controllers) + self.driver = UiDriver(self.device1) + + def setup(self): + Step(self.devices[0].device_id) + global device + device = self.driver.shell("param get const.product.model") + device = device.replace("\n", "").replace(" ", "") + device = str(device) + Step(device) + # 解锁屏幕 + wake = self.driver.Screen.is_on() + time.sleep(0.5) + if wake: + self.driver.ScreenLock.unlock() + else: + self.driver.Screen.wake_up() + self.driver.ScreenLock.unlock() + self.driver.Screen.enable_stay_awake() + + def process(self): + global notepad + notepad = "com.huawei.hmos.notepad" + self.driver.shell("echo 0 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.start_app(notepad) + time.sleep(3) + pid = self.driver.System.get_pid(notepad) + result = self.driver.shell("ls /proc/%d/root/storage/Users/currentUser" % pid) + content = ["Desktop", "Documents", "Download", "appdata"] + for i in content: + self.driver.Assert.contains(result, i) + + def teardown(self): + Step("收尾工作.................") + self.driver.shell("echo 1 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.clear_app_data(notepad) + self.driver.AppManager.stop_app(notepad) \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1200.json b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1200.json new file mode 100644 index 00000000..0306fd77 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1200.json @@ -0,0 +1,14 @@ +{ + "description": "Config for OpenHarmony devicetest test cases", + "environment": [ + { + "type": "device" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1200.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1200.py b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1200.py new file mode 100644 index 00000000..23bdcb0c --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1200.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +''' +#!!================================================================ +#版权 (C) 2024, Huawei Technologies Co., HUTAF xDevice +#================================================================== +#文 件 名: SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1200.py +#文件说明: +#作 者: lWX1283052 +#生成日期: 2024-07-17 +#!!================================================================ +''' +import time +from devicetest.core.test_case import TestCase, Step +from hypium import * + +class SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1200(TestCase): + + def __init__(self, controllers): + self.TAG = self.__class__.__name__ + TestCase.__init__(self, self.TAG, controllers) + self.driver = UiDriver(self.device1) + + def setup(self): + Step(self.devices[0].device_id) + global device + device = self.driver.shell("param get const.product.model") + device = device.replace("\n", "").replace(" ", "") + device = str(device) + Step(device) + # 解锁屏幕 + wake = self.driver.Screen.is_on() + time.sleep(0.5) + if wake: + self.driver.ScreenLock.unlock() + else: + self.driver.Screen.wake_up() + self.driver.ScreenLock.unlock() + self.driver.Screen.enable_stay_awake() + + def process(self): + global notepad + notepad = "com.huawei.hmos.notepad" + self.driver.shell("echo 0 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.start_app(notepad) + time.sleep(3) + pid = self.driver.System.get_pid(notepad) + result = self.driver.shell("ls -Z /proc/%d/root/storage" % pid) + content = ["External", "hmdfs", "Users"] + for i in content: + self.driver.Assert.contains(result, "u:object_r:sharefs:s0 %s" % i) + + def teardown(self): + Step("收尾工作.................") + self.driver.shell("echo 1 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.clear_app_data(notepad) + self.driver.AppManager.stop_app(notepad) \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1300.json b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1300.json new file mode 100644 index 00000000..d7855375 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1300.json @@ -0,0 +1,14 @@ +{ + "description": "Config for OpenHarmony devicetest test cases", + "environment": [ + { + "type": "device" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1300.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1300.py b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1300.py new file mode 100644 index 00000000..685ea32f --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1300.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +''' +#!!================================================================ +#版权 (C) 2024, Huawei Technologies Co., HUTAF xDevice +#================================================================== +#文 件 名: SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1300.py +#文件说明: +#作 者: lWX1283052 +#生成日期: 2024-07-17 +#!!================================================================ +''' +import time +from devicetest.core.test_case import TestCase, Step +from hypium import * + +class SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1300(TestCase): + + def __init__(self, controllers): + self.TAG = self.__class__.__name__ + TestCase.__init__(self, self.TAG, controllers) + self.driver = UiDriver(self.device1) + + def setup(self): + Step(self.devices[0].device_id) + global device + device = self.driver.shell("param get const.product.model") + device = device.replace("\n", "").replace(" ", "") + device = str(device) + Step(device) + # 解锁屏幕 + wake = self.driver.Screen.is_on() + time.sleep(0.5) + if wake: + self.driver.ScreenLock.unlock() + else: + self.driver.Screen.wake_up() + self.driver.ScreenLock.unlock() + self.driver.Screen.enable_stay_awake() + + def process(self): + global notepad + notepad = "com.huawei.hmos.notepad" + self.driver.shell("echo 0 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.start_app(notepad) + time.sleep(3) + pid = self.driver.System.get_pid(notepad) + result = self.driver.shell("ls -Z /proc/%d/root/storage/Users" % pid).rsplit("\n") + self.driver.Assert.equal(result[0], "u:object_r:sharefs:s0 currentUser") + + def teardown(self): + Step("收尾工作.................") + self.driver.shell("echo 1 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.clear_app_data(notepad) + self.driver.AppManager.stop_app(notepad) \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1400.json b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1400.json new file mode 100644 index 00000000..784c42a8 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1400.json @@ -0,0 +1,14 @@ +{ + "description": "Config for OpenHarmony devicetest test cases", + "environment": [ + { + "type": "device" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1400.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1400.py b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1400.py new file mode 100644 index 00000000..88022add --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1400.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +''' +#!!================================================================ +#版权 (C) 2024, Huawei Technologies Co., HUTAF xDevice +#================================================================== +#文 件 名: SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1400.py +#文件说明: +#作 者: lWX1283052 +#生成日期: 2024-07-17 +#!!================================================================ +''' +import time +from devicetest.core.test_case import TestCase, Step +from hypium import * + +class SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1400(TestCase): + + def __init__(self, controllers): + self.TAG = self.__class__.__name__ + TestCase.__init__(self, self.TAG, controllers) + self.driver = UiDriver(self.device1) + + def setup(self): + Step(self.devices[0].device_id) + global device + device = self.driver.shell("param get const.product.model") + device = device.replace("\n", "").replace(" ", "") + device = str(device) + Step(device) + # 解锁屏幕 + wake = self.driver.Screen.is_on() + time.sleep(0.5) + if wake: + self.driver.ScreenLock.unlock() + else: + self.driver.Screen.wake_up() + self.driver.ScreenLock.unlock() + self.driver.Screen.enable_stay_awake() + + def process(self): + global notepad + notepad = "com.huawei.hmos.notepad" + self.driver.shell("echo 0 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.start_app(notepad) + time.sleep(3) + pid = self.driver.System.get_pid(notepad) + result = self.driver.shell("ls /proc/%d/root/storage/Users/currentUser/appdata" % pid).split() + content = ["el1", "el2"] + for i in content: + self.driver.Assert.contains(result, i) + + def teardown(self): + Step("收尾工作.................") + self.driver.shell("echo 1 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.clear_app_data(notepad) + self.driver.AppManager.stop_app(notepad) \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1500.json b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1500.json new file mode 100644 index 00000000..c512296a --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1500.json @@ -0,0 +1,14 @@ +{ + "description": "Config for OpenHarmony devicetest test cases", + "environment": [ + { + "type": "device" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1500.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1500.py b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1500.py new file mode 100644 index 00000000..9b6ba847 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1500.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +''' +#!!================================================================ +#版权 (C) 2024, Huawei Technologies Co., HUTAF xDevice +#================================================================== +#文 件 名: SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1500.py +#文件说明: +#作 者: lWX1283052 +#生成日期: 2024-07-17 +#!!================================================================ +''' +import time +from devicetest.core.test_case import TestCase, Step +from hypium import * + +class SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1500(TestCase): + + def __init__(self, controllers): + self.TAG = self.__class__.__name__ + TestCase.__init__(self, self.TAG, controllers) + self.driver = UiDriver(self.device1) + + def setup(self): + Step(self.devices[0].device_id) + global device + device = self.driver.shell("param get const.product.model") + device = device.replace("\n", "").replace(" ", "") + device = str(device) + Step(device) + # 解锁屏幕 + wake = self.driver.Screen.is_on() + time.sleep(0.5) + if wake: + self.driver.ScreenLock.unlock() + else: + self.driver.Screen.wake_up() + self.driver.ScreenLock.unlock() + self.driver.Screen.enable_stay_awake() + + def process(self): + global notepad + notepad = "com.huawei.hmos.notepad" + self.driver.shell("echo 0 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.start_app(notepad) + time.sleep(3) + pid = self.driver.System.get_pid(notepad) + result = self.driver.shell("ls -Z /proc/%d/root/storage/Users/currentUser/appdata/el2" % pid) + content = ["base", "distributedfiles", "cloud"] + for i in content: + self.driver.Assert.contains(result, "sharefs_appdata_file:s0 %s" % i) + + def teardown(self): + Step("收尾工作.................") + self.driver.shell("echo 1 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.clear_app_data(notepad) + self.driver.AppManager.stop_app(notepad) \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1600.json b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1600.json new file mode 100644 index 00000000..bea2ed9d --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1600.json @@ -0,0 +1,14 @@ +{ + "description": "Config for OpenHarmony devicetest test cases", + "environment": [ + { + "type": "device" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1600.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1600.py b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1600.py new file mode 100644 index 00000000..5bde65b4 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1600.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +''' +#!!================================================================ +#版权 (C) 2024, Huawei Technologies Co., HUTAF xDevice +#================================================================== +#文 件 名: SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1600.py +#文件说明: +#作 者: lWX1283052 +#生成日期: 2024-07-17 +#!!================================================================ +''' +import time +from devicetest.core.test_case import TestCase, Step +from hypium import * + +class SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1600(TestCase): + + def __init__(self, controllers): + self.TAG = self.__class__.__name__ + TestCase.__init__(self, self.TAG, controllers) + self.driver = UiDriver(self.device1) + + def setup(self): + Step(self.devices[0].device_id) + global device + device = self.driver.shell("param get const.product.model") + device = device.replace("\n", "").replace(" ", "") + device = str(device) + Step(device) + # 解锁屏幕 + wake = self.driver.Screen.is_on() + time.sleep(0.5) + if wake: + self.driver.ScreenLock.unlock() + else: + self.driver.Screen.wake_up() + self.driver.ScreenLock.unlock() + self.driver.Screen.enable_stay_awake() + + def process(self): + global notepad + count = 0 + notepad = "com.huawei.hmos.notepad" + self.driver.shell("echo 0 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.start_app(notepad) + time.sleep(3) + pid = self.driver.System.get_pid(notepad) + for i in range(1, 3): + result = self.driver.shell("ls /proc/%d/root/storage/Users/currentUser/appdata/el%d/base" % (pid, i)).split() + for bundle_name in result: + if "com.huawei" in bundle_name or "com.ohos" in bundle_name: + count += 1 + self.driver.Assert.greater(count, 0) + + def teardown(self): + Step("收尾工作.................") + self.driver.shell("echo 1 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.clear_app_data(notepad) + self.driver.AppManager.stop_app(notepad) \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1700.json b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1700.json new file mode 100644 index 00000000..deb58f9b --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1700.json @@ -0,0 +1,14 @@ +{ + "description": "Config for OpenHarmony devicetest test cases", + "environment": [ + { + "type": "device" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1700.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1700.py b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1700.py new file mode 100644 index 00000000..a06650e6 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemanager_sandbox/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1700.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +''' +#!!================================================================ +#版权 (C) 2024, Huawei Technologies Co., HUTAF xDevice +#================================================================== +#文 件 名: SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1700.py +#文件说明: +#作 者: lWX1283052 +#生成日期: 2024-07-17 +#!!================================================================ +''' +# -*- coding: utf-8 -*- +import time +from devicetest.core.test_case import TestCase, Step +from hypium import * + +class SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1700(TestCase): + + def __init__(self, controllers): + self.TAG = self.__class__.__name__ + TestCase.__init__(self, self.TAG, controllers) + self.driver = UiDriver(self.device1) + + def setup(self): + Step(self.devices[0].device_id) + global device + device = self.driver.shell("param get const.product.model") + device = device.replace("\n", "").replace(" ", "") + device = str(device) + Step(device) + # 解锁屏幕 + wake = self.driver.Screen.is_on() + time.sleep(0.5) + if wake: + self.driver.ScreenLock.unlock() + else: + self.driver.Screen.wake_up() + self.driver.ScreenLock.unlock() + self.driver.Screen.enable_stay_awake() + + def process(self): + global notepad + notepad = "com.huawei.hmos.notepad" + self.driver.shell("echo 0 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.start_app(notepad) + time.sleep(3) + pid = self.driver.System.get_pid(notepad) + result = self.driver.shell("ls -Z /proc/%d/root/storage/Users/currentUser/appdata/el1" % pid).split("\n") + self.driver.Assert.equal(result[0], "u:object_r:sharefs_appdata_file:s0 base") + + def teardown(self): + Step("收尾工作.................") + self.driver.shell("echo 1 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.clear_app_data(notepad) + self.driver.AppManager.stop_app(notepad) \ No newline at end of file -- Gitee