Skip to content

Commit

Permalink
Fix test runner map & add sleep for T2C tap action (#158)
Browse files Browse the repository at this point in the history
  • Loading branch information
taoran6 authored Nov 22, 2022
1 parent 5495b3c commit b6aa390
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

import java.util.Set;

@Service
@Service("appiumCrossRunner")
public class AppiumCrossRunner extends AppiumRunner {
@Value("${app.registry.name}")
String agentName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

import static org.junit.platform.engine.discovery.DiscoverySelectors.selectClass;

@Service
@Service("appiumRunner")
public class AppiumRunner extends TestRunner {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import java.util.Collections;
import java.util.Map;

@Service
@Service("espressoRunner")
public class EspressoRunner extends TestRunner {
@Resource
ADBOperateUtil adbOperateUtil;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import java.util.Map;
import java.util.concurrent.TimeUnit;

@Service
@Service("adbMonkeyRunner")
public class AdbMonkeyRunner extends TestRunner {
static final Logger classLogger = LoggerFactory.getLogger(AdbMonkeyRunner.class);
private final AnimatedGifEncoder e = new AnimatedGifEncoder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import java.io.IOException;
import java.util.concurrent.TimeUnit;

@Service
@Service("appiumMonkeyRunner")
public class AppiumMonkeyRunner extends AppiumRunner {
private final AnimatedGifEncoder e = new AnimatedGifEncoder();
private LogCollector logCollector;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import java.io.IOException;
import java.util.concurrent.TimeUnit;

@Service
@Service("smartRunner")
public class SmartRunner extends TestRunner {
private final AnimatedGifEncoder e = new AnimatedGifEncoder();
@Resource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import java.util.Set;
import java.util.concurrent.TimeUnit;

@Service
@Service("t2cRunner")
public class T2CRunner extends AppiumRunner {

private final AnimatedGifEncoder e = new AnimatedGifEncoder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,12 @@ public static void chooseActionType(BaseDriverController driver, ActionInfo acti
driver.click(webElement);
break;
case "tap":
//wait 3s before and after the tap action
safeSleep(3000);
int x = (Integer) arguments.get("x");
int y = (Integer) arguments.get("y");
driver.tap(x, y);
safeSleep(3000);
break;
case "input":
String content;
Expand Down Expand Up @@ -138,11 +141,7 @@ public static void chooseActionType(BaseDriverController driver, ActionInfo acti
break;
case "sleep":
long timeout = Long.parseLong((String) arguments.get("duration"));
try {
Thread.sleep(timeout);
} catch (InterruptedException e) {
e.printStackTrace();
}
safeSleep(timeout);
break;
case "getInfo":
String attributeKey = (String) arguments.get("attribute");
Expand Down Expand Up @@ -191,4 +190,12 @@ public static void chooseActionType(BaseDriverController driver, ActionInfo acti

}
}

private static void safeSleep(long millis) {
try {
Thread.sleep(millis);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}

0 comments on commit b6aa390

Please sign in to comment.