未验证 提交 90e2cbf6 编写于 作者: O openharmony_ci 提交者: Gitee

!4978 web组件XTS失败用例修改

Merge pull request !4978 from 章靖/master
......@@ -179,7 +179,8 @@ struct Index {
let webPageHeight=this.controller.getPageHeight()+""
setTimeout(()=>{
this.controller.runJavaScript({script:"getPageHeight()",callback:(res)=>{
Utils.emitEvent(webPageHeight==res,124)
console.info("getPageHeight==>"+res)
Utils.emitEventTwo(res,webPageHeight,124)
}})
},3000)
break;
......@@ -235,4 +236,4 @@ struct Index {
}
}
}
}
\ No newline at end of file
}
......@@ -60,4 +60,59 @@ export default class Utils {
console.info("webFlag emit action state err: " + JSON.stringify(err));
}
}
static registerEventTwo(testCaseName,eventId,done){
console.info(`[${testCaseName}] START`);
try{
let callBack=(backData)=>{
console.info(`${testCaseName} get result is:`+JSON.stringify(backData));
expect(backData.data.actualValue).assertLarger(backData.data.expectedValue-100);
expect(backData.data.actualValue).assertLess(backData.data.expectedValue-(-100));
console.info(`[${testCaseName}] END`);
done()
}
let innerEvent = {
eventId:eventId,
priority:events_emitter.EventPriority.LOW
}
events_emitter.on(innerEvent,callBack)
}catch(err){
console.info(`[${testCaseName}] err:`+JSON.stringify(err));
}
}
static emitEventTwo(expectedValue,actualValue,eventId){
try {
let backData = {
data: {
"expectedValue":expectedValue,
"actualValue":actualValue
}
}
let backEvent = {
eventId:eventId,
priority:events_emitter.EventPriority.LOW
}
console.info("webFlag start to emit action state");
events_emitter.emit(backEvent, backData);
} catch (err) {
console.info("webFlag emit action state err: " + JSON.stringify(err));
}
}
static registerContainEvent(testCaseName,expectedValue,eventId,done){
console.info(`[${testCaseName}] START`);
try{
let callBack=(backData)=>{
console.info(`${testCaseName} get result is:`+JSON.stringify(backData));
expect(backData.data.ACTION).assertContain(expectedValue);
console.info(`[${testCaseName}] END`);
done()
}
let innerEvent = {
eventId:eventId,
priority:events_emitter.EventPriority.LOW
}
events_emitter.on(innerEvent,callBack)
}catch(err){
console.info(`[${testCaseName}] err:`+JSON.stringify(err));
}
}
}
......@@ -19,7 +19,7 @@ import Utils from './Utils.ets';
let emitKey = "emitUserAgent";
export default function webJsunit() {
describe('ActsAceWebDevTest', function () {
beforeEach(async function () {
beforeEach(async function (done) {
await Utils.sleep(2000);
console.info("web beforeEach start");
done();
......@@ -70,7 +70,7 @@ export default function webJsunit() {
*/
it('onUrlLoadIntercept',0,async function(done){
emitKey="emitOnRenderExited";
Utils.registerEvent("onUrlLoadIntercept","https://www.gitee.com",104,done);
Utils.registerEvent("onUrlLoadIntercept","https://gitee.com/",104,done);
sendEventByKey('webcomponent',10,'');
})
/*
......@@ -100,7 +100,7 @@ export default function webJsunit() {
*/
it('loadUrl',0,async function(done){
emitKey="emitRunJavaScript";
Utils.registerEvent("loadUrl","基于Git的代码托管和研发协作平台--Gitee | Software Development and Collaboration Platform",110,done);
Utils.registerContainEvent("loadUrl","代码托管和研发协作平台",110,done);
sendEventByKey('webcomponent',10,'');
})
/*
......@@ -168,7 +168,7 @@ export default function webJsunit() {
*/
it('getPageHeight',0,async function(done){
emitKey="emitGetRequestFocus";
Utils.registerEvent("getPageHeight","true",124,done);
Utils.registerEventTwo("getPageHeight",124,done);
sendEventByKey('webcomponent',10,'');
})
/*
......
......@@ -29,14 +29,13 @@
]
}]
}],
"requestPermissions": [{
"name": "ohos.permission.SYSTEM_FLOAT_WINDOW",
"reason": "need use ohos.permission.SYSTEM_FLOAT_WINDOW"
"requestPermissions": [
{
"name": "ohos.permission.LOCATION"
},
{
"name": "ohos.permission.CAPTURE_SCREEN",
"reason": "need use ohos.permission.SYSTEM_FLOAT_WINDOW"
"name": "ohos.permission.INTERNET"
}
]
}
}
\ No newline at end of file
}
......@@ -5,9 +5,15 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>index</title>
<style>
#pageHeight{
height:1300px
}
</style>
</head>
<body>
<div id="container">首页</div>
<div id="pageHeight"></div>
</body>
<script>
function getUserAgent(){
......@@ -24,4 +30,4 @@
return height
}
</script>
</html>
\ No newline at end of file
</html>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册