希望有人可以帮助我解决这个问题,因为我一直在寻找几天没有成功
我目前正在尝试使用Protractor进行AngularJS应用程序的e2e测试
我有Protractor设置并运行测试,但是当我有多个测试/规范时,第一个测试运行,然后在命令行中出现以下错误:
A Jasmine spec timed out. Resetting the WebDriver Control Flow.
The last active task was: unkNown
我的config.js如下:
// 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 } };
这是我的茉莉花测试
// 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(); }); });
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'); }); });
任何帮助将不胜感激
P.S道歉,如果我格式化错了,第一次海报:)
编辑:通过npm update更新到Protractor v1.0.0解决了问题
非常感谢大家的帮助:)