Skip to content

Version 1.11.x

Compare
Choose a tag to compare
@giulong giulong released this 30 May 19:15
· 218 commits to develop since this release
1dba53f

Html reports with Google Charts

Beside the default html template, a new one that leverages Google's pie charts is available for both Summary and Testbook. Here's a preview of the latter:

html-testbook-pies

To pick this one, you just need to specify this template in your configuration.yaml:

testBook:
  enabled: true
  reporters:
    - html:
        template: templates/testbook-pies.html

Js

Thanks to @AndreaDotDev for working on the Add Javascript helper methods feature, Spectrum now injects the js object that you can use to programmatically execute Javascript actions without manually writing the scripts. As an example, instead of writing:

((JavascriptExecutor) driver).executeScript("arguments[0].value='Some text';", webElement);

you can directly do this:

js.sendKeys(webElement, "Some text");

Be sure to check the Javascript Executor docs for the details.

@JsWebElement

The Js implementation above lets you run Javascript programmatically in a clean way. If you need to always interact with a webElement using Javascript, you can also choose to annotate it with @JsWebElement like this:

@FindBy(tagName = "h1")
@JsWebElement
private WebElement title;

The result is that, without doing nothing else, you can call the regular webElement methods and the execution will actually be delegated to Js, resulting in Javascript-only interactions. This means, as an example, that methods like sendKeys or getText will actually be executed in Javascript.

Check the JsWebElement docs for the details.