A group of plug-ins that can be used in conjunction with maven to execute the Google Closure Compiler on JavaScript code. This Framework allows for scaling and modularity.
MIT License
16
stars
7
forks
source link
Allow browser version configuration for HtmlUnitDriver #45
The idea is to allow configuration of browserVersion for both the closure-testing-framework-plugin and closure-testing-report-maven-plugin. As a results user can control output of sensitive operations (like above mentioned Element.innerHTML).
If browserVersion is empty of not specified at all then the default BrowserVersion is used, which usually defaults to INTERNET EXPLORER but it is an internal implementation detail of BrowserVersion and is subject to change depending on used library version.
Example Unit Test
To give specific example of unit test where it was important to control browser version imagine the following use case. We generate HTML elements using the following code:
var captionDiv = goog.dom.createDom(goog.dom.TagName.DIV,"captionClass");
goog.dom.appendChild(caption, goog.dom.createTextNode("Caption"));
This creates a DIV element with class="captionClass" and text node containing text "Caption". Now, we can easily use innerHTML in test like this:
Now, without specifying browserVersion such test would fail:
* Test = testMethod : FAILED
Expected <<div class="captionClass">Caption</div>> (String) but was <<div class=captionClass>Caption</div>> (String)
Difference was at position 11. Expected [...s="captionClass"...] vs. actual [...s=captionClass...]
This is caused by the fact that if INTERNET EXPLORER browser version is used (which is used by default) then element attribute values are output without quotation. When we specify browserVersion equal for example to FF then such test would pass.
When dealing with Element.innerHTML in Selenium tests result can differ depending on the used browser. HtmlUnitDriver allows to specify which BrowserVersion to use.
The idea is to allow configuration of
browserVersion
for both theclosure-testing-framework-plugin
andclosure-testing-report-maven-plugin
. As a results user can control output of sensitive operations (like above mentionedElement.innerHTML
).Example of configuration
Supported values
CHROME
FIREFOX
FF
INTERNET EXPLORER
IE
If
browserVersion
is empty of not specified at all then the default BrowserVersion is used, which usually defaults toINTERNET EXPLORER
but it is an internal implementation detail of BrowserVersion and is subject to change depending on used library version.Example Unit Test
To give specific example of unit test where it was important to control browser version imagine the following use case. We generate HTML elements using the following code:
This creates a DIV element with class="captionClass" and text node containing text "Caption". Now, we can easily use
innerHTML
in test like this:Now, without specifying
browserVersion
such test would fail:This is caused by the fact that if
INTERNET EXPLORER
browser version is used (which is used by default) then element attribute values are output without quotation. When we specifybrowserVersion
equal for example toFF
then such test would pass.