robotframework-browserpom 0.5.0__tar.gz → 0.5.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {robotframework_browserpom-0.5.0 → robotframework_browserpom-0.5.2}/BrowserPOM/__init__.py +23 -4
- {robotframework_browserpom-0.5.0 → robotframework_browserpom-0.5.2}/BrowserPOM/decorator.py +4 -0
- {robotframework_browserpom-0.5.0 → robotframework_browserpom-0.5.2}/BrowserPOM/pageobject.py +2 -1
- {robotframework_browserpom-0.5.0 → robotframework_browserpom-0.5.2}/BrowserPOM/uiobject.py +2 -2
- {robotframework_browserpom-0.5.0 → robotframework_browserpom-0.5.2}/PKG-INFO +1 -1
- {robotframework_browserpom-0.5.0 → robotframework_browserpom-0.5.2}/pyproject.toml +1 -2
- {robotframework_browserpom-0.5.0 → robotframework_browserpom-0.5.2}/.gitignore +0 -0
- {robotframework_browserpom-0.5.0 → robotframework_browserpom-0.5.2}/BrowserPOM/addons/playwright_page_method.js +0 -0
- {robotframework_browserpom-0.5.0 → robotframework_browserpom-0.5.2}/BrowserPOM/pom_stubs.py +0 -0
- {robotframework_browserpom-0.5.0 → robotframework_browserpom-0.5.2}/LICENSE +0 -0
- {robotframework_browserpom-0.5.0 → robotframework_browserpom-0.5.2}/readme.md +0 -0
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"""Browser Page Object Model (POM) UIObject class."""
|
|
2
2
|
|
|
3
3
|
import contextlib
|
|
4
|
+
import importlib
|
|
4
5
|
from pathlib import Path
|
|
6
|
+
from typing import TYPE_CHECKING, cast
|
|
5
7
|
|
|
6
8
|
from Browser import Browser
|
|
7
9
|
from Browser.utils import ScreenshotFileTypes, ScreenshotReturnType
|
|
@@ -11,6 +13,9 @@ from robot.libraries.BuiltIn import BuiltIn, RobotNotRunningError
|
|
|
11
13
|
from .pageobject import PageObject
|
|
12
14
|
from .uiobject import UIObject
|
|
13
15
|
|
|
16
|
+
if TYPE_CHECKING:
|
|
17
|
+
from collections.abc import Callable
|
|
18
|
+
|
|
14
19
|
|
|
15
20
|
class BrowserPOM(Browser):
|
|
16
21
|
"""*PageObjectLibrary* is a lightweight library which supports using
|
|
@@ -111,12 +116,26 @@ class BrowserPOM(Browser):
|
|
|
111
116
|
|
|
112
117
|
ROBOT_LIBRARY_SCOPE = "TEST SUITE"
|
|
113
118
|
|
|
114
|
-
def __init__(self) -> None:
|
|
115
|
-
"""Initialize the BrowserPOM library.
|
|
119
|
+
def __init__(self, *args: object, **kwargs: object) -> None:
|
|
120
|
+
"""Initialize the BrowserPOM library with playwright page functionality.
|
|
121
|
+
Optional arguments are passed to the
|
|
122
|
+
[https://robotframework-browser.org/|BrowserLibrary] constructor.
|
|
123
|
+
"""
|
|
116
124
|
addon_path = Path(__file__).parent / "addons" / "playwright_page_method.js"
|
|
117
125
|
with contextlib.suppress(RobotNotRunningError):
|
|
118
126
|
BuiltIn().set_library_search_order("BrowserPOM", "Browser")
|
|
119
|
-
|
|
127
|
+
|
|
128
|
+
jsextensions = kwargs.pop("jsextension", [])
|
|
129
|
+
if isinstance(jsextensions, str):
|
|
130
|
+
jsextensions = [extension.strip() for extension in jsextensions.split(",")]
|
|
131
|
+
elif not isinstance(jsextensions, list):
|
|
132
|
+
jsextensions = [jsextensions]
|
|
133
|
+
if str(addon_path) not in jsextensions:
|
|
134
|
+
jsextensions.insert(0, str(addon_path))
|
|
135
|
+
kwargs["jsextension"] = jsextensions
|
|
136
|
+
|
|
137
|
+
browser_init = cast("Callable[..., None]", super().__init__)
|
|
138
|
+
browser_init(*args, **kwargs)
|
|
120
139
|
|
|
121
140
|
@keyword
|
|
122
141
|
def take_screenshot(self, *args, **kwargs): # noqa:ANN002,ANN003,ANN201
|
|
@@ -125,7 +144,7 @@ class BrowserPOM(Browser):
|
|
|
125
144
|
"""
|
|
126
145
|
path = self._browser_control.take_screenshot(*args, **kwargs)
|
|
127
146
|
try:
|
|
128
|
-
|
|
147
|
+
allure = importlib.import_module("allure")
|
|
129
148
|
|
|
130
149
|
allure.attach.file(
|
|
131
150
|
path,
|
{robotframework_browserpom-0.5.0 → robotframework_browserpom-0.5.2}/BrowserPOM/pageobject.py
RENAMED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"""Browser Page Object Model (POM) UIObject class."""
|
|
2
2
|
|
|
3
3
|
import contextlib
|
|
4
|
+
from typing import cast
|
|
4
5
|
from urllib.parse import urlparse
|
|
5
6
|
|
|
6
7
|
import robot.api.logger
|
|
@@ -39,7 +40,7 @@ class PageObject:
|
|
|
39
40
|
"""Returns the browser instance from robotframework-browser library
|
|
40
41
|
Browser library has to be imported in robot file to reference
|
|
41
42
|
"""
|
|
42
|
-
return BuiltIn().get_library_instance("BrowserPOM")
|
|
43
|
+
return cast("Browser", BuiltIn().get_library_instance("BrowserPOM"))
|
|
43
44
|
|
|
44
45
|
def __str__(self) -> str:
|
|
45
46
|
"""Return a string representation of the page object."""
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from typing import TYPE_CHECKING, Self
|
|
5
|
+
from typing import TYPE_CHECKING, Self, cast
|
|
6
6
|
|
|
7
7
|
from robot.libraries.BuiltIn import BuiltIn
|
|
8
8
|
|
|
@@ -38,7 +38,7 @@ class UIObject:
|
|
|
38
38
|
Browser: An instance of the Browser library.
|
|
39
39
|
|
|
40
40
|
"""
|
|
41
|
-
return BuiltIn().get_library_instance("BrowserPOM")
|
|
41
|
+
return cast("Browser", BuiltIn().get_library_instance("BrowserPOM"))
|
|
42
42
|
|
|
43
43
|
def __getitem__(self, index: int | str) -> Self:
|
|
44
44
|
"""Retrieves an indexed or text-based child UI object.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "robotframework-browserpom"
|
|
3
|
-
version = "0.5.
|
|
3
|
+
version = "0.5.2"
|
|
4
4
|
description = "robotframework-browser library extension to create Page Objects"
|
|
5
5
|
authors = [{ name = "Hasan Alp Zengin", email = "hasanalpzengin@gmail.com" }]
|
|
6
6
|
requires-python = ">=3.9,<4.0"
|
|
@@ -29,7 +29,6 @@ test = [
|
|
|
29
29
|
"ruff>=0.11.0,<0.12",
|
|
30
30
|
]
|
|
31
31
|
dev = [
|
|
32
|
-
"allure-robotframework>=2.15.3",
|
|
33
32
|
"hatchling",
|
|
34
33
|
"setuptools>=80.9.0,<81",
|
|
35
34
|
]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|