Skip to content

Commit f5d192a

Browse files
committed
fix: update return types in property methods to fix errors in assertion methods
Signed-off-by: Daniel Biehl <[email protected]>
1 parent 6ba06cf commit f5d192a

File tree

3 files changed

+24
-8
lines changed

3 files changed

+24
-8
lines changed

src/PlatynUI/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def get_keyword_types(self, name: str) -> Any:
129129

130130
if kw is not None and getattr(kw, PLATYNUI_ASSERTABLE_FIELD, False):
131131
result["assertion_operator"] = Optional[AssertionOperator]
132-
result["assertion_expected"] = result.get("return", Optional[Any])
132+
result["assertion_expected"] = any
133133
result["assertion_message"] = Optional[str]
134134

135135
return result

src/PlatynUI/keywords/properties.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ class PropertyName(Enum):
2121
class Properties:
2222
@keyword
2323
@assertable
24-
def get_property_value(self, descriptor: ElementDescriptor[Properties], name: Union[PropertyName, str]) -> None:
24+
def get_property_value(self, descriptor: ElementDescriptor[Properties], name: Union[PropertyName, str]) -> any:
2525
return descriptor().get_property_value(name)
2626

2727
@keyword
28-
def get_property_names(self, descriptor: ElementDescriptor[Properties]) -> None:
28+
@assertable
29+
def get_property_names(self, descriptor: ElementDescriptor[Properties]) -> list[str]:
2930
return descriptor().get_property_names()

tests/robot/properties.robot

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,23 @@ first
99
# Mouse Click app:Application/Frame//PushButton[@Name="Open File..."]
1010

1111
# Mouse Click app:Application/Frame//PushButton[@Name="Open File..."]
12-
${names} Get Property Names app:Application/Frame//Label[@Name="Welcome to Kate"]
13-
Log To Console ${names}
14-
${a} Get Property Value app:Application/Frame//Label[@Name="Welcome to Kate"] Name
15-
Get Text app:Application/Frame//Label[@Name="Welcome to Kate"] should be Welcome to Kate
16-
Log To Console ${a}
12+
# ${names} Get Property Names app:Application/Frame//Label[@Name="Welcome to Kate"]
13+
# Log To Console ${names}
14+
# ${a} Get Property Value app:Application/Frame//Label[@Name="Welcome to Kate"] Name
15+
# Get Text app:Application/Frame//Label[@Name="Welcome to Kate"] should be Welcome to Kate
16+
# Log To Console ${a}
17+
${names} Get Property Names app:Application[@MainWindowTitle="Rechner"]//Button[@Name="Eins"]
18+
Log Many ${names}
19+
${class_name} Get Property Value
20+
... app:Application[@MainWindowTitle="Rechner"]//Button[@Name="Eins"]
21+
... ClassName
22+
Log class_name: ${class_name}
23+
Get Property Value
24+
... app:Application[@MainWindowTitle="Rechner"]//Button[@AutomationId="num1Button"]
25+
... Name
26+
... equal
27+
... Eins
28+
29+
Get Property Names app:Application[@MainWindowTitle="Rechner"]//Button[@Name="Eins"] contains ClassName
30+
31+
# Get Text app:Application[@MainWindowTitle="Rechner"]//Text[@AutomationId="NormalOutput"]

0 commit comments

Comments
 (0)