-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability to get related xpath locators by index
- Loading branch information
Showing
5 changed files
with
49 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,8 @@ words: | |
- yaspeller | ||
|
||
# Code words | ||
- argnames | ||
- argvalues | ||
- docstrings | ||
- conftest | ||
- kwargs | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import pytest | ||
|
||
from pomcorn.locators.base_locators import XPathLocator | ||
|
||
TEST_QUERY = "//span[text()='Users'][last()]" | ||
|
||
|
||
@pytest.mark.parametrize( | ||
argnames=["index", "result"], | ||
argvalues=[ | ||
[-2, f"({TEST_QUERY})[last() - 1]"], | ||
[-1, f"({TEST_QUERY})[last()]"], | ||
[0, f"({TEST_QUERY})[1]"], | ||
[1, f"({TEST_QUERY})[2]"], | ||
], | ||
) | ||
def test_getting_related_xpath_locators_by_index(index: int, result: str): | ||
"""Check that getting related xpath locators by index works correct.""" | ||
locator = XPathLocator(TEST_QUERY) | ||
assert locator[index].query == result |