2016-09-12 4 views
0

これは、これは私のspecs.js分度器のスタックトレースは、構文上の問題やエラーが

var elhLoginpage = { 
nameInput : element(by.model('user.UserName')), 
passInput : element(by.model('model')), 
submitButton :element(by.buttonText('sign in')), 
setEmail: function(email) { 
this.nameInput.sendKeys(email); 
}, 
setPass: function(password) { 
this.passInput.sendKeys(password); 
}, 
clickSubmit:function(){ 
this.submitButton.click(); 
} 
}; 

var elhHomepage = { 
greetingText : element(by.css('.greeting-des')), 
getgreetingText: function() { 
this.greetingText.text(); 
} 
}; 


describe('elhLoginpage login test', function() { 
it('should land on homepage when valid username and password is entered', 
    function(){ 
elhLoginpage.setEmail('[email protected]'); 
elhLoginpage.setPass('sun'); 
elhLoginpage.clickSubmit(); 
expect(elhHomepage.getgreetingText().toEqual('Hello lease'); 
}); 
}); 

私は私のconf.js

exports.config = { 
seleniumAddress: 'http://localhost:4444/wd/hub', 
specs: ['C:\\Users\\meiyer\\Desktop\\Protractor_Tests\\specs\\specs.js'], 
baseUrl: 'https://devcp.us.sunpowermonitor.com/#/dashboard', 
// Framework to use. Jasmine is recommended. 
framework: 'jasmine', 
//Options to be passed to Jasmine-node. 
jasmineNodeOpts: { 
    onComplete: null, 
    isVerbose: true, 
    showColors: true, 
    includeStackTrace: true 
} 
}; 

で発生した.jsファイルに行番号を言及していません - > protractor conf.js.というnode.jsコマンドプロンプトでテストを実行しています。私はスタックトレースの下になっています。以下の情報から。問題が発生した.jsファイルのいずれの行番号でもデバッグできません。 stacktraceでこの情報を有効にする方法はありますか?

スタックトレース -

C:\Users\meiyer\Desktop\Protractor_Tests>protractor conf.js 
    [15:40:56] I/hosted - Using the selenium server at 
    http://localhost:4444/wd/hub 
    [15:40:56] I/launcher - Running 1 instances of WebDriver 
    [15:40:58] E/launcher - Error: SyntaxError: missing) after argument list 
    at exports.runInThisContext (vm.js:53:16) 
    at Module._compile (module.js:373:25) 
    at Object.Module._extensions..js (module.js:416:10) 
    at Module.load (module.js:343:32) 
    at Function.Module._load (module.js:300:12) 
    at Module.require (module.js:353:17) 
    at require (internal/module.js:12:17) 
    at 
    C:\Users\meiyer\AppData\Roaming\npm\node_modules\protractor\node_modules\ 
    jasmine\lib\jasmine.js:71:5 
    at Array.forEach (native) 
    at Jasmine.loadSpecs 
    C:\Users\meiyer\AppData\Roaming\npm\node_modules\protr 
    actor\node_modules\jasmine\lib\jasmine.js:70:18) 
    [15:40:58] E/launcher - Process exited with error code 100 

答えて

3

Unforunately構文上の問題のための分度器で一般的なエラーである可能性があります。コードインデントなしではわかりにくいですが、エラーは)が不足していることを意味し、最終的にはexpectステートメントで1行が抜けているように見えます。

あなたが持っている:

expect(elhHomepage.getgreetingText().toEqual('Hello lease'); 

をそれは次のようになります。

expect(elhHomepage.getgreetingText()).toEqual('Hello lease'); 

あなたはすぐにこのような構文エラーを見つけることがES Lintようリンターを使用することができます。

+1

私は実際にもっと機能豊富で最新のリンター、「ESLint」をお勧めします。 – alecxe

+0

@alecxeありがとう、更新済み – Gunderson

関連する問題