提交 1d4f76a1 编写于 作者: W wang-xupeng2

update slider steper and grid testcases

Signed-off-by: Nwang-xupeng2 <wangxupeng2@huawei.com>
上级 ec8b0dfc
...@@ -206,7 +206,7 @@ struct SliderExample { ...@@ -206,7 +206,7 @@ struct SliderExample {
Text(this.modeT).fontSize(9).fontColor(0xCCCCCC).width('50%').margin(15).key('modeT') Text(this.modeT).fontSize(9).fontColor(0xCCCCCC).width('50%').margin(15).key('modeT')
Row() { Row() {
Slider({ Slider({
value: this.vInSetValueOne1, value: this.vInSetValueOne,
style: this.style, style: this.style,
direction: this.directionT, direction: this.directionT,
reverse: this.reverse,// 竖向的Slider默认是上端是min值,下端是max值,因此想要从下往上滑动,需要设置reverse为true reverse: this.reverse,// 竖向的Slider默认是上端是min值,下端是max值,因此想要从下往上滑动,需要设置reverse为true
...@@ -215,7 +215,7 @@ struct SliderExample { ...@@ -215,7 +215,7 @@ struct SliderExample {
step:this.step step:this.step
}).showTips(true) }).showTips(true)
.onChange((value: number, mode: SliderChangeMode) => { .onChange((value: number, mode: SliderChangeMode) => {
this.vInSetValueOne1 = value this.vInSetValueOne = value
console.info('value:' + value + 'm`ode:' + mode.toString()) console.info('value:' + value + 'm`ode:' + mode.toString())
}).key('sliderConstructor') }).key('sliderConstructor')
...@@ -233,7 +233,7 @@ struct SliderExample { ...@@ -233,7 +233,7 @@ struct SliderExample {
Slider().showTips(true) Slider().showTips(true)
.onChange((value: number, mode: SliderChangeMode) => { .onChange((value: number, mode: SliderChangeMode) => {
this.vInSetValueOne = value this.vInSetValueOne1 = value
this.modeT = mode.toString() this.modeT = mode.toString()
console.info('value:' + value + 'm`ode:' + mode.toString()) console.info('value:' + value + 'm`ode:' + mode.toString())
}).key('sliderConstructor2') }).key('sliderConstructor2')
......
...@@ -88,7 +88,7 @@ struct StepperExample { ...@@ -88,7 +88,7 @@ struct StepperExample {
// 第二个步骤页 // 第二个步骤页
StepperItem() { StepperItem() {
Column() { Column() {
Text('Page Two') Text('Page Two').key('pageTwo')
.itemTextStyle() .itemTextStyle()
Button('change status:' + this.secondState) Button('change status:' + this.secondState)
.backgroundColor('#007dFF') .backgroundColor('#007dFF')
......
...@@ -143,12 +143,9 @@ export default function GridJsunit() { ...@@ -143,12 +143,9 @@ export default function GridJsunit() {
// Verify onScrollIndex event // Verify onScrollIndex event
let grid2 = CommonFunc.getComponentRect('grid2'); let grid2 = CommonFunc.getComponentRect('grid2');
let top = grid2.top let top = grid2.top
let grid2b = CommonFunc.getComponentRect('grid2'); let bottom = grid2.bottom
let bottom = grid2b.bottom let left = grid2.left
let grid2l = CommonFunc.getComponentRect('grid2'); let right = grid2.right
let left = grid2l.left
let grid2r = CommonFunc.getComponentRect('grid2');
let right = grid2r.right
let driver = await UiDriver.create() let driver = await UiDriver.create()
await driver.swipe(Math.round((right - left) / 2), Math.round(bottom - 10), Math.round((right - left) / 2), Math.round(top + 10)); await driver.swipe(Math.round((right - left) / 2), Math.round(bottom - 10), Math.round((right - left) / 2), Math.round(top + 10));
await driver.swipe(Math.round((right - left) / 2), Math.round(bottom - 10), Math.round((right - left) / 2), Math.round(top + 10)); await driver.swipe(Math.round((right - left) / 2), Math.round(bottom - 10), Math.round((right - left) / 2), Math.round(top + 10));
...@@ -166,9 +163,10 @@ export default function GridJsunit() { ...@@ -166,9 +163,10 @@ export default function GridJsunit() {
let button = await driver.findComponent(BY.key('button')); let button = await driver.findComponent(BY.key('button'));
await button.click(); await button.click();
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
let button1 = await driver.findComponent(BY.key('button')); let strJson = getInspectorByKey('button');
let text3 = await button1.getText(); let obj = JSON.parse(strJson);
expect(text3).assertEqual('clicked'); console.info('[GridJsunit_0400] component obj is: ' + obj.$attrs.content);
expect(obj.$attrs.content).assertEqual('clicked');
console.info('[GridJsunit_0400] END'); console.info('[GridJsunit_0400] END');
done(); done();
}); });
......
...@@ -120,32 +120,36 @@ export default function stepperJsunit() { ...@@ -120,32 +120,36 @@ export default function stepperJsunit() {
it('stepperJsunit_0600', 0, async function (done) { it('stepperJsunit_0600', 0, async function (done) {
console.info('stepperJsunit_0600 START'); console.info('stepperJsunit_0600 START');
// reset the component init status
globalThis.value.message.notify({name:'nextLabel',value:'下一步'});
await CommonFunc.sleep(1000);
globalThis.value.message.notify({name:'prevLabel',value:'返回'});
await CommonFunc.sleep(1000);
globalThis.value.message.notify({name:'status',value:ItemState.Normal}); globalThis.value.message.notify({name:'status',value:ItemState.Normal});
// test the stepper onChange onNext onPrevious event // test the stepper onChange onNext onPrevious event
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
let driver = UiDriver.create(); let driver = UiDriver.create();
let button = await driver.findComponent(BY.text('Next')); let button = await driver.findComponent(BY.text('Next'));
await button.click(); await button.click();
console.info('stepperJsunit_0600 button click succ');
await CommonFunc.sleep(1000);
// reset the component init status
globalThis.value.message.notify({name:'nextLabel',value:'下一步'});
await CommonFunc.sleep(1000);
globalThis.value.message.notify({name:'prevLabel',value:'返回'});
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
let button2 = await driver.findComponent(BY.text('下一步')); let button2 = await driver.findComponent(BY.text('下一步'));
await button2.click(); await button2.click();
console.info('stepperJsunit_0600 button2 click succ');
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
let textThree = await driver.findComponent(BY.text('Page Three')); let strJson = getInspectorByKey('pageThree');
let txt = await textThree.getText(); let obj = JSON.parse(strJson);
console.info('stepperJsunit_0700 component obj is: ' + txt); console.info('stepperJsunit_0600 component obj is: ' + obj.$attrs.content);
expect(txt).assertEqual('Page Three'); expect(obj.$attrs.content).assertEqual('Page Three');
// test the previous // test the previous
let button3 = await driver.findComponent(BY.text('返回')); let button3 = await driver.findComponent(BY.text('返回'));
await button3.click(); await button3.click();
let textTwo = await driver.findComponent(BY.text('Page Two')); await CommonFunc.sleep(1000);
let txtT = await textTwo.getText(); console.info('stepperJsunit_0600 button3 click succ');
console.info('stepperJsunit_0600 component obj is: ' + txtT); let strJson1 = getInspectorByKey('pageTwo');
expect(txtT).assertEqual('Page Two'); let obj1 = JSON.parse(strJson1);
console.info('stepperJsunit_0600 component obj1 is: ' + obj1.$attrs.content);
expect(obj1.$attrs.content).assertEqual('Page Two');
done(); done();
}); });
...@@ -157,17 +161,20 @@ export default function stepperJsunit() { ...@@ -157,17 +161,20 @@ export default function stepperJsunit() {
await CommonFunc.sleep(2000); await CommonFunc.sleep(2000);
let button2 = await driver.findComponent(BY.text('下一步')); let button2 = await driver.findComponent(BY.text('下一步'));
await button2.click(); await button2.click();
console.info('stepperJsunit_0700 button2 click succ');
await CommonFunc.sleep(2000); await CommonFunc.sleep(2000);
let button3 = await driver.findComponent(BY.text('下一步')); let button3 = await driver.findComponent(BY.text('下一步'));
await button3.click(); await button3.click();
console.info('stepperJsunit_0700 button3 click succ');
await CommonFunc.sleep(2000); await CommonFunc.sleep(2000);
let button4 = await driver.findComponent(BY.text('开始')); let button4 = await driver.findComponent(BY.text('开始'));
await button4.click(); await button4.click();
console.info('stepperJsunit_0700 button4 click succ');
await CommonFunc.sleep(2000); await CommonFunc.sleep(2000);
let textTwo = await driver.findComponent(BY.text('Page Four')); let strJson = getInspectorByKey('pageFour');
let txtT = await textTwo.getText(); let obj = JSON.parse(strJson);
console.info('stepperJsunit_0700 component obj is: ' + txtT); console.info('stepperJsunit_0700 component obj is: ' + obj.$attrs.content);
expect(txtT).assertEqual('Page Four'); expect(obj.$attrs.content).assertEqual('Page Four');
done(); done();
}); });
...@@ -179,10 +186,10 @@ export default function stepperJsunit() { ...@@ -179,10 +186,10 @@ export default function stepperJsunit() {
let button = await driver.findComponent(BY.text('返回')); let button = await driver.findComponent(BY.text('返回'));
await button.click(); await button.click();
await CommonFunc.sleep(2000); await CommonFunc.sleep(2000);
let textTwo = await driver.findComponent(BY.text('Page Three')); let strJson = getInspectorByKey('pageThree');
let txtT = await textTwo.getText(); let obj = JSON.parse(strJson);
console.info('stepperJsunit_0800 component obj is: ' + txtT); console.info('stepperJsunit_0800 component obj is: ' + obj.$attrs.content);
expect(txtT).assertEqual('Page Three'); expect(obj.$attrs.content).assertEqual('Page Three');
done(); done();
}); });
}) })
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册