diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0100.json b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0100.json new file mode 100644 index 0000000000000000000000000000000000000000..2b59544a42bc4377b0557649709324031b85fd9e --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemgr_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/SubStartupAppspawnFilemgrSandbox0100.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0100.py b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0100.py new file mode 100644 index 0000000000000000000000000000000000000000..0a0194339ca6a8787a782ff0747644e809c14197 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0100.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import time +from devicetest.core.test_case import TestCase, Step +from hypium import FilemgrSandbox, Appspawn, SubStartup + + +class SubStartupAppspawnFilemgrSandbox0100(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) + 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): + file_mgr + file_mgr = "com.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_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0200.json b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0200.json new file mode 100644 index 0000000000000000000000000000000000000000..494b868887250003f2896c178eb834c42be55f55 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemgr_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/SubStartupAppspawnFilemgrSandbox0200.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0200.py b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0200.py new file mode 100644 index 0000000000000000000000000000000000000000..daf89fbc915c6d73ca2a3b48cc4425a0e43a3cea --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0200.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import time +from devicetest.core.test_case import TestCase, Step +from hypium import FilemgrSandbox, Appspawn, SubStartup + + +class SubStartupAppspawnFilemgrSandbox0200(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) + 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): + file_mgr + file_mgr = "com.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_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0300.json b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0300.json new file mode 100644 index 0000000000000000000000000000000000000000..d3d2775c2d0246ce5fef1f5a765bf1935cdfc880 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemgr_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/SubStartupAppspawnFilemgrSandbox0300.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0300.py b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0300.py new file mode 100644 index 0000000000000000000000000000000000000000..a1b1e96bd99500349ce852c49e409be97d043cb7 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0300.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import time +from devicetest.core.test_case import TestCase, Step +from hypium import FilemgrSandbox, Appspawn, SubStartup + + +class SubStartupAppspawnFilemgrSandbox0300(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) + 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): + file_mgr + file_mgr = "com.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_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0400.json b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0400.json new file mode 100644 index 0000000000000000000000000000000000000000..39d21ea1cf1c3f0dab7f0c2d9b0007287e91a2db --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemgr_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/SubStartupAppspawnFilemgrSandbox0400.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0400.py b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0400.py new file mode 100644 index 0000000000000000000000000000000000000000..26a39493a1dc5c89590c76b873efc773a40b1af1 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0400.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import time +from devicetest.core.test_case import TestCase, Step +from hypium import FilemgrSandbox, Appspawn, SubStartup + + +class SubStartupAppspawnFilemgrSandbox0400(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) + 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): + file_mgr + file_mgr = "com.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_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0500.json b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0500.json new file mode 100644 index 0000000000000000000000000000000000000000..603a78254bf2bf9299e98d393497f0c8d5c02cfc --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemgr_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/SubStartupAppspawnFilemgrSandbox0500.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0500.py b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0500.py new file mode 100644 index 0000000000000000000000000000000000000000..3c1c873bdd0a0fd16ce2c368b1376109d49267b5 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0500.py @@ -0,0 +1,64 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import time +from devicetest.core.test_case import TestCase, Step +from hypium import FilemgrSandbox, Appspawn, SubStartup + + +class SubStartupAppspawnFilemgrSandbox0500(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) + 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): + file_mgr + count = 0 + file_mgr = "com.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." 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_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0600.json b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0600.json new file mode 100644 index 0000000000000000000000000000000000000000..4e801c20ba745178d52893e3d35da20efa218ced --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemgr_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/SubStartupAppspawnFilemgrSandbox0600.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0600.py b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0600.py new file mode 100644 index 0000000000000000000000000000000000000000..e49149370143e59f8f7092720e50d3a5e95e9360 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0600.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import time +from devicetest.core.test_case import TestCase, Step +from hypium import FilemgrSandbox, Appspawn, SubStartup + + +class SubStartupAppspawnFilemgrSandbox0600(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) + 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): + file_mgr + file_mgr = "com.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_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0700.json b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0700.json new file mode 100644 index 0000000000000000000000000000000000000000..8f16be1afb9f1a4d5ead923c78d595b05f0e12d8 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemgr_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/SubStartupAppspawnFilemgrSandbox0700.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0700.py b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0700.py new file mode 100644 index 0000000000000000000000000000000000000000..64725e22f8e0ecc8f4fc55960bf93cfc3813c0fb --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0700.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import time +from devicetest.core.test_case import TestCase, Step +from hypium import FilemgrSandbox, Appspawn, SubStartup + + +class SubStartupAppspawnFilemgrSandbox0700(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) + 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): + file_mgr + count = 0 + file_mgr = "com.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." 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_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0800.json b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0800.json new file mode 100644 index 0000000000000000000000000000000000000000..80bd2cf2f6284904d9145a5dacb3f1fe17aa69fa --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemgr_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/SubStartupAppspawnFilemgrSandbox0800.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0800.py b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0800.py new file mode 100644 index 0000000000000000000000000000000000000000..4ddfadbd7f6571c42c156f0c40d3b3f11ded4e06 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0800.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import time +from devicetest.core.test_case import TestCase, Step +from hypium import FilemgrSandbox, Appspawn, SubStartup + + +class SubStartupAppspawnFilemgrSandbox0800(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) + 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): + file_mgr + count = 0 + file_mgr = "com.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." 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_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0900.json b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0900.json new file mode 100644 index 0000000000000000000000000000000000000000..0c444897a3de5210b60ad6a559851f173651d4e1 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemgr_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/SubStartupAppspawnFilemgrSandbox0900.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0900.py b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0900.py new file mode 100644 index 0000000000000000000000000000000000000000..e0d16560bfa32d2eb8bfb3bf816c135658294506 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0900.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import time +from devicetest.core.test_case import TestCase, Step +from hypium import FilemgrSandbox, Appspawn, SubStartup + + +class SubStartupAppspawnFilemgrSandbox0900(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) + 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): + file_mgr + count = 0 + file_mgr = "com.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_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1000.json b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1000.json new file mode 100644 index 0000000000000000000000000000000000000000..56838555587bce4634f663ceadcd316c0ef35a0d --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemgr_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/SubStartupAppspawnFilemgrSandbox1000.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1000.py b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1000.py new file mode 100644 index 0000000000000000000000000000000000000000..a9890f385f4affd5c464bf0015ee56a81166f1b0 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1000.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import time +from devicetest.core.test_case import TestCase, Step +from hypium import FilemgrSandbox, Appspawn, SubStartup + + +class SubStartupAppspawnFilemgrSandbox1000(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) + 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): + notepad + notepad = "com.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_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1100.json b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1100.json new file mode 100644 index 0000000000000000000000000000000000000000..071a6565187a6c851bc2a3a19351e2f20c8d59b1 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemgr_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/SubStartupAppspawnFilemgrSandbox1100.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1100.py b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1100.py new file mode 100644 index 0000000000000000000000000000000000000000..0a81042ebef023d5368b40a760b43402fc1bd231 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1100.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import time +from devicetest.core.test_case import TestCase, Step +from hypium import FilemgrSandbox, Appspawn, SubStartup + + +class SubStartupAppspawnFilemgrSandbox1100(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) + 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): + notepad + notepad = "com.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_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1200.json b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1200.json new file mode 100644 index 0000000000000000000000000000000000000000..1cdcdb7db03886c75a7db8e3d9bd8d9cb403bb25 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemgr_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/SubStartupAppspawnFilemgrSandbox1200.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1200.py b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1200.py new file mode 100644 index 0000000000000000000000000000000000000000..2ef1db996ae89c45b9f997e5228cd38ca6e21aa7 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1200.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import time +from devicetest.core.test_case import TestCase, Step +from hypium import FilemgrSandbox, Appspawn, SubStartup + + +class SubStartupAppspawnFilemgrSandbox1200(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) + 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): + notepad + notepad = "com.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_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1300.json b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1300.json new file mode 100644 index 0000000000000000000000000000000000000000..6a974dd263ceea2087c21fbdac750447b0894005 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemgr_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/SubStartupAppspawnFilemgrSandbox1300.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1300.py b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1300.py new file mode 100644 index 0000000000000000000000000000000000000000..6231fe7e82cddd97c07b0012bd2ab1fc8f0399b6 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1300.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import time +from devicetest.core.test_case import TestCase, Step +from hypium import FilemgrSandbox, Appspawn, SubStartup + + +class SubStartupAppspawnFilemgrSandbox1300(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) + 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): + notepad + notepad = "com.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_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1400.json b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1400.json new file mode 100644 index 0000000000000000000000000000000000000000..6be9d12ef5939e83cde2b5d4b125654a0d292346 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemgr_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/SubStartupAppspawnFilemgrSandbox1400.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1400.py b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1400.py new file mode 100644 index 0000000000000000000000000000000000000000..7803be0c802c9e99430dacc8b0cbe95ae99486e9 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1400.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import time +from devicetest.core.test_case import TestCase, Step +from hypium import FilemgrSandbox, Appspawn, SubStartup + + +class SubStartupAppspawnFilemgrSandbox1400(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) + 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): + notepad + notepad = "com.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_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1500.json b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1500.json new file mode 100644 index 0000000000000000000000000000000000000000..3b303104e6627798d803ab477c86b09fa1673559 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemgr_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/SubStartupAppspawnFilemgrSandbox1500.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1500.py b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1500.py new file mode 100644 index 0000000000000000000000000000000000000000..2a6326a17b246328d79fe17d70a2dd8980bcf16b --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1500.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import time +from devicetest.core.test_case import TestCase, Step +from hypium import FilemgrSandbox, Appspawn, SubStartup + + +class SubStartupAppspawnFilemgrSandbox1500(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) + 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): + notepad + notepad = "com.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_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1600.json b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1600.json new file mode 100644 index 0000000000000000000000000000000000000000..cc7e90ae68e087f5c3a7e2067814c274bc51f84f --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemgr_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/SubStartupAppspawnFilemgrSandbox1600.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1600.py b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1600.py new file mode 100644 index 0000000000000000000000000000000000000000..cde3680ad78c50156315ad2d800759b39a319f73 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1600.py @@ -0,0 +1,64 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import time +from devicetest.core.test_case import TestCase, Step +from hypium import FilemgrSandbox, Appspawn, SubStartup + + +class SubStartupAppspawnFilemgrSandbox1600(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) + 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): + notepad + count = 0 + notepad = "com.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." 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_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1700.json b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1700.json new file mode 100644 index 0000000000000000000000000000000000000000..987cdcae603bc223d9ce9c9504ac22e214665105 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemgr_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/SubStartupAppspawnFilemgrSandbox1700.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1700.py b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1700.py new file mode 100644 index 0000000000000000000000000000000000000000..e9d031955890b43ee89c02d73eb82eb57fccffe4 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1700.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import time +from devicetest.core.test_case import TestCase, Step +from hypium import FilemgrSandbox, Appspawn, SubStartup + + +class SubStartupAppspawnFilemgrSandbox1700(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) + 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): + notepad + notepad = "com.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 diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1800.json b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1800.json new file mode 100644 index 0000000000000000000000000000000000000000..93278ccfad27155d767ec0aa386945eb5d4e1760 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1800.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/SubStartupAppspawnFilemgrSandbox1800.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1800.py b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1800.py new file mode 100644 index 0000000000000000000000000000000000000000..53eeb47525ce8e8be0f7c87db86fb7dba056a4af --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1800.py @@ -0,0 +1,64 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import time +from devicetest.core.test_case import TestCase, Step +from hypium import FilemgrSandbox, Appspawn, SubStartup + + +class SubStartupAppspawnFilemgrSandbox1800(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) + 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): + notepad + count = 0 + notepad = "com.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/el2/distributedfiles" % pid).split() + for bundle_name in result: + if "com." 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_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1900.json b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1900.json new file mode 100644 index 0000000000000000000000000000000000000000..c6034bb5676a696b89175ba4cd4766dee315cd3b --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1900.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/SubStartupAppspawnFilemgrSandbox1900.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1900.py b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1900.py new file mode 100644 index 0000000000000000000000000000000000000000..cec6adb66f802a0c5e7b4a0dc814d9b4ae192124 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1900.py @@ -0,0 +1,64 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import time +from devicetest.core.test_case import TestCase, Step +from hypium import FilemgrSandbox, Appspawn, SubStartup + + +class SubStartupAppspawnFilemgrSandbox1900(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) + 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): + notepad + count = 0 + notepad = "com.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/el2/cloud" % pid).split() + for bundle_name in result: + if "com." 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_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2000.json b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2000.json new file mode 100644 index 0000000000000000000000000000000000000000..b253383096f8a4648b785fba44b3f597cab0a34c --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2000.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/SubStartupAppspawnFilemgrSandbox2000.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2000.py b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2000.py new file mode 100644 index 0000000000000000000000000000000000000000..e954c06d32499efef003728d24df7236330fd98a --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2000.py @@ -0,0 +1,57 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import time +from devicetest.core.test_case import TestCase, Step +from hypium import FilemgrSandbox, Appspawn, SubStartup + + +class SubStartupAppspawnFilemgrSandbox2000(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) + 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): + notepad + notepad = "com.notepad" + 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) + self.driver.Assert.contains(result, "Operation not permitted") + + def teardown(self): + Step("收尾工作.................") + 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_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2100.json b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2100.json new file mode 100644 index 0000000000000000000000000000000000000000..d4d8580cb71445e0ac28cdd6715694d6fe4bbc90 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2100.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/SubStartupAppspawnFilemgrSandbox2100.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2100.py b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2100.py new file mode 100644 index 0000000000000000000000000000000000000000..d977d931edab3dd9b37099318ac755fcacad9124 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2100.py @@ -0,0 +1,57 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import time +from devicetest.core.test_case import TestCase, Step +from hypium import FilemgrSandbox, Appspawn, SubStartup + + +class SubStartupAppspawnFilemgrSandbox2100(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) + 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): + notepad + notepad = "com.notepad" + 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) + self.driver.Assert.contains(result, "Operation not permitted") + + def teardown(self): + Step("收尾工作.................") + 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_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2200.json b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2200.json new file mode 100644 index 0000000000000000000000000000000000000000..d204b6d2adb6eaf60c770a84d63986350b1c13a0 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2200.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/SubStartupAppspawnFilemgrSandbox2200.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2200.py b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2200.py new file mode 100644 index 0000000000000000000000000000000000000000..2fbd8db1c19e92f6ef67659adc91f2df0f63a448 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2200.py @@ -0,0 +1,58 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import time +from devicetest.core.test_case import TestCase, Step +from hypium import FilemgrSandbox, Appspawn, SubStartup + + +class SubStartupAppspawnFilemgrSandbox2200(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) + 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): + notepad + notepad = "com.notepad" + 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" % (pid, i)) + self.driver.Assert.contains(result, "Operation not permitted") + + def teardown(self): + Step("收尾工作.................") + 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_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2300.json b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2300.json new file mode 100644 index 0000000000000000000000000000000000000000..c1f9ef7272ebd0392aaf0a443b532144b0318bec --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2300.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/SubStartupAppspawnFilemgrSandbox2300.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2300.py b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2300.py new file mode 100644 index 0000000000000000000000000000000000000000..4062169bd87b9e932d46734aef255818e921f748 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2300.py @@ -0,0 +1,57 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import time +from devicetest.core.test_case import TestCase, Step +from hypium import FilemgrSandbox, Appspawn, SubStartup + + +class SubStartupAppspawnFilemgrSandbox2300(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) + 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): + notepad + notepad = "com.notepad" + 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/External" % pid) + self.driver.Assert.contains(result, "Operation not permitted") + + def teardown(self): + Step("收尾工作.................") + 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_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2500.json b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2500.json new file mode 100644 index 0000000000000000000000000000000000000000..b89444cbb25d323901fca2295b74ff593c1362c2 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2500.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/SubStartupAppspawnFilemgrSandbox2500.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2500.py b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2500.py new file mode 100644 index 0000000000000000000000000000000000000000..61a324b6b2cdc4a4a7817d819f8f17dd38194088 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2500.py @@ -0,0 +1,57 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import time +from devicetest.core.test_case import TestCase, Step +from hypium import FilemgrSandbox, Appspawn, SubStartup + + +class SubStartupAppspawnFilemgrSandbox2500(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) + 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): + notepad + notepad = "com.notepad" + 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/hmdfs" % pid) + self.driver.Assert.contains(result, "Operation not permitted") + + def teardown(self): + Step("收尾工作.................") + self.driver.AppManager.clear_app_data(notepad) + self.driver.AppManager.stop_app(notepad) \ No newline at end of file