robotframework-browserpom 0.5.1__tar.gz → 0.6.0__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.1 → robotframework_browserpom-0.6.0}/BrowserPOM/__init__.py +1 -1
- robotframework_browserpom-0.6.0/BrowserPOM/addons/filter_locator.js +25 -0
- {robotframework_browserpom-0.5.1 → robotframework_browserpom-0.6.0}/BrowserPOM/decorator.py +4 -0
- {robotframework_browserpom-0.5.1 → robotframework_browserpom-0.6.0}/BrowserPOM/uiobject.py +1 -4
- {robotframework_browserpom-0.5.1 → robotframework_browserpom-0.6.0}/PKG-INFO +1 -1
- {robotframework_browserpom-0.5.1 → robotframework_browserpom-0.6.0}/pyproject.toml +3 -2
- robotframework_browserpom-0.5.1/BrowserPOM/addons/playwright_page_method.js +0 -52
- {robotframework_browserpom-0.5.1 → robotframework_browserpom-0.6.0}/.gitignore +0 -0
- {robotframework_browserpom-0.5.1 → robotframework_browserpom-0.6.0}/BrowserPOM/pageobject.py +0 -0
- {robotframework_browserpom-0.5.1 → robotframework_browserpom-0.6.0}/BrowserPOM/pom_stubs.py +0 -0
- {robotframework_browserpom-0.5.1 → robotframework_browserpom-0.6.0}/LICENSE +0 -0
- {robotframework_browserpom-0.5.1 → robotframework_browserpom-0.6.0}/readme.md +0 -0
|
@@ -121,7 +121,7 @@ class BrowserPOM(Browser):
|
|
|
121
121
|
Optional arguments are passed to the
|
|
122
122
|
[https://robotframework-browser.org/|BrowserLibrary] constructor.
|
|
123
123
|
"""
|
|
124
|
-
addon_path = Path(__file__).parent / "addons" / "
|
|
124
|
+
addon_path = Path(__file__).parent / "addons" / "filter_locator.js"
|
|
125
125
|
with contextlib.suppress(RobotNotRunningError):
|
|
126
126
|
BuiltIn().set_library_search_order("BrowserPOM", "Browser")
|
|
127
127
|
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
async function filterLocator(base_locator, filter_statement, page, logger) {
|
|
2
|
+
const playwright_function = "(page.locator('" + base_locator + "').filter({" + filter_statement + "}))"
|
|
3
|
+
logger("Filtering Playwright locator: " + playwright_function)
|
|
4
|
+
const result = await eval(playwright_function);
|
|
5
|
+
// If the result is an object we assume it's a locator so we return the _selector property of the locator object
|
|
6
|
+
if (typeof result == "object") {
|
|
7
|
+
return result._selector;
|
|
8
|
+
} else {
|
|
9
|
+
return result;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
filterLocator.rfdoc = `
|
|
14
|
+
This keyword returns a Playwright locator with the given filter applied.
|
|
15
|
+
|
|
16
|
+
Parameters:
|
|
17
|
+
base_locator : (string) The locator on which the filter should be applied.
|
|
18
|
+
filter_statement : (string) The filter to apply, e.g. 'hasText: "foo"'
|
|
19
|
+
|
|
20
|
+
Example
|
|
21
|
+
| Filter Locator //li hasText: "foo"
|
|
22
|
+
`
|
|
23
|
+
|
|
24
|
+
exports.__esModule = true;
|
|
25
|
+
exports.filterLocator = filterLocator;
|
|
@@ -71,10 +71,7 @@ class UIObject:
|
|
|
71
71
|
|
|
72
72
|
"""
|
|
73
73
|
base_locator = str(self).replace("'", '"')
|
|
74
|
-
locator = BuiltIn().run_keyword(
|
|
75
|
-
"Playwright Page Method",
|
|
76
|
-
"locator('" + base_locator + "').filter({" + filter_text + "})",
|
|
77
|
-
)
|
|
74
|
+
locator = BuiltIn().run_keyword("Filter Locator", base_locator, filter_text)
|
|
78
75
|
return self.__class__(locator)
|
|
79
76
|
|
|
80
77
|
def self_locator(self) -> str:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "robotframework-browserpom"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.6.0"
|
|
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"
|
|
@@ -24,9 +24,10 @@ repository = "https://github.com/hasanalpzengin/robotframework-browserpom"
|
|
|
24
24
|
[dependency-groups]
|
|
25
25
|
test = [
|
|
26
26
|
"prek>=0.2.19",
|
|
27
|
-
"pyrefly>=
|
|
27
|
+
"pyrefly>=1.1.1",
|
|
28
28
|
"pytest_robotframework>=4.3.0,<5",
|
|
29
29
|
"ruff>=0.11.0,<0.12",
|
|
30
|
+
"robotframework-browser-batteries>=19.9.0",
|
|
30
31
|
]
|
|
31
32
|
dev = [
|
|
32
33
|
"hatchling",
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
const path = require('node:path');
|
|
2
|
-
const { expect } = require(path.resolve('node_modules/playwright/test'));
|
|
3
|
-
|
|
4
|
-
async function playwrightPageMethod(page_method, page, logger) {
|
|
5
|
-
const playwright_function = '(page.' + page_method + ')';
|
|
6
|
-
logger("Executing Playwright Page method: " + page_method)
|
|
7
|
-
const result = await eval(playwright_function);
|
|
8
|
-
// If the result is an object we assume it's a locator so we return the _selector property of the locator object
|
|
9
|
-
if (typeof result == "object") {
|
|
10
|
-
return result._selector;
|
|
11
|
-
} else {
|
|
12
|
-
return result;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
async function playwrightJS(statement, page, logger) {
|
|
17
|
-
const playwright_statement = '(' + statement + ')';
|
|
18
|
-
logger("Executing Playwright method: " + statement)
|
|
19
|
-
const result = await eval(playwright_statement);
|
|
20
|
-
// If the result is an object we assume it's a locator so we return the _selector property of the locator object
|
|
21
|
-
if (typeof result == "object") {
|
|
22
|
-
return result._selector;
|
|
23
|
-
} else {
|
|
24
|
-
return result;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
playwrightPageMethod.rfdoc = `
|
|
29
|
-
This keyword executes a Playwright Page method.
|
|
30
|
-
|
|
31
|
-
Parameters: page_method : (string) The page method to be executed in Playwright.
|
|
32
|
-
|
|
33
|
-
Example
|
|
34
|
-
| Playwright Page Method getByRole('link', { name: 'Get started' }).click()
|
|
35
|
-
`
|
|
36
|
-
|
|
37
|
-
playwrightJS.rfdoc = `
|
|
38
|
-
This keyword executes a JavaScript Playwright statement, which can be page methods including assertions.
|
|
39
|
-
Except for the following assertions which are not supported:
|
|
40
|
-
| expect(page).toHaveScreenshot()
|
|
41
|
-
| expect(page).toMatchSnapshot()
|
|
42
|
-
|
|
43
|
-
Parameters: statement : (string) The Playwright statement to be executed.
|
|
44
|
-
|
|
45
|
-
Example
|
|
46
|
-
| Playwright JS page.getByRole('link', { name: 'Get started' }).click()
|
|
47
|
-
| Playwright JS expect(page.getByRole('link', { name: 'Get started' })).toBeVisible()
|
|
48
|
-
`
|
|
49
|
-
|
|
50
|
-
exports.__esModule = true;
|
|
51
|
-
exports.playwrightPageMethod = playwrightPageMethod;
|
|
52
|
-
exports.playwrightJS = playwrightJS;
|
|
File without changes
|
{robotframework_browserpom-0.5.1 → robotframework_browserpom-0.6.0}/BrowserPOM/pageobject.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|