简体   繁体   中英

(Protractor e2e) Getting error “A Jasmine Spec timed out: Resetting WebDriver Control Flow”

Hoping someone can help me out on this, as i've been searching around for days with no success

I'm currently attempting to use Protractor for e2e testing of an AngularJS application

I've got Protractor setup and running a test, however when I have more than one test / spec, the first test runs and then errors out with the following on the command line:

A Jasmine spec timed out. Resetting the WebDriver Control Flow. The last active task was: unknown

My config.js is as follows:

// conf.js
exports.config = {
  seleniumAddress: 'http://localhost:4444/wd/hub',
  specs: ['spec.js','fileupload.js'],
  allScriptsTimeout: 20000,

  // Options to be passed to Jasmine-node.
  jasmineNodeOpts: {
    showColors: true,
    defaultTimeoutInterval: 100000,
    isVerbose: true
  }
};

Here are both of my Jasmine tests

// spec.js

describe('Site login', function () {
    it('should login', function () {
        browser.driver.get('http://mysite.co.uk');
        browser.driver.findElement(by.name('UserName')).sendKeys('user');
        browser.driver.findElement(by.name('Password')).sendKeys('xpassword');
        browser.driver.findElement(by.id('logIn')).click();

        expect(browser.driver.findElement(by.id('topUsername')).getText()).toContain('user');

        browser.close();
    });
});

// File Upload spec

describe('File Upload', function() {
    it('should upload a file', function () {
        browser.driver.get('http://mysite.co.uk');
        browser.driver.findElement(by.name('UserName')).sendKeys('user');
        browser.driver.findElement(by.name('Password')).sendKeys('xpassword');
        browser.driver.findElement(by.id('logIn')).click();

        browser.driver.findElement(by.id('upload')).click(); 
        browser.driver.findElement(by.name('FileToUpload')).sendKeys("C:\\myfile.csv"); 
        browser.driver.findElement(by.xpath('html/body/div[1]/div[7]/div[2]/div/button[2]/span')).click(); 
        console.log('file has been uploaded');
        });
    });

Any help would be greatly appreciated

PS apologies if I've formatted anything wrong, first time poster :)

Edit : Issue resolved by updating to Protractor v1.0.0 via npm update

Thanks a lot for everyone's help :)

refer to framework: 'jasmine2',

this to your protractor config i've been having the same issue for days! lemme know if it helps!

You can add this code to your config file conf.js or otherName.js

    // Options to be passed to Jasmine-node
JasmineNodeOpts: {
    onComplete: null,
    // if true, print colors to the terminal
    showColors: true,
    // if true display spec Name
    isVerbose: false,
    silent: true,
    // if true, include stack traces in failures
    includeStackTrace: true,
    // default time to wait in ms before a test fails
    defaultTimeoutInterval: 30000,
    print: function() {}
},

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM