From 5b71a2e2d2b94dbfd9a023d6907f7db02b4e480a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=BB=E5=98=89=E8=BE=89?= <961978925@qq.com> Date: Fri, 6 Dec 2024 16:29:02 +0800 Subject: [PATCH] =?UTF-8?q?SetWebDebuggingAccess=20xts=E7=BC=96=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...roller_SetWebDebuggingAccessFalse.test.ets | 81 +++++++++++++++++++ ...troller_SetWebDebuggingAccessTrue.test.ets | 81 +++++++++++++++++++ 2 files changed, 162 insertions(+) create mode 100644 xtstemplate/entry/src/ohosTest/ets/test/WebController_SetWebDebuggingAccessFalse.test.ets create mode 100644 xtstemplate/entry/src/ohosTest/ets/test/WebController_SetWebDebuggingAccessTrue.test.ets diff --git a/xtstemplate/entry/src/ohosTest/ets/test/WebController_SetWebDebuggingAccessFalse.test.ets b/xtstemplate/entry/src/ohosTest/ets/test/WebController_SetWebDebuggingAccessFalse.test.ets new file mode 100644 index 0000000..bb2616b --- /dev/null +++ b/xtstemplate/entry/src/ohosTest/ets/test/WebController_SetWebDebuggingAccessFalse.test.ets @@ -0,0 +1,81 @@ +/* + * Copyright (C) 2023 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 { + describe, + it, + expect, + beforeAll, + beforeEach, + afterEach, + afterAll, +} from '@ohos/hypium'; +import { Driver, ON, Component } from '@ohos.UiTest'; +import { startAbility, stopAbility, waitUiReadyMs } from '../utils/index'; + +export default function WebController_SetWebDebuggingAccessFalseTest() { + describe('WebController_SetWebDebuggingAccessFalseTest', () => { + /** + * beforeAll: PrePageControlTest at the test suite level, which are executed before the test suite is executed. + */ + beforeAll(async () => { + await startAbility('com.example.webviewtest2', 'EntryAbility'); + const driver: Driver = Driver.create(); + await driver.delayMs(waitUiReadyMs); + }); + + /** + * beforeEach: PrePageControlTest at the test case level, which are executed before each test case is executed. + */ + beforeEach(async () => { + const driver: Driver = Driver.create(); + await driver.delayMs(waitUiReadyMs); + const TAB: Component = await driver.findComponent(ON.text('WebController_SetWebDebuggingAccessFalse')); + await TAB.click(); + await driver.delayMs(waitUiReadyMs); + }); + + + /** + * afterEach: Test case-level clearance conditions, which are executed after each test case is executed. + */ + afterEach(() => { + }); + + /** + * afterAll: Test suite-level cleanup condition, which is executed after the test suite is executed. + */ + // afterAll(async () => { + // await stopAbility(); + // const driver: Driver = Driver.create(); + // await driver.delayMs(waitUiReadyMs); + // }); + + /** + * @tc.number: SUB_Web_WebView_Stop_Func_0100 + * @tc.name : SUB_Web_WebView_Stop_Func_0100 + * @tc.desc : test whether the stop function is valid + * @tc.size : MediumTest + * @tc.type : Func + * @tc.level : 2 + */ + it('SUB_Web_WebView_SetWebDebuggingAccess_Func_0100', 0, async () => { + console.log('SUB_Web_WebView_SetWebDebuggingAccess_Func_0100 test start'); + const driver: Driver = Driver.create(); + await driver.delayMs(waitUiReadyMs); + }); + + }); +} diff --git a/xtstemplate/entry/src/ohosTest/ets/test/WebController_SetWebDebuggingAccessTrue.test.ets b/xtstemplate/entry/src/ohosTest/ets/test/WebController_SetWebDebuggingAccessTrue.test.ets new file mode 100644 index 0000000..1665661 --- /dev/null +++ b/xtstemplate/entry/src/ohosTest/ets/test/WebController_SetWebDebuggingAccessTrue.test.ets @@ -0,0 +1,81 @@ +/* + * Copyright (C) 2023 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 { + describe, + it, + expect, + beforeAll, + beforeEach, + afterEach, + afterAll, +} from '@ohos/hypium'; +import { Driver, ON, Component } from '@ohos.UiTest'; +import { startAbility, stopAbility, waitUiReadyMs } from '../utils/index'; + +export default function WebController_SetWebDebuggingAccessTrueTest() { + describe('WebController_SetWebDebuggingAccessTrueTest', () => { + /** + * beforeAll: PrePageControlTest at the test suite level, which are executed before the test suite is executed. + */ + beforeAll(async () => { + await startAbility('com.example.webviewtest2', 'EntryAbility'); + const driver: Driver = Driver.create(); + await driver.delayMs(waitUiReadyMs); + }); + + /** + * beforeEach: PrePageControlTest at the test case level, which are executed before each test case is executed. + */ + beforeEach(async () => { + const driver: Driver = Driver.create(); + await driver.delayMs(waitUiReadyMs); + const TAB: Component = await driver.findComponent(ON.text('WebController_SetWebDebuggingAccessTrue')); + await TAB.click(); + await driver.delayMs(waitUiReadyMs); + }); + + + /** + * afterEach: Test case-level clearance conditions, which are executed after each test case is executed. + */ + afterEach(() => { + }); + + /** + * afterAll: Test suite-level cleanup condition, which is executed after the test suite is executed. + */ + // afterAll(async () => { + // await stopAbility(); + // const driver: Driver = Driver.create(); + // await driver.delayMs(waitUiReadyMs); + // }); + + /** + * @tc.number: SUB_Web_WebView_Stop_Func_0100 + * @tc.name : SUB_Web_WebView_Stop_Func_0100 + * @tc.desc : test whether the stop function is valid + * @tc.size : MediumTest + * @tc.type : Func + * @tc.level : 2 + */ + it('SUB_Web_WebView_SetWebDebuggingAccess_Func_0100', 0, async () => { + console.log('SUB_Web_WebView_SetWebDebuggingAccess_Func_0100 test start'); + const driver: Driver = Driver.create(); + await driver.delayMs(waitUiReadyMs); + }); + + }); +} -- Gitee