mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-27 22:49:56 -05:00
CasperJS waitForOpaque fails more gracefully
This commit is contained in:
parent
1c52e3a980
commit
96f246533b
1 changed files with 8 additions and 1 deletions
|
@ -58,10 +58,17 @@ casper.writeContentToCodeMirror = function (content) {
|
||||||
|
|
||||||
casper.waitForOpaque = function (classname, then, timeout) {
|
casper.waitForOpaque = function (classname, then, timeout) {
|
||||||
casper.waitFor(function checkOpaque() {
|
casper.waitFor(function checkOpaque() {
|
||||||
return this.evaluate(function (element) {
|
var value = this.evaluate(function (element) {
|
||||||
var target = document.querySelector(element);
|
var target = document.querySelector(element);
|
||||||
|
if (target === null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return window.getComputedStyle(target).getPropertyValue('opacity') === "1";
|
return window.getComputedStyle(target).getPropertyValue('opacity') === "1";
|
||||||
}, classname);
|
}, classname);
|
||||||
|
if (value !== true && value !== false) {
|
||||||
|
casper.test.fail('Unable to find element: ' + classname);
|
||||||
|
}
|
||||||
|
return value;
|
||||||
}, then, timeout);
|
}, then, timeout);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue