2017-12-05 4 views
0

'로그인이 정의되지 않았습니다.'라는 오류가 발생합니다. 모든 솔루션/아이디어?각도기 : 다른 파일의 기능에 액세스하는 방법?

//<Common.js> 
var Common = function(){ 
this.login = function(uname,password){ 
    //All your code that you want to call from the test spec 
    element(by.id('txtUserName')).sendKeys(login); 
    element(by.id('txtPassword')).sendKeys(password); 
    element(by.xpath('//input[@id="btnLogin"]')).click(); 

}; 
}; 

module.exports = new Common(); 

//<Test.js> 
var newPage = require('./Common.js'); 

describe('The application', function() { 

    it('should let you log into the application', function() { 
     newPage.login('abcd', '1234'); 
}); 
}); 


Failures: 
1) The application should let you log into the application 
    Message: 
    Failed: login is not defined 
    Stack: 
    ReferenceError: login is not defined 

'로그인이 정의되지 않았습니다.'라는 오류가 발생합니다. 모든 솔루션/아이디어? 감사

답변

1

아래 라인 'UNAME'으로 업데이트 '로그인'

element(by.id('txtUserName')).sendKeys(uname); 
관련 문제