diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 1462c39..c60c620 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -18,8 +18,8 @@ jobs: java-version: '8' distribution: 'temurin' cache: maven - - run: sed -i "s/SONIC_REMOTE_TEST_URL/${{ secrets.REMOTE_TEST_URL }}/g" src/test/java/org/cloud/sonic/core/ios/IOSDriverTest.java - - run: sed -i "s/SONIC_REMOTE_TEST_URL/${{ secrets.REMOTE_TEST_URL }}/g" src/test/java/org/cloud/sonic/core/ios/service/WdaClientTest.java + - run: sed -i "s/SONIC_REMOTE_TEST_URL/${{ secrets.REMOTE_TEST_URL }}/g" src/test/java/org/cloud/sonic/driver/ios/IOSDriverTest.java + - run: sed -i "s/SONIC_REMOTE_TEST_URL/${{ secrets.REMOTE_TEST_URL }}/g" src/test/java/org/cloud/sonic/driver/ios/service/WdaClientTest.java - name: Validate and Compile with Maven run: mvn cobertura:cobertura - name: upload codecov diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml index d924852..bef4455 100644 --- a/.github/workflows/doc.yml +++ b/.github/workflows/doc.yml @@ -1,8 +1,9 @@ name: update readme doc on: - release: - types: [published] + push: + tags: + - "*.*.*" jobs: release: diff --git a/README.md b/README.md index 8ed13f6..e199735 100644 --- a/README.md +++ b/README.md @@ -58,14 +58,14 @@ sonic-driver-core can be separated from appium and interact directly with webdri io.github.soniccloudorg sonic-driver-core - 1.0.16 + 1.0.17 ``` #### Gradle ``` -implementation 'io.github.soniccloudorg:sonic-driver-core:1.0.16' +implementation 'io.github.soniccloudorg:sonic-driver-core:1.0.17' ``` ### Code diff --git a/README_CN.md b/README_CN.md index b2ca6f9..e57c117 100644 --- a/README_CN.md +++ b/README_CN.md @@ -53,12 +53,12 @@ sonic-driver-core可以脱离Appium,直接与WebDriverAgent或UIautomator2交 io.github.soniccloudorg sonic-driver-core - 1.0.16 + 1.0.17 ``` #### Gradle ``` -implementation 'io.github.soniccloudorg:sonic-driver-core:1.0.16' +implementation 'io.github.soniccloudorg:sonic-driver-core:1.0.17' ``` ### 代码 diff --git a/src/main/java/org/cloud/sonic/driver/ios/IOSDriver.java b/src/main/java/org/cloud/sonic/driver/ios/IOSDriver.java index f235af5..249fc29 100644 --- a/src/main/java/org/cloud/sonic/driver/ios/IOSDriver.java +++ b/src/main/java/org/cloud/sonic/driver/ios/IOSDriver.java @@ -382,6 +382,16 @@ public void appAuthReset(AuthResource authResource) throws SonicRespException { appAuthReset(authResource.getResource()); } + /** + * set default FindElement retry time and interval. + * + * @param retry + * @param interval + */ + public void setDefaultFindElementInterval(Integer retry, Integer interval) { + wdaClient.setDefaultFindElementInterval(retry, interval); + } + /** * find element in device. * diff --git a/src/main/java/org/cloud/sonic/driver/ios/service/WdaClient.java b/src/main/java/org/cloud/sonic/driver/ios/service/WdaClient.java index 8b8601a..d95c4c1 100644 --- a/src/main/java/org/cloud/sonic/driver/ios/service/WdaClient.java +++ b/src/main/java/org/cloud/sonic/driver/ios/service/WdaClient.java @@ -97,6 +97,8 @@ public interface WdaClient { void appAuthReset(int resource) throws SonicRespException; //element handler. + void setDefaultFindElementInterval(Integer retry, Integer interval); + WebElement findElement(String selector, String value, Integer retry, Integer interval) throws SonicRespException; List findElementList(String selector, String value, Integer retry, Integer interval) throws SonicRespException; diff --git a/src/main/java/org/cloud/sonic/driver/ios/service/impl/WdaClientImpl.java b/src/main/java/org/cloud/sonic/driver/ios/service/impl/WdaClientImpl.java index 44a1313..85d3f4c 100644 --- a/src/main/java/org/cloud/sonic/driver/ios/service/impl/WdaClientImpl.java +++ b/src/main/java/org/cloud/sonic/driver/ios/service/impl/WdaClientImpl.java @@ -380,6 +380,16 @@ public void appAuthReset(int resource) throws SonicRespException { } } + @Override + public void setDefaultFindElementInterval(Integer retry, Integer interval) { + if (retry != null) { + FIND_ELEMENT_RETRY = retry; + } + if (interval != null) { + FIND_ELEMENT_INTERVAL = interval; + } + } + @Override public WebElement findElement(String selector, String value, Integer retry, Integer interval) throws SonicRespException { WebElement webElement = null; diff --git a/src/test/java/org/cloud/sonic/driver/ios/IOSDriverTest.java b/src/test/java/org/cloud/sonic/driver/ios/IOSDriverTest.java index 204e520..588d7ea 100644 --- a/src/test/java/org/cloud/sonic/driver/ios/IOSDriverTest.java +++ b/src/test/java/org/cloud/sonic/driver/ios/IOSDriverTest.java @@ -258,6 +258,8 @@ public void testFindElement() throws SonicRespException, InterruptedException, I imageOutput.close(); output.delete(); iosDriver.findElement(IOSSelector.ACCESSIBILITY_ID, "取消").click(); + iosDriver.setDefaultFindElementInterval(null, 3000); + iosDriver.setDefaultFindElementInterval(5, null); iosDriver.pressButton(SystemButton.HOME); }