Giter VIP home page Giter VIP logo

healenium-example-maven's Introduction

healenium-example-maven

Java + Maven + Junit5 project with healenium usage example

To setup Healenium see the tutorial: https://www.youtube.com/watch?v=Ed5HyfwZhq4

How to start

1.Start Healenium backend from infra folder

cd infra

docker-compose up -d

To download this file into your project use this command:

$ curl https://raw.githubusercontent.com/healenium/healenium-example-maven/master/infra/docker-compose.yml -o docker-compose.yml

Create /db/sql folder on the same level in your project. Add init.sql file into ./db/sql/init.sql folder in your project via command:

$ curl https://raw.githubusercontent.com/healenium/healenium-client/master/example/init.sql -o init.sql

Verify that images healenium/hlm-backend:3.2.5 and postgres:11-alpine and healenium/hlm-selector-imitator:1.1 are up and running

2. Project structure

|__infra
    |__db/sql
        |__init.sql
    |__docker-compose.yml
|__src/main/java/
|__src/test/java/
|__pom.xml

3.Run test in terminal with maven

In BaseTest.java class select necessary driver: LOCAL, PROXY or REMOTE and browser to run: chrome, firefox or edge.

driver = new DriverContext(DriverType.LOCAL).getDriver(BrowserType.CHROME);

LOCAL - used for local run. It's been set by default in BaseTest.java class. For this driver should be used docker-compose file from test example.

PROXY - used if you're running tests using healenium-proxy. For this driver you need to set docker-compose containers as in example by link: https://github.com/healenium/healenium-example-dotnet/blob/master/infra/docker-compose.yml

REMOTE - used if you-re running test on remote machine. Do not forget to provide necessary host. In this test example it's been used remote machine with Selenoid.

In BaseTest.java class select necessary framework: SELENIUM or SELENIDE.

pages = new FrameworkContext(FrameworkType.SELENIDE, driver).setFramework();

If you want to execute all tests, please use the command: mvn clean test

4.After test execution you should see generated report link in command line logs

img.png

Report contains only healed locators with old-new values and a button that tells if healing was successful for further algorithm corrections

img_1.png

5. Screenshots

Also you could take a screenshots for your com.epam.healenium.tests like it implements here: BaseTest.screenshot

  public byte[] screenshot() {
      return ((TakesScreenshot) driver.getDelegate()).getScreenshotAs(OutputType.BYTES);
  }

6. @DisableHealing annotation

If don't want to use Healenium in some methods just use @DisableHealing annotation.

The example of usage you can find here: MainPageWithFindBy.checkLocatorTestButtonDontHealing

img_2.png

7. Plugin Healenium for Intellij IDE

For updating broken locators you could use Plugin "Healenium" for Intellij IDE (https://plugins.jetbrains.com/plugin/14178-healenium).

With this plugin you can update your locators:

  • on class level

update_on_class_level

  • or on variable level

update_on_class_level

element_update

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.