提交 558aea7b 编写于 作者: Z zgit2021 提交者: zhangjing

web组件xts用例优化

Change-Id: Ie7ee13330a19727a7b3b0c89bb4ccf440a340f6c
Signed-off-by: Nzhangjing <zhangjing403@huawei.com>
上级 9015c79f
...@@ -35,7 +35,7 @@ struct Index { ...@@ -35,7 +35,7 @@ struct Index {
@State errorReceive:string="" @State errorReceive:string=""
@State httpErrorReceive:number=0 @State httpErrorReceive:number=0
@State titleReceive:string="" @State titleReceive:string=""
@State downloadStart:string="" @State isDownloadStart:boolean=false
@State javaScriptAccess:boolean=true @State javaScriptAccess:boolean=true
@State fileAccess:boolean=true @State fileAccess:boolean=true
@State domStorageAccess:boolean=false @State domStorageAccess:boolean=false
...@@ -56,6 +56,8 @@ struct Index { ...@@ -56,6 +56,8 @@ struct Index {
@State mixedAllSwitch:boolean=false @State mixedAllSwitch:boolean=false
@State overViewFalseHeight:number=0 @State overViewFalseHeight:number=0
@State webVisibility: Visibility = Visibility.Visible @State webVisibility: Visibility = Visibility.Visible
@State isProgressFinish:boolean=false
@State isHttpErrorReceive:boolean=false
onPageShow(){ onPageShow(){
let valueChangeEvent={ let valueChangeEvent={
eventId:10, eventId:10,
...@@ -109,7 +111,7 @@ struct Index { ...@@ -109,7 +111,7 @@ struct Index {
break; break;
} }
case "emitOnUrlLoadIntercept":{ case "emitOnUrlLoadIntercept":{
this.controller.loadUrl({url:"https://www.gitee.com/"}) this.controller.loadUrl({url:"https://gitee.com/"})
setTimeout(()=>{ setTimeout(()=>{
Utils.emitEvent(loadedUrl,104) Utils.emitEvent(loadedUrl,104)
},3000) },3000)
...@@ -127,7 +129,7 @@ struct Index { ...@@ -127,7 +129,7 @@ struct Index {
break; break;
} }
case "emitLoadUrl":{ case "emitLoadUrl":{
this.controller.loadUrl({url:"https://www.gitee.com"}) this.controller.loadUrl({url:"https://gitee.com/"})
setTimeout(()=>{ setTimeout(()=>{
let webTitle=this.controller.getTitle() let webTitle=this.controller.getTitle()
Utils.emitEvent(webTitle,110) Utils.emitEvent(webTitle,110)
...@@ -144,10 +146,9 @@ struct Index { ...@@ -144,10 +146,9 @@ struct Index {
break; break;
} }
case "emitOnProgressChange":{ case "emitOnProgressChange":{
this.controller.loadUrl({url:"https://www.gitee.com"}) this.isProgressFinish=true
setTimeout(()=>{ await Utils.sleep(1000)
Utils.emitEvent(this.progress,114) this.controller.loadUrl({url:"https://gitee.com/"})
},5000)
break; break;
} }
case "emitOnRefreshAccessedHistory":{ case "emitOnRefreshAccessedHistory":{
...@@ -461,13 +462,9 @@ struct Index { ...@@ -461,13 +462,9 @@ struct Index {
break; break;
} }
case "emitOnHttpErrorReceive":{ case "emitOnHttpErrorReceive":{
this.isHttpErrorReceive=true
await Utils.sleep(1000)
this.controller.loadUrl({url:'https://example1.com/path/does/not/exist/index.jsp'}) this.controller.loadUrl({url:'https://example1.com/path/does/not/exist/index.jsp'})
setTimeout(()=>{
this.controller.loadUrl({url:'https://example1.com/path/does/not/exist/index.jsp'})
setTimeout(()=>{
Utils.emitEvent(this.httpErrorReceive,66)
},3000)
},3000)
break; break;
} }
case "emitOnTitleReceive":{ case "emitOnTitleReceive":{
...@@ -478,10 +475,9 @@ struct Index { ...@@ -478,10 +475,9 @@ struct Index {
break; break;
} }
case "emitOnDownloadStart":{ case "emitOnDownloadStart":{
this.isDownloadStart=true
await Utils.sleep(1000)
this.controller.loadUrl({url:"https://consumer.huawei.com/content/dam/huawei-cbg-site/cn/mkt/mobileservices/2022/download/PC107f1b3947c942ffaa14334a879065d8.2107261020.exe"}) this.controller.loadUrl({url:"https://consumer.huawei.com/content/dam/huawei-cbg-site/cn/mkt/mobileservices/2022/download/PC107f1b3947c942ffaa14334a879065d8.2107261020.exe"})
setTimeout(()=>{
Utils.emitEvent(this.downloadStart,68)
},5000)
break; break;
} }
case "emitSetCookie":{ case "emitSetCookie":{
...@@ -711,6 +707,10 @@ struct Index { ...@@ -711,6 +707,10 @@ struct Index {
if(this.enterPageEnd){ if(this.enterPageEnd){
Utils.emitEvent(this.newScale,97) Utils.emitEvent(this.newScale,97)
this.enterPageEnd=false this.enterPageEnd=false
}else if(this.isProgressFinish){
console.info("isProgressFinish==>")
Utils.emitEvent(this.progress,114)
this.isProgressFinish=false
} }
}) })
.onConsole((event) => { .onConsole((event) => {
...@@ -744,13 +744,22 @@ struct Index { ...@@ -744,13 +744,22 @@ struct Index {
} }
}) })
.onHttpErrorReceive((event) => { .onHttpErrorReceive((event) => {
this.httpErrorReceive = event.response.getResponseCode() if(this.isHttpErrorReceive){
console.info("isHttpErrorReceive==>")
this.httpErrorReceive = event.response.getResponseCode()
Utils.emitEvent(this.httpErrorReceive,66)
this.isHttpErrorReceive=false
}
}) })
.onTitleReceive((event) => { .onTitleReceive((event) => {
this.titleReceive = event.title this.titleReceive = event.title
}) })
.onDownloadStart((event) => { .onDownloadStart((event) => {
this.downloadStart = event.url if(this.isDownloadStart){
console.info("isDownloadStart==>")
Utils.emitEvent(event.url,68)
this.isDownloadStart=false
}
}) })
.onScaleChange((event)=>{ .onScaleChange((event)=>{
console.log("onScaleChange==>") console.log("onScaleChange==>")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册