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

update Beta1 demo

Signed-off-by: Nwang-xupeng2 <wangxupeng2@huawei.com>
上级 12360681
...@@ -17,6 +17,7 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from " ...@@ -17,6 +17,7 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "
import router from '@system.router'; import router from '@system.router';
import events_emitter from '@ohos.events.emitter' import events_emitter from '@ohos.events.emitter'
import Utils from './Utils'; import Utils from './Utils';
import {UiComponent, UiDriver, Component, Driver, UiWindow, ON, BY, MatchPattern, DisplayRotation, ResizeDirection, WindowMode, PointerMatrix} from '@ohos.UiTest';
export default function buttonJsunit() { export default function buttonJsunit() {
describe('buttonTest', function () { describe('buttonTest', function () {
...@@ -299,6 +300,9 @@ export default function buttonJsunit() { ...@@ -299,6 +300,9 @@ export default function buttonJsunit() {
}); });
it('testButton12', 0, async function (done) { it('testButton12', 0, async function (done) {
let driver = Driver.create();
let density = await driver.getDisplayDensity();
console.info("[testButton12] getDisplayDensity is: " + JSON.stringify(density));
await Utils.sleep(1000); await Utils.sleep(1000);
var callback = (eventData) => { var callback = (eventData) => {
console.info("[testButton12] get event state result is: " + JSON.stringify(eventData)); console.info("[testButton12] get event state result is: " + JSON.stringify(eventData));
...@@ -307,10 +311,17 @@ export default function buttonJsunit() { ...@@ -307,10 +311,17 @@ export default function buttonJsunit() {
console.info("[testButton12] get event state result is: " + Math.trunc(event.screenY)); console.info("[testButton12] get event state result is: " + Math.trunc(event.screenY));
console.info("[testButton12] get event state result is: " + Math.trunc(event.screenX)); console.info("[testButton12] get event state result is: " + Math.trunc(event.screenX));
try { try {
expect(event.screenX).assertEqual(185) if(density.x == 1080){
expect(event.screenY).assertEqual(533) expect(Math.trunc(event.screenX)).assertEqual(185)
expect(event.x).assertEqual(100) expect(Math.trunc(event.screenY)).assertEqual(533)
expect(event.y).assertEqual(50) expect(Math.trunc(event.x)).assertEqual(100)
expect(Math.trunc(event.y)).assertEqual(50)
}else{
expect(Math.trunc(event.screenX)).assertEqual(185)
expect(Math.trunc(event.screenY)).assertEqual(523)
expect(Math.trunc(event.x)).assertEqual(100)
expect(Math.trunc(event.y)).assertEqual(50)
}
} catch (err) { } catch (err) {
console.info("[testButton12_] expection err : " + JSON.stringify(err)); console.info("[testButton12_] expection err : " + JSON.stringify(err));
expect().assertFail(); expect().assertFail();
......
...@@ -300,6 +300,7 @@ export default function tabsJsunit() { ...@@ -300,6 +300,7 @@ export default function tabsJsunit() {
console.info("testTabs_1400 click result is: " + JSON.stringify(sendEventByKey('tabContent1', 10, ""))); console.info("testTabs_1400 click result is: " + JSON.stringify(sendEventByKey('tabContent1', 10, "")));
await Utils.sleep(1000); await Utils.sleep(1000);
console.info('testTabs_1400 END'); console.info('testTabs_1400 END');
done();
}); });
}) })
} }
\ No newline at end of file
...@@ -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')
......
...@@ -88,7 +88,7 @@ export default function blankJsunit() { ...@@ -88,7 +88,7 @@ export default function blankJsunit() {
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
console.info("[blankJsunit_0300'] component obj is: " + obj.$attrs.min); console.info("[blankJsunit_0300'] component obj is: " + obj.$attrs.min);
// return not the default value to confirm ? // return not the default value to confirm ?
expect(obj.$attrs.min).assertEqual('0.00px'); expect(obj.$attrs.min).assertEqual('0.00vp');
done(); done();
}); });
...@@ -162,7 +162,7 @@ export default function blankJsunit() { ...@@ -162,7 +162,7 @@ export default function blankJsunit() {
let strJson2 = getInspectorByKey('bl2'); let strJson2 = getInspectorByKey('bl2');
let obj2 = JSON.parse(strJson2); let obj2 = JSON.parse(strJson2);
console.info("[blankJsunit_0300'] component obj2 is: " + JSON.stringify(obj2)); console.info("[blankJsunit_0300'] component obj2 is: " + JSON.stringify(obj2));
expect(obj2.$attrs.min).assertEqual('0.00px'); expect(obj2.$attrs.min).assertEqual('0.00vp');
done(); done();
}); });
......
...@@ -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.label).assertEqual('clicked');
console.info('[GridJsunit_0400] END'); console.info('[GridJsunit_0400] END');
done(); done();
}); });
...@@ -241,10 +239,10 @@ export default function GridJsunit() { ...@@ -241,10 +239,10 @@ export default function GridJsunit() {
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
let driver = await UiDriver.create() let driver = await UiDriver.create()
let gridItem1 = CommonFunc.getComponentRect('0'); let gridItem1 = CommonFunc.getComponentRect('0');
let top1 = gridItem1.top let left1 = gridItem1.left
let gridItem2 = CommonFunc.getComponentRect('4'); let gridItem2 = CommonFunc.getComponentRect('1');
let top2 = gridItem2.top let left2 = gridItem2.left
expect(top1).assertEqual(parseInt(top2)); expect(parseInt(left1)).assertEqual(parseInt(left2));
console.info('[GridJsunit_0800] END'); console.info('[GridJsunit_0800] END');
done(); done();
}); });
......
...@@ -134,18 +134,20 @@ export default function SearchJsunit() { ...@@ -134,18 +134,20 @@ export default function SearchJsunit() {
let textComponent1 = await driver.findComponent(BY.key('search')); let textComponent1 = await driver.findComponent(BY.key('search'));
await textComponent1.inputText("hello") await textComponent1.inputText("hello")
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
let change = await driver.findComponent(BY.key('change')); let strJson1 = getInspectorByKey('change');
let text1 = await change.getText(); let obj1 = JSON.parse(strJson1);
expect(text1).assertEqual('onChange:hello'); console.info("[SearchJsunit_0300] obj1: " + JSON.stringify(obj1));
expect(obj1.$attrs.content).assertEqual('onChange:hello');
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
// Verify the onSubmit function of the Search component // Verify the onSubmit function of the Search component
let textComponent2 = await driver.findComponent(BY.text('CLICK_SEARCH')); let textComponent2 = await driver.findComponent(BY.text('CLICK_SEARCH'));
await textComponent2.click() await textComponent2.click()
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
let submit = await driver.findComponent(BY.key('submit')); let strJson2 = getInspectorByKey('submit');
let text2 = await submit.getText(); let obj2 = JSON.parse(strJson2);
expect(text2).assertEqual('onSubmit:hello'); console.info("[SearchJsunit_0300] obj2: " + JSON.stringify(obj2));
expect(obj2.$attrs.content).assertEqual('onSubmit:hello');
// Verify the onCopy function of the Search component // Verify the onCopy function of the Search component
await textComponent1.longClick() await textComponent1.longClick()
...@@ -154,9 +156,11 @@ export default function SearchJsunit() { ...@@ -154,9 +156,11 @@ export default function SearchJsunit() {
await textComponent3.click() await textComponent3.click()
let textComponent4 = await driver.findComponent(BY.text('复制')); let textComponent4 = await driver.findComponent(BY.text('复制'));
await textComponent4.click() await textComponent4.click()
let copy = await driver.findComponent(BY.key('copy')); await CommonFunc.sleep(1000);
let text3 = await copy.getText(); let strJson3 = getInspectorByKey('copy');
expect(text3).assertEqual('onCopy:hello'); let obj3 = JSON.parse(strJson3);
console.info("[SearchJsunit_0300] obj3: " + JSON.stringify(obj3));
expect(obj3.$attrs.content).assertEqual('onCopy:hello');
// Verify the onCut function of the Search component // Verify the onCut function of the Search component
await textComponent1.longClick() await textComponent1.longClick()
...@@ -165,25 +169,29 @@ export default function SearchJsunit() { ...@@ -165,25 +169,29 @@ export default function SearchJsunit() {
await textComponent5.click() await textComponent5.click()
let textComponent6 = await driver.findComponent(BY.text('剪切')); let textComponent6 = await driver.findComponent(BY.text('剪切'));
await textComponent6.click() await textComponent6.click()
let cut = await driver.findComponent(BY.key('cut')); await CommonFunc.sleep(1000);
let text4 = await cut.getText(); let strJson4 = getInspectorByKey('cut');
expect(text4).assertEqual('onCut:hello'); let obj4 = JSON.parse(strJson4);
console.info("[SearchJsunit_0300] obj4: " + JSON.stringify(obj4));
expect(obj4.$attrs.content).assertEqual('onCut:hello');
// Verify the onPaste function of the Search component // Verify the onPaste function of the Search component
await textComponent1.longClick() await textComponent1.longClick()
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
let textComponent8 = await driver.findComponent(BY.text('粘贴')); let textComponent8 = await driver.findComponent(BY.text('粘贴'));
await textComponent8.click() await textComponent8.click()
let paste = await driver.findComponent(BY.key('paste')); await CommonFunc.sleep(1000);
let text5 = await paste.getText(); let strJson5 = getInspectorByKey('paste');
expect(text5).assertEqual('onPaste:hello'); let obj5 = JSON.parse(strJson5);
console.info("[SearchJsunit_0300] obj5: " + JSON.stringify(obj5));
expect(obj5.$attrs.content).assertEqual('onPaste:hello');
// Verify the caretPosition function of the Search component // Verify the caretPosition function of the Search component
let textComponent7 = await driver.findComponent(BY.key('button')); let textComponent7 = await driver.findComponent(BY.key('button'));
await textComponent7.click(); await textComponent7.click();
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
let text6 = await textComponent7.getText(); let text = await textComponent7.getText();
expect(text6).assertEqual('Set caretPosition 2'); expect(text).assertEqual('Set caretPosition 2');
console.info('[SearchJsunit_0300] END'); console.info('[SearchJsunit_0300] END');
done(); done();
}); });
...@@ -227,7 +235,7 @@ export default function SearchJsunit() { ...@@ -227,7 +235,7 @@ export default function SearchJsunit() {
expect(obj.$attrs.icon).assertEqual('resource:///ohos_search.svg'); expect(obj.$attrs.icon).assertEqual('resource:///ohos_search.svg');
expect(obj.$attrs.searchButton).assertEqual('CLICK_SEARCH'); expect(obj.$attrs.searchButton).assertEqual('CLICK_SEARCH');
expect(obj.$attrs.placeholderColor).assertEqual('#FF00000A'); expect(obj.$attrs.placeholderColor).assertEqual('#FF00000A');
expect(obj.$attrs.value).assertEqual('hello'); expect(obj.$attrs.value).assertEqual('');
expect(obj.$attrs.placeholderFont).assertEqual('{"style":"FontStyle.Normal","size":"14.00fp","weight":"400","fontFamily":"sans-serif"}'); expect(obj.$attrs.placeholderFont).assertEqual('{"style":"FontStyle.Normal","size":"14.00fp","weight":"400","fontFamily":"sans-serif"}');
expect(obj.$attrs.textFont).assertEqual('{"fontSize":"14.00fp","fontStyle":"FontStyle.Normal","fontWeight":"400","fontFamily":"HarmonyOS Sans"}'); expect(obj.$attrs.textFont).assertEqual('{"fontSize":"14.00fp","fontStyle":"FontStyle.Normal","fontWeight":"400","fontFamily":"HarmonyOS Sans"}');
expect(obj.$attrs.textAlign).assertEqual('TextAlign.Start'); expect(obj.$attrs.textAlign).assertEqual('TextAlign.Start');
......
...@@ -71,11 +71,10 @@ export default function SelectJsunit() { ...@@ -71,11 +71,10 @@ export default function SelectJsunit() {
expect(obj.$attrs.optionFont).assertEqual('{"size":"16.00fp","weight":"400","family":"","style":"FontStyle.Normal"}'); expect(obj.$attrs.optionFont).assertEqual('{"size":"16.00fp","weight":"400","family":"","style":"FontStyle.Normal"}');
expect(obj.$attrs.optionFontColor).assertEqual('#FFFF0000'); expect(obj.$attrs.optionFontColor).assertEqual('#FFFF0000');
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
let driver = await UiDriver.create() let strJson1 = getInspectorByKey('indexValue');
let textComponent = await driver.findComponent(BY.key('indexValue')); let obj1 = JSON.parse(strJson1);
let text = await textComponent.getText(); console.info("[SelectJsunit_0300] component obj1 is: " + JSON.stringify(obj1));
console.info("[SelectJsunit_0100] indexValue: " + JSON.stringify(text)); expect(obj1.$attrs.content).assertEqual('indexValue:0');
expect(text).assertEqual('indexValue:0');
console.info('[SelectJsunit_0100] END'); console.info('[SelectJsunit_0100] END');
done(); done();
}); });
...@@ -132,16 +131,16 @@ export default function SelectJsunit() { ...@@ -132,16 +131,16 @@ export default function SelectJsunit() {
let textComponent1 = await driver.findComponent(BY.key('select')); let textComponent1 = await driver.findComponent(BY.key('select'));
await textComponent1.click() await textComponent1.click()
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
let textMenuComponent = await driver.findComponent(BY.text('bbb'));
let textMenu = await textMenuComponent.getText();
expect(textMenu).assertEqual('bbb');
// Verify the onSelect function of the select component // Verify the onSelect function of the select component
let textMenuComponent = await driver.findComponent(BY.text('bbb'));
await textMenuComponent.click() await textMenuComponent.click()
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
let textComponent2 = await driver.findComponent(BY.key('indexValue')); let strJson1 = getInspectorByKey('indexValue');
let text = await textComponent2.getText(); let obj1 = JSON.parse(strJson1);
expect(text).assertEqual('indexValue:1'); console.info("[SelectJsunit_0300] component obj1 is: " + JSON.stringify(obj1));
expect(obj1.$attrs.content).assertEqual('indexValue:1');
let strJson = getInspectorByKey('select'); let strJson = getInspectorByKey('select');
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
console.info("[SelectJsunit_0300] component obj is: " + JSON.stringify(obj)); console.info("[SelectJsunit_0300] component obj is: " + JSON.stringify(obj));
...@@ -196,10 +195,10 @@ export default function SelectJsunit() { ...@@ -196,10 +195,10 @@ export default function SelectJsunit() {
expect(obj.$attrs.optionFont).assertEqual('{"size":"16.00fp","weight":"400","family":"","style":"FontStyle.Normal"}'); expect(obj.$attrs.optionFont).assertEqual('{"size":"16.00fp","weight":"400","family":"","style":"FontStyle.Normal"}');
expect(obj.$attrs.optionFontColor).assertEqual('#FFFFFF00'); expect(obj.$attrs.optionFontColor).assertEqual('#FFFFFF00');
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
let driver = await UiDriver.create() let strJson1 = getInspectorByKey('indexValue');
let textComponent = await driver.findComponent(BY.key('indexValue')); let obj1 = JSON.parse(strJson1);
let text = await textComponent.getText(); console.info("[SelectJsunit_0400] component obj1 is: " + JSON.stringify(obj1));
expect(text).assertEqual('indexValue:1'); expect(obj1.$attrs.content).assertEqual('indexValue:1');
console.info('[SelectJsunit_0400] END'); console.info('[SelectJsunit_0400] END');
done(); done();
}); });
......
...@@ -101,15 +101,15 @@ export default function TextPickerJsunit() { ...@@ -101,15 +101,15 @@ export default function TextPickerJsunit() {
it('TextPickerJsunit_0300', 0, async function (done) { it('TextPickerJsunit_0300', 0, async function (done) {
// Verify the functions of TextPicker component // Verify the functions of TextPicker component
console.info('[TextPickerJsunit_0300] START'); console.info('[TextPickerJsunit_0300] START');
let bottomComponent = CommonFunc.getComponentRect('textPicker'); let component = CommonFunc.getComponentRect('textPicker');
let bottom = bottomComponent.bottom let bottom = component.bottom
let rightComponent = CommonFunc.getComponentRect('textPicker'); let right = component.right
let right = rightComponent.right
console.info("[TextPickerJsunit_0300] bottom: " + JSON.stringify(bottom)); console.info("[TextPickerJsunit_0300] bottom: " + JSON.stringify(bottom));
console.info("[TextPickerJsunit_0300] right: " + JSON.stringify(right)); console.info("[TextPickerJsunit_0300] right: " + JSON.stringify(right));
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
let driver = await UiDriver.create() 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)); await driver.swipe(Math.round(right / 2), Math.round(bottom * 2 / 3), Math.round(right / 2), Math.round(bottom / 3));
await CommonFunc.sleep(1000);
let strJson = getInspectorByKey('textContent1'); let strJson = getInspectorByKey('textContent1');
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
console.info("[TextPickerJsunit_0300] obj: " + JSON.stringify(obj)); console.info("[TextPickerJsunit_0300] obj: " + JSON.stringify(obj));
...@@ -141,7 +141,7 @@ export default function TextPickerJsunit() { ...@@ -141,7 +141,7 @@ export default function TextPickerJsunit() {
expect(obj.$attrs.range).assertEqual('["icon:,text:banana1","icon:,text:orange2","icon:,text:peach3","icon:,text:grape4"]'); expect(obj.$attrs.range).assertEqual('["icon:,text:banana1","icon:,text:orange2","icon:,text:peach3","icon:,text:grape4"]');
expect(obj.$attrs.selected).assertEqual('1'); expect(obj.$attrs.selected).assertEqual('1');
//expect(obj.$attrs.value).assertEqual(''); //expect(obj.$attrs.value).assertEqual('');
expect(obj.$attrs.defaultPickerItemHeight).assertEqual('25.00fp'); expect(obj.$attrs.defaultPickerItemHeight).assertEqual('0.00fp');
console.info('[TextPickerJsunit_0400] END'); console.info('[TextPickerJsunit_0400] END');
done(); done();
}); });
......
...@@ -190,7 +190,7 @@ export default function ToggleJsunit() { ...@@ -190,7 +190,7 @@ export default function ToggleJsunit() {
console.info("[ToggleJsunit_0600] isOn: " + JSON.stringify(obj.$attrs.isOn)); console.info("[ToggleJsunit_0600] isOn: " + JSON.stringify(obj.$attrs.isOn));
console.info("[ToggleJsunit_0600] selectedColor: " + JSON.stringify(obj.$attrs.selectedColor)); console.info("[ToggleJsunit_0600] selectedColor: " + JSON.stringify(obj.$attrs.selectedColor));
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
expect(obj.$attrs.type).assertEqual('ButtonType.Capsule'); expect(obj.$attrs.type).assertEqual('ToggleType.Switch');
expect(obj.$attrs.isOn).assertEqual('false'); expect(obj.$attrs.isOn).assertEqual('false');
expect(obj.$attrs.selectedColor).assertEqual('#FF00007B'); expect(obj.$attrs.selectedColor).assertEqual('#FF00007B');
let strJson1 = getInspectorByKey('toggleSwitch'); let strJson1 = getInspectorByKey('toggleSwitch');
......
...@@ -52,7 +52,7 @@ export default function marqueeJsunit() { ...@@ -52,7 +52,7 @@ export default function marqueeJsunit() {
// to confirm allowScale // to confirm allowScale
console.info('marqueeJsunit_0100 component obj is: ' + obj.$attrs.allowScale); console.info('marqueeJsunit_0100 component obj is: ' + obj.$attrs.allowScale);
expect(obj.$attrs.start).assertEqual('false'); expect(obj.$attrs.start).assertEqual('false');
expect(obj.$attrs.step).assertEqual('50.000000'); expect(parseInt(obj.$attrs.step)).assertEqual(vp2px(50));
expect(obj.$attrs.loop).assertEqual('2'); expect(obj.$attrs.loop).assertEqual('2');
expect(obj.$attrs.fromStart).assertEqual('true'); expect(obj.$attrs.fromStart).assertEqual('true');
expect(obj.$attrs.src).assertEqual('Running Marquee starts rolling'); expect(obj.$attrs.src).assertEqual('Running Marquee starts rolling');
...@@ -107,7 +107,7 @@ export default function marqueeJsunit() { ...@@ -107,7 +107,7 @@ export default function marqueeJsunit() {
// check the value of changed attribute // check the value of changed attribute
let strJson = getInspectorByKey('marquee'); let strJson = getInspectorByKey('marquee');
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
expect(obj.$attrs.loop).assertEqual('-30'); expect(obj.$attrs.loop).assertEqual('-1');
done(); done();
}); });
...@@ -119,7 +119,7 @@ export default function marqueeJsunit() { ...@@ -119,7 +119,7 @@ export default function marqueeJsunit() {
// check the value of changed parameter // check the value of changed parameter
let strJson = getInspectorByKey('marquee'); let strJson = getInspectorByKey('marquee');
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
expect(obj.$attrs.step).assertEqual('50.000000'); expect(parseInt(obj.$attrs.step)).assertEqual(vp2px(50));
done(); done();
}); });
...@@ -131,7 +131,7 @@ export default function marqueeJsunit() { ...@@ -131,7 +131,7 @@ export default function marqueeJsunit() {
let strJson = getInspectorByKey('marquee'); let strJson = getInspectorByKey('marquee');
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
// to confirm // to confirm
expect(obj.$attrs.step).assertEqual('-30.000000'); expect(parseInt(obj.$attrs.step)).assertEqual(vp2px(6));
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();
}); });
}) })
......
...@@ -158,10 +158,11 @@ export default function textAreaJsunit() { ...@@ -158,10 +158,11 @@ export default function textAreaJsunit() {
it('textAreaJsunit_0800', 0, async function (done) { it('textAreaJsunit_0800', 0, async function (done) {
console.info('textAreaJsunit_0800 START'); console.info('textAreaJsunit_0800 START');
globalThis.value.message.notify({name:'placeholder',value:''}) globalThis.value.message.notify({name:'text',value:''})
await CommonFunc.sleep(2000); await CommonFunc.sleep(1000);
// test the change event
let driver = UiDriver.create(); let driver = UiDriver.create();
await CommonFunc.sleep(1000);
// test the change event
let text = await driver.findComponent(BY.key('textArea')); let text = await driver.findComponent(BY.key('textArea'));
await text.inputText('123'); await text.inputText('123');
await CommonFunc.sleep(2000); await CommonFunc.sleep(2000);
...@@ -205,7 +206,7 @@ export default function textAreaJsunit() { ...@@ -205,7 +206,7 @@ export default function textAreaJsunit() {
}); });
it('textAreaJsunit_1000', 0, async function (done) { it('textAreaJsunit_1000', 0, async function (done) {
console.info('marqueeJsunit_0900 START'); console.info('textAreaJsunit_1000 START');
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
// test the cut event // test the cut event
let driver = UiDriver.create(); let driver = UiDriver.create();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册