Skip to content

Commit

Permalink
Merge pull request NetrisTV#37 from HardBoiledSmith/DEV-13561
Browse files Browse the repository at this point in the history
DEV-13561 [라미엘] 테스트 시작/끝 모든앱 강제종료
  • Loading branch information
yoonjs2 committed Jan 15, 2022
2 parents ecfcd98 + 5211618 commit 4e63b34
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/server/goog-device/mw/WebsocketProxyOverAdb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ export class WebsocketProxyOverAdb extends WebsocketProxy {
return service;
}

// TODO: HBsmith DEV-12386, DEV-13493, DEV-13549
// TODO: HBsmith DEV-12386, DEV-13493, DEV-13549, DEV-13561
public release(): void {
this.tearDownTest();
super.release();
Expand Down Expand Up @@ -244,15 +244,16 @@ export class WebsocketProxyOverAdb extends WebsocketProxy {
return;
}

const cmdAppStop = `am force-stop '${this.appKey}'`;
const cmdAppStop =
'for pp in $(dumpsys window a | grep "/" | cut -d "{" -f2 | cut -d "/" -f1 | cut -d " " -f2); do am force-stop "${pp}"; done';
const cmdAppStart = `monkey -p '${this.appKey}' -c android.intent.category.LAUNCHER 1`;

device
.runShellCommandAdbKit(cmdAppStop)
.then((output) => {
console.log(
Utils.getTimeISOString(),
output ? output : `success to stop the app: ${cmdAppStop}`,
output ? output : `success to stop all of the apps: ${cmdAppStop}`,
);
return device.runShellCommandAdbKit(cmdAppStart);
})
Expand Down Expand Up @@ -288,15 +289,12 @@ export class WebsocketProxyOverAdb extends WebsocketProxy {
.then((output) => {
console.log(Utils.getTimeISOString(), output ? output : `success to run a command: ${cmdPower}`);

if (!this.appKey) {
return;
}

const cmdStopApp = `am force-stop '${this.appKey}'`;
const cmdAppStop =
'for pp in $(dumpsys window a | grep "/" | cut -d "{" -f2 | cut -d "/" -f1 | cut -d " " -f2); do am force-stop "${pp}"; done';
device
.runShellCommandAdbKit(cmdStopApp)
.runShellCommandAdbKit(cmdAppStop)
.then((output) => {
console.log(Utils.getTimeISOString(), output ? output : `success to stop app: ${cmdStopApp}`);
console.log(Utils.getTimeISOString(), output ? output : `success to stop all of running apps`);
})
.catch((e) => {
console.error(Utils.getTimeISOString(), e);
Expand Down

0 comments on commit 4e63b34

Please sign in to comment.