提交 c2c28655 编写于 作者: Z zhangjing 提交者: jiangkaixuan

web子系统新增用例

Signed-off-by: Nzhangjing <zhangjing403@huawei.com>
上级 7594c7d4
......@@ -56,6 +56,10 @@ struct Index {
@State mixedSwitch:boolean=false
@State mixedAllSwitch:boolean=false
@State overViewFalseHeight:number=0
@State isAuthFlag:boolean=false
@State conFirmFlag:boolean=false
@State sslErrorFlag:boolean=false
@State clientFlag:boolean=false
onPageShow(){
let valueChangeEvent={
eventId:10,
......@@ -212,6 +216,59 @@ struct Index {
console.info("onBlur==>")
this.controller.requestFocus()
})
.onHttpAuthRequest((event)=>{
console.info("onHttpAuthRequest==>")
if(this.isAuthFlag){
console.info("isAuthFlag==>")
let isHttpAuth=event.handler.isHttpAuthInfoSaved()
Utils.emitEvent(isHttpAuth,192)
this.isAuthFlag=false
}else if(this.conFirmFlag){
console.info("conFirmFlag==>")
let flag=event.handler.confirm("1111","2222")
Utils.emitEvent(flag,194)
this.conFirmFlag=false
}else{
console.info("cancel==>")
event.handler.cancel()
}
return false
})
.onSslErrorEventReceive((event)=>{
console.info("onSslErrorEventReceive==>")
if(this.sslErrorFlag){
event.handler.handleCancel()
setTimeout(()=>{
let sslError=event.error
Utils.emitEvent(sslError,198)
},3000)
this.sslErrorFlag=false
}else{
event.handler.handleConfirm()
setTimeout(()=>{
let webTitle=this.controller.getTitle()
Utils.emitEvent(webTitle,200)
},3000)
}
})
.onClientAuthenticationRequest((event)=>{
console.info("onClientAuthenticationRequest==>")
if(this.clientFlag){
event.handler.cancel()
setTimeout(()=>{
let webTitle=this.controller.getTitle()
Utils.emitEvent(webTitle,202)
},3000)
event.handler.confirm("/system/etc/user.pk8", "/system/etc/chain-user.pem")
this.clientFlag=false
}else{
event.handler.ignore()
setTimeout(()=>{
let webTitle=this.controller.getTitle()
Utils.emitEvent(webTitle,204)
},3000)
}
})
TextInput({placeholder:"inputs your words"})
.key('textInput')
.type(InputType.Normal)
......@@ -789,6 +846,40 @@ struct Index {
Utils.emitEvent(getCookieManagerCalled,89)
break;
}
case "emitIsHttpAuthInfoSaved":{
this.isAuthFlag=true;
await Utils.sleep(1000)
this.controller.loadUrl({url:"http://httpbin.org/basic-auth/1111/2222"})
break;
}
case "emitHttpAuthRequestConfirm":{
this.conFirmFlag=true;
await Utils.sleep(1000)
this.controller.loadUrl({url:"http://httpbin.org/basic-auth/1111/2222"})
break;
}
case "emitHttpAuthRequestCancel":{
this.conFirmFlag=false;
await Utils.sleep(1000)
this.controller.loadUrl({url:"http://httpbin.org/basic-auth/1111/2222"})
setTimeout(()=>{
let webTitle=this.controller.getTitle()
Utils.emitEvent(webTitle,196)
},3000)
break;
}
case "emitSslCancel":{
this.sslErrorFlag=true
await Utils.sleep(1000)
this.controller.loadUrl({url:"https://expired.badssl.com/"})
break;
}
case "emitSslConfirm":{
this.sslErrorFlag=false
await Utils.sleep(1000)
this.controller.loadUrl({url:"https://expired.badssl.com/"})
break;
}
default:
console.info("can not match case")
}
......
......@@ -688,9 +688,59 @@ export default function webJsunit() {
*tc.desic Gets network cookie manager
*/
it('getCookieManager',0,async function(done){
emitKey="emitGetCookieManager";
emitKey="emitIsHttpAuthInfoSaved";
Utils.registerEvent("getCookieManager",true,89,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_066
*tc.name isHttpAuthInfoSaved
*tc.desic isHttpAuthInfoSaved
*/
it('isHttpAuthInfoSaved',0,async function(done){
emitKey="emitHttpAuthRequestConfirm";
Utils.registerEvent("isHttpAuthInfoSaved",false,192,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_067
*tc.name httpAuthRequestConfirm
*tc.desic confirm
*/
it('httpAuthRequestConfirm',0,async function(done){
emitKey="emitHttpAuthRequestCancel";
Utils.registerEvent("httpAuthRequestConfirm",true,194,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_068
*tc.name httpAuthRequestCancel
*tc.desic cancel
*/
it('httpAuthRequestCancel',0,async function(done){
emitKey="emitSslCancel";
Utils.registerContainEvent("httpAuthRequestCancel","httpbin",196,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_069
*tc.name sslCancel
*tc.desic cancel
*/
it('sslCancel',0,async function(done){
emitKey="emitSslConfirm";
Utils.registerEvent("sslCancel",2,198,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_070
*tc.name sslConfirm
*tc.desic confirm
*/
it('sslConfirm',0,async function(done){
emitKey="emitSslConfirm";
Utils.registerContainEvent("sslConfirm","expired",200,done);
sendEventByKey('webcomponent',10,'');
})
})
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册