From 96f246533bb8362d36d64344faef0ee4895e73bd Mon Sep 17 00:00:00 2001 From: Hannah Wolfe Date: Sun, 15 Dec 2013 18:15:52 +0000 Subject: [PATCH] CasperJS waitForOpaque fails more gracefully --- core/test/functional/base.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/core/test/functional/base.js b/core/test/functional/base.js index 029f1f5cc2..657eb994f6 100644 --- a/core/test/functional/base.js +++ b/core/test/functional/base.js @@ -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); };