提交 85f992fe 编写于 作者: Z zhouke

modify.Signed-off-by: <zhouke35@huawei.com>.

Signed-off-by: Nzhouke <zhouke35@huawei.com>
上级 56dfc4f7
......@@ -16,6 +16,6 @@ import("//build/ohos_var.gni")
group("arkXtest") {
testonly = true
if (is_standard_system) {
deps = [ "uitest:uitest_xts" ]
deps = [ "uitest:uitestActs" ]
}
}
# Copyright (C) 2021 Huawei Device Co., Ltd.
# Copyright (C) 2022 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
......@@ -13,7 +13,7 @@
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("uitest_xts") {
ohos_js_hap_suite("uitestActs") {
hap_profile = "./src/main/config.json"
deps = [
":uitest_ets_assets",
......@@ -22,7 +22,7 @@ ohos_js_hap_suite("uitest_xts") {
]
ets2abc = true
certificate_profile = "//test/xts/acts/arkXtest/uitest/signature/auto_ohos_default_com.uitest.test.p7b"
hap_name = "uitest_xts"
hap_name = "uitestActs"
}
ohos_js_assets("uitest_ets_assets") {
source_dir = "./src/main/ets/MainAbility"
......
......@@ -3,8 +3,8 @@
"driver": {
"type": "OHJSUnitTest",
"test-timeout": "1800000",
"bundle-name": "com.uitest.test",
"package-name": "com.uitest.test",
"bundle-name": "com.uitest.acts",
"package-name": "com.uitest.acts",
"shell-timeout": "60000"
},
"kits": [
......@@ -14,6 +14,25 @@
],
"type": "AppInstallKit",
"cleanup-apps": true
},
{
"type": "PushKit",
"push": [
"resource/arkXtest/arkXtest_windowsTest.hap -> /data/local/tmp/arkXtest_windowsTest.hap",
"resource/arkXtest/window_manager_config.xml -> /system/etc/window/resources/window_manager_config.xml"
]
},
{
"type": "ShellKit",
"run-command": [
"power-shell wakeup",
"uinput -T -d 300 600 -m 300 600 300 100 -u 300 100",
"power-shell setmode 602",
"bm install -p /data/local/tmp/arkXtest_windowsTest.hap"
],
"teardown-command": [
"bm uninstall -n com.example.windows"
]
}
]
}
\ No newline at end of file
{
"app": {
"vendor": "open",
"bundleName": "com.uitest.test",
"bundleName": "com.uitest.acts",
"version": {
"code": 1000000,
"name": "1.0.0"
......@@ -14,7 +14,7 @@
},
"deviceConfig": {},
"module": {
"package": "com.uitest.test",
"package": "com.uitest.acts",
"name": ".MyApplication",
"mainAbility": ".MainAbility",
"srcPath": "MainAbility",
......
/**
* Copyright (c) 2022 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 router from '@system.router';
import prompt from '@ohos.prompt';
......@@ -41,7 +27,12 @@ struct ScrollExample {
router.push({ uri: 'pages/fourth' })
})
)
Text('Click twice')
Button() {
Text('Click twice')
.fontSize(25)
.fontWeight(FontWeight.Bold)
}
.type(ButtonType.Capsule)
.margin({top:20})
.gesture(
TapGesture({ count: 2 })
......
......@@ -25,7 +25,7 @@ struct Third{
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('page_3')
Text('doubleClick')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
......
......@@ -41,7 +41,12 @@ struct ScrollExample {
router.push({ uri: 'pages/fourth' })
})
)
Text('Click twice')
Button() {
Text('Click twice')
.fontSize(25)
.fontWeight(FontWeight.Bold)
}
.type(ButtonType.Capsule)
.margin({top:20})
.gesture(
TapGesture({ count: 2 })
......
......@@ -25,7 +25,7 @@ struct Third{
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('page_3')
Text('doubleClick')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
......
......@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import abilityTest from './Ability.test'
import abilityTest from './uitest.test'
export default function testsuite() {
abilityTest()
......
......@@ -14,7 +14,7 @@
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
import abilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry';
import { UiDriver, BY, ResizeDirection, MatchPattern } from '@ohos.uitest'
import { UiDriver, BY, ResizeDirection, MatchPattern, WindowMode } from '@ohos.uitest'
import ability_featureAbility from '@ohos.ability.featureAbility';
const delegator = abilityDelegatorRegistry.getAbilityDelegator();
......@@ -39,7 +39,7 @@ async function stopApplication(bundleName: string) {
export default function abilityTest() {
describe('UiTestCase', function () {
it('UiComponent.InputText', 0, async function () {
it('testInputNumber', 0, async function () {
let driver = UiDriver.create()
await driver.delayMs(waitUiReadyMs)
let input = await driver.findComponent(BY.type('TextInput'))
......@@ -50,37 +50,54 @@ export default function abilityTest() {
expect(text == '123').assertTrue()
})
it('UiComponent.ClearText', 0, async function () {
it('testClearText', 0, async function () {
let driver = UiDriver.create()
await driver.delayMs(waitUiReadyMs)
let input = await driver.findComponent(BY.type('TextInput'))
await input.clearText()
let input1 = await driver.findComponent(BY.type('TextInput'))
await input1.inputText('abc')
let input2 = await driver.findComponent(BY.type('TextInput'))
await input2.clearText()
await driver.delayMs(waitUiReadyMs)
let input_new = await driver.findComponent(BY.type('TextInput'))
let text = await input_new.getText()
expect(text).assertEqual('')
})
it('checkable', 0, async function () {
it('testCheckable', 0, async function () {
let driver = UiDriver.create()
await driver.delayMs(waitUiReadyMs)
let button = await driver.findComponent(BY.checkable(true).type('Checkbox'))
let checkable = await button.isCheckable()
expect(typeof (checkable) == 'boolean').assertTrue()
expect(checkable == true).assertTrue()
})
it('checked', 0, async function () {
it('testChecked', 0, async function () {
let driver = UiDriver.create()
await driver.delayMs(waitUiReadyMs)
let button = await driver.findComponent(BY.checked(false).type('Checkbox'))
let checked = await button.isChecked()
expect(typeof (checked) == 'boolean').assertTrue()
expect(checked == false).assertTrue()
})
it('testMatchPattren', 0, async function () {
let driver = UiDriver.create()
await driver.delayMs(waitUiReadyMs)
let Button1 = await driver.findComponent(BY.text('next page',MatchPattern.EQUALS))
expect(await Button1.getText() == 'next page').assertTrue()
let Button2 = await driver.findComponent(BY.text('next',MatchPattern.STARTS_WITH))
expect(await Button2.getText() == 'next page').assertTrue()
let Button3 = await driver.findComponent(BY.text('page',MatchPattern.ENDS_WITH))
expect(await Button3.getText() == 'next page').assertTrue()
let Button4 = await driver.findComponent(BY.text('ext',MatchPattern.CONTAINS))
expect(await Button4.getText() == 'next page').assertTrue()
})
it('UiDriver.click', 0, async function () {
it('testClick', 0, async function () {
let driver = UiDriver.create()
await driver.delayMs(waitUiReadyMs)
await driver.click(350, 90)
let Button = await driver.findComponent(BY.text('next page'))
let center = await Button.getBoundsCenter()
await driver.click(center.X, center.Y)
await driver.delayMs(waitUiReadyMs)
let newButton = await driver.findComponent(BY.text('back to index'))
let text = await newButton.getText()
......@@ -88,10 +105,25 @@ export default function abilityTest() {
await newButton.click()
})
it('UiDriver.LongClick', 0, async function () {
it('testDoubleClick', 0, async function () {
let driver = UiDriver.create()
await driver.delayMs(waitUiReadyMs)
let Button = await driver.findComponent(BY.text('Click twice'))
let center = await Button.getBoundsCenter()
await driver.doubleClick(center.X, center.Y)
await driver.delayMs(waitUiReadyMs)
let button = await driver.findComponent(BY.text('doubleClick'))
let text = await button.getText()
expect(text == 'doubleClick').assertTrue()
await button.click()
})
it('testLongClick', 0, async function () {
let driver = UiDriver.create()
await driver.delayMs(waitUiReadyMs)
await driver.longClick(350, 90)
let Button = await driver.findComponent(BY.text('next page'))
let center = await Button.getBoundsCenter()
await driver.longClick(center.X, center.Y)
await driver.delayMs(waitUiReadyMs)
let newButton = await driver.findComponent(BY.text('longClick'))
let text = await newButton.getText()
......@@ -99,26 +131,31 @@ export default function abilityTest() {
await newButton.click()
})
it('key', 0, async function () {
it('testUiComponentClick', 0, async function () {
let driver = UiDriver.create()
await driver.delayMs(waitUiReadyMs)
let button = await driver.findComponent(BY.key('my-key'))
expect(await button.getKey() == 'my-key').assertTrue()
let button = await driver.findComponent(BY.text('next page'))
await button.click()
await driver.delayMs(waitUiReadyMs)
let newButton = await driver.findComponent(BY.text('back to index'))
let text = await newButton.getText()
expect(text == 'back to index').assertTrue()
await newButton.click()
})
it('UiComponent.Click', 0, async function () {
it('testUiComponentDoubleClick', 0, async function () {
let driver = UiDriver.create()
await driver.delayMs(waitUiReadyMs)
let button = await driver.findComponent(BY.text('next page', MatchPattern.EQUALS))
await button.click()
let button = await driver.findComponent(BY.text('Click twice'))
await button.doubleClick()
await driver.delayMs(waitUiReadyMs)
let newButton = await driver.findComponent(BY.text('back to index'))
let newButton = await driver.findComponent(BY.text('doubleClick'))
let text = await newButton.getText()
expect(text == 'back to index').assertTrue()
expect(text == 'doubleClick').assertTrue()
await newButton.click()
})
it('UiComponent.LongClick', 0, async function () {
it('testUiComponentLongClick', 0, async function () {
let driver = UiDriver.create()
await driver.delayMs(waitUiReadyMs)
let button = await driver.findComponent(BY.text('next page'))
......@@ -130,71 +167,79 @@ export default function abilityTest() {
await newButton.click()
})
it('UiComponent.getType', 0, async function () {
it('testKey', 0, async function () {
let driver = UiDriver.create()
await driver.delayMs(waitUiReadyMs)
let text = await driver.findComponent(BY.type('Text'))
let type = await text.getType()
expect(type == 'Text').assertTrue()
let button = await driver.findComponent(BY.key('my-key'))
expect(await button.getKey() == 'my-key').assertTrue()
})
it('UiComponent.getText', 0, async function () {
it('testId', 0, async function () {
let driver = UiDriver.create()
await driver.delayMs(waitUiReadyMs)
let button = await driver.findComponent(BY.text('next page'))
let text = await button.getText()
expect(text == 'next page').assertTrue()
let id = await button.getId()
let button2 = await driver.findComponent(BY.id(id))
expect(await button.getText() == 'next page').assertTrue()
})
it('UiComponent.isClickable', 0, async function () {
it('testGetType', 0, async function () {
let driver = UiDriver.create()
await driver.delayMs(waitUiReadyMs)
let text = await driver.findComponent(BY.type('Text'))
let type = await text.getType()
expect(type == 'Text').assertTrue()
})
it('testClickable', 0, async function () {
let driver = UiDriver.create()
await driver.delayMs(waitUiReadyMs)
let button = await driver.findComponent(BY.text('next page').clickable(false))
let clickable = await button.isClickable()
expect(typeof (clickable) == 'boolean').assertTrue()
expect(clickable == false).assertTrue()
})
it('UiComponent.isLongClickable', 0, async function () {
it('testLongClickable', 0, async function () {
let driver = UiDriver.create()
await driver.delayMs(waitUiReadyMs)
let button = await driver.findComponent(BY.text('next page').longClickable(false))
let longClickable = await button.isLongClickable()
expect(typeof (longClickable) == 'boolean').assertTrue()
expect(longClickable== false).assertTrue()
})
it('UiComponent.isScrollable', 0, async function () {
it('testScrollable', 0, async function () {
let driver = UiDriver.create()
await driver.delayMs(waitUiReadyMs)
let scrollBar = await driver.findComponent(BY.type('Scroll').scrollable(false))
let scrollable = await scrollBar.isScrollable()
expect(typeof (scrollable) == 'boolean').assertTrue()
expect(scrollable == false).assertTrue()
})
it('UiComponent.isEnabled', 0, async function () {
it('testEnabled', 0, async function () {
let driver = UiDriver.create()
await driver.delayMs(waitUiReadyMs)
let button = await driver.findComponent(BY.text('next page').enabled(true))
let enable = await button.isEnabled()
expect(enable).assertEqual(true)
expect(enable == true).assertTrue()
})
it('UiComponent.isFocused', 0, async function () {
it('testFocused', 0, async function () {
let driver = UiDriver.create()
await driver.delayMs(waitUiReadyMs)
let button = await driver.findComponent(BY.text('next page').focused(false))
let focused = await button.isFocused()
expect(typeof (focused) == 'boolean').assertTrue()
expect(focused == false).assertTrue()
})
it('UiComponent.isSelected', 0, async function () {
it('testSelected', 0, async function () {
let driver = UiDriver.create()
await driver.delayMs(waitUiReadyMs)
let button = await driver.findComponent(BY.text('next page').selected(false))
let selected = await button.isSelected()
expect(typeof (selected) == 'boolean').assertTrue()
expect(selected == false).assertTrue()
})
it('UiComponent.scrollToBottom', 0, async function () {
it('testScrollToBottom', 0, async function () {
let driver = UiDriver.create()
await driver.delayMs(waitUiReadyMs)
let scrollBar = await driver.findComponent(BY.type('Scroll'))
......@@ -202,28 +247,26 @@ export default function abilityTest() {
await scrollBar.scrollToBottom()
let button = await driver.findComponent(BY.text('bottom'))
expect(await button.getText() == 'bottom').assertTrue()
await scrollBar.scrollToTop()
})
it('UiComponent.scrollToTop', 0, async function () {
it('testScrollToTop', 0, async function () {
let driver = UiDriver.create()
await driver.delayMs(waitUiReadyMs)
await driver.swipe(100, 200, 100, 100)
await driver.delayMs(waitUiReadyMs)
let scrollBar = await driver.findComponent(BY.type('Scroll'))
expect(scrollBar !== null).assertTrue()
await scrollBar.scrollToBottom()
await scrollBar.scrollToTop()
let button = await driver.findComponent(BY.text('next page'))
expect(await button.getText() == 'next page').assertTrue()
})
it('UiDriver.assertComponentExist', 0, async function () {
it('testAssertComponentExist', 0, async function () {
let driver = UiDriver.create()
await driver.delayMs(waitUiReadyMs)
await driver.assertComponentExist(BY.text('next page'))
})
it('UiDriver.pressBack', 0, async function () {
it('testPressBack', 0, async function () {
let driver = UiDriver.create()
await driver.delayMs(waitUiReadyMs)
let button = await driver.findComponent(BY.text('next page'))
......@@ -235,81 +278,98 @@ export default function abilityTest() {
expect(await button_ori.getText() == 'next page').assertTrue()
})
it('UiDriver.findComponents', 0, async function () {
it('testFindComponents', 0, async function () {
let driver = UiDriver.create()
await driver.delayMs(waitUiReadyMs)
let buttons = await driver.findComponents(BY.type('Button'))
expect(await buttons[0].getText() != null).assertTrue()
})
it('UiDriver.triggerKey', 0, async function () {
it('testTriggerKey', 0, async function () {
let driver = UiDriver.create()
await driver.delayMs(waitUiReadyMs)
let button = await driver.findComponent(BY.text('next page'))
await button.click()
await driver.delayMs(waitUiReadyMs)
await driver.triggerKey(2)
let keyBack = 2
await driver.triggerKey(keyBack)
await driver.delayMs(waitUiReadyMs)
let button_ori = await driver.findComponent(BY.text('next page'))
expect(await button_ori.getText() == 'next page').assertTrue()
})
it('getUiComponentBounds', 0, async function () {
it('testGetUiComponentBounds', 0, async function () {
let driver = UiDriver.create()
await driver.delayMs(waitUiReadyMs)
let text = await driver.findComponent(BY.text('next page'))
expect(text !== null).assertTrue()
let bounds = await text.getBounds();
console.info(`UiTestCase, bounds=${bounds}, type=${typeof (bounds)}`)
console.info(bounds.rightX.toString())
console.info(bounds.leftX.toString())
console.info(bounds.topY.toString())
console.info(bounds.bottomY.toString())
expect(bounds !== null).assertTrue()
expect(bounds.rightX).assertLarger(bounds.leftX)
expect(bounds.bottomY).assertLarger(bounds.topY)
})
it('getUiComponentBoundsCenter', 0, async function () {
it('testGetUiComponentBoundsCenter', 0, async function () {
let driver = UiDriver.create()
await driver.delayMs(waitUiReadyMs)
let button = await driver.findComponent(BY.text('next page'))
let point = await button.getBoundsCenter()
let bounds = await button.getBounds()
expect(point!== null).assertTrue()
expect(point.Y == (bounds.bottomY + bounds.topY)/2).assertTrue()
expect(point.X == (bounds.rightX + bounds.leftX)/2).assertTrue()
})
it('UiDriver.waitForComponent', 0, async function () {
it('testWaitForComponent', 0, async function () {
let driver = UiDriver.create()
await driver.delayMs(waitUiReadyMs)
let button = await driver.waitForComponent(BY.text('next page'), waitUiReadyMs)
expect(button !== null).assertTrue()
})
it('UiDriver.screenCap', 0, async function () {
it('testScreenCap', 0, async function () {
let driver = UiDriver.create()
await driver.delayMs(waitUiReadyMs)
let savePath = '/data/local/tmp/1.png'
let success = await driver.screenCap(savePath)
expect(success == true).assertTrue()
})
it('testIsBefore', 0, async function () {
let driver = UiDriver.create()
await driver.delayMs(waitUiReadyMs)
let path = '/data/local/tmp/1.png'
let success = await driver.screenCap(path)
expect(typeof (success) == 'boolean').assertTrue()
let button = await driver.findComponent(BY.isBefore(BY.text('Click twice')).type('Button'))
expect(await button.getType() == 'Button').assertTrue()
})
it('By.isBefore', 0, async function () {
await startAbility('com.ohos.settings', 'com.ohos.settings.MainAbility')
it('testIsAfter', 0, async function () {
let driver = UiDriver.create()
await driver.delayMs(waitUiReadyMs)
let button = await driver.findComponent(BY.isBefore(BY.text('显示与亮度')).text('移动数据'))
expect(await button.getText() == '移动数据').assertTrue()
let button = await driver.findComponent(BY.isAfter(BY.text('next page')).type('Text'))
expect(await button.getText() == 'Click twice').assertTrue()
})
it('By.isAfter', 0, async function () {
await startAbility('com.ohos.settings', 'com.ohos.settings.MainAbility')
it('testScrollSearch', 0, async function () {
let driver = UiDriver.create()
await driver.delayMs(waitUiReadyMs)
let button = await driver.findComponent(BY.isAfter(BY.text('显示与亮度')).text('声音'))
expect(await button.getText() == '声音').assertTrue()
let scrollBar = await driver.findComponent(BY.type('Scroll'))
let text = await scrollBar.scrollSearch(BY.text('4'))
await driver.delayMs(waitUiReadyMs)
expect(text != null).assertTrue()
await scrollBar.scrollToTop()
})
it('window.resize', 0, async function () {
it('testGetWindowMode', 0, async function () {
await startAbility('com.example.windows', 'MainAbility')
let driver = UiDriver.create()
await driver.delayMs(waitUiReadyMs)
let window = await driver.findWindow({bundleName:'com.example.windows'})
let mode = await window.getWindowMode()
expect(mode == WindowMode.FULLSCREEN).assertTrue()
await stopApplication('com.example.windows')
})
it('testWindowMoveTo', 0, async function () {
await startAbility('com.example.windows', 'MainAbility')
let driver = UiDriver.create()
await driver.delayMs(waitUiReadyMs)
......@@ -317,87 +377,81 @@ export default function abilityTest() {
await window.resume()
await driver.delayMs(waitUiReadyMs)
let window1 = await driver.findWindow({bundleName:'com.example.windows'})
let bounds1 = await window1.getBounds()
await window1.moveTo(100,100)
await driver.delayMs(waitUiReadyMs)
let window2 = await driver.findWindow({bundleName:'com.example.windows'})
await window2.resize(600, 600,7)
let bounds2 = await window2.getBounds()
expect(bounds1 != bounds2).assertTrue()
await stopApplication('com.example.windows')
})
})
it('window.maximize', 0, async function () {
it('testWindowResize', 0, async function () {
await startAbility('com.example.windows', 'MainAbility')
let driver = UiDriver.create()
await driver.delayMs(waitUiReadyMs)
let window = await driver.findWindow({bundleName:'com.example.windows'})
await window.resume()
await driver.delayMs(waitUiReadyMs)
let window1 = await driver.findWindow({bundleName:'com.example.windows'})
let bounds1 = await window1.getBounds()
await window1.resize(400,400,ResizeDirection.RIGHT_DOWN)
await driver.delayMs(waitUiReadyMs)
let window2 = await driver.findWindow({bundleName:'com.example.windows'})
await window2.maximize()
let bounds2 = await window2.getBounds()
expect(bounds1 != bounds2).assertTrue()
await stopApplication('com.example.windows')
})
it('window.minimize', 0, async function () {
it('testWindowFocus', 0, async function () {
await startAbility('com.example.windows', 'MainAbility')
let driver = UiDriver.create()
await driver.delayMs(waitUiReadyMs)
let window = await driver.findWindow({bundleName:'com.example.windows'})
await window.minimize()
await window.focus()
let IsActive = await window.focus()
expect(IsActive == true).assertTrue()
await stopApplication('com.example.windows')
})
it('window.close', 0, async function () {
it('testWindowMaximize', 0, async function () {
await startAbility('com.example.windows', 'MainAbility')
let driver = UiDriver.create()
await driver.delayMs(waitUiReadyMs)
let window = await driver.findWindow({bundleName:'com.example.windows'})
await window.close()
await window.resume()
let window2 = await driver.findWindow({bundleName:'com.example.windows'})
await window2.maximize()
await driver.delayMs(waitUiReadyMs)
let window3 = await driver.findWindow({bundleName:'com.example.windows'})
let mode = await window3.getWindowMode()
expect(mode == WindowMode.FULLSCREEN).assertTrue()
await stopApplication('com.example.windows')
})
it('window.split', 0, async function () {
it('testWindowMinimize', 0, async function () {
await startAbility('com.example.windows', 'MainAbility')
let driver = UiDriver.create()
await driver.delayMs(waitUiReadyMs)
let window = await driver.findWindow({bundleName:'com.example.windows'})
await window.split()
await window.minimize()
await driver.delayMs(waitUiReadyMs)
let button = await driver.findComponent(BY.text('Clock'))
expect(button != null).assertTrue()
await stopApplication('com.example.windows')
})
it('testWindowClose', 0, async function () {
await startAbility('com.example.windows', 'MainAbility')
let driver = UiDriver.create()
await driver.delayMs(waitUiReadyMs)
let window = await driver.findWindow({bundleName:'com.example.windows'})
await window.close()
await driver.delayMs(waitUiReadyMs)
let button = await driver.findComponent(BY.text('Clock'))
expect(button != null).assertTrue()
})
})
afterAll(function () {
console.info(`uitestApiStatistic::Start runnig afterAll`)
try {
let mod = globalThis.requireInternal('uitest')
// collect all functions
let objects = {
'By': mod.By, 'UiDriver': mod.UiDriver, 'UiComponent': mod.UiComponent
}
let allApis = []
for (let name in objects) {
let object = objects[name]
Object.getOwnPropertyNames(object).forEach(pn => {
if (pn != 'constructor' && typeof (object[pn]) == 'function') {
allApis.push(name + '.' + pn)
}
})
Object.getOwnPropertyNames(object.prototype).forEach(pn => {
if (pn != 'constructor' && typeof (object.prototype[pn]) == 'function') {
allApis.push(name + '.' + pn)
}
})
}
let calledApis: Array<string> = mod.getCalledJsApis()
calledApis.forEach(name => console.info(`uitestApiStatistic::CoveredApi: ${name}`))
let missedApis = allApis.filter(value =>!calledApis.includes(value))
console.info(`uitestApiStatistic::Total ${allApis.length}, coverd ${calledApis.length}, missed ${missedApis.length}`)
missedApis.forEach(name => console.warn(`uitestApiStatistic::NotCoveredApi: ${name}`))
} catch (e) {
console.error(`uitestApiStatistic::Runnig afterAll failed: ${e}`)
} finally {
console.info(`uitestApiStatistic::End runnig afterAll`)
}
})
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册