在量角器框架中运行脚本时出现AfterAll错误

时间:2018-05-30 15:31:35

标签: protractor

在量角器脚本执行期间,通过命令获取以下错误消息

  

在afterAll中抛出了一个错误   AfterAll TypeError:无法读取null

的属性'_specs'

任何人都可以帮我这个吗?

这是使用

的配置文件
var userData = require('./data/userData');
var path = require('path');

var today = new Date(),
    timeStamp = today.getMonth() + 1 + '-' + 
                today.getDate() + '-' + today.getFullYear() + '-' + 
                today.getHours() + 'h-' + today.getMinutes() + 'm';

exports.config = {

    seleniumServerJar: "./selenium-server-standalone-3.12.0.jar",
    specs: ['specs/protractorGenericTestSpec.js'],
    baseUrl: 'http://qualityshepherd.com',
    framework: 'jasmine2',

    onPrepare: function () {
        browser.driver.manage().window().maximize();
        var jasmineReporters = require('jasmine-reporters');
        var capsPromise = browser.getCapabilities();
        capsPromise.then(function (caps) {
            var browserName = userData.testUser.browser.toUpperCase();
            //  var browserVersion = caps.caps_.version;
            //  var prePendStr = browserName + '-' + browserVersion + '-';
            jasmine.getEnv().addReporter(new jasmineReporters.JUnitXmlReporter({
                consolidateAll: true,
                savePath: 'testresults',
                filePrefix: userData.testUser.browser
            }))
        });
    },

    capabilities: {
        browserName: userData.testUser.browser,
        shardTestFiles: true,
        maxInstances:  1
    },

    jasmineNodeOpts: {
        // onComplete will be called just before the driver quits.
        onComplete: null,
        // If true, display spec names.
        isVerbose: false,
        // If true, print colors to the terminal.
        showColors: true,
        // If true, include stack traces in failures.
        includeStackTrace: true,
        // Default time to wait in ms before a test fails.
        defaultTimeoutInterval: 100000,
        //Script Timeout
        allScriptsTimeout: 150000
    }

};

1 个答案:

答案 0 :(得分:0)

这是正在使用的配置文件 var userData = require('./ data / userData'); var path = require('path');

var today = new Date(),     timeStamp = today.getMonth()+ 1 +' - '+ today.getDate()+' - '+ today.getFullYear()+' - '+ today.getHours()+'h-'+ today.getMinutes() +'m';

exports.config = {

seleniumServerJar: "./selenium-server-standalone-3.12.0.jar",
specs: ['specs/protractorGenericTestSpec.js'],
baseUrl: 'http://qualityshepherd.com',
framework: 'jasmine2',

onPrepare: function () {
    browser.driver.manage().window().maximize();
    var jasmineReporters = require('jasmine-reporters');
    var capsPromise = browser.getCapabilities();
    capsPromise.then(function (caps) {
        var browserName = userData.testUser.browser.toUpperCase();
        //  var browserVersion = caps.caps_.version;
        //  var prePendStr = browserName + '-' + browserVersion + '-';
        jasmine.getEnv().addReporter(new jasmineReporters.JUnitXmlReporter({
            consolidateAll: true,
            savePath: 'testresults',
            filePrefix: userData.testUser.browser
        }))
    });
},

capabilities: {
    browserName: userData.testUser.browser,
    shardTestFiles: true,
    maxInstances:  1
},

jasmineNodeOpts: {
    // onComplete will be called just before the driver quits.
    onComplete: null,
    // If true, display spec names.
    isVerbose: false,
    // If true, print colors to the terminal.
    showColors: true,
    // If true, include stack traces in failures.
    includeStackTrace: true,
    // Default time to wait in ms before a test fails.
    defaultTimeoutInterval: 100000,
    //Script Timeout
    allScriptsTimeout: 150000
}

};