diff --git a/arkui/ace_ets_component_ui/entry/src/main/ets/test/TimePickerJsunit.test.ets b/arkui/ace_ets_component_ui/entry/src/main/ets/test/TimePickerJsunit.test.ets index 821c609e41a5f8c3d0e80d6a94a1f25788e955f0..766e0011620b8610735d65f991291b1f25c6d0a3 100644 --- a/arkui/ace_ets_component_ui/entry/src/main/ets/test/TimePickerJsunit.test.ets +++ b/arkui/ace_ets_component_ui/entry/src/main/ets/test/TimePickerJsunit.test.ets @@ -101,17 +101,18 @@ export default function TimePickerJsunit() { let switchButton = await driver.findComponent(BY.key('button')); await switchButton.click(); await CommonFunc.sleep(1000); - let modeComponent = await driver.findComponent(BY.key('mode')); - let mode = await modeComponent.getText(); - console.info("[TimePickerJsunit_0200] mode: " + JSON.stringify(mode)); - expect(mode).assertEqual('24hour:true'); + let strJson = getInspectorByKey('mode'); + let obj = JSON.parse(strJson); + console.info("[TimePickerJsunit_0200] component obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.content).assertEqual('24hour:true'); // Verify switch 12-hour await switchButton.click(); await CommonFunc.sleep(1000); - let mode1 = await modeComponent.getText(); - console.info("[TimePickerJsunit_0200] mode1: " + JSON.stringify(mode1)); - expect(mode1).assertEqual('24hour:false'); + let strJson1 = getInspectorByKey('mode'); + let obj1 = JSON.parse(strJson1); + console.info("[TimePickerJsunit_0200] component obj1 is: " + JSON.stringify(obj1)); + expect(obj1.$attrs.content).assertEqual('24hour:false'); console.info('[TimePickerJsunit_0200] END'); done(); }); @@ -123,21 +124,20 @@ export default function TimePickerJsunit() { let switchButton = await driver.findComponent(BY.key('button')); await switchButton.click(); await CommonFunc.sleep(1000); - let timePickerTop = CommonFunc.getComponentRect('timePicker'); - let top = timePickerTop.top - let timePickerBottom = CommonFunc.getComponentRect('timePicker'); - let bottom = timePickerBottom.bottom - let timePickerRight = CommonFunc.getComponentRect('timePicker'); - let right = timePickerRight.right + let timePicker = CommonFunc.getComponentRect('timePicker'); + let top = timePicker.top + let bottom = timePicker.bottom + let right = timePicker.right let middle = (top + bottom) / 2 // Verify hour let hour = await driver.findComponent(BY.key('hour')); let hour1 = await hour.getText(); console.info("[TimePickerJsunit_0300] hour1: " + JSON.stringify(hour1)); - await driver.swipe(Math.round(right * 0.23), Math.round(middle + 100), Math.round(right * 0.23), Math.round(middle - 100)); + await driver.swipe(Math.round(right * 0.24), Math.round(middle + 100), Math.round(right * 0.24), Math.round(middle - 100)); await CommonFunc.sleep(1000); - let hour2 = await hour.getText(); + let hourComponent = await driver.findComponent(BY.key('hour')); + let hour2 = await hourComponent.getText(); console.info("[TimePickerJsunit_0300] hour2: " + JSON.stringify(hour2)); expect(hour1 == hour2).assertFalse(); diff --git a/arkui/ace_ets_component_ui/entry/src/main/ets/test/imageAnimatorJsunit.test.ets b/arkui/ace_ets_component_ui/entry/src/main/ets/test/imageAnimatorJsunit.test.ets index 67210e78629cbf21942df150b79b2d0a02901fc6..3f22167ab48a13fc116d206adba0724eef95de47 100644 --- a/arkui/ace_ets_component_ui/entry/src/main/ets/test/imageAnimatorJsunit.test.ets +++ b/arkui/ace_ets_component_ui/entry/src/main/ets/test/imageAnimatorJsunit.test.ets @@ -79,14 +79,14 @@ export default function imageAniamtorJsunit() { expect(obj.$attrs.state).assertEqual('AnimationStatus.Running'); globalThis.value.message.notify({name:'state',value:AnimationStatus.Paused}) - await CommonFunc.sleep(1000); + await CommonFunc.sleep(2000); 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'); globalThis.value.message.notify({name:'state',value:AnimationStatus.Stopped}) - await CommonFunc.sleep(1000); + await CommonFunc.sleep(2000); let strJson3 = getInspectorByKey('imageAnimator'); let obj3 = JSON.parse(strJson3); console.info('[imageAniamtorJsunit_0200] component obj3 is: ' + obj3.$attrs.state); diff --git a/arkui/ace_ets_component_ui/entry/src/main/ets/test/imageOneJsunit.test.ets b/arkui/ace_ets_component_ui/entry/src/main/ets/test/imageOneJsunit.test.ets index 8ff8bed0d6d836f6cd4ceb86924c217995c4218d..9358ac123adffcd1a7a0e206a133bb7fa847dbd5 100644 --- a/arkui/ace_ets_component_ui/entry/src/main/ets/test/imageOneJsunit.test.ets +++ b/arkui/ace_ets_component_ui/entry/src/main/ets/test/imageOneJsunit.test.ets @@ -36,7 +36,7 @@ export default function imageOneJsunit() { } } catch (err) { console.error("push imageOneJsunit page error:" + err); - expect().assertFail(); + expect().assertFail(); } done(); }); @@ -114,42 +114,42 @@ export default function imageOneJsunit() { await CommonFunc.sleep(1000); // test the enum of objectFit globalThis.value.message.notify({name:'objectFit',value:ImageFit.Cover}) - await CommonFunc.sleep(100); + await CommonFunc.sleep(500); let strJson = getInspectorByKey('objectFit'); let obj = JSON.parse(strJson); console.info('textimageOneJsunit_0400 component obj is: ' + obj.$attrs.objectFit); expect(obj.$attrs.objectFit).assertEqual('ImageFit.Cover'); globalThis.value.message.notify({name:'objectFit',value:ImageFit.Auto}) - await CommonFunc.sleep(100); + await CommonFunc.sleep(500); let strJson2 = getInspectorByKey('objectFit'); let obj2 = JSON.parse(strJson2); console.info('textimageOneJsunit_0400 component obj2 is: ' + obj2.$attrs.objectFit); expect(obj2.$attrs.objectFit).assertEqual('ImageFit.Auto'); globalThis.value.message.notify({name:'objectFit',value:ImageFit.Fill}) - await CommonFunc.sleep(100); + await CommonFunc.sleep(500); let strJson3 = getInspectorByKey('objectFit'); let obj3 = JSON.parse(strJson3); console.info('textimageOneJsunit_0400 component obj3 is: ' + obj3.$attrs.objectFit); expect(obj3.$attrs.objectFit).assertEqual('ImageFit.Fill'); globalThis.value.message.notify({name:'objectFit',value:ImageFit.ScaleDown}) - await CommonFunc.sleep(100); + await CommonFunc.sleep(500); let strJson4 = getInspectorByKey('objectFit'); let obj4 = JSON.parse(strJson4); console.info('textimageOneJsunit_0400 component obj4 is: ' + obj4.$attrs.objectFit); expect(obj4.$attrs.objectFit).assertEqual('ImageFit.ScaleDown'); globalThis.value.message.notify({name:'objectFit',value:ImageFit.None}) - await CommonFunc.sleep(100); + await CommonFunc.sleep(500); let strJson5 = getInspectorByKey('objectFit'); let obj5 = JSON.parse(strJson5); console.info('textimageOneJsunit_0400 component obj5 is: ' + obj5.$attrs.objectFit); expect(obj5.$attrs.objectFit).assertEqual('ImageFit.None'); globalThis.value.message.notify({name:'objectFit',value:ImageFit.Contain}) - await CommonFunc.sleep(100); + await CommonFunc.sleep(500); let strJson6 = getInspectorByKey('objectFit'); let obj6 = JSON.parse(strJson6); console.info('textimageOneJsunit_0400 component obj6 is: ' + obj6.$attrs.objectFit); @@ -217,4 +217,4 @@ export default function imageOneJsunit() { done(); }); }) -} \ No newline at end of file +} diff --git a/arkui/ace_ets_component_ui/entry/src/main/ets/test/sliderJsunit.test.ets b/arkui/ace_ets_component_ui/entry/src/main/ets/test/sliderJsunit.test.ets index 379b6df6c49f26442e89a0341ab208b4d3c0a4f2..fb1efd7d1283495a4d0a3c02ecfd5106d02005b4 100644 --- a/arkui/ace_ets_component_ui/entry/src/main/ets/test/sliderJsunit.test.ets +++ b/arkui/ace_ets_component_ui/entry/src/main/ets/test/sliderJsunit.test.ets @@ -200,7 +200,7 @@ export default function sliderJsunit() { let strJson = getInspectorByKey('tex'); let obj = JSON.parse(strJson); console.info("[sliderJsunit_0800] obj: " + JSON.stringify(obj)); - expect(obj.$attrs.content).assertEqual('30'); + expect(Math.round(obj.$attrs.content)).assertEqual(50); let strJson1 = getInspectorByKey('modeT'); let obj1 = JSON.parse(strJson1); console.info("[sliderJsunit_0800] obj1: " + JSON.stringify(obj1)); @@ -241,4 +241,4 @@ export default function sliderJsunit() { done(); }); }) -} \ No newline at end of file +} diff --git a/arkui/ace_ets_component_ui/entry/src/main/ets/test/textAreaJsunit.test.ets b/arkui/ace_ets_component_ui/entry/src/main/ets/test/textAreaJsunit.test.ets index 9402e2f3f1868cb4783ed45429a0053477c5465d..edf653021b9392e340f4c4bc9252aaaa86662e8d 100644 --- a/arkui/ace_ets_component_ui/entry/src/main/ets/test/textAreaJsunit.test.ets +++ b/arkui/ace_ets_component_ui/entry/src/main/ets/test/textAreaJsunit.test.ets @@ -37,14 +37,14 @@ export default function textAreaJsunit() { } } catch (err) { console.error("push textAreaJsunit page error:" + err); - expect().assertFail(); + expect().assertFail(); } done(); }); it('textAreaJsunit_0100', 0, async function (done) { console.info('textAreaJsunit_0100'); - await CommonFunc.sleep(30000); + await CommonFunc.sleep(1000); // get the textArea component and test attribute let strJson = getInspectorByKey('textArea'); let obj = JSON.parse(strJson);