0
在我的測試中,我有如何使用量角器在我的測試運行之前創建一個助手來登錄我?
var LoginHelper = require('../helpers/functional/login.js')
describe('Passport Navigation', function() {
beforeAll(function() {
return LoginHelper()
})
it('should properly load the All Skills view', function() {
browser.get('https://example.com/ng-app/profile')
element(by.model('myModel')).sendKeys('test stuff')
element(by.css('btn')).click()
expect(myModel()).toEqual('more')
})
})
我的助手是:
module.exports = function() {
browser.ignoreSynchronization = false
browser.driver.get('https://example.com/ng-app')
browser.driver.findElement(by.id('username')).sendKeys("myusername");
browser.driver.findElement(by.id('password')).sendKeys("mypassword");
return browser.driver.findElement(by.tagName('input')).click()
}
的問題是我的網站登錄不形成棱角部位和什麼情況是(據我可以告訴) ,它加載登錄頁面,然後輸入用戶名/密碼出錯退出
1) Passport Navigation should properly load the All Skills view
Message:
Failed: Angular could not be found on the page https://example.com/ng-app/profile.If this is not an Angular application, you may need to turn off waiting fo
r Angular.
Please see
https://github.com/angular/protractor/blob/master/docs/timeouts.md#waiting-for-angular-on-page-load
Stack:
Error: Angular could not be found on the page https://example.com/ng-app/profile.If this is not an Angular application, you may need to turn off waiting for
Angular.
添加到protractor.conf: ... onPrepare:{ browser.driver.get(URL);瀏覽器.driver.findElement(by.id('username'))。sendKeys(...); ...有些等待登錄成功 –