Buenos noches!
We have merged next pack of pull requests and released Selenide 5.8.0.
What updates will you see there?
Simplified creation of custom conditions using lambdas
In class Condition
there is a new method match
which allows you to create custom conditions without need to subclass Condition
.
You just need to pass it a lambda.
See examples in tests:
$("#multirowTable").should(match("border=1", el -> el.getAttribute("border").equals("1")));
We also added similar methods for collections anyMatch
, allMatch
and noneMatch
.
See examples in tests:
$$("input").shouldBe(anyMatch("value==dog", el -> el.getAttribute("value").equals("dog")));
$$("input").shouldBe(allMatch("value==cat", el -> el.getAttribute("value").equals("cat")));
$$("input").shouldBe(noneMatch("value==bird", el -> el.getAttribute("value").equals("bird")));
See issue 662.
Thanks to Dmytro Stekanov for PR 1059.
Added methods $.sibling()
and $.preceding()
… which allow you to find “previous” and “following” elements on the same DOM level. It can be useful when you don’t have good locators, but need to navigate in DOM tree.
See examples in tests:
$("#multirowTableFirstRow").sibling(0).shouldHave(id("multirowTableSecondRow"));
$(".second_row").parent().preceding(0).find("td", 0).shouldHave(cssClass("first_row"));
See issue 845.
Thanks to Dmytro Stekanov for PR 1064.
Added support for pseudo-elements
As many of you know, there are things in HTML called pseudo-elements: “:before”, “:after”, “:first-letter”, “:first-line”, “:selection”. They can contains important texts and styles that you sometimes want to check. Now it’s possible.
See examples in tests:
$("h1").shouldHave(pseudo(":first-letter", "color", "rgb(255, 0, 0)"));
$("abbr").shouldHave(pseudo(":before", "content", "\"beforeContent\""));
$("abbr").shouldHave(pseudo(":before", "\"beforeContent\""));
You can also ask for a value of pseudo-element from SelenideElement
(but we do not welcome this method):
assertThat($("h1").pseudo(":first-letter", "color")).isEqualTo("rgb(255, 0, 0)");
assertThat($("abbr").pseudo(":before")).isEqualTo("\"beforeContent\"");
See issue 994.
Thanks to Denys Shynkarenko for PR 1045.
Fixed SoftAssertionsExtension for JUnit5
If one of your tests failed, SoftAssertionsExtension
also marked all following tests as failed. Ups.
See issue 1071.
Thanks to Alexei Vinogradov for the fix.
Now $.click()
always clicks in the CENTER of an element
Usually method $.click()
did click in the center of the element.
But if you set Configuration.clickViaJS=true
, it clicked in the top left corner.
Not that it was critical, but you never know … Now it always clicks in the center.
Just in case. Just to keep the same behaviour in all cases.
See commit 106c53941c718.
News
- Wow! John C. Pratt created a Selenide Exporter for Katalon Recorder (works with Katalon Recorder).
- We discovered phpSelenide - a Selenide port to PHP.
- And if you didn’t know, SeleneJS - a Selenide port to JavaScript.
selenide.org
28.02.20