Commit e3b36c38 authored by Jérome Perrin's avatar Jérome Perrin

Zelenium: add an option to ignore snapshot tests

Because they depend on the browser version, the window size, the
available fonts and maybe other things, snapshot tests basically only
work when running on testnode and fail when we run the tests from our
browsers locally. With this option, the difference of snapshot are not
considered a failure.

Also adjust snapshots, because this adds a checkbox in the upper frame,
the viewport of the test frame is now a little bit taller.
parent 07496d63
......@@ -16,7 +16,7 @@
</item>
<item>
<key> <string>height</string> </key>
<value> <int>284</int> </value>
<value> <int>276</int> </value>
</item>
<item>
<key> <string>precondition</string> </key>
......
......@@ -226,6 +226,16 @@ Selenium.prototype.doVerifyImageMatchSnapshot = (
locator,
misMatchTolerance
) => {
if (window['ignoreSnapshotTest'].checked){
// calling getReferenceImageCounter has the side effect
// of increasing the counter, so if we enable / disable
// snapshot mid test the counter stays in sync.
var snapshotCounter = getReferenceImageCounter(
testFrame.getCurrentTestCase().pathname);
console.log("ignoring snapshot test " + snapshotCounter);
return;
}
var misMatchToleranceFloat = parseFloat(misMatchTolerance);
if (isNaN(misMatchToleranceFloat)) {
misMatchToleranceFloat = 0;
......@@ -263,7 +273,7 @@ Selenium.prototype.doVerifyImageMatchSnapshot = (
if (response.status === 200) {
return response.blob();
}
throw new Error('Feching reference failed ' + response.statusText);
throw new Error('Fetching reference failed ' + response.statusText);
})
.then(
blob => {
......
......@@ -106,6 +106,9 @@ to work-around a bug in IE on Win2K whereby the HTA application doesn't function
<div class="executionOptions">
<input id="highlightOption" type="checkbox" name="highlightOption" value="0"/>
<label for="highlightOption">Highlight elements</label>
<br/>
<input id="ignoreSnapshotTest" type="checkbox" name="ignoreSnapshotTest" value="0"/>
<label for="ignoreSnapshotTest">Ignore snapshot tests</label>
</div>
</fieldset>
......
......@@ -107,6 +107,9 @@ to work-around a bug in IE on Win2K whereby the HTA application doesn't function
<div class="executionOptions">
<input id="highlightOption" type="checkbox" name="highlightOption" value="0"/>
<label for="highlightOption">Highlight elements</label>
<br/>
<input id="ignoreSnapshotTest" type="checkbox" name="ignoreSnapshotTest" value="0"/>
<label for="ignoreSnapshotTest">Ignore snapshot tests</label>
</div>
</fieldset>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment