提交 40603dac 编写于 作者: C chengxingzhen

XTS失败用例适配

Signed-off-by: Nchengxingzhen <chengxingzhen@huawei.com>
上级 a86e8bd7
...@@ -40,7 +40,7 @@ struct Index { ...@@ -40,7 +40,7 @@ struct Index {
core.init(); core.init();
core.subscribeEvent('task', reportExtend); core.subscribeEvent('task', reportExtend);
const configService = core.getDefaultService('config'); const configService = core.getDefaultService('config');
want.parameters['timeout'] = 10000; want.parameters['timeout'] = 20000;
console.info('[FormComponent] parameters---->' + JSON.stringify(want.parameters)); console.info('[FormComponent] parameters---->' + JSON.stringify(want.parameters));
configService.setConfig(want.parameters); configService.setConfig(want.parameters);
testsuite(); testsuite();
......
...@@ -599,7 +599,6 @@ export default function test() { ...@@ -599,7 +599,6 @@ export default function test() {
async function delPublishCallbackB() { async function delPublishCallbackB() {
console.info(`${tcNumber} delPublishCallbackB`); console.info(`${tcNumber} delPublishCallbackB`);
await sleep(1000);
console.info(`${tcNumber} delPublishCallbackB end`); console.info(`${tcNumber} delPublishCallbackB end`);
console.info(`${tcNumber} end`); console.info(`${tcNumber} end`);
done(); done();
......
...@@ -81,6 +81,7 @@ export const getFormsInfoTest = (describeName, filterParameter) => { ...@@ -81,6 +81,7 @@ export const getFormsInfoTest = (describeName, filterParameter) => {
console.log(`${callbackName} exception caught: ${JSON.stringify(error)})`); console.log(`${callbackName} exception caught: ${JSON.stringify(error)})`);
console.log(`${callbackName} should not reach here`); console.log(`${callbackName} should not reach here`);
expect().assertFail(); expect().assertFail();
done();
} }
}); });
...@@ -97,6 +98,7 @@ export const getFormsInfoTest = (describeName, filterParameter) => { ...@@ -97,6 +98,7 @@ export const getFormsInfoTest = (describeName, filterParameter) => {
console.log(`${promiseName} getFormsInfo data: ${JSON.stringify(data)}`); console.log(`${promiseName} getFormsInfo data: ${JSON.stringify(data)}`);
console.log(`${promiseName} should not reach here`); console.log(`${promiseName} should not reach here`);
expect().assertFail(); expect().assertFail();
done();
} catch (error) { } catch (error) {
console.log(`${promiseName} exception caught: ${JSON.stringify(error)})`); console.log(`${promiseName} exception caught: ${JSON.stringify(error)})`);
expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE);
...@@ -177,7 +179,6 @@ export const getFormsInfoTest = (describeName, filterParameter) => { ...@@ -177,7 +179,6 @@ export const getFormsInfoTest = (describeName, filterParameter) => {
tempDataB = dataB[0] tempDataB = dataB[0]
expect(error.code).assertEqual(ERR_OK_CODE); expect(error.code).assertEqual(ERR_OK_CODE);
expect(error.message).assertEqual(ERR_OK); expect(error.message).assertEqual(ERR_OK);
done();
console.log(`==========${callbackName2} ${describeName} end==========`); console.log(`==========${callbackName2} ${describeName} end==========`);
}); });
await sleep(2000) await sleep(2000)
...@@ -232,9 +233,9 @@ export const getFormsInfoTest = (describeName, filterParameter) => { ...@@ -232,9 +233,9 @@ export const getFormsInfoTest = (describeName, filterParameter) => {
expect(FormInfo.FormType.JS).assertEqual(formInfo.type) expect(FormInfo.FormType.JS).assertEqual(formInfo.type)
expect('card_b').assertEqual(formInfo.jsComponentName) expect('card_b').assertEqual(formInfo.jsComponentName)
expect(FormInfo.ColorMode.MODE_AUTO).assertEqual(formInfo.colorMode) expect(FormInfo.ColorMode.MODE_AUTO).assertEqual(formInfo.colorMode)
expect(1).assertEqual(formInfo.isDefault) expect(formInfo.isDefault).assertTrue()
expect(1).assertEqual(formInfo.updateEnabled) expect(formInfo.updateEnabled).assertTrue()
expect(1).assertEqual(formInfo.formVisibleNotify) expect(formInfo.formVisibleNotify).assertTrue()
expect(undefined).assertEqual(formInfo.relatedBundleName) expect(undefined).assertEqual(formInfo.relatedBundleName)
expect("abilityb").assertEqual(formInfo.formConfigAbility) expect("abilityb").assertEqual(formInfo.formConfigAbility)
expect(3).assertEqual(formInfo.updateDuration) expect(3).assertEqual(formInfo.updateDuration)
...@@ -242,8 +243,8 @@ export const getFormsInfoTest = (describeName, filterParameter) => { ...@@ -242,8 +243,8 @@ export const getFormsInfoTest = (describeName, filterParameter) => {
expect('10:30').assertEqual(formInfo.scheduledUpdateTime) expect('10:30').assertEqual(formInfo.scheduledUpdateTime)
expect(1).assertEqual(formInfo.supportDimensions[0]) expect(1).assertEqual(formInfo.supportDimensions[0])
expect(2).assertEqual(formInfo.supportDimensions[1]) expect(2).assertEqual(formInfo.supportDimensions[1])
expect('originWidgetNameB').assertEqual(formInfo.metaData.customizeData[0].name) expect('originWidgetNameB').assertEqual(formInfo.customizeData[0].name)
expect('valueB').assertEqual(formInfo.metaData.customizeData[0].value) expect('valueB').assertEqual(formInfo.customizeData[0].value)
} }
/** /**
...@@ -283,6 +284,7 @@ export const getFormsInfoTest = (describeName, filterParameter) => { ...@@ -283,6 +284,7 @@ export const getFormsInfoTest = (describeName, filterParameter) => {
console.log(`${promiseName3} getFormsInfo data: ${JSON.stringify(data)}`); console.log(`${promiseName3} getFormsInfo data: ${JSON.stringify(data)}`);
console.log(`${promiseName3} should not reach here`); console.log(`${promiseName3} should not reach here`);
expect().assertFail(); expect().assertFail();
done();
} catch (error) { } catch (error) {
console.log(`${promiseName3} exception caught: ${JSON.stringify(error)})`); console.log(`${promiseName3} exception caught: ${JSON.stringify(error)})`);
expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE);
...@@ -312,6 +314,7 @@ export const getFormsInfoTest = (describeName, filterParameter) => { ...@@ -312,6 +314,7 @@ export const getFormsInfoTest = (describeName, filterParameter) => {
console.log(`${callbackName4} exception caught: ${JSON.stringify(error)})`); console.log(`${callbackName4} exception caught: ${JSON.stringify(error)})`);
console.log(`${callbackName4} should not reach here`); console.log(`${callbackName4} should not reach here`);
expect().assertFail(); expect().assertFail();
done();
} }
}); });
...@@ -328,6 +331,7 @@ export const getFormsInfoTest = (describeName, filterParameter) => { ...@@ -328,6 +331,7 @@ export const getFormsInfoTest = (describeName, filterParameter) => {
console.log(`${promiseName4} getFormsInfo data: ${JSON.stringify(data)}`); console.log(`${promiseName4} getFormsInfo data: ${JSON.stringify(data)}`);
console.log(`${promiseName4} should not reach here`); console.log(`${promiseName4} should not reach here`);
expect().assertFail(); expect().assertFail();
done();
} catch (error) { } catch (error) {
console.log(`${promiseName4} exception caught: ${JSON.stringify(error)})`); console.log(`${promiseName4} exception caught: ${JSON.stringify(error)})`);
expect(error.code).assertEqual(ERR_GET_BUNDLE_FAILED_CODE); expect(error.code).assertEqual(ERR_GET_BUNDLE_FAILED_CODE);
...@@ -357,6 +361,7 @@ export const getFormsInfoTest = (describeName, filterParameter) => { ...@@ -357,6 +361,7 @@ export const getFormsInfoTest = (describeName, filterParameter) => {
console.log(`${callbackName5} exception caught: ${JSON.stringify(error)})`); console.log(`${callbackName5} exception caught: ${JSON.stringify(error)})`);
console.log(`${callbackName5} should not reach here`); console.log(`${callbackName5} should not reach here`);
expect().assertFail(); expect().assertFail();
done();
} }
}); });
...@@ -373,6 +378,7 @@ export const getFormsInfoTest = (describeName, filterParameter) => { ...@@ -373,6 +378,7 @@ export const getFormsInfoTest = (describeName, filterParameter) => {
console.log(`${promiseName5} getFormsInfo data: ${JSON.stringify(data)}`); console.log(`${promiseName5} getFormsInfo data: ${JSON.stringify(data)}`);
console.log(`${promiseName5} should not reach here`); console.log(`${promiseName5} should not reach here`);
expect().assertFail(); expect().assertFail();
done();
} catch (error) { } catch (error) {
console.log(`${promiseName5} exception caught: ${JSON.stringify(error)})`); console.log(`${promiseName5} exception caught: ${JSON.stringify(error)})`);
expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE);
...@@ -403,6 +409,7 @@ export const getFormsInfoTest = (describeName, filterParameter) => { ...@@ -403,6 +409,7 @@ export const getFormsInfoTest = (describeName, filterParameter) => {
console.log(`${callbackName6} exception caught: ${JSON.stringify(error)})`); console.log(`${callbackName6} exception caught: ${JSON.stringify(error)})`);
console.log(`${callbackName6} should not reach here`); console.log(`${callbackName6} should not reach here`);
expect().assertFail(); expect().assertFail();
done();
} }
}); });
...@@ -424,6 +431,7 @@ export const getFormsInfoTest = (describeName, filterParameter) => { ...@@ -424,6 +431,7 @@ export const getFormsInfoTest = (describeName, filterParameter) => {
console.log(`${promiseName6} exception caught: ${JSON.stringify(error)})`); console.log(`${promiseName6} exception caught: ${JSON.stringify(error)})`);
console.log(`${promiseName6} should not reach here`); console.log(`${promiseName6} should not reach here`);
expect().assertFail(); expect().assertFail();
done();
} }
}); });
...@@ -460,6 +468,7 @@ export const getFormsInfoTest = (describeName, filterParameter) => { ...@@ -460,6 +468,7 @@ export const getFormsInfoTest = (describeName, filterParameter) => {
console.log(`${callbackName7} exception caught: ${JSON.stringify(error)})`); console.log(`${callbackName7} exception caught: ${JSON.stringify(error)})`);
console.log(`${callbackName7} should not reach here`); console.log(`${callbackName7} should not reach here`);
expect().assertFail(); expect().assertFail();
done();
} }
}); });
...@@ -492,6 +501,7 @@ export const getFormsInfoTest = (describeName, filterParameter) => { ...@@ -492,6 +501,7 @@ export const getFormsInfoTest = (describeName, filterParameter) => {
console.log(`${promiseName7} exception caught: ${JSON.stringify(error)})`); console.log(`${promiseName7} exception caught: ${JSON.stringify(error)})`);
console.log(`${promiseName7} should not reach here`); console.log(`${promiseName7} should not reach here`);
expect().assertFail(); expect().assertFail();
done();
} }
}); });
...@@ -504,17 +514,17 @@ export const getFormsInfoTest = (describeName, filterParameter) => { ...@@ -504,17 +514,17 @@ export const getFormsInfoTest = (describeName, filterParameter) => {
expect(FormInfo.FormType.JS).assertEqual(formInfo.type) expect(FormInfo.FormType.JS).assertEqual(formInfo.type)
expect('card_c').assertEqual(formInfo.jsComponentName) expect('card_c').assertEqual(formInfo.jsComponentName)
expect(FormInfo.ColorMode.MODE_LIGHT).assertEqual(formInfo.colorMode) expect(FormInfo.ColorMode.MODE_LIGHT).assertEqual(formInfo.colorMode)
expect(1).assertEqual(formInfo.isDefault) expect(formInfo.isDefault).assertTrue()
expect(1).assertEqual(formInfo.updateEnabled) expect(formInfo.updateEnabled).assertTrue()
expect(1).assertEqual(formInfo.formVisibleNotify) expect(formInfo.formVisibleNotify).assertTrue()
expect(undefined).assertEqual(formInfo.relatedBundleName) expect(undefined).assertEqual(formInfo.relatedBundleName)
expect("abilityc").assertEqual(formInfo.formConfigAbility) expect("abilityc").assertEqual(formInfo.formConfigAbility)
expect(4).assertEqual(formInfo.updateDuration) expect(4).assertEqual(formInfo.updateDuration)
expect(3).assertEqual(formInfo.defaultDimension) expect(3).assertEqual(formInfo.defaultDimension)
expect(3).assertEqual(formInfo.supportDimensions[0]) expect(3).assertEqual(formInfo.supportDimensions[0])
expect(4).assertEqual(formInfo.supportDimensions[1]) expect(4).assertEqual(formInfo.supportDimensions[1])
expect('originWidgetNameC').assertEqual(formInfo.metaData.customizeData[0].name) expect('originWidgetNameC').assertEqual(formInfo.customizeData[0].name)
expect('valueC').assertEqual(formInfo.metaData.customizeData[0].value) expect('valueC').assertEqual(formInfo.customizeData[0].value)
} }
}); });
}; };
...@@ -31,7 +31,9 @@ var deleteForm_Event = "FMS_FormDelete_commonEvent"; ...@@ -31,7 +31,9 @@ var deleteForm_Event = "FMS_FormDelete_commonEvent";
var subscriberOnAcquired; var subscriberOnAcquired;
var subscriberOnDeleted; var subscriberOnDeleted;
var subscriberOnReleased; var subscriberOnReleased;
function sleep(time) {
return new Promise((resolve)=>setTimeout(resolve,time));
}
export default function test() { export default function test() {
describe(`FmsReleaseFormTest`, () => { describe(`FmsReleaseFormTest`, () => {
...@@ -437,12 +439,12 @@ export default function test() { ...@@ -437,12 +439,12 @@ export default function test() {
} }
} }
} }
function releaseForms() { async function releaseForms() {
console.debug("====>FMS_releaseForm_1300 releaseForms====>"); console.debug("====>FMS_releaseForm_1300 releaseForms====>");
commonEvent.subscribe(subscriberOnReleased, onReleasedCallBack); commonEvent.subscribe(subscriberOnReleased, onReleasedCallBack);
for(var iIndex = 0; iIndex < formIdList.length; iIndex++) { for(var iIndex = 0; iIndex < formIdList.length; iIndex++) {
console.log(`FMS_releaseForm_1300 featureAbility.startAbility start`); console.log(`FMS_releaseForm_1300 featureAbility.startAbility start`);
featureAbility.startAbility({ await featureAbility.startAbility({
want: { want: {
bundleName: "com.ohos.st.formsystemhostc", bundleName: "com.ohos.st.formsystemhostc",
abilityName: "com.ohos.st.formsystemhostc.MainAbility", abilityName: "com.ohos.st.formsystemhostc.MainAbility",
...@@ -465,6 +467,7 @@ export default function test() { ...@@ -465,6 +467,7 @@ export default function test() {
expect().assertFail(); expect().assertFail();
done(); done();
}); });
await sleep(1000)
console.log(`FMS_releaseForm_1300 featureAbility.startAbility end`); console.log(`FMS_releaseForm_1300 featureAbility.startAbility end`);
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册