量角器错误第一次 - Jasmine spec超时。重新启动WebDriver控制流程

时间:2016-07-01 13:25:54

标签: selenium jasmine protractor

今天我醒来并试图像往常一样使用量角器进行E2E测试并显示错误消息:

  

'茉莉花规格超时。重新使用WebDriver控制流程'。

我想指出在使用相同规格之前从未发生过。这对我没有任何意义。 有什么想法吗?让我分享我的配置:

var HtmlReporter = require('protractor-html-screenshot-reporter');

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

var reporter = new HtmlReporter({
baseDirectory: '../test_out/e2e',
docTitle: 'Protractor Reporter',
docName: 'protractor-tests-report-' + timeStamp + '.html',
takeScreenShotsOnlyForFailedSpecs: false
});

exports.config = {

"allScriptsTimeout": 15000,

seleniumPort: 4444,
seleniumAddress: 'http://localhost:4444/wd/hub',

// Capabilities to be passed to the webdriver instance.
capabilities: {
    'browserName': 'chrome',
    chromeOptions: {
        args: [
        '--disable-extensions'
        ]
    }
},

//A base URL for your application under test.
//Calls to protractor.get() with relative paths will be prepended with this.
//baseUrl: 'http://localhost/',
baseUrl: 'https://federation-sts-stage.accenture.com/adfs/ls?wa=wsignin1.0&wtrealm=https%3a%2f%2frecruitmentdocuments.ciostage.accenture.com%2f&wctx=rm%3d1%26id%3dpassive%26ru%3d%252f&wct=2016-03-09T13%3a48%3a44Z&RedirectToIdentityProvider=urn%3afederation%3aaccenture%3astage',

frameworks: [
    'jasmine',
    'jasmine-matchers'
],

//An array of file patterns that point to your spec files.
//Patterns are relative to the current working directory when Protractor is started up.
specs: [
    //"../../../../../ng-app/test/javascript/e2e/**/*.scenario.js"
    "../../../../../ng-app/test/javascript/e2e/**/login.scenario.js",
    "../../../../../ng-app/test/javascript/e2e/**/assignTask.scenario.js"
    //"../../../../../ng-app/test/javascript/e2e/**/cancelTask.scenario.js",
    //"../../../../../ng-app/test/javascript/e2e/**/search.scenario.js",
    //"../../../../../ng-app/test/javascript/e2e/**/uploadDocument.scenario.js",
    //"../../../../../ng-app/test/javascript/e2e/**/openDocument.scenario.js"
     //"../../../../../ng-app/test/javascript/e2e/**/createOffer.scenario.js",
     //"../../../../../ng-app/test/javascript/e2e/**/shareLink.scenario.js"
     //"../../../../../ng-app/test/javascript/e2e/**/createOPR.scenario.js"
],

//Separate your tests in various test suites: 
//protractor protractor.conf.js --suite homepage
suites: {
    login: '../../../../../ng-app/test/javascript/e2e/**/login.scenario.js',
    assignTask: '../../../../../ng-app/test/javascript/e2e/**/assignTask.scenario.js'        
    //cancelTask: '../../../../../ng-app/test/javascript/e2e/**/cancelTask.scenario.js',
    //search: '../../../../../ng-app/test/javascript/e2e/**/search.scenario.js',
    //uploadDocument: '../../../../../ng-app/test/javascript/e2e/**/uploadDocument.scenario.js',
    //openDocument: '../../../../../ng-app/test/javascript/e2e/**/openDocument.scenario.js'
    //createOffer: '../../../../../ng-app/test/javascript/e2e/**/createOffer.scenario.js',
    //shareLink: '../../../../../ng-app/test/javascript/e2e/**/shareLink.scenario.js'
    //createOPR: '../../../../../ng-app/test/javascript/e2e/**/createOPR.scenario.js'
},

onPrepare: function () {
    //Set window size before starting the tests
    //browser.driver.manage().window().setSize(320, 568);
    browser.driver.manage().window().maximize();

    var SpecReporter = require('jasmine-spec-reporter');
    jasmine.getEnv().addReporter(new SpecReporter({
        displayStacktrace: 'all',     // display stacktrace for each failed assertion, values: (all|specs|summary|none)
        displayFailuresSummary: true, // display summary of all failures after execution
        displayPendingSummary: true,  // display summary of all pending specs after execution
        displaySuccessfulSpec: true,  // display each successful spec
        displayFailedSpec: true,      // display each failed spec
        displayPendingSpec: false,    // display each pending spec
        displaySpecDuration: true,   // display each spec duration
        displaySuiteNumber: false,    // display each suite number (hierarchical)
        colors: {
            success: 'green',
            failure: 'red',
            pending: 'yellow'
        },
        prefixes: {
            success: '✓ ',
            failure: '✗ ',
            pending: '* '
        },
        customProcessors: []
    }));

    //// Add a screenshot reporter and store screenshots to `/tmp/screnshots`: 
    jasmine.getEnv().addReporter(reporter);
},



// Options to be passed to Jasmine-node.
jasmineNodeOpts: {
    onComplete: null,                   //function to call before the driver quits
    showColors: true,                   //provide colored output during spec runs
    defaultTimeoutInterval: 60000,
    isVerbose: true,                    //provide verbose output during spec runs
    includeStackTrace: true           //include a stack trace on errors
},
};

2 个答案:

答案 0 :(得分:0)

您的allScriptsTimeout设置为15秒,jasmine defaultTimeoutInterval设置为60秒。这意味着如果某个异步调用的时间超过15秒,或者'it'语句的运行时间超过60秒,则jasmine将终止测试并抛出此错误消息Jasmine spec timed out

您的应用程序已更改,以使您的测试合法运行速度比以前慢(增加超时间隔以使测试再次通过,或解决应用程序的性能),或者测试挂在某处并卡住

答案 1 :(得分:0)

当我们遇到测试突然停止工作的问题时,它通常是Chrome版本和版本之间不匹配的问题。 chromedriver。 Chrome会自动更新,默认情况下它的网络驱动程序不会。

检查驱动程序版本

您可以通过查找chromedriver可执行文件并打开它来检查,该应用程序应显示版本。
Chrome driver version

现在确保检查here当前版本的chromedriver是否适用于您的chrome版本。如果没有:

更新chromedriver

您可以使用正确的版本覆盖chromedriver可执行文件。

如果您使用webdriver管理器,则chromedriver可以保持自动更新。

This NPM package will auto update the needed drivers