提交 7eddc4d2 编写于 作者: W wang-xupeng2

update Ui testcases

Signed-off-by: Nwang-xupeng2 <wangxupeng2@huawei.com>
上级 817001f1
......@@ -50,7 +50,7 @@ struct CheckboxExample {
} else {
this.selectedColor = "#000000"
}
}).key("check1").id('chek1')
}).key('chek1')
Checkbox({name: 'checkbox2', group: 'checkboxGroup'})
.select(false)
.selectedColor(0x39a2db)
......
......@@ -44,7 +44,7 @@ struct ImageAnimatorExample {
}
let callback:Callback = (message:any) => {
console.error('message = ' + message.name + "--" + message.value)
if (message.name == 'type') {
if (message.name == 'state') {
this.state = message.value
}
if (message.name == 'reverse') {
......@@ -99,7 +99,7 @@ struct ImageAnimatorExample {
.margin({ top: 100 })
.key('imageAnimator')
.onStart(() => {
console.info('Start')
console.info('Start123456')
this.message1 = 'start'
})
.onPause(() => {
......
......@@ -61,10 +61,10 @@ export default function TextPickerJsunit() {
// Get the content of Initial value
let driver = await UiDriver.create()
let change = await driver.findComponent(BY.key('text'));
let textChange = await change.getText();
console.info("[TextPickerJsunit_0100] textChange: " + JSON.stringify(textChange));
expect(textChange).assertEqual('value: 0');
let strJson1 = getInspectorByKey('text');
let obj1 = JSON.parse(strJson1);
console.info("[TextPickerJsunit_0100] obj1: " + JSON.stringify(obj1));
expect(obj1.$attrs.content).assertEqual('value: 0');
console.info('[TextPickerJsunit_0100] END');
done();
});
......@@ -110,10 +110,10 @@ export default function TextPickerJsunit() {
await CommonFunc.sleep(1000);
let driver = await UiDriver.create()
await driver.swipe(Math.round(right / 2), Math.round(bottom * 2 / 3), Math.round(right / 2), Math.round(bottom / 3));
let change = await driver.findComponent(BY.key('text'));
let textChange = await change.getText();
console.info("[TextPickerJsunit_0300] textChange: " + JSON.stringify(textChange));
expect(textChange == 'value: 0').assertFalse();
let strJson = getInspectorByKey('text');
let obj = JSON.parse(strJson);
console.info("[TextPickerJsunit_0300] obj: " + JSON.stringify(obj));
expect(obj.$attrs.content == 'value: 0').assertFalse();
done();
});
......
......@@ -76,19 +76,21 @@ export default function imageAniamtorJsunit() {
let strJson = getInspectorByKey('imageAnimator');
let obj = JSON.parse(strJson);
console.info('[imageAniamtorJsunit_0200] component obj is: ' + obj.$attrs.state);
//expect(obj.$attrs.state).assertEqual('AnimationStatus.Running');
expect(obj.$attrs.state).assertEqual('AnimationStatus.Running');
globalThis.value.message.notify({name:'state',value:AnimationStatus.Paused})
await CommonFunc.sleep(5000);
await CommonFunc.sleep(1000);
let strJson2 = getInspectorByKey('imageAnimator');
let obj2 = JSON.parse(strJson2);
console.info('[imageAniamtorJsunit_0200] component obj2 is: ' + obj2.$attrs.state);
//expect(obj2.$attrs.state).assertEqual('AnimationStatus.Paused');
expect(obj2.$attrs.state).assertEqual('AnimationStatus.Paused');
globalThis.value.message.notify({name:'state',value:AnimationStatus.Stopped})
await CommonFunc.sleep(5000);
await CommonFunc.sleep(1000);
let strJson3 = getInspectorByKey('imageAnimator');
let obj3 = JSON.parse(strJson3);
console.info('[imageAniamtorJsunit_0200] component obj3 is: ' + obj3.$attrs.state);
//expect(obj3.$attrs.state).assertEqual('AnimationStatus.Stopped');
expect(obj3.$attrs.state).assertEqual('AnimationStatus.Stopped');
console.info('[imageAniamtorJsunit_0200] END');
done();
});
......@@ -178,13 +180,15 @@ export default function imageAniamtorJsunit() {
expect(btn != null).assertTrue();
await btn.click();
await CommonFunc.sleep(1000);
let textComponent = await driver.findComponent(BY.key('t1'));
let text = await textComponent.getText();
expect(text).assertEqual('start');
let strJson = getInspectorByKey('t1');
let obj = JSON.parse(strJson);
console.info("[imageAniamtorJsunit_0700] obj: " + JSON.stringify(obj));
expect(obj.$attrs.content).assertEqual('start');
await CommonFunc.sleep(3000);
let textComponent1 = await driver.findComponent(BY.key('t5'));
let text1 = await textComponent1.getText();
expect(text1).assertEqual('onFinish');
let strJson1 = getInspectorByKey('t5');
let obj1 = JSON.parse(strJson1);
console.info("[imageAniamtorJsunit_0700] obj1: " + JSON.stringify(obj1));
expect(obj1.$attrs.content).assertEqual('onFinish');
console.info('imageAniamtorJsunit_0700 END');
done();
});
......@@ -201,7 +205,7 @@ export default function imageAniamtorJsunit() {
let btn2 = await driver.findComponent(ON.id('start'));
expect(btn2 != null).assertTrue();
await btn2.click();
await CommonFunc.sleep(1000);
await CommonFunc.sleep(1000);
let strJson = getInspectorByKey('t3');
let obj = JSON.parse(strJson);
console.info('imageAnimatorJsunit_0800 component obj is: '+ obj.$attrs.content);
......
......@@ -182,9 +182,34 @@ export default function sliderJsunit() {
expect(obj.$attrs.constructor.value).assertEqual('30.000000');
done();
});
it('sliderJsunit_0800', 0, async function (done) {
it('sliderJsunit_0800', 0, async function (done) {
// Verify the swipe function of slider component
console.info('sliderJsunit_0800 START');
await CommonFunc.sleep(1000);
let sliderT = CommonFunc.getComponentRect('sliderConstructor');
let top = sliderT.top
let bottom = sliderT.bottom
let left = sliderT.left
let right = sliderT.right
let x = Math.round(left + (right - left) / 2)
let driver = await Driver.create();
await driver.delayMs(waitUiReadyMs);
await driver.swipe(x, Math.round(bottom - 20), x, Math.round(top + 50));
await driver.delayMs(waitUiReadyMs);
let strJson = getInspectorByKey('tex');
let obj = JSON.parse(strJson);
console.info("[sliderJsunit_0800] obj: " + JSON.stringify(obj));
expect(obj.$attrs.content).assertEqual('30');
let strJson1 = getInspectorByKey('modeT');
let obj1 = JSON.parse(strJson1);
console.info("[sliderJsunit_0800] obj1: " + JSON.stringify(obj1));
expect(obj1.$attrs.content).assertEqual('mode');
done();
});
it('sliderJsunit_0900', 0, async function (done) {
console.info('[sliderJsunit_0800] START');
// modify the constructor attribute of slider dynamically
globalThis.value.message.notify({name:'vInSetValueOne',value:-30})
await CommonFunc.sleep(1000);
......@@ -203,7 +228,7 @@ export default function sliderJsunit() {
// check the value of changed parameter
let strJson = getInspectorByKey('sliderConstructor');
let obj = JSON.parse(strJson);
console.info('sliderJsunit_0200 component obj is: ' + obj.$attrs.style + "---" + obj.$attrs.constructor.direction + "--" + obj.$attrs.constructor.value
console.info('[sliderJsunit_0900] component obj is: ' + obj.$attrs.style + "---" + obj.$attrs.constructor.direction + "--" + obj.$attrs.constructor.value
+ "---" + obj.$attrs.constructor.reverse + "----" + obj.$attrs.constructor.min + "----" + obj.$attrs.constructor.max + "---" + obj.$attrs.constructor.step);
expect(obj.$attrs.style).assertEqual('SliderStyle.OutSet');
expect(obj.$attrs.constructor.direction).assertEqual('Axis.Horizontal');
......@@ -212,33 +237,7 @@ export default function sliderJsunit() {
expect(obj.$attrs.constructor.min).assertEqual('-20.000000');
expect(obj.$attrs.constructor.max).assertEqual('1000.000000');
expect(obj.$attrs.constructor.step).assertEqual('1.000000');
done();
});
it('sliderJsunit_0900', 0, async function (done) {
// Verify the swipe function of slider component
console.info('sliderJsunit_0900 START');
await CommonFunc.sleep(1000);
let sliderT = CommonFunc.getComponentRect('sliderConstructor2');
let top = sliderT.top
let sliderB = CommonFunc.getComponentRect('sliderConstructor2');
let bottom = sliderB.bottom
let sliderL = CommonFunc.getComponentRect('sliderConstructor2');
let left = sliderL.left
let sliderR = CommonFunc.getComponentRect('sliderConstructor2');
let right = sliderR.right
let driver = await Driver.create();
await driver.delayMs(waitUiReadyMs);
await driver.swipe(Math.round((right - left) / 2), Math.round(bottom - 10), Math.round((right - left) / 2), Math.round(top + 10));
await driver.delayMs(waitUiReadyMs);
let textIn = await driver.findComponent(ON.id('tex'));
let txt = await textIn.getText();
console.info('sliderJsunit_0900 component textIn obj is: ' + txt);
expect(txt).assertEqual('20');
let modeT = await driver.findComponent(ON.id('modeT'));
let txtt = await modeT.getText();
console.info('sliderJsunit_0900 modeT component obj is: ' + txtt);
expect(txtt).assertEqual('mode');
console.info('[sliderJsunit_0900] END');
done();
});
})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册