提交 5b9356c0 编写于 作者: X xinking129

change code

Signed-off-by: Nxinking129 <xinxin13@huawei.com>
上级 bd53b20a
...@@ -514,47 +514,30 @@ export default function abilityTest() { ...@@ -514,47 +514,30 @@ export default function abilityTest() {
] ]
} }
}; };
globalThis.abilitycontext.startAbility( globalThis.abilitycontext.startAbility(want).then(() => {
want, (err) => { console.info('startAbility first succeed');
if (err.code) { setTimeout(() => {
console.error(`startAbility failed, code is ${err.code}, message is ${err.message}`); globalThis.abilitycontext.startAbility(want).then(() => {
expect(true).assertFalse(); console.info('startAbility second succeed');
return;
}
console.info('startAbility succeed');
expect(true).assertTrue()
});
await sleep(1000);
setTimeout(()=> { setTimeout(()=> {
abilityDelegator.executeShellCommand('pkill -f com.example.mytest5').then(data => { abilityDelegator.executeShellCommand('pkill -f com.example.mytest5').then((data) => {
console.log('pkill -f successful ' + JSON.stringify(data)) console.log('pkill -f successful ' + JSON.stringify(data))
}).catch(err => { }).catch((err) => {
console.log('pkill -f err is ' + JSON.stringify(err)) console.log('pkill -f err is ' + JSON.stringify(err))
}); });
},1000) done();
await sleep(1000); }, 1000)
setTimeout(()=> { }).catch((err) => {
globalThis.abilitycontext.startAbility( console.error(`startAbility second failed, error is ${JSON.stringify(err)}`);
want, (err) => {
if (err.code) {
console.error(`startAbility failed, code is ${err.code}, message is ${err.message}`);
expect(true).assertFalse(); expect(true).assertFalse();
done(); done();
return;
}
console.info('startAbility succeed');
expect(true).assertTrue();
setTimeout(()=> {
abilityDelegator.executeShellCommand('pkill -f com.example.mytest5').then(data => {
console.log('pkill -f successful ' + JSON.stringify(data))
}).catch(err => {
console.log('pkill -f err is ' + JSON.stringify(err))
}); });
}, 1000);
}).catch((err) => {
console.error(`startAbility first failed, error is ${JSON.stringify(err)}`);
expect(true).assertFalse();
done(); done();
},1000)
}); });
},1000)
}) })
/* /*
...@@ -564,7 +547,7 @@ export default function abilityTest() { ...@@ -564,7 +547,7 @@ export default function abilityTest() {
* @tc.level:1 * @tc.level:1
*/ */
it('ACTS_NFC_SelectTypes_1300',0, async function (done) { it('ACTS_NFC_SelectTypes_1300',0, async function (done) {
hilog.info(DOMAIN, TAG, '%{public}s', 'ACTS_NFC_SelectTypes_1300 begin'); hilog.info(DOMAIN, TAG, '%{public}s', 'ACTS_NFC_SelectTypes_1200 begin');
let want = { let want = {
action: "ohos.nfc.tag.action.TAG_FOUND", action: "ohos.nfc.tag.action.TAG_FOUND",
type: '', type: '',
...@@ -574,41 +557,29 @@ export default function abilityTest() { ...@@ -574,41 +557,29 @@ export default function abilityTest() {
] ]
} }
}; };
globalThis.abilitycontext.startAbility( globalThis.abilitycontext.startAbility(want).then(() => {
want, (err) => { console.info('startAbility first succeed');
if (err.code) { setTimeout(() => {
console.error(`startAbility failed, code is ${err.code}, message is ${err.message}`); globalThis.abilitycontext.startAbility(want).then(() => {
expect(true).assertFalse(); console.info('startAbility second succeed');
return;
}
console.info('startAbility succeed');
expect(true).assertTrue()
});
setTimeout(()=> { setTimeout(()=> {
abilityDelegator.executeShellCommand('pkill -f com.example.mytest4').then(data => { abilityDelegator.executeShellCommand('pkill -f com.example.mytest4').then((data) => {
console.log('pkill -f successful ' + JSON.stringify(data)) console.log('pkill -f successful ' + JSON.stringify(data))
}).catch(err => { }).catch((err) => {
console.log('pkill -f err is ' + JSON.stringify(err)) console.log('pkill -f err is ' + JSON.stringify(err))
}); });
},1000) done();
globalThis.abilitycontext.startAbility( }, 1000)
want, (err) => { }).catch((err) => {
if (err.code) { console.error(`startAbility second failed, error is ${JSON.stringify(err)}`);
console.error(`startAbility failed, code is ${err.code}, message is ${err.message}`);
expect(true).assertFalse(); expect(true).assertFalse();
done(); done();
return;
}
console.info('startAbility succeed');
expect(true).assertTrue();
setTimeout(()=> {
abilityDelegator.executeShellCommand('pkill -f com.example.mytest5').then(data => {
console.log('pkill -f successful ' + JSON.stringify(data))
}).catch(err => {
console.log('pkill -f err is ' + JSON.stringify(err))
}); });
}, 1000);
}).catch((err) => {
console.error(`startAbility first failed, error is ${JSON.stringify(err)}`);
expect(true).assertFalse();
done(); done();
},1000)
}); });
}) })
}) })
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册