Ошибка асинхронного обратного вызова при выполнении сценария - PullRequest
0 голосов
/ 26 июня 2019

Я получаю ошибку асинхронного обратного вызова при запуске определенного функционального блока. Если я закомментирую эту функцию вызова, она работает нормально. Не удалось определить, в чем может быть проблема. Я пытался смотреть в Интернете, но это не решает мою проблему В файле Conf.js

exports.config = {
SELENIUM_PROMISE_MANAGER: false,
 jasmineNodeOpts: {
  showColors: true,
  defaultTimeoutInterval: 90000,
  stopSpecOnExpectationFailure: true,
  print: function () { }
 },
}

В том же spec.js

var CreateNodes = require('../datafiles/CreateNodes.js'); //in this file I have three sets of data
arrayofCreateNodeData = function () {
    return CreateNodes
}
it(', Navigate to deliverables', function (doneDS) {
designIcon.click().then(function () {
   const nodePromiseArray = [];

        for (i = 0; i < CreateNodes.length; i++) {
            const nodeData = CreateNodes[i];
            const result = await addNewNode(nodeData, doneDS);
            nodePromiseArray.push(result);
            doneDS();
        };

});

Это функция, которая будет вызываться кодом выше

function addNewNode(nodeData, doneAddNode) {
return new Promise(function (resolve, reject) {
    vectorpo.addActionBtn.click().then(async () => {
        //Select the node type
        var plot = element(by.css("vector-deliverable-free-form"));
        vectorpo.nodeTypeMenu.element(by.css("li button")).element(by.cssContainingText('div', 'Node')).click();
        vectorpo.nodeTypeMenu.element(by.cssContainingText('div', nodeData.nodeType)).click()
        browser.wait(EC.visibilityOf(element(by.css("svg.node-placer"))), 5000);
        browser.actions().mouseMove(plot, { x: 490, y: 100 }).click().perform();
        await element(by.css("div .yfiles-labeleditbox")).sendKeys(nodeData.nodeDescript, protractor.Key.ENTER);
        browser.refresh();
        await browser.wait(EC.visibilityOf(vectorpo.yfilesCanvasMain), 15000);
        resolve();
        doneAddNode();
    }).catch(e => {
        console.error(e);
    })
})
}

И после создания трех новых узлов я получаю следующую ошибку. Не уверен, что случилось, я делаю здесь.

  Failures:
  1) , Navigate to deliverables
  Message:
    Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
  Stack:
    Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
        at listOnTimeout (internal/timers.js:531:17)
        at processTimers (internal/timers.js:475:7)

    Executed 2 of 2 specs (1 FAILED) in 1 min 16 secs.
    [22:38:10] I/local - Shutting down selenium standalone server.
    [22:38:10] I/launcher - 0 instance(s) of WebDriver still running
    [22:38:10] I/launcher - chrome #01 failed 1 test(s)
    [22:38:10] I/launcher - overall: 1 failed spec(s)
    [22:38:10] E/launcher - Process exited with error code 1
    An unexpected error occured: undefined
    npm ERR! code ELIFECYCLE
    npm ERR! errno 1
    npm ERR! angular-ui@0.0.0 e2e: `ng e2e --dev-server-target=`
    npm ERR! Exit status 1
    npm ERR!
    npm ERR! Failed at the angular-ui@0.0.0 e2e script.
    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

    npm ERR! A complete log of this run can be found in:
...