Good night!
I have an offer for you that you shouldn’t refuse.
Upgrade to Selenide 6.16.0!
date(...)
and datetime(...)
$.doubleClick()
in AppiumHere is the coolness!
One of basic Selenide features is collection checks. With just one line you can check a bunch of elements:
$$("option").shouldHave(texts("Gandalf", "Gendalf", "Gondalf"))
But such a check can take a significant time in case of big collections.
For example, if a page has 1000 <option>
elements, that check takes ~3 seconds on my machine.
The slowness is due to the fact that Selenide fetches the text of each element separately. 1000 webdriver calls, even very fast ones, takes its time.
It’s time to speed up those checks!
Now Selenide fetches texts of all 1000 elements with a single webdriver call using JavaScript.
Now that check takes 200ms instead of 3 seconds. It became 15 times faster! That’s crazy.
P.S. For Appium and other webdriver not supporting JS, Selenide will fall back to the old implementation (fetches texts one-by-one). At least it’s not worse than before.
See PR 2362.
During the previous refactoring, we improved error message for collections. Now Selenide provides a more detailed error of which element didn’t meet the conditions:
For example, this check:
$$(".number").shouldHave(exactTexts("On", "Tw", "Thre"))
Reported just a simple "Texts mismatch"
message:
Texts mismatch
Actual: [One, Two, Three]
Expected: [On, Tw, Thre]
And now it specifies what exactly didn’t match:
Text #0 mismatch (expected: "On", actual: "One")
Actual: [One, Two, Three]
Expected: [On, Tw, Thre]
See PR 2362.
date(...)
and datetime(...)
import static com.codeborne.selenide.conditions.datetime.DateConditionOptions.*;
LocalDate birthday = LocalDate.of(2022, 10, 11);
$("#birthdate").shouldHave(date(birthday));
$("#birthdate").shouldHave(date(birthday, "yyyy-MM-dd"));
$("#birthdate").shouldHave(dateBetween(parse("2020-01-01"), parse("2023-12-31")));
$("#birthdate").shouldHave(dateFormat("yyyy-MM-dd"));
See issue 2268. Thanks to Maksim @Au6ojlut for PR 2281.
Selenide had a method for selecting a date (withDate
):
$("#birthdate").setValue(withDate(LocalDate.of(...)));
// for <input type="date">
Now we have similar methods for selecting date and time (withDateTime
):
$("#birthdate").setValue(withDateTime(LocalDateTime.of(...)));
// for <input type="datetime-local">
or only time (withTime
):
$("#openFrom").setValue(withTime(LocalTime.of(7, 12)));
$("#closeFrom").setValue(withTime(LocalTime.of(17, 59, 58)));
// for <input type="time">
See PR 2357.
In Selenide, you can enable soft asserts mode. Then Selenide will collect several failures during a test, and throw an exception in the end. This exception will include all collected assertion errors.
The problem is that Selenide didn’t show full stacktraces, so you couldn’t see the “Caused by:” part. Now it will be shown.
Be prepared for the lengthy stack traces :)
See issue 2350 and PR 2354.
Selenide has methods for BasicAuth authentication:
open("/basic-auth/hello", "my.test.com", "scott", "pwd123");
Until now, we had two BasicAuth implementations.
Authorization
header to every http request (Basic YWRtaW460JrQsNC30LrQvtCy0LAg0LTRltCx0YDQvtCy0LA=
).https://scott:pwd123@localhost:42220/basic-auth/hello
).Now we have a third implementation. If webdriver implements interface org.openqa.selenium.HasAuthentication
, then Selenide adds login+password via this interface. Basically it means Chromium based browsers (Chrome, Chromium, Edge).
See issue 2336 and PR 2358.
Until now, you could set only one domain for BasicAuth:
open("/basic-auth/hello", "my.test.com", "scott", "pwd123");
It doesn’t help if AUT uses multiple domains. For example, if AUT at address “https://my.test.com” opens a frame with address “https://api.test.com” or, say, “https://api.test.com”. You can set an empty domain, but it’s not always safe.
Now you can set multiple domains separated by comma or “|”:
open("/basic-auth/hello", "my.test.com|auth.test.com|api.test.com",
"scott", "pwd123");
See PR 2358.
P.S. Of course, the domain name is not used when Selenide adds the login+password just to the URL.
$.doubleClick()
in AppiumIn a previous release we broke, and now we’ve fixed the double click in mobile phones:
$(AppiumBy.xpath(".//android.widget.CheckBox")).doubleClick();
See issue 2346 and PR 2347.
Usually Selenide takes a screenshot after a test failure.
BUT If you close the browser in @AfterEach
method, Selenide could not take the screenshot anymore:
@AfterEach
void tearDown() {
Selenide.closeWebDriver();
}
Now Selenide will take the screenshot earlier - BEFORE all @AfterEach
methods.
See issue 2352 and PR 2356.
Video Run Selenide Appium Test in LambdaTest in blog “Testing Mini Bytes”
Number of monthly downloads of Selenide is still around 600 thousands!
02.07.23