Skip to content

ngoanh2n/blur

Repository files navigation

Java Maven GitHub Actions

Table of Contents

Blur

Lib

The main libs are used for blur.

Name Version Repository
Selenium 4.24.0 SeleniumHQ/selenium/java
Appium 9.3.0 appium/java-client
Selenide 7.4.3 selenide/selenide
Allure 2.29.0 allure-framework/allure-java
JUnit5 5.11.0 junit-team/junit5

Module

The modules are built in separated artifacts.

Name Version Repository
Commons 1.6.0 ngoanh2n/commons
CSV Comparator 1.10.0 ngoanh2n/csv-comparator
Image Comparator 1.5.0 ngoanh2n/image-comparator
WebDriverChecker 2.8.0 ngoanh2n/webdriverchecker
WebDriverShooter 1.1.1 ngoanh2n/webdrivershooter

Declaration

  • Case 1: Declare blur as a dependency in build.gradle or pom.xml
  • Case 2: Create a new module inside Skeleton and compile blur in build.gradle of module

Gradle

Add to build.gradle.

implementation("com.github.ngoanh2n:blur:0.2.0")

Maven

Add to pom.xml.

<dependency>
    <groupId>com.github.ngoanh2n</groupId>
    <artifactId>blur</artifactId>
    <version>0.2.0</version>
</dependency>

Skeleton

Refer to Open project and create module.

Usage

WebDriver

You have to use Blur.open(..) for opening the page or app first.

  • com.codeborne.selenide.Selectors
    Define a locator by a locating strategy.

    By by = Selectors.byXpath(..);
    By by = Selectors.withText(..);
    ...
  • com.github.ngoanh2n.blur.Blur.$(..)
    Find element/elements by a locator.

    SelenideElement element = Blur.$(..);
    ElementsCollection elements = Blur.$$(..);
    ...
  • com.codeborne.selenide.Condition
    Define a condition to check element.

    Condition condition = Condition.enabled;
    Condition condition = Condition.exactText(..);
    ...
  • com.codeborne.selenide.SelenideElement
    Interact with element.

    SelenideElement element = element.dragAndDrop(..);
    SelenideElement element = element.shouldBe(condition);
    ...
  • com.codeborne.selenide.CollectionCondition
    Define a collection condition to check elements.

    CollectionCondition condition = CollectionCondition.size(..);
    CollectionCondition condition = CollectionCondition.texts(..);
    ...
  • com.codeborne.selenide.ElementsCollection
    Interact with list of elements.

    ElementsCollection elements = elements.filter(condition);
    ElementsCollection elements = elements.shouldBe(condition);
    ...
  • com.github.ngoanh2n.wdc.WebDriverChecker
    Check WebDriver characteristics and environment.

    boolean result = WebDriverChecker.isIOS(..);
    boolean result = WebDriverChecker.isSafari(..);
    ...
  • com.github.ngoanh2n.wds.WebDriverShooter
    Take screenshot with WebDriver and comparison.

    Screenshot screenshot = WebDriverShooter.page(..);
    Screenshot screenshot = WebDriverShooter.frame(..);
    Screenshot screenshot = WebDriverShooter.element(..);

Comparator

  • com.github.ngoanh2n.csv.CsvComparator
    Compare 2 CSV files.

    CsvComparisonResult result = CsvComparator.compare(expectedCSV, actualCSV);
    CsvComparisonResult result = CsvComparator.compare(expectedCSV, actualCSV, options);
  • com.github.ngoanh2n.img.ImageComparator
    Compare 2 image files.

    ImageComparisonResult result = ImageComparator.compare(expectedImage, actualImage);
    ImageComparisonResult result = ImageComparator.compare(expectedImage, actualImage, options);

Commons

  • com.github.ngoanh2n.Resources
    Find and read Java resources.

    File file = Resources.getFile("file.json");
    String content = Resources.getContent("file.yml");
    InputStream is = Resources.getInputStream("file.png");
  • com.github.ngoanh2n.YamlData
    Read Yaml file to Map, List of Maps, Model, List of Models.

    public class User extends YamlData {}
    ---
    User user = new User().fromResource("user.yml").toModel();
    List<User> users = new User().fromResource("users.yml").toModels();
    ...
  • com.github.ngoanh2n.Property
    Represent a JVM system property.

    Property property = Property.ofString(..);
    Property property = Property.ofBoolean(..);
    ...
  • com.github.ngoanh2n.PropertiesFile
    Read properties file.

    PropertiesFile propertiesFile = new PropertiesFile("file.properties");
    String value = propertiesFile.getProperty("keyName");
  • com.github.ngoanh2n.AllureEnvironment
    Write environment.properties to Allure results directory.

    AllureEnvironment.write(properties);
    AllureEnvironment.write("file1.properties", "file2.properties");
  • com.github.ngoanh2n.EnabledIfProperty
    Signal that the annotated test class or test method is enabled.

    public class MyTest {
        @Test
        @EnabledIfProperty(name = "browser", value = "safari")
        public void test () {}
    }
  • com.github.ngoanh2n.SetProperty
    Set JVM system property for the annotated test class or test method.

    @SetProperty(name = "browser", value = "safari")
    public class MyTest {}
    ---
    public class MyTest {
        @Test
        @SetProperty(name = "browser", value = "safari")
        public void test () {}
    }