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

#216 screenshot alias #217

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ This document follows the conventions laid out in [Keep a CHANGELOG][].
- Click Hold Close
- [#204](https://github.com/GDATASoftwareAG/robotframework-flaui/issues/204) New Keyword
- Invoke Button
- [#206](https://github.com/GDATASoftwareAG/robotframework-flaui/issues/206) New alias property include to fix alias usage.
```
Library FlaUILibrary uia=UIA3 screenshot_on_failure=True alias=FLA AS FLA
```

### Bugfix
- [#202](https://github.com/GDATASoftwareAG/robotframework-flaui/issues/202) Bad Naming changed
- Argument naming in all Click Hold keywords updated from timeout_in_ms to hold_time
- [#211](https://github.com/GDATASoftwareAG/robotframework-flaui/issues/211) Click Close TypoFix
- the default timeout of click close changed from 1ms to 1000ms
- [#206](https://github.com/GDATASoftwareAG/robotframework-flaui/issues/206) Screenshot bugfix for alias usage.
```
Library FlaUILibrary uia=UIA3 screenshot_on_failure=True AS FLA
```

## [Release][3.4.0] [3.4.0][3.3.0-3.4.0] - 2024-08-22

Expand Down
2 changes: 1 addition & 1 deletion atests/ScreenshotAlias.robot
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Library Process
Library String
Library OperatingSystem
Library StringFormat
Library FlaUILibrary uia=${UIA} screenshot_on_failure=True alias=FLA AS FLA
Library FlaUILibrary uia=${UIA} screenshot_on_failure=True AS FLA
Resource util/Common.resource
Resource util/Error.resource
Resource util/XPath.resource
Expand Down
18 changes: 8 additions & 10 deletions src/FlaUILibrary/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,23 +105,20 @@ class KeywordModules(Enum):
def __init__(self, uia='UIA3',
screenshot_on_failure='True',
screenshot_dir=None,
timeout=1000,
alias="FlaUILibrary"):
timeout=1000):
"""
FlaUiLibrary can be imported by following optional arguments:

``uia`` Microsoft UI-Automation framework to use. UIA2 or UIA3
``screenshot_on_failure`` indicator to disable or enable screenshot feature.
``screenshot_dir`` is the directory where screenshots are saved.
``timeout`` maximum amount of waiting time in ms for an element find action. Default value is 1000ms.
``alias`` alias library name from import.

If the given directory does not already exist, it will be created when the first screenshot is taken.
If the argument is not given, the default location for screenshots is the output directory of the Robot run,
i.e. the directory where output and log files are generated.
"""
# FlaUI init
self._alias = alias
self.builtin = BuiltIn()

try:
Expand Down Expand Up @@ -168,10 +165,11 @@ def _start_test(self, name, attrs): # pylint: disable=unused-argument
self.screenshots.set_name(name)
self.screenshots.img_counter = 1

def _end_keyword(self, name, attrs): # pylint: disable=unused-argument
if attrs['status'] == 'FAIL' \
and self.screenshots.is_enabled \
and attrs['libname'] == self._alias:

self.screenshots.execute_action(Screenshot.Action.CAPTURE,
def run_keyword(self, name, args, kwargs=None):
try:
return DynamicCore.run_keyword(self, name, args, kwargs)
except Exception:
if self.screenshots.is_enabled:
self.screenshots.execute_action(Screenshot.Action.CAPTURE,
Screenshot.create_value_container())
raise