mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -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.waitFor(function checkOpaque() {
|
||||
return this.evaluate(function (element) {
|
||||
var value = this.evaluate(function (element) {
|
||||
var target = document.querySelector(element);
|
||||
if (target === null) {
|
||||
return null;
|
||||
}
|
||||
return window.getComputedStyle(target).getPropertyValue('opacity') === "1";
|
||||
}, classname);
|
||||
if (value !== true && value !== false) {
|
||||
casper.test.fail('Unable to find element: ' + classname);
|
||||
}
|
||||
return value;
|
||||
}, then, timeout);
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue