From 873d8f6dcd2cfb15387ea2870b08c2706d5703fd Mon Sep 17 00:00:00 2001 From: Martin Schneider Date: Sat, 26 Sep 2020 12:26:33 +0800 Subject: [PATCH] Release 1.9-RC4 --- justtestlah-awsdevicefarm/pom.xml | 2 +- justtestlah-browserstack/pom.xml | 2 +- justtestlah-core/pom.xml | 2 +- .../java/qa/justtestlah/base/BasePage.java | 7 ++++- .../java/qa/justtestlah/utils/ImageUtils.java | 4 ++- justtestlah-demos/demos/google.properties | 2 +- justtestlah-demos/pom.xml | 2 +- justtestlah-galen/pom.xml | 2 +- justtestlah-mobile-tools/pom.xml | 2 +- justtestlah-quickstart/pom.xml | 2 +- .../META-INF/maven/archetype-metadata.xml | 2 +- .../src/test/resources/justtestlah.properties | 3 ++ justtestlah-visual/pom.xml | 2 +- .../main/java/qa/justtestlah/visual/OCR.java | 8 +++++ pom.xml | 10 +++---- src/site/markdown/index.md | 30 +++++++++---------- 16 files changed, 50 insertions(+), 32 deletions(-) diff --git a/justtestlah-awsdevicefarm/pom.xml b/justtestlah-awsdevicefarm/pom.xml index ed3c0829..02e30f83 100644 --- a/justtestlah-awsdevicefarm/pom.xml +++ b/justtestlah-awsdevicefarm/pom.xml @@ -9,7 +9,7 @@ qa.justtestlah justtestlah-parent - 1.9-RC3 + 1.9-RC4 diff --git a/justtestlah-browserstack/pom.xml b/justtestlah-browserstack/pom.xml index 54595bf1..456458c5 100644 --- a/justtestlah-browserstack/pom.xml +++ b/justtestlah-browserstack/pom.xml @@ -9,7 +9,7 @@ qa.justtestlah justtestlah-parent - 1.9-RC3 + 1.9-RC4 diff --git a/justtestlah-core/pom.xml b/justtestlah-core/pom.xml index ec2f16ee..26f8cb4b 100644 --- a/justtestlah-core/pom.xml +++ b/justtestlah-core/pom.xml @@ -9,7 +9,7 @@ qa.justtestlah justtestlah-parent - 1.9-RC3 + 1.9-RC4 diff --git a/justtestlah-core/src/main/java/qa/justtestlah/base/BasePage.java b/justtestlah-core/src/main/java/qa/justtestlah/base/BasePage.java index d2edf993..ab7aca97 100644 --- a/justtestlah-core/src/main/java/qa/justtestlah/base/BasePage.java +++ b/justtestlah-core/src/main/java/qa/justtestlah/base/BasePage.java @@ -29,7 +29,6 @@ import qa.justtestlah.log.TestLogWriter; import qa.justtestlah.stubs.AppiumTemplateMatcher; import qa.justtestlah.stubs.Galen; -import qa.justtestlah.stubs.Match; import qa.justtestlah.stubs.OCR; import qa.justtestlah.stubs.TemplateMatcher; import qa.justtestlah.utils.ImageUtils; @@ -133,6 +132,12 @@ public WebElement findImage(String imageName, double threshold) { ((AppiumTemplateMatcher) templateMatcher).setDriver(WebDriverRunner.getWebDriver()); } String path = ImageUtils.getFullPath(imageName); + if (path == null) { + throw new RuntimeException( + String.format( + "Template image %s not found on classpath. Please make sure it is located in the images folder", + imageName)); + } return new ImageWebElement( driver, templateMatcher.match(screenshotFile.getAbsolutePath(), path, threshold).getRect(), diff --git a/justtestlah-core/src/main/java/qa/justtestlah/utils/ImageUtils.java b/justtestlah-core/src/main/java/qa/justtestlah/utils/ImageUtils.java index b7e6a50e..e0df36d3 100644 --- a/justtestlah-core/src/main/java/qa/justtestlah/utils/ImageUtils.java +++ b/justtestlah-core/src/main/java/qa/justtestlah/utils/ImageUtils.java @@ -1,6 +1,7 @@ package qa.justtestlah.utils; import java.io.IOException; +import java.net.URL; import java.nio.file.Files; import java.nio.file.Paths; import java.util.Base64; @@ -33,7 +34,8 @@ public static String getImageAsBase64String(String imageName) { * @return the fully-qualified path to the specified image */ public static String getFullPath(String imageName) { - return ImageUtils.class.getClassLoader().getResource(IMAGE_FOLDER + "/" + imageName).getFile(); + URL url = ImageUtils.class.getClassLoader().getResource(IMAGE_FOLDER + "/" + imageName); + return (url != null) ? url.getFile() : null; } /** diff --git a/justtestlah-demos/demos/google.properties b/justtestlah-demos/demos/google.properties index fe8c54f2..452d6991 100644 --- a/justtestlah-demos/demos/google.properties +++ b/justtestlah-demos/demos/google.properties @@ -13,7 +13,7 @@ testdata.enabled=true testdata.filter=google # Mac OS #tesseract.datapath=/usr/local/Cellar/tesseract/4.1.1/share/tessdata -tesseract.datapath=/usr/share/tesseract-ocr/4.00/tessdata +#tesseract.datapath=/usr/share/tesseract-ocr/4.00/tessdata opencv.mode=client galen.enabled=true diff --git a/justtestlah-demos/pom.xml b/justtestlah-demos/pom.xml index 41ece452..a492d483 100644 --- a/justtestlah-demos/pom.xml +++ b/justtestlah-demos/pom.xml @@ -9,7 +9,7 @@ qa.justtestlah justtestlah-parent - 1.9-RC3 + 1.9-RC4 diff --git a/justtestlah-galen/pom.xml b/justtestlah-galen/pom.xml index 69ea4cb6..5dd17ea3 100644 --- a/justtestlah-galen/pom.xml +++ b/justtestlah-galen/pom.xml @@ -9,7 +9,7 @@ qa.justtestlah justtestlah-parent - 1.9-RC3 + 1.9-RC4 diff --git a/justtestlah-mobile-tools/pom.xml b/justtestlah-mobile-tools/pom.xml index 5b3a9093..fab51703 100644 --- a/justtestlah-mobile-tools/pom.xml +++ b/justtestlah-mobile-tools/pom.xml @@ -9,7 +9,7 @@ qa.justtestlah justtestlah-parent - 1.9-RC3 + 1.9-RC4 diff --git a/justtestlah-quickstart/pom.xml b/justtestlah-quickstart/pom.xml index fadb3c1c..e2142339 100644 --- a/justtestlah-quickstart/pom.xml +++ b/justtestlah-quickstart/pom.xml @@ -5,7 +5,7 @@ qa.justtestlah justtestlah-parent - 1.9-RC3 + 1.9-RC4 justtestlah-quickstart JustTestLah! Quickstart diff --git a/justtestlah-quickstart/src/main/resources/META-INF/maven/archetype-metadata.xml b/justtestlah-quickstart/src/main/resources/META-INF/maven/archetype-metadata.xml index f3c76b4e..d5a966ba 100644 --- a/justtestlah-quickstart/src/main/resources/META-INF/maven/archetype-metadata.xml +++ b/justtestlah-quickstart/src/main/resources/META-INF/maven/archetype-metadata.xml @@ -25,7 +25,7 @@ - 1.9-RC2 + 1.9-RC4 false diff --git a/justtestlah-quickstart/src/main/resources/archetype-resources/src/test/resources/justtestlah.properties b/justtestlah-quickstart/src/main/resources/archetype-resources/src/test/resources/justtestlah.properties index 874ab6c1..9396ca45 100644 --- a/justtestlah-quickstart/src/main/resources/archetype-resources/src/test/resources/justtestlah.properties +++ b/justtestlah-quickstart/src/main/resources/archetype-resources/src/test/resources/justtestlah.properties @@ -10,6 +10,9 @@ testdata.enabled=true features.directory=src/test/resources/features cucumber.report.directory=target/report/cucumber cloudprovider=local +#if (${galen} == 'true' || ${galen} == 'yes' || ${galen} == 'y') +galen.enabled=true +#end # WEB settings web.baseUrl=https://www.google.com diff --git a/justtestlah-visual/pom.xml b/justtestlah-visual/pom.xml index d07f6123..64752589 100644 --- a/justtestlah-visual/pom.xml +++ b/justtestlah-visual/pom.xml @@ -9,7 +9,7 @@ qa.justtestlah justtestlah-parent - 1.9-RC3 + 1.9-RC4 diff --git a/justtestlah-visual/src/main/java/qa/justtestlah/visual/OCR.java b/justtestlah-visual/src/main/java/qa/justtestlah/visual/OCR.java index 983151d2..98dba017 100644 --- a/justtestlah-visual/src/main/java/qa/justtestlah/visual/OCR.java +++ b/justtestlah-visual/src/main/java/qa/justtestlah/visual/OCR.java @@ -10,6 +10,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Primary; import org.springframework.stereotype.Component; @@ -27,6 +28,9 @@ public class OCR implements qa.justtestlah.stubs.OCR { private TakesScreenshot driver; private Tesseract ocr; + @Value("${tesseract.datapath:}") + private String dataPath; + @Autowired public OCR(Tesseract ocr) { this.ocr = ocr; @@ -47,6 +51,10 @@ public String getText() { } private String getText(File file) { + if (dataPath.length() == 0) { + throw new RuntimeException( + "tesseract.datapath not set. Please set this property in justtestlah.properties."); + } LOG.info("Peforming OCR on file {}", file); try { String text = ocr.doOCR(file).trim(); diff --git a/pom.xml b/pom.xml index a0b569b0..70d1603b 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 qa.justtestlah justtestlah-parent - 1.9-RC3 + 1.9-RC4 JustTestLah! pom JustTestLah! is a JAVA test framework targeting projects that support multiple platforms, in particular Web, Android and iOS. It follows a BDD approach and allows testing against all platforms using the same feature files. JustTestLah's main aim is to make the configuration and the actual test code as easy as possible. @@ -100,12 +100,12 @@ 2.0.0-alpha1 1.3.0-alpha4 3.17.2 - 3.5.11 + 3.5.13 1.27 1.23 2.6.10 - 2.6.2 - 1.10.14 + 2.6.3 + 1.10.16 2.8.6 2.30.1 4.5.12 @@ -142,7 +142,7 @@ 4.8.90 2.10 0.1.55 - 1.11.864 + 1.11.870 3.0.0-M2 2.11.2 29.0-jre diff --git a/src/site/markdown/index.md b/src/site/markdown/index.md index 2b899ce4..07f801f1 100644 --- a/src/site/markdown/index.md +++ b/src/site/markdown/index.md @@ -142,7 +142,7 @@ Add the following to your `pom.xml`: qa.justtestlah justtestlah-core - 1.9-RC3 + 1.9-RC4 ``` @@ -150,11 +150,11 @@ Add the following to your `pom.xml`: Add the following to your `build.gradle`: ```yaml -compile group: 'qa.justtestlah', name: 'justtestlah-core', version: '1.9-RC3' +compile group: 'qa.justtestlah', name: 'justtestlah-core', version: '1.9-RC4' ``` ### Option 4: Manual setup -Add `justtestlah-core-1.9-RC3.jar` to your classpath. +Add `justtestlah-core-1.9-RC4.jar` to your classpath. ## Page objects, steps and feature files There are three main ingredients for tests in JustTestLah!: @@ -326,7 +326,7 @@ browserstack.appiumLogs=true browserstack.video=true browserstack.geoLocation=SG browserstack.timezone=SG -browserstack.appium_version=1.9-RC3.0 +browserstack.appium_version=1.9-RC4.0 browserstack.acceptSslCerts=true # AWS DEVICEFARM settings (requires `cloudprovider=aws` and `justtestlah-awsdevicefarm` on the classpath) @@ -556,16 +556,16 @@ browserstack.geoLocation=SG browserstack.networkProfile= browserstack.customNetwork= browserstack.timezone=SG -browserstack.appium_version=1.9-RC3.0 +browserstack.appium_version=1.9-RC4.0 ``` -Make sure `justtestlah-browserstack-1.9-RC3.jar` is on your classpath: +Make sure `justtestlah-browserstack-1.9-RC4.jar` is on your classpath: ```xml qa.justtestlah justtestlah-browserstack - 1.9-RC3 + 1.9-RC4 ``` @@ -622,13 +622,13 @@ aws.jobTimeOut= aws.skipAppResign= ``` -Make sure `justtestlah-awsdevicefarm-1.9-RC3.jar` is on your classpath: +Make sure `justtestlah-awsdevicefarm-1.9-RC4.jar` is on your classpath: ```xml qa.justtestlah justtestlah-awsdevicefarm - 1.9-RC3 + 1.9-RC4 ``` @@ -637,13 +637,13 @@ You can refer to [this article](https://medium.com/@mart.schneider/mobile-test-a Please note that AWS Devicefarm is a paid service. ## Visual and layout testing -Make sure `justtestlah-visual-1.9-RC3.jar` is on your classpath: +Make sure `justtestlah-visual-1.9-RC4.jar` is on your classpath: ```xml qa.justtestlah justtestlah-visual - 1.9-RC3 + 1.9-RC4 ``` @@ -674,13 +674,13 @@ There are two modes to use template matching which can be configured in `justtes JustTestLah! integrates [Tesseract](https://github.com/tesseract-ocr/tesseract) to perform [Optical character recognition](https://en.wikipedia.org/wiki/Optical_character_recognition). -This requires `justtestlah-visual-1.9-RC3.jar` on the classpath: +This requires `justtestlah-visual-1.9-RC4.jar` on the classpath: ```xml qa.justtestlah justtestlah-visual - 1.9-RC3 + 1.9-RC4 ``` @@ -730,13 +730,13 @@ assertThat(googlePage.getLogoText()).isEqualTo("Google"); ### Galen -Make sure `justtestlah-galen-1.9-RC3.jar` is on your classpath: +Make sure `justtestlah-galen-1.9-RC4.jar` is on your classpath: ```xml qa.justtestlah justtestlah-galen - 1.9-RC3 + 1.9-RC4 ```