Released Selenide 6.7.0

Released Selenide 6.7.0

Full texts, full screenshots
04.08.22


Good day!


We’ve got a big release Selenide 6.7.0

Now $.shouldHave(text) can verify the whole text

From the very beginning, command $.shouldHave(text) verified the text partially, not the whole text:

  <div id="freedom-to">Britney Spears</div>
  $("#freedom-to").shouldHave(text("Brit"));  // was OK

Initially, this seemed like a good idea, because a web page often contains all sorts of inconsiderable/invisible characters. (newlines, tab characters, non-portable spaces, multiple spaces, etc.).

But now it seems that it was still a bad idea, because beginners assume by default that the text is verified entirely, and snatch their portion of WTF moments when they discover that all their checks were checking a little wrong. :)

And Selenide learned to ignore differences in the inconsiderable characters (for example, multiple subsequent spaces/tabs/newlines are considered as a single space).

NB! Since this change is too drastic and will probably break a bunch of your tests, we left the previous behaviour as a default. And the new one can be enabled with this setting:

  Configuration.textCheck = FULL_TEXT;

And when you need to check a substring, you can use the new check partialText:

  $("#freedom-to").shouldHave(partialText("ey Spear"))

Perhaps we will enable this mode by default in the next major version of Selenide 7.0.0 - until then you can play around and give us feedback.

See issue 1780 and PR 1783.


Full-size screenshots

Finally!

Now Selenide can take full-size screenshots.

When a test fails, Selenide automatically takes a screenshot to help you understand why the test failed. By default, the webdriver captures only the visible part, not the entire browser window. But the most important things are often located outside the screen. The test failure is often caused by some disabled button at the bottom of the screen or a pop-up notification somewhere in the corner.

Now you can apply a plugin that takes a screenshot with the full content of a web page in one line:

testImplementation "com.codeborne:selenide-full-screenshot:6.7.0"

P.S. This plugin works only in browser supporting CDP (Chrome, Edge etc.) and Firefox. In other browsers, Selenide will take standard screenshots as usually.

See issue 1799 and PR 1858. Thanks to Aliaksandr Rasolka for PR 1800.


Caching of page object elements

As you know, Selenide supports “standard” Selenium page objects with annotations like @FindBy. But one specific annotation @CacheLookup was not supported by Selenide. It seemed an unneeded optimization because during test run, most of the time is usually spent on other things.

Now we support the caching, why not. Who knows, probably has so much optimized project that the search of web elements became a bottleneck. I would like to see such a project. :)

Thanks to Ilya Koshaleu for PR 1894.

P.S. The question arises, should we also add caching for regular $ and $$ as well. What should be the api: a parameter, a setting? New method?

Suggest your ideas!


Cancelled TestNG annotation @Report

Now the cancel culture has reached the annotations!

If you use TestNG and Selenide text report, this announce is for you. Until now, you had to add 2 annotations to your tests:

  @Listeners({TextReport.class})
  @Report
  class MyTest {...}

Why we did this is a long story about the clumsy principles of how listeners work in TestNG (in short: adding a listener annotation to one class suddenly affects all other classes). But now we realized that the system can be simplified: the @Report annotation is no longer needed.

Now Selenide report will be generated for all tests annotated with @Listeners({TextReport.class} and their child classes.

See issue 1891 and PR 1909.


Decode downloaded file name

It turned out that when downloading a file, the file name in the server response is sometimes encoded in Base64. And Selenide was reading this encoded file name as is. Now Selenide decrypts the file name.

See issue 1886 and PR 1889.


Fixed $.setValue() in IE

It turns out we recently broke the $.setValue() method in Internet Explorer. We assumed people don’t use IE anymore: IE has officially given up. But there were complaints, and we restored IE support.

See PR 1907.


Made HttpClientTimeouts public

See PR 1902.


Returned parameter type to String for method $.setValue()

Personally, it burns me from the fact that such a problem arose at all.

See details in issue 1885 and PR 1888.


Added a warning about invalid file extension parameter

See PR 1887.


Updated dependencies


UPD Selenide 6.7.1

  • restored parameter Driver in method SelenidePageFactory.findSelector() - it’s used by selenide-appium plugin.


News


Andrei Solntsev

selenide.org

04.08.22