!294 uiTest flex测试case代码提交

Merge pull request !294 from Nicklaus/master
This commit is contained in:
openharmony_ci 2023-09-18 09:24:05 +00:00 committed by Gitee
commit 3a750ed26c
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
9 changed files with 9642 additions and 1 deletions

View File

@ -212,6 +212,10 @@ import FlexAlignItemsTest001 from './generalAttributes/Flex/FlexAlignItemsTest00
import FlexAlignSelfTest001 from './generalAttributes/Flex/FlexAlignSelfTest001.test'
import FlexBasisTest001 from './generalAttributes/Flex/FlexBasisTest001.test'
import FlexBasisTest002 from './generalAttributes/Flex/FlexBasisTest002.test'
import FlexBasisTest003 from './generalAttributes/Flex/FlexBasisTest003.test'
import FlexBasisTest004 from './generalAttributes/Flex/FlexBasisTest004.test'
import FlexDirectionTest001 from './generalAttributes/Flex/FlexDirectionTest001.test'
import FlexDisplayPriority001 from './generalAttributes/Flex/FlexDisplayPriorityTest001.test'
export default function testsuite() {
@ -398,4 +402,8 @@ export default function testsuite() {
FlexAlignSelfTest001()
FlexBasisTest001()
FlexBasisTest002()
FlexBasisTest003()
FlexBasisTest004()
FlexDirectionTest001()
FlexDisplayPriority001()
}

View File

@ -0,0 +1,109 @@
/**
* Copyright (c) 2023 Shenzhen Kaihong Digital Industry Development 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 CommonTest from '../../common/CommonTest';
import Utils from '../../model/Utils'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
import Settings from '../../model/Settings'
import windowSnap from '../../model/snapShot'
import Logger from '../../model/Logger'
import { AttrsManager } from '../../model/AttrsManager';
import {
UiComponent,
UiDriver,
Component,
Driver,
UiWindow,
ON,
BY,
MatchPattern,
DisplayRotation,
ResizeDirection,
WindowMode,
PointerMatrix
} from '@ohos.UiTest';
export default function FlexBasisTest003() {
let supportView = [
'AlphabetIndexer', 'Blank', 'Button', 'Checkbox', 'CheckboxGroup', 'DataPanel', 'DatePicker',
'Divider', 'Gauge', 'Image', 'ImageAnimator','Marquee', 'Menu', 'MenuItem','MenuItemGroup',
'Progress', 'QRCode', 'Radio', 'Rating', 'ScrollBar',
'Search', 'Select', 'Slider', 'Text', 'TextArea',
'TextInput','TextPicker', 'TextTimer', 'TimePicker', 'Badge', 'Column', 'ColumnSplit', 'Counter', 'Flex',
'GridRow', 'Grid', 'List', 'Navigator', 'Panel',
'RelativeContainer','Row', 'RowSplit', 'Scroll', 'SideBarContainer', 'Stack', 'Swiper', 'Tabs',
'WaterFlow', 'Video', 'Circle', 'Ellipse', 'Line', 'Polyline', 'Polygon', 'Path', 'Rect', 'Shape',
'Canvas','XComponent','Toggle1', 'Toggle2','Toggle3','NavRouter','Navigation'
]
//页面配置信息
// this param is required.
let pageConfig = {
testName: 'FlexBasisTest003', //截图命名的一部分
pageUrl: 'TestAbility/pages/flex/FlexBasisPage003' //用于设置窗口页面
}
//要测试的属性值遍历生成case
// this param is required.
let testValues =[
{
describe: 'null',
setValue: [null, null, null, null]
},
{
describe: 'undefined',
setValue: [undefined, undefined, undefined, undefined]
},
{
describe: '-5',
setValue: [-5, -5, -5, -5]
},
]
function sleep(time) {
return new Promise((resolve) => setTimeout(resolve, time))
}
// create test suite
describe("FlexBasisTest003", () => {
beforeAll(async function () {
console.info('beforeAll in1');
})
// create test cases by config.
afterEach(async function (done) {
if (Settings.windowClass == null) {
return
}
Settings.windowClass.destroyWindow((err) => {
if (err.code) {
Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`)
return;
}
Logger.info('TEST', `Succeeded in destroy the window.`);
})
await sleep(1000);
done()
})
CommonTest.initTest1(pageConfig, supportView, testValues)
})
}
export function create() {
throw new Error('Function not implemented.');
}

View File

@ -0,0 +1,101 @@
/**
* Copyright (c) 2023 Shenzhen Kaihong Digital Industry Development 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 CommonTest from '../../common/CommonTest';
import Utils from '../../model/Utils'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
import Settings from '../../model/Settings'
import windowSnap from '../../model/snapShot'
import Logger from '../../model/Logger'
import { AttrsManager } from '../../model/AttrsManager';
import {
UiComponent,
UiDriver,
Component,
Driver,
UiWindow,
ON,
BY,
MatchPattern,
DisplayRotation,
ResizeDirection,
WindowMode,
PointerMatrix
} from '@ohos.UiTest';
export default function FlexBasisTest004() {
let supportView = [
'AlphabetIndexer', 'Blank', 'Button', 'Checkbox', 'CheckboxGroup', 'DataPanel', 'DatePicker',
'Divider', 'Gauge', 'Image', 'ImageAnimator','Marquee', 'Menu', 'MenuItem','MenuItemGroup',
'Progress', 'QRCode', 'Radio', 'Rating', 'ScrollBar',
'Search', 'Select', 'Slider', 'Text', 'TextArea',
'TextInput','TextPicker', 'TextTimer', 'TimePicker', 'Badge', 'Column', 'ColumnSplit', 'Counter', 'Flex',
'GridRow', 'Grid', 'List', 'Navigator', 'Panel',
'RelativeContainer','Row', 'RowSplit', 'Scroll', 'SideBarContainer', 'Stack', 'Swiper', 'Tabs',
'WaterFlow', 'Video', 'Circle', 'Ellipse', 'Line', 'Polyline', 'Polygon', 'Path', 'Rect', 'Shape',
'Canvas','XComponent','Toggle1', 'Toggle2','Toggle3','NavRouter','Navigation'
]
//页面配置信息
// this param is required.
let pageConfig = {
testName: 'FlexBasisTest004', //截图命名的一部分
pageUrl: 'TestAbility/pages/flex/FlexBasisPage004' //用于设置窗口页面
}
//要测试的属性值遍历生成case
// this param is required.
let testValues =[
{
describe: 'no_basis',
setValue: [100,100,100,100]
}
]
function sleep(time) {
return new Promise((resolve) => setTimeout(resolve, time))
}
// create test suite
describe("FlexBasisTest004", () => {
beforeAll(async function () {
console.info('beforeAll in1');
})
// create test cases by config.
afterEach(async function (done) {
if (Settings.windowClass == null) {
return
}
Settings.windowClass.destroyWindow((err) => {
if (err.code) {
Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`)
return;
}
Logger.info('TEST', `Succeeded in destroy the window.`);
})
await sleep(1000);
done()
})
CommonTest.initTest1(pageConfig, supportView, testValues)
})
}
export function create() {
throw new Error('Function not implemented.');
}

View File

@ -0,0 +1,112 @@
/**
* Copyright (c) 2023 Shenzhen Kaihong Digital Industry Development 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 CommonTest from '../../common/CommonTest';
import Utils from '../../model/Utils'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
import Settings from '../../model/Settings'
import windowSnap from '../../model/snapShot'
import Logger from '../../model/Logger'
import { AttrsManager } from '../../model/AttrsManager';
import {
UiComponent,
UiDriver,
Component,
Driver,
UiWindow,
ON,
BY,
MatchPattern,
DisplayRotation,
ResizeDirection,
WindowMode,
PointerMatrix
} from '@ohos.UiTest';
export default function FlexDirectionTest001() {
let supportView = [
'AlphabetIndexer', 'Blank', 'Button', 'Checkbox', 'CheckboxGroup', 'DataPanel', 'DatePicker',
'Divider', 'Gauge', 'Image', 'ImageAnimator','Marquee', 'Menu', 'MenuItem','MenuItemGroup',
'Progress', 'QRCode', 'Radio', 'Rating', 'ScrollBar',
'Search', 'Select', 'Slider', 'Text', 'TextArea',
'TextInput','TextPicker', 'TextTimer', 'TimePicker', 'Badge', 'Column', 'ColumnSplit', 'Counter', 'Flex',
'GridRow', 'Grid', 'List', 'Navigator', 'Panel',
'RelativeContainer','Row', 'RowSplit', 'Scroll', 'SideBarContainer', 'Stack', 'Swiper', 'Tabs',
'WaterFlow', 'Video', 'Circle', 'Ellipse', 'Line', 'Polyline', 'Polygon', 'Path', 'Rect', 'Shape',
'Canvas','XComponent','Toggle1', 'Toggle2','Toggle3','NavRouter','Navigation'
]
//页面配置信息
// this param is required.
let pageConfig = {
testName: 'FlexDirectionTest001', //截图命名的一部分
pageUrl: "TestAbility/pages/flex/FlexDirectionPage001" //用于设置窗口页面
}
//要测试的属性值遍历生成case
// this param is required.
let testValues =[
{
describe: 'Direction_Row',
setValue: { wrap: FlexWrap.Wrap, direction: FlexDirection.Row}
},
{
describe: 'Direction_RowReverse',
setValue: { wrap: FlexWrap.Wrap, direction: FlexDirection.RowReverse}
},
{
describe: 'Direction_Column',
setValue: { wrap: FlexWrap.Wrap, direction: FlexDirection.Column}
},
{
describe: 'Direction_ColumnReverse',
setValue: { wrap: FlexWrap.Wrap, direction: FlexDirection.ColumnReverse}
},
]
function sleep(time) {
return new Promise((resolve) => setTimeout(resolve, time))
}
// create test suite
describe("FlexDirectionTest001", () => {
beforeAll(async function () {
console.info('beforeAll in1');
})
// create test cases by config.
afterEach(async function (done) {
if (Settings.windowClass == null) {
return
}
Settings.windowClass.destroyWindow((err) => {
if (err.code) {
Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`)
return;
}
Logger.info('TEST', `Succeeded in destroy the window.`);
})
await sleep(1000);
done()
})
CommonTest.initTest1(pageConfig, supportView, testValues)
})
}
export function create() {
throw new Error('Function not implemented.');
}

View File

@ -0,0 +1,104 @@
/**
* Copyright (c) 2023 Shenzhen Kaihong Digital Industry Development 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 CommonTest from '../../common/CommonTest';
import Utils from '../../model/Utils'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
import Settings from '../../model/Settings'
import windowSnap from '../../model/snapShot'
import Logger from '../../model/Logger'
import { AttrsManager } from '../../model/AttrsManager';
import {
UiComponent,
UiDriver,
Component,
Driver,
UiWindow,
ON,
BY,
MatchPattern,
DisplayRotation,
ResizeDirection,
WindowMode,
PointerMatrix
} from '@ohos.UiTest';
export default function FlexDisplayPriority001() {
//69*2=138
let supportView = [
'AlphabetIndexer', 'Blank', 'Button', 'Checkbox', 'CheckboxGroup', 'DataPanel', 'DatePicker',
'Divider', 'Gauge', 'Image', 'ImageAnimator','Marquee', 'Menu', 'MenuItem','MenuItemGroup',
'Progress', 'QRCode', 'Radio', 'Rating', 'ScrollBar',
'Search', 'Select', 'Slider', 'Text', 'TextArea',
'TextInput','TextPicker', 'TextTimer', 'TimePicker', 'Badge', 'Column', 'ColumnSplit', 'Counter', 'Flex',
'GridRow', 'Grid', 'List', 'Navigator', 'Panel',
'RelativeContainer','Row', 'RowSplit', 'Scroll', 'SideBarContainer', 'Stack', 'Swiper', 'Tabs',
'WaterFlow', 'Video', 'Circle', 'Ellipse', 'Line', 'Polyline', 'Polygon', 'Path', 'Rect', 'Shape',
'Canvas','XComponent','Toggle1', 'Toggle2','Toggle3','NavRouter','Navigation'
]
//页面配置信息
// this param is required.
let pageConfig = {
testName: 'FlexDisplayPriority001', //截图命名的一部分
pageUrl: 'TestAbility/pages/flex/FlexDisplayPriorityPage001' //用于设置窗口页面
}
//要测试的属性值遍历生成case
// this param is required.
let testValues =[
{
describe: '1_2_3_4',
setValue: [1, 2, 3, 4]
},
{
describe: '1_0.5',
setValue: [1, 0.5, 0.5, 1]
},
]
function sleep(time) {
return new Promise((resolve) => setTimeout(resolve, time))
}
// create test suite
describe("FlexDisplayPriority001", () => {
beforeAll(async function () {
console.info('beforeAll in1');
})
// create test cases by config.
afterEach(async function (done) {
if (Settings.windowClass == null) {
return
}
Settings.windowClass.destroyWindow((err) => {
if (err.code) {
Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`)
return;
}
Logger.info('TEST', `Succeeded in destroy the window.`);
})
await sleep(1000);
done()
})
CommonTest.initTest1(pageConfig, supportView, testValues)
})
}
export function create() {
throw new Error('Function not implemented.');
}

View File

@ -179,6 +179,9 @@
"TestAbility/pages/flex/FlexAlignSelfPage001",
"TestAbility/pages/flex/FlexBasisPage001",
"TestAbility/pages/flex/FlexBasisPage002",
"TestAbility/pages/flex/FlexBasisPage003"
"TestAbility/pages/flex/FlexBasisPage003",
"TestAbility/pages/flex/FlexBasisPage004",
"TestAbility/pages/flex/FlexDirectionPage001",
"TestAbility/pages/flex/FlexDisplayPriorityPage001"
]
}