Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 在获取元素页面中快捷测试元素定位是否可以定位并点击 #464

Merged
merged 2 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/main/java/org/cloud/sonic/agent/transport/TransportClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,14 @@ public void onMessage(String s) {
runIOSStep(jsonObject);
}
}
case "debugStep" -> {
if (jsonObject.getInteger("pf") == PlatformType.ANDROID) {
debugAndroidStep(jsonObject);
}
if (jsonObject.getInteger("pf") == PlatformType.IOS) {
debugIOSStep(jsonObject);
}
}
case "suite" -> {
List<JSONObject> cases = jsonObject.getJSONArray("cases").toJavaList(JSONObject.class);
TestNG tng = new TestNG();
Expand Down Expand Up @@ -440,4 +448,13 @@ private void iosRelease(String udId) {
DevicesLockMap.unlockAndRemoveByUdId(udId);
log.info("ios unlock udId:{}", udId);
}

private void debugAndroidStep(JSONObject jsonObject) {

}

private void debugIOSStep(JSONObject jsonObject){

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,18 @@ public void onMessage(String message, Session session) {
});
}
}
case "checkLocation" -> {
JSONObject jsonCheck = new JSONObject();
jsonCheck.put("msg", "generateStep");
jsonCheck.put("key", key);
jsonCheck.put("udId", iDevice.getSerialNumber());
jsonCheck.put("pwd", msg.getString("pwd"));
jsonCheck.put("sessionId", session.getUserProperties().get("id").toString());
jsonCheck.put("element", msg.getString("element"));
jsonCheck.put("eleType", msg.getString("eleType"));
jsonCheck.put("pf", 1);
TransportWorker.send(jsonCheck);
}
}
}
}
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/org/cloud/sonic/agent/websockets/IOSWSServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,17 @@ public void onMessage(String message, Session session) {
}
sendText(session, result.toJSONString());
}
case "checkLocation" -> {
JSONObject jsonCheck = new JSONObject();
jsonCheck.put("msg", "generateStep");
jsonCheck.put("key", key);
jsonCheck.put("udId", udId);
jsonCheck.put("sessionId", session.getUserProperties().get("id").toString());
jsonCheck.put("element", msg.getString("element"));
jsonCheck.put("eleType", msg.getString("eleType"));
jsonCheck.put("pf", 2);
TransportWorker.send(jsonCheck);
}
}
}
}
Expand Down
Loading