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..da38e96ad381b27b8ccc5464f537fa29614b5492 --- /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.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_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..a34f716fad6f3d8ae56c393bd10d1a0caa488ad2 --- /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.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_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..5202c61e64d08e71abf5e2a4b15ee40fb4549b29 --- /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.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_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..ee46c8581eedff2a97a36bab5c296f1907fafe83 --- /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.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_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..1d1439bd266b72cd56f204461e55aa2c4add18e3 --- /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.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." 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..31f09ea342db91aa3757262f112bd52dcb8b38e7 --- /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.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_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..89c32be6b3a2f3d8e616d5d3f4647d7db01b7b3b --- /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.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." 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..aa7f8abe04f7b7de29fc2ac21f329d4ba117a413 --- /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.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." 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..f3bb2136f81da847f7a3a86325bcbe876478ffcf --- /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.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_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..e07743c3d75e6aef98f5184483dd25940569decd --- /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.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_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..f93a6d2d517bee94bb1c27904279a7594eefa598 --- /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.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_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..f4066486cc369795d7111eb434b9accfda95c73d --- /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.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_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..215475b1baf755f614d8d651389469ef43f23017 --- /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.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_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..5902c943c26c272b7218c308a637063bb0e1b371 --- /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.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_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..2fb69ff0477f4ffaa8952a1af640bf1eb79ff0e3 --- /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.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_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..9e5905b8a3ce85dd1f6d80c2b36a14f06a79c16d --- /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.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." 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..05b9ad55b7231778e39076e9881d3358d1639b70 --- /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.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 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..5c663660efa38d7c860ca8cf7c839589ea5e0de9 --- /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.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/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..640d9c261a9c2e144bdbb27769d311ef60daac14 --- /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.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/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..d68060d13accc2c582d50ce1c6b8953273a87009 --- /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.hmos.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..990742ffba11797f11e2ef3ef370e6d896fa0e92 --- /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.hmos.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..e797ef7e6b6882ce3adeadfb8fa212f16227f9f8 --- /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.hmos.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..28db72b77116527bb47623855679490a8bc89797 --- /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.hmos.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..1c5f86776083006fe9dd94275aaf99f80a401dfa --- /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.hmos.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