Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/by image utils #367

Merged
merged 33 commits into from
Jan 17, 2024
Merged

Feature/by image utils #367

merged 33 commits into from
Jan 17, 2024

Conversation

TobiasAdler
Copy link
Collaborator

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.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@mreiche
Copy link
Collaborator

mreiche commented Nov 13, 2023

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
Copy link
Contributor

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
Copy link
Contributor

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

# Conflicts:
#	driver-ui/src/main/java/eu/tsystems/mms/tic/testframework/utils/JSUtils.java
#	integration-tests/src/test/java/eu/tsystems/mms/tic/testframework/test/guielement/AbstractGuiElementNonFunctionalAssertionTest.java
#	integration-tests/src/test/java/eu/tsystems/mms/tic/testframework/test/reporting/ScreenshotsTest.java
@TobiasAdler
Copy link
Collaborator Author

@martingrossmann All conflicts have been resolved.

@martingrossmann martingrossmann added this to the 2.7 milestone Jan 17, 2024
@martingrossmann martingrossmann merged commit c5a7fc4 into master Jan 17, 2024
@martingrossmann martingrossmann deleted the feature/by-image-utils branch January 17, 2024 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants