telekom / testerra

Testerra is an integrated framework for automating tests for (web) applications.
https://docs.testerra.io/
Apache License 2.0
27 stars 15 forks source link

Feature/by image utils #367

Closed TobiasAdler closed 9 months ago

TobiasAdler commented 12 months ago

Description

By-image-utils & helper methods

In DesktopWebDriverUtils, the methods clickByImage and mouseOverByImage were added to provide a new way to hover over and click an element, that may not be possible to find in the usual ways (for example the test method elements in the threads view of testerra report, which are inside of a canvas element and can not be accessed by selenium).

These methods are build with the sikuli-api, which provides the possibility to search for images in the current viewport of the web driver. Since only the current viewport is analysed, a scroll-by-value-functionality and helper methods for the browser were added in JSUtils and used to ensure the image is searched in the complete webpage.

Unit- & report-ng-tests

The report-ng-tests for the threads view were updated to use the mouseOverByImage-method since due to the canvas element of echarts it was not possible to access the specific test methods in the usual ways. Unit tests for the new utilities were added as well.

Type of change

Please delete options that are not relevant.

Checklist:

mreiche commented 12 months ago

I would rather like to implement an By.image('path/to/referenceImage.png') than introducing utils for that.

UiElement uiElement = find(By.image('...'));
uiElement.click();
martingrossmann commented 12 months ago

A kind of By.image is still part of Testerra. It was taken over from the former framework but was never realy updated and documeneted. Maybe it can be removed. Sikuli was used to find the given image in the viewport. With the help of the coordinates at this point the current existing Selenium Webelement was tried to identify. This was used to create a GuiElement.

But this usecase does not work at canvas graphics where you only have a big canvas Webelement. This solution works without any webelement and should be a little helper (e.g. for canvas elements), not more.

From my point a UiElement always based on a Selenium Webelement to support all features like actions, asserts, ...

martingrossmann commented 9 months ago

@TobiasAdler I would approve this PR. Please resolve the conflicts. Thanks!

TobiasAdler commented 9 months ago

@martingrossmann All conflicts have been resolved.