Skip to content

Commit

Permalink
[#277] NEW: remove collection.should_each(condition)
Browse files Browse the repository at this point in the history
+ ... and ability to pass element_condition to `collection.should(HERE)`
  -  Use instead: `collection.should(element_condition.each)`
+ bump version to 2.0.0b13
+ update README.md for 2.0.0b12
  • Loading branch information
yashaka committed Sep 26, 2022
1 parent 2db9038 commit e1ed780
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 32 deletions.
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,16 @@
- "merge" element.execute_script with element._execute_script
- TODO: trim text in have.exact_text

## 2.0.0b12 (to be released on 26.09.2022)

## 2.0.0b13 (to be released on ??.09.2022)

### NEW: BREAKING CHANGE: removed collection.should_each ... [#277](https://github.com/yashaka/selene/issues/277)

- ... and ability to pass element_condition to `collection.should(HERE)`
- Use instead: `collection.should(element_condition.each)`
- like in `browser.all('.selene-user').should(hava.css_class('cool').each)`

## 2.0.0b12 (released on 26.09.2022)

### NEW: collection.should(condition.each) [#277](https://github.com/yashaka/selene/issues/277)

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Tests with Selene can be built either in a simple straightforward "selenide' sty

## Versions

* Latest recommended version to use is >= [2.0.0b10](https://pypi.org/project/selene/2.0.0b10/)
* Latest recommended version to use is >= [2.0.0b12](https://pypi.org/project/selene/2.0.0b12/)
* it's a completely new version of selene, with improved API and speed
* supports 3.7 <= python <= 3.10,
* bundled with Selenium = 4.1
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "selene"
version = "2.0.0b12"
version = "2.0.0b13"
description = "User-oriented browser tests in Python (Selenide port)"
authors = ["Iakiv Kramarenko <yashaka@gmail.com>"]
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion selene/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,4 +220,4 @@
# """
from selene.core.entity import Element, Collection # noqa

__version__ = '2.0.0b12'
__version__ = '2.0.0b13'
30 changes: 2 additions & 28 deletions selene/core/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -992,22 +992,8 @@ def collected(

# --- Assertable --- #

def should(
self,
condition: Union[Condition[Iterable[Element]], Condition[Element]],
) -> Collection:
if isinstance(condition, ElementCondition):
warnings.warn(
"don't pass element-conditions like have.text to collection of elements, "
"cause it will lead to confusions in meaning... "
"While browser.all('.item').should(have.text('same for all items')) is pretty obvious, "
"Something like ss('.item').should(have.text('same for all items')) is not...",
DeprecationWarning,
)
# super().should(condition.each) # TODO: fix types
self.wait.for_(condition.each)
else:
super().should(condition)
def should(self, condition: Condition[Iterable[Element]]) -> Collection:
self.wait.for_(condition)
return self

# --- Deprecated --- #
Expand All @@ -1019,18 +1005,6 @@ def get_actual_webelements(self) -> List[WebElement]:
)
return self()

def should_each(self, condition: Condition[Element]) -> Collection:
warnings.warn(
"deprecated; use should(condition.each) method instead, like in: "
"browser.all('.foo').should(have.css_class('bar').each)",
DeprecationWarning,
)

# self.should(condition.each) # TODO: fix types
self.wait.for_(condition.each)

return self


class Browser(WaitingEntity):
def __init__(
Expand Down

0 comments on commit e1ed780

Please sign in to comment.