From 226182f768f27818a6342f626b37dc49597f0839 Mon Sep 17 00:00:00 2001 From: caofengbin <1050430934@qq.com> Date: Mon, 22 May 2023 11:09:40 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E4=B8=89=E4=B8=AA=E8=80=81=E7=9A=84?= =?UTF-8?q?=E6=96=87=E6=9C=AC=E6=96=AD=E8=A8=80=E6=8C=87=E4=BB=A4getText?= =?UTF-8?q?=EF=BC=8CgetWebViewText=EF=BC=8CgetPocoText=E6=A2=B3=E7=90=86?= =?UTF-8?q?=E4=BF=9D=E7=95=99=EF=BC=8C=E5=81=9A=E8=80=81=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E7=9A=84=E5=85=BC=E5=AE=B9=E4=BD=BF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tests/handlers/AndroidStepHandler.java | 19 ++++++++++--------- .../agent/tests/handlers/IOSStepHandler.java | 13 +++++++------ 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/main/java/org/cloud/sonic/agent/tests/handlers/AndroidStepHandler.java b/src/main/java/org/cloud/sonic/agent/tests/handlers/AndroidStepHandler.java index 8a681ef5..3ccf26b0 100755 --- a/src/main/java/org/cloud/sonic/agent/tests/handlers/AndroidStepHandler.java +++ b/src/main/java/org/cloud/sonic/agent/tests/handlers/AndroidStepHandler.java @@ -2234,9 +2234,6 @@ public void runStep(JSONObject stepJSON, HandleContext handleContext) throws Thr case "sendKeysByActions" -> sendKeysByActions(handleContext, eleList.getJSONObject(0).getString("eleName"), eleList.getJSONObject(0).getString("eleType") , eleList.getJSONObject(0).getString("eleValue"), step.getString("content")); - case "getText" -> - getTextAndAssert(handleContext, eleList.getJSONObject(0).getString("eleName"), eleList.getJSONObject(0).getString("eleType") - , eleList.getJSONObject(0).getString("eleValue"), step.getString("content")); case "isExistEle" -> isExistEle(handleContext, eleList.getJSONObject(0).getString("eleName"), eleList.getJSONObject(0).getString("eleType") , eleList.getJSONObject(0).getString("eleValue"), step.getBoolean("content")); @@ -2295,9 +2292,6 @@ public void runStep(JSONObject stepJSON, HandleContext handleContext) throws Thr case "publicStep" -> publicStep(handleContext, step.getString("content"), step.getJSONArray("pubSteps")); case "setDefaultFindWebViewElementInterval" -> setDefaultFindWebViewElementInterval(handleContext, step.getInteger("content"), step.getInteger("text")); - case "getWebViewText" -> - getWebViewTextAndAssert(handleContext, eleList.getJSONObject(0).getString("eleName"), eleList.getJSONObject(0).getString("eleType") - , eleList.getJSONObject(0).getString("eleValue"), step.getString("content")); case "webElementScrollToView" -> webElementScrollToView(handleContext, step.getString("text"), step.getString("content"), step.getString("content")); case "isExistWebViewEle" -> @@ -2356,9 +2350,6 @@ public void runStep(JSONObject stepJSON, HandleContext handleContext) throws Thr case "getPocoTextValue" -> globalParams.put(step.getString("content"), getPocoText(handleContext, eleList.getJSONObject(0).getString("eleName") , eleList.getJSONObject(0).getString("eleType"), eleList.getJSONObject(0).getString("eleValue"))); - case "getPocoText" -> - getPocoTextAndAssert(handleContext, eleList.getJSONObject(0).getString("eleName"), eleList.getJSONObject(0).getString("eleType") - , eleList.getJSONObject(0).getString("eleValue"), step.getString("content")); case "freezeSource" -> freezeSource(handleContext); case "thawSource" -> thawSource(handleContext); case "closePocoDriver" -> closePocoDriver(handleContext); @@ -2375,6 +2366,16 @@ public void runStep(JSONObject stepJSON, HandleContext handleContext) throws Thr case "getClipperByKeyboard" -> globalParams.put(step.getString("content"), getClipperByKeyboard(handleContext)); case "setClipperByKeyboard" -> setClipperByKeyboard(handleContext, step.getString("content")); + // <= 2.5版本的文本断言语法(包括原生,webView,Poco三类),保留做兼容,老版本升级上来的存量用例继续可用 + case "getText" -> + getTextAndAssert(handleContext, eleList.getJSONObject(0).getString("eleName"), eleList.getJSONObject(0).getString("eleType") + , eleList.getJSONObject(0).getString("eleValue"), step.getString("content")); + case "getWebViewText" -> + getWebViewTextAndAssert(handleContext, eleList.getJSONObject(0).getString("eleName"), eleList.getJSONObject(0).getString("eleType") + , eleList.getJSONObject(0).getString("eleValue"), step.getString("content")); + case "getPocoText" -> + getPocoTextAndAssert(handleContext, eleList.getJSONObject(0).getString("eleName"), eleList.getJSONObject(0).getString("eleType") + , eleList.getJSONObject(0).getString("eleValue"), step.getString("content")); } switchType(step, handleContext); } diff --git a/src/main/java/org/cloud/sonic/agent/tests/handlers/IOSStepHandler.java b/src/main/java/org/cloud/sonic/agent/tests/handlers/IOSStepHandler.java index 022ca1cb..17b29d16 100755 --- a/src/main/java/org/cloud/sonic/agent/tests/handlers/IOSStepHandler.java +++ b/src/main/java/org/cloud/sonic/agent/tests/handlers/IOSStepHandler.java @@ -1506,9 +1506,6 @@ public void runStep(JSONObject stepJSON, HandleContext handleContext) throws Thr case "sendKeys" -> sendKeys(handleContext, eleList.getJSONObject(0).getString("eleName"), eleList.getJSONObject(0).getString("eleType") , eleList.getJSONObject(0).getString("eleValue"), step.getString("content")); - case "getText" -> - getTextAndAssert(handleContext, eleList.getJSONObject(0).getString("eleName"), eleList.getJSONObject(0).getString("eleType") - , eleList.getJSONObject(0).getString("eleValue"), step.getString("content")); case "isExistEle" -> isExistEle(handleContext, eleList.getJSONObject(0).getString("eleName"), eleList.getJSONObject(0).getString("eleType") , eleList.getJSONObject(0).getString("eleValue"), step.getBoolean("content")); @@ -1596,9 +1593,6 @@ public void runStep(JSONObject stepJSON, HandleContext handleContext) throws Thr case "getPocoTextValue" -> globalParams.put(step.getString("content"), getPocoText(handleContext, eleList.getJSONObject(0).getString("eleName") , eleList.getJSONObject(0).getString("eleType"), eleList.getJSONObject(0).getString("eleValue"))); - case "getPocoText" -> - getPocoTextAndAssert(handleContext, eleList.getJSONObject(0).getString("eleName"), eleList.getJSONObject(0).getString("eleType") - , eleList.getJSONObject(0).getString("eleValue"), step.getString("content")); case "freezeSource" -> freezeSource(handleContext); case "thawSource" -> thawSource(handleContext); case "closePocoDriver" -> closePocoDriver(handleContext); @@ -1608,6 +1602,13 @@ public void runStep(JSONObject stepJSON, HandleContext handleContext) throws Thr case "iteratorIOSElement" -> iteratorIOSElement(handleContext, eleList.getJSONObject(0).getString("eleName"), eleList.getJSONObject(0).getString("eleType") , eleList.getJSONObject(0).getString("eleValue")); + // <= 2.5版本的文本断言语法(包括原生,webView,Poco三类),保留做兼容,老版本升级上来的存量用例继续可用 + case "getText" -> + getTextAndAssert(handleContext, eleList.getJSONObject(0).getString("eleName"), eleList.getJSONObject(0).getString("eleType") + , eleList.getJSONObject(0).getString("eleValue"), step.getString("content")); + case "getPocoText" -> + getPocoTextAndAssert(handleContext, eleList.getJSONObject(0).getString("eleName"), eleList.getJSONObject(0).getString("eleType") + , eleList.getJSONObject(0).getString("eleValue"), step.getString("content")); } switchType(step, handleContext); } From 59d9efb4c5b5a80ce9b409524a4c377d2f60f94c Mon Sep 17 00:00:00 2001 From: caofengbin <1050430934@qq.com> Date: Mon, 22 May 2023 12:17:18 +0800 Subject: [PATCH 2/5] =?UTF-8?q?Android=E7=AB=AF=E7=9A=84=E5=8E=9F=E7=94=9F?= =?UTF-8?q?=EF=BC=8Cweb=EF=BC=8CPOCO=E7=B1=BB=E5=9E=8B=EF=BC=8C=E5=A2=9E?= =?UTF-8?q?=E5=BC=BA=E6=96=87=E6=9C=AC=E6=96=AD=E8=A8=80=E7=9A=84=E8=83=BD?= =?UTF-8?q?=E5=8A=9B=EF=BC=8Cagent=E9=80=BB=E8=BE=91=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tests/handlers/AndroidStepHandler.java | 68 +++++++++++++++++++ .../agent/tests/handlers/AssertUtil.java | 16 +++++ 2 files changed, 84 insertions(+) diff --git a/src/main/java/org/cloud/sonic/agent/tests/handlers/AndroidStepHandler.java b/src/main/java/org/cloud/sonic/agent/tests/handlers/AndroidStepHandler.java index 3ccf26b0..ac8c32c1 100755 --- a/src/main/java/org/cloud/sonic/agent/tests/handlers/AndroidStepHandler.java +++ b/src/main/java/org/cloud/sonic/agent/tests/handlers/AndroidStepHandler.java @@ -2199,6 +2199,55 @@ public void switchTouchMode(HandleContext handleContext, String mode) { AndroidTouchHandler.switchTouchMode(iDevice, AndroidTouchHandler.TouchMode.valueOf(mode)); } + /** + * >2.5.0版本,增强型的文本断言能力,支持指定断言的方式 + * + * @param handleContext HandleContext + * @param des 元素名 + * @param selector 元素定位方式 + * @param pathValue 定位方式值 + * @param operation 断言类型(equal,notEqual,contain,notContain) + * @param expect 期望值 + * @param elementType 元素类型(原生,web,poco) + */ + public void getElementTextAndAssertWithOperation(HandleContext handleContext, String des, String selector, + String pathValue, String operation, String expect, int elementType) { + try { + String realValue = switch (elementType) { + case ANDROID_ELEMENT_TYPE -> getText(handleContext, des, selector, pathValue); + case WEB_ELEMENT_TYPE -> getWebViewText(handleContext, des, selector, pathValue); + case POCO_ELEMENT_TYPE -> getPocoText(handleContext, des, selector, pathValue); + default -> throw new SonicRespException("未支持的元素类型" + elementType + ",无法进行文本断言"); + }; + if (handleContext.getE() != null) { + return; + } + handleContext.setStepDes("断言" + des + "文本"); + try { + expect = TextHandler.replaceTrans(expect, globalParams); + AssertUtil assertUtil = new AssertUtil(); + StringBuilder sbLog = new StringBuilder("真实值:"); + sbLog.append(realValue); + sbLog.append(",期望 "); + sbLog.append(assertUtil.getAssertDesc(operation)); + sbLog.append(" "); + sbLog.append(expect); + handleContext.setDetail(sbLog.toString()); + switch (operation) { + case "equal" -> assertEquals(realValue, expect); + case "notEqual" -> assertNotEquals(realValue, expect); + case "contain" -> assertTrue(realValue.contains(expect)); + case "notContain" -> assertFalse(realValue.contains(expect)); + default -> throw new SonicRespException("未支持的文本断言操作类型" + operation + ",无法进行文本断言"); + } + } catch (AssertionError e) { + handleContext.setE(e); + } + } catch (Exception e) { + handleContext.setE(e); + } + } + public void runStep(JSONObject stepJSON, HandleContext handleContext) throws Throwable { JSONObject step = stepJSON.getJSONObject("step"); // 兼容childSteps @@ -2376,6 +2425,25 @@ public void runStep(JSONObject stepJSON, HandleContext handleContext) throws Thr case "getPocoText" -> getPocoTextAndAssert(handleContext, eleList.getJSONObject(0).getString("eleName"), eleList.getJSONObject(0).getString("eleType") , eleList.getJSONObject(0).getString("eleValue"), step.getString("content")); + // > 2.5版本的文本断言语法,支持指定断言的方式 + case "assertText" -> getElementTextAndAssertWithOperation(handleContext, + eleList.getJSONObject(0).getString("eleName"), + eleList.getJSONObject(0).getString("eleType"), + eleList.getJSONObject(0).getString("eleValue"), + step.getString("content"), step.getString("text"), + ANDROID_ELEMENT_TYPE); + case "assertWebViewText" -> getElementTextAndAssertWithOperation(handleContext, + eleList.getJSONObject(0).getString("eleName"), + eleList.getJSONObject(0).getString("eleType"), + eleList.getJSONObject(0).getString("eleValue"), + step.getString("content"), step.getString("text"), + WEB_ELEMENT_TYPE); + case "assertPocoText" -> getElementTextAndAssertWithOperation(handleContext, + eleList.getJSONObject(0).getString("eleName"), + eleList.getJSONObject(0).getString("eleType"), + eleList.getJSONObject(0).getString("eleValue"), + step.getString("content"), step.getString("text"), + POCO_ELEMENT_TYPE); } switchType(step, handleContext); } diff --git a/src/main/java/org/cloud/sonic/agent/tests/handlers/AssertUtil.java b/src/main/java/org/cloud/sonic/agent/tests/handlers/AssertUtil.java index eb5e6799..ed55741e 100755 --- a/src/main/java/org/cloud/sonic/agent/tests/handlers/AssertUtil.java +++ b/src/main/java/org/cloud/sonic/agent/tests/handlers/AssertUtil.java @@ -54,4 +54,20 @@ public boolean assertElementNum(String operation, int expectedCount, List return isSuccess; } + public String getAssertDesc(String originOpe) { + switch (originOpe) { + case "equal" -> { + return "等于"; + } + case "notEqual" -> { + return "不等于"; + } + case "contain" -> { + return "包含"; + } + default -> { + return "不包含"; + } + } + } } From 172faf4aeef0d113dfe9b1d7bb657b38256c463f Mon Sep 17 00:00:00 2001 From: caofengbin <1050430934@qq.com> Date: Mon, 22 May 2023 12:23:29 +0800 Subject: [PATCH 3/5] =?UTF-8?q?iOS=E7=AB=AF=E7=9A=84=E5=8E=9F=E7=94=9F?= =?UTF-8?q?=EF=BC=8CPOCO=E7=B1=BB=E5=9E=8B=EF=BC=8C=E5=A2=9E=E5=BC=BA?= =?UTF-8?q?=E6=96=87=E6=9C=AC=E6=96=AD=E8=A8=80=E7=9A=84=E8=83=BD=E5=8A=9B?= =?UTF-8?q?=EF=BC=8Cagent=E9=80=BB=E8=BE=91=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../agent/tests/handlers/IOSStepHandler.java | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/src/main/java/org/cloud/sonic/agent/tests/handlers/IOSStepHandler.java b/src/main/java/org/cloud/sonic/agent/tests/handlers/IOSStepHandler.java index 17b29d16..52e12d01 100755 --- a/src/main/java/org/cloud/sonic/agent/tests/handlers/IOSStepHandler.java +++ b/src/main/java/org/cloud/sonic/agent/tests/handlers/IOSStepHandler.java @@ -1480,6 +1480,53 @@ public void iteratorIOSElement(HandleContext handleContext, String des, String s } } + /** + * >2.5.0版本,增强型的文本断言能力,支持指定断言的方式 + * + * @param handleContext HandleContext + * @param des 元素名 + * @param selector 元素定位方式 + * @param pathValue 定位方式值 + * @param operation 断言类型(equal,notEqual,contain,notContain) + * @param expect 期望值 + * @param elementType 元素类型(原生,web,poco) + */ + public void getElementTextAndAssertWithOperation(HandleContext handleContext, String des, String selector, + String pathValue, String operation, String expect, int elementType) { + try { + String realValue = switch (elementType) { + case IOS_ELEMENT_TYPE -> getText(handleContext, des, selector, pathValue); + case POCO_ELEMENT_TYPE -> getPocoText(handleContext, des, selector, pathValue); + default -> throw new SonicRespException("未支持的元素类型" + elementType + ",无法进行文本断言"); + }; + if (handleContext.getE() != null) { + return; + } + handleContext.setStepDes("断言" + des + "文本"); + try { + expect = TextHandler.replaceTrans(expect, globalParams); + AssertUtil assertUtil = new AssertUtil(); + StringBuilder sbLog = new StringBuilder("真实值:"); + sbLog.append(realValue); + sbLog.append(",期望 "); + sbLog.append(assertUtil.getAssertDesc(operation)); + sbLog.append(" "); + sbLog.append(expect); + handleContext.setDetail(sbLog.toString()); + switch (operation) { + case "equal" -> assertEquals(realValue, expect); + case "notEqual" -> assertNotEquals(realValue, expect); + case "contain" -> assertTrue(realValue.contains(expect)); + case "notContain" -> assertFalse(realValue.contains(expect)); + default -> throw new SonicRespException("未支持的文本断言操作类型" + operation + ",无法进行文本断言"); + } + } catch (AssertionError e) { + handleContext.setE(e); + } + } catch (Exception e) { + handleContext.setE(e); + } + } public void runStep(JSONObject stepJSON, HandleContext handleContext) throws Throwable { JSONObject step = stepJSON.getJSONObject("step"); @@ -1609,6 +1656,19 @@ public void runStep(JSONObject stepJSON, HandleContext handleContext) throws Thr case "getPocoText" -> getPocoTextAndAssert(handleContext, eleList.getJSONObject(0).getString("eleName"), eleList.getJSONObject(0).getString("eleType") , eleList.getJSONObject(0).getString("eleValue"), step.getString("content")); + // > 2.5版本的文本断言语法,支持指定断言的方式 + case "assertText" -> getElementTextAndAssertWithOperation(handleContext, + eleList.getJSONObject(0).getString("eleName"), + eleList.getJSONObject(0).getString("eleType"), + eleList.getJSONObject(0).getString("eleValue"), + step.getString("content"), step.getString("text"), + IOS_ELEMENT_TYPE); + case "assertPocoText" -> getElementTextAndAssertWithOperation(handleContext, + eleList.getJSONObject(0).getString("eleName"), + eleList.getJSONObject(0).getString("eleType"), + eleList.getJSONObject(0).getString("eleValue"), + step.getString("content"), step.getString("text"), + POCO_ELEMENT_TYPE); } switchType(step, handleContext); } From ae609975581fef24602eb06b54b49c6972f08af6 Mon Sep 17 00:00:00 2001 From: caofengbin <1050430934@qq.com> Date: Mon, 22 May 2023 16:20:32 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E6=96=87=E6=9C=AC=E6=96=AD=E8=A8=80?= =?UTF-8?q?=EF=BC=8C=E6=96=AD=E8=A8=80=E6=96=B9=E5=BC=8F=E7=9A=84=E7=BC=BA?= =?UTF-8?q?=E7=9C=81=E7=B1=BB=E5=9E=8B=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/cloud/sonic/agent/tests/handlers/AssertUtil.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/cloud/sonic/agent/tests/handlers/AssertUtil.java b/src/main/java/org/cloud/sonic/agent/tests/handlers/AssertUtil.java index ed55741e..604a5f1a 100755 --- a/src/main/java/org/cloud/sonic/agent/tests/handlers/AssertUtil.java +++ b/src/main/java/org/cloud/sonic/agent/tests/handlers/AssertUtil.java @@ -65,9 +65,12 @@ public String getAssertDesc(String originOpe) { case "contain" -> { return "包含"; } - default -> { + case "notContain" -> { return "不包含"; } + default -> { + return "未知类型"; + } } } } From bf4569f6185f9e770a95d732e6119db37c640a52 Mon Sep 17 00:00:00 2001 From: caofengbin <1050430934@qq.com> Date: Mon, 22 May 2023 16:22:57 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E6=96=AD=E8=A8=80=E9=83=A8=E5=88=86?= =?UTF-8?q?=E7=9A=84=E8=BE=93=E5=87=BA=EF=BC=8C=E7=BB=9F=E4=B8=80=E6=8C=89?= =?UTF-8?q?=E7=85=A7=E9=A1=B9=E7=9B=AE=E4=B8=AD=E5=85=B6=E4=BB=96=E5=9C=B0?= =?UTF-8?q?=E6=96=B9=E7=9A=84=E5=9C=BA=E6=99=AF=E8=A7=84=E8=8C=83=EF=BC=8C?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E4=B8=AD=E6=96=87=E9=80=97=E5=8F=B7=E7=9A=84?= =?UTF-8?q?=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sonic/agent/tests/handlers/AndroidStepHandler.java | 6 +++--- .../cloud/sonic/agent/tests/handlers/IOSStepHandler.java | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/cloud/sonic/agent/tests/handlers/AndroidStepHandler.java b/src/main/java/org/cloud/sonic/agent/tests/handlers/AndroidStepHandler.java index ac8c32c1..ea4a439f 100755 --- a/src/main/java/org/cloud/sonic/agent/tests/handlers/AndroidStepHandler.java +++ b/src/main/java/org/cloud/sonic/agent/tests/handlers/AndroidStepHandler.java @@ -873,7 +873,7 @@ public void isExistEleNum(HandleContext handleContext, String des, String select } break; default: - handleContext.setE(new AssertionError("未知的元素类型" + elementType + ",无法断言元素个数")); + handleContext.setE(new AssertionError("未知的元素类型" + elementType + ",无法断言元素个数")); break; } String runDetail = "期望个数:" + operation + " " + expectedCount + ",实际个数:" + " " + (elementList == null ? 0 : elementList.size()); @@ -2217,7 +2217,7 @@ public void getElementTextAndAssertWithOperation(HandleContext handleContext, St case ANDROID_ELEMENT_TYPE -> getText(handleContext, des, selector, pathValue); case WEB_ELEMENT_TYPE -> getWebViewText(handleContext, des, selector, pathValue); case POCO_ELEMENT_TYPE -> getPocoText(handleContext, des, selector, pathValue); - default -> throw new SonicRespException("未支持的元素类型" + elementType + ",无法进行文本断言"); + default -> throw new SonicRespException("未支持的元素类型" + elementType + ",无法进行文本断言"); }; if (handleContext.getE() != null) { return; @@ -2238,7 +2238,7 @@ public void getElementTextAndAssertWithOperation(HandleContext handleContext, St case "notEqual" -> assertNotEquals(realValue, expect); case "contain" -> assertTrue(realValue.contains(expect)); case "notContain" -> assertFalse(realValue.contains(expect)); - default -> throw new SonicRespException("未支持的文本断言操作类型" + operation + ",无法进行文本断言"); + default -> throw new SonicRespException("未支持的文本断言操作类型" + operation + ",无法进行文本断言"); } } catch (AssertionError e) { handleContext.setE(e); diff --git a/src/main/java/org/cloud/sonic/agent/tests/handlers/IOSStepHandler.java b/src/main/java/org/cloud/sonic/agent/tests/handlers/IOSStepHandler.java index 52e12d01..73749afe 100755 --- a/src/main/java/org/cloud/sonic/agent/tests/handlers/IOSStepHandler.java +++ b/src/main/java/org/cloud/sonic/agent/tests/handlers/IOSStepHandler.java @@ -693,7 +693,7 @@ public void isExistEleNum(HandleContext handleContext, String des, String select } break; default: - handleContext.setE(new AssertionError("未知的元素类型" + elementType + ",无法断言元素个数")); + handleContext.setE(new AssertionError("未知的元素类型" + elementType + ",无法断言元素个数")); break; } String runDetail = "期望个数:" + operation + " " + expectedCount + ",实际个数:" + " " + (elementList == null ? 0 : elementList.size()); @@ -1497,7 +1497,7 @@ public void getElementTextAndAssertWithOperation(HandleContext handleContext, St String realValue = switch (elementType) { case IOS_ELEMENT_TYPE -> getText(handleContext, des, selector, pathValue); case POCO_ELEMENT_TYPE -> getPocoText(handleContext, des, selector, pathValue); - default -> throw new SonicRespException("未支持的元素类型" + elementType + ",无法进行文本断言"); + default -> throw new SonicRespException("未支持的元素类型" + elementType + ",无法进行文本断言"); }; if (handleContext.getE() != null) { return; @@ -1518,7 +1518,7 @@ public void getElementTextAndAssertWithOperation(HandleContext handleContext, St case "notEqual" -> assertNotEquals(realValue, expect); case "contain" -> assertTrue(realValue.contains(expect)); case "notContain" -> assertFalse(realValue.contains(expect)); - default -> throw new SonicRespException("未支持的文本断言操作类型" + operation + ",无法进行文本断言"); + default -> throw new SonicRespException("未支持的文本断言操作类型" + operation + ",无法进行文本断言"); } } catch (AssertionError e) { handleContext.setE(e);