How to use the ext/testpanel/testpanel.setError function in ext

To help you get started, we’ve selected a few ext examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pylonide / pylon / client / ext / selenium / selenium.js View on Github external
}, function(){
            var nodes = apf.queryNodes(fileNode, "test[@status=0 or error]");

            if (_self.stopping) {
                testpanel.setError(fileNode, "Test Cancelled");
                return;
            }
            else if (nodes.length)
                testpanel.setError(fileNode, "failed " + (nodes.length) + " tests of " + tests.length);
            else
                testpanel.setPass(fileNode, tests.length + " of " + tests.length);
            
            _self.running = false;
            
            callback();
        });
    },
github pylonide / pylon / client / ext / nodeunit / nodeunit.js View on Github external
function completed(){
                var nodes = apf.queryNodes(fileNode, "test[@status=0 or error]");

                if (_self.stopping) {
                    testpanel.setError(fileNode, "Test Cancelled");
                    return;
                }
                else if (nodes.length)
                    testpanel.setError(fileNode, "Failed " + (nodes.length)
                        + " tests of " + fileNode.selectNodes("test").length);
                else
                    testpanel.setPass(fileNode,
                        "(" + fileNode.selectNodes("test").length + ")");
            }
github pylonide / pylon / client / ext / selenium / selenium.js View on Github external
apf.asyncForEach(tests, function(name, nextTest, i){
            if (_self.stopping) {
                testpanel.setError(fileNode, "Test Cancelled");
                _self.stopped();
                return;
            }
            
            var actions  = testObject[name];
            var script   = sp.compile(actions);
            var testNode = nodes[i];
            var actionIndex = -1;
            var assertIndex = -1;
            
            _self.lastTestNode = testNode;

            testpanel.setLog(fileNode, "running test " + (i + 1) + " of " + tests.length);
            testpanel.setLog(testNode, "connecting...");

            var data = {
github pylonide / pylon / client / ext / selenium / selenium.js View on Github external
if (actionNode) {
                                var actionName = actionNode.getAttribute("name");
                                if ((_self.actionLookup[actionName] || actionName) 
                                  == (_self.actionLookup[msg.cmd] || msg.cmd)) {
                                    testpanel.setExecute(actionNode);
                                    actionIndex++;
                                    assertIndex = -1;
                                }
                            }
                        case 3: //LOG
                            testpanel.setLog(testNode, "command '" 
                                + (msg.out || msg.cmd) + "'");
                            break;
                        case 4:
                            if (testNode.selectSingleNode("error|assert[@status=0]"))
                                testpanel.setError(testNode, "Test Failed");
                            else
                                testpanel.setPass(testNode);
                        
                            testpanel.setExecute();
                        
                            apf.xmldb.setAttribute(fileNode, "video", msg.video);
                            
                            //Small hack
                            if (self.dgTestProject)
                                dgTestProject.reselect(); //Due to apf bug
                            if (self.dgUiRecorder)
                                dgUiRecorder.reselect(); //Due to apf bug
                        
                            ide.removeEventListener("socketMessage", arguments.callee);
                            nextTest();
                            break;
github pylonide / pylon / client / ext / selenium / selenium.js View on Github external
ide.addEventListener("socketMessage", function(e){
                if (e.message.subtype == "selenium") {
                    var msg = e.message.body;

                    switch (msg.type) {
                        case 0:
                            testpanel.setError(testNode, msg.err);
                            testpanel.setError(fileNode, msg.err);
                            
                            ide.removeEventListener("socketMessage", arguments.callee);
                            if (_self.stopping)
                                _self.stopped();
                            else {
                                _self.running = false;
                                callback();
                            }
                            break;
                        case 1: //PASS .data[input | match]

                            var assertNode;
                            var actions = testNode.selectNodes("action");
                            if (actions.length) {
                                var actionNode = actions[actionIndex];
                                var asserts    = actionNode.selectNodes("assert");
github pylonide / pylon / client / ext / selenium / selenium.js View on Github external
if (!assertNode) {
                                    assertNode = testNode.ownerDocument
                                        .createElement("assert");
                                    assertNode.setAttribute("name",
                                        msg.data.input + " == " + msg.data.match);
                                    assertNode.setAttribute("input",
                                        msg.data.input);
                                    assertNode.setAttribute("match",
                                        msg.data.match);
                                    apf.xmldb.appendChild(testNode, assertNode);
                                }
                            }
                            
                            if (assertNode)
                                testpanel.setError(assertNode, "Got: "
                                    + msg.data.measured);
                            break;
                        case 6: //CMD
                            var actions = testNode.selectNodes("action");
                            var actionNode = actions.length && actions[actionIndex+1];
                            if (actionNode) {
                                var actionName = actionNode.getAttribute("name");
                                if ((_self.actionLookup[actionName] || actionName) 
                                  == (_self.actionLookup[msg.cmd] || msg.cmd)) {
                                    testpanel.setExecute(actionNode);
                                    actionIndex++;
                                    assertIndex = -1;
                                }
                            }
                        case 3: //LOG
                            testpanel.setLog(testNode, "command '"
github pylonide / pylon / client / ext / selenium / selenium.js View on Github external
ide.addEventListener("socketMessage", function(e){
                if (e.message.subtype == "selenium") {
                    var msg = e.message.body;

                    switch (msg.type) {
                        case 0:
                            testpanel.setError(testNode, msg.err);
                            testpanel.setError(fileNode, msg.err);
                            
                            ide.removeEventListener("socketMessage", arguments.callee);
                            if (_self.stopping)
                                _self.stopped();
                            else {
                                _self.running = false;
                                callback();
                            }
                            break;
                        case 1: //PASS .data[input | match]

                            var assertNode;
                            var actions = testNode.selectNodes("action");
                            if (actions.length) {
                                var actionNode = actions[actionIndex];
github pylonide / pylon / client / ext / nodeunit / nodeunit.js View on Github external
function completed(){
                var nodes = apf.queryNodes(fileNode, "test[@status=0 or error]");

                if (_self.stopping) {
                    testpanel.setError(fileNode, "Test Cancelled");
                    return;
                }
                else if (nodes.length)
                    testpanel.setError(fileNode, "Failed " + (nodes.length)
                        + " tests of " + fileNode.selectNodes("test").length);
                else
                    testpanel.setPass(fileNode,
                        "(" + fileNode.selectNodes("test").length + ")");
            }
github pylonide / pylon / client / ext / nodeunit / nodeunit.js View on Github external
ide.addEventListener("socketMessage", function(e){
                //@todo testpanel.setLog(node, "started");

                if (e.message.type == "node-data") {
                    parseMessage(e.message);
                }
                else if (e.message.type.indexOf("node-exit") > -1) {
                    ide.removeEventListener("socketMessage", arguments.callee);
                    if (_self.stopping)
                        _self.stopped();
                    else {
                        _self.running = false;
                        if (fileNode.getAttribute("status") == -1)
                            testpanel.setError(fileNode, "failed");
                        if (!stProcessRunning.active)
                            next();
                        else {
                            stProcessRunning.addEventListener("deactivate", function(){
                                next();
                                stProcessRunning.removeEventListener("deactivate", arguments.callee);
                            });
                        }
                    }
                }
            });
github pylonide / pylon / client / ext / nodeunit / nodeunit.js View on Github external
var part = parts[i];
                    //FAIL
                    if (part.substr(0, 3) == "[31") {
                        match = part.match(/^\[31m\[(\d+)\/(\d+)\]\s+(.*?)\s+FAIL.*([\S\s]*?)(?=\[\d+m|$)/);
                        if(!match)
                            continue;

                        var testNode = fileNode.selectSingleNode("test[@name=" + escapeXpathString(match[3]) + "]");
                        if (!testNode) {
                            var doc  = fileNode.ownerDocument;
                            testNode = doc.createElement("test");
                            testNode.setAttribute("name", match[3]);
                            apf.xmldb.appendChild(fileNode, testNode);
                        }
                        //fileNode.addNode();
                        testpanel.setError(testNode, "Test Failed");
                        testpanel.setLog(fileNode, "completed test " + match[2] + " of " + match[1]);

                        var errorNode = testNode.ownerDocument
                            .createElement("error");
                        errorNode.setAttribute("name", match[4]);
                        apf.xmldb.appendChild(testNode, errorNode);

                        if (match[2] == match[1])
                            completed();
                    }
                    //PASS
                    //[32m[4/1] test basic addition OK
                    else if (part.substr(0, 3) == "[32") {
                        match = part.match(/^\[32m\[(\d+)\/(\d+)\]\s+(.*?)\sOK[\s\S]{4,6}/);
                        if(!match)
                            continue;