robotframework-browserpom 0.1.1__tar.gz → 0.1.3__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.
@@ -28,6 +28,7 @@ class PageObject(metaclass=ABCMeta):
28
28
  self.logger = robot.api.logger
29
29
  self.locator = LocatorMap(getattr(self, "_locators", {}))
30
30
  self.builtin = BuiltIn()
31
+ self.builtin.set_local_variable(f"${self.__class__.__name__}", self.locator)
31
32
 
32
33
  @property
33
34
  def browser(self) -> Browser:
@@ -0,0 +1,121 @@
1
+ Metadata-Version: 2.1
2
+ Name: robotframework-browserpom
3
+ Version: 0.1.3
4
+ Summary: robotframework-browser library extension to create Page Objects
5
+ Home-page: https://github.com/hasanalpzengin/robotframework-browserpom
6
+ Author: Hasan Alp Zengin
7
+ Author-email: hasanalpzengin@gmail.com
8
+ Requires-Python: >=3.12,<4.0
9
+ Classifier: Framework :: Robot Framework
10
+ Classifier: Framework :: Robot Framework :: Library
11
+ Classifier: Framework :: Robot Framework :: Tool
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Topic :: Software Development :: Quality Assurance
18
+ Classifier: Topic :: Software Development :: Testing
19
+ Requires-Dist: robotframework (>=7.1.0,<8.0.0)
20
+ Requires-Dist: robotframework-browser (>=18.0.0,<19.0.0)
21
+ Project-URL: Repository, https://github.com/hasanalpzengin/robotframework-browserpom
22
+ Description-Content-Type: text/markdown
23
+
24
+ # robotframework-browserpom
25
+
26
+ `robotframework-browserpom` is a [robotframework-browser](https://robotframework-browser.org/) library extension designed to simplify the creation of Page Objects. It provides an easy-to-use interface to define Page Object Models (POM) for browser automation with the Robot Framework, allowing for cleaner, maintainable, and reusable test automation code.
27
+
28
+ Heavily inspired by [robotframework-pageobjectlibrary](https://github.com/boakley/robotframework-pageobjectlibrary) repository which is built for usage with Selenium Library and not compatible with robotframework-browser.
29
+
30
+ ## Features
31
+
32
+ - **Integration with Robot Framework Browser**: Seamlessly integrates with the `robotframework-browser` library.
33
+ - **Page Object Model Support**: Simplifies the creation and management of Page Objects in browser-based test automation.
34
+ - **Enhanced Readability**: Improves the maintainability of test automation by promoting a clean separation between test actions and page element interactions.
35
+
36
+ ## Installation
37
+
38
+ To install `robotframework-browserpom`, you can use `poetry`:
39
+
40
+ ```bash
41
+ poetry add robotframework-browserpom
42
+ ```
43
+
44
+ Alternatively, to install in development mode (if you are contributing to the library):
45
+
46
+ poetry install
47
+
48
+ Dependencies
49
+
50
+ This project depends on the following libraries:
51
+
52
+ Python 3.12 or above
53
+ robotframework (>=7.1.0)
54
+ robotframework-browser (>=18.0.0)
55
+
56
+ Development dependencies include:
57
+
58
+ pytest for testing
59
+ black for code formatting
60
+ isort for sorting imports
61
+ flake8 for linting
62
+ mypy for static type checking
63
+ pylint for additional linting checks
64
+ coverage for test coverage reporting
65
+
66
+ Usage
67
+
68
+ To use robotframework-browserpom, create Page Objects by defining Python classes that represent the pages in your web application. These classes should contain methods that interact with the elements on the page.
69
+
70
+ Example:
71
+
72
+ ```python
73
+ from robot.api.deco import keyword
74
+
75
+ from BrowserPOM.pageobject import PageObject
76
+
77
+
78
+ class MainPage(PageObject):
79
+ """
80
+ main page
81
+ """
82
+ PAGE_TITLE = "MainPage"
83
+ PAGE_URL = "/index.html"
84
+
85
+ _locators = {
86
+ "tile": {
87
+ "skeleton": "//li",
88
+ "price_label": "//li//p[2]",
89
+ "title": "//li//h2",
90
+ "author": "//li//p[1]"
91
+ },
92
+ "search_bar": "input[@id='searchBar']"
93
+ }
94
+
95
+ @keyword
96
+ def enter_search(self, search):
97
+ """Enter to search bar"""
98
+ self.browser.type_text(self.locator.search_bar, search)
99
+
100
+ def get_tile_count(self):
101
+ return self.browser.get_element_count(self.locator.get("tile").get("skeleton"))
102
+ ```
103
+
104
+ ## License
105
+
106
+ This project is licensed under the MIT License - see the LICENSE file for details.
107
+ Contributing
108
+
109
+ Contributions are welcome! Please fork this repository and submit a pull request with your changes.
110
+
111
+ Before submitting your pull request, make sure to:
112
+
113
+ Follow the coding style conventions (Black for formatting, Flake8 for linting).
114
+ Write tests for any new features or bug fixes.
115
+ Update the documentation as needed.
116
+
117
+ Contact
118
+
119
+ For any questions or feedback, you can reach the project maintainer:
120
+
121
+ Hasan Alp Zengin (hasanalpzengin@gmail.com)
@@ -1,9 +1,22 @@
1
1
  [tool.poetry]
2
2
  name = "robotframework-browserpom"
3
- version = "0.1.1"
3
+ version = "0.1.3"
4
4
  description = "robotframework-browser library extension to create Page Objects"
5
5
  authors = ["Hasan Alp Zengin <hasanalpzengin@gmail.com>"]
6
6
  packages = [{ include = "BrowserPOM" }]
7
+ readme = "readme.md"
8
+ classifiers = [
9
+ "Programming Language :: Python :: 3",
10
+ "License :: OSI Approved :: MIT License",
11
+ "Operating System :: OS Independent",
12
+ "Framework :: Robot Framework",
13
+ "Framework :: Robot Framework :: Library",
14
+ "Framework :: Robot Framework :: Tool",
15
+ "Topic :: Software Development :: Testing",
16
+ "Topic :: Software Development :: Quality Assurance",
17
+ ]
18
+ repository = "https://github.com/hasanalpzengin/robotframework-browserpom"
19
+
7
20
 
8
21
  [tool.poetry.dependencies]
9
22
  python = "^3.12"
@@ -24,24 +37,6 @@ flake8-pyproject = "1.2.3"
24
37
  requires = ["poetry-core"]
25
38
  build-backend = "poetry.core.masonry.api"
26
39
 
27
- [project]
28
- name = "robotframework-browserpom"
29
- version = "0.1.1"
30
- authors = [
31
- { name="Hasan Alp Zengin", email="hasalp38@gmail.com" },
32
- ]
33
- description = "robotframework-browser library extension to create Page Object Model"
34
- readme = "README.md"
35
- requires-python = ">=3.12"
36
- classifiers = [
37
- "Programming Language :: Python :: 3",
38
- "License :: OSI Approved :: MIT License",
39
- "Operating System :: OS Independent",
40
- ]
41
-
42
- [project.urls]
43
- Homepage = "https://github.com/hasanalpzengin/robotframework-browserpom"
44
-
45
40
  [tool.black]
46
41
  line-length = 88
47
42
  target-version = ['py312']
@@ -0,0 +1,98 @@
1
+ # robotframework-browserpom
2
+
3
+ `robotframework-browserpom` is a [robotframework-browser](https://robotframework-browser.org/) library extension designed to simplify the creation of Page Objects. It provides an easy-to-use interface to define Page Object Models (POM) for browser automation with the Robot Framework, allowing for cleaner, maintainable, and reusable test automation code.
4
+
5
+ Heavily inspired by [robotframework-pageobjectlibrary](https://github.com/boakley/robotframework-pageobjectlibrary) repository which is built for usage with Selenium Library and not compatible with robotframework-browser.
6
+
7
+ ## Features
8
+
9
+ - **Integration with Robot Framework Browser**: Seamlessly integrates with the `robotframework-browser` library.
10
+ - **Page Object Model Support**: Simplifies the creation and management of Page Objects in browser-based test automation.
11
+ - **Enhanced Readability**: Improves the maintainability of test automation by promoting a clean separation between test actions and page element interactions.
12
+
13
+ ## Installation
14
+
15
+ To install `robotframework-browserpom`, you can use `poetry`:
16
+
17
+ ```bash
18
+ poetry add robotframework-browserpom
19
+ ```
20
+
21
+ Alternatively, to install in development mode (if you are contributing to the library):
22
+
23
+ poetry install
24
+
25
+ Dependencies
26
+
27
+ This project depends on the following libraries:
28
+
29
+ Python 3.12 or above
30
+ robotframework (>=7.1.0)
31
+ robotframework-browser (>=18.0.0)
32
+
33
+ Development dependencies include:
34
+
35
+ pytest for testing
36
+ black for code formatting
37
+ isort for sorting imports
38
+ flake8 for linting
39
+ mypy for static type checking
40
+ pylint for additional linting checks
41
+ coverage for test coverage reporting
42
+
43
+ Usage
44
+
45
+ To use robotframework-browserpom, create Page Objects by defining Python classes that represent the pages in your web application. These classes should contain methods that interact with the elements on the page.
46
+
47
+ Example:
48
+
49
+ ```python
50
+ from robot.api.deco import keyword
51
+
52
+ from BrowserPOM.pageobject import PageObject
53
+
54
+
55
+ class MainPage(PageObject):
56
+ """
57
+ main page
58
+ """
59
+ PAGE_TITLE = "MainPage"
60
+ PAGE_URL = "/index.html"
61
+
62
+ _locators = {
63
+ "tile": {
64
+ "skeleton": "//li",
65
+ "price_label": "//li//p[2]",
66
+ "title": "//li//h2",
67
+ "author": "//li//p[1]"
68
+ },
69
+ "search_bar": "input[@id='searchBar']"
70
+ }
71
+
72
+ @keyword
73
+ def enter_search(self, search):
74
+ """Enter to search bar"""
75
+ self.browser.type_text(self.locator.search_bar, search)
76
+
77
+ def get_tile_count(self):
78
+ return self.browser.get_element_count(self.locator.get("tile").get("skeleton"))
79
+ ```
80
+
81
+ ## License
82
+
83
+ This project is licensed under the MIT License - see the LICENSE file for details.
84
+ Contributing
85
+
86
+ Contributions are welcome! Please fork this repository and submit a pull request with your changes.
87
+
88
+ Before submitting your pull request, make sure to:
89
+
90
+ Follow the coding style conventions (Black for formatting, Flake8 for linting).
91
+ Write tests for any new features or bug fixes.
92
+ Update the documentation as needed.
93
+
94
+ Contact
95
+
96
+ For any questions or feedback, you can reach the project maintainer:
97
+
98
+ Hasan Alp Zengin (hasanalpzengin@gmail.com)
@@ -1,12 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: robotframework-browserpom
3
- Version: 0.1.1
4
- Summary: robotframework-browser library extension to create Page Objects
5
- Author: Hasan Alp Zengin
6
- Author-email: hasanalpzengin@gmail.com
7
- Requires-Python: >=3.12,<4.0
8
- Classifier: Programming Language :: Python :: 3
9
- Classifier: Programming Language :: Python :: 3.12
10
- Classifier: Programming Language :: Python :: 3.13
11
- Requires-Dist: robotframework (>=7.1.0,<8.0.0)
12
- Requires-Dist: robotframework-browser (>=18.0.0,<19.0.0)