I am new to JavaScript and Protractor both, I am using Protractor with cucmber js. I am getting issue is below code :
Then(/^I verified all pages visible to logged in user$/, () => {
var expVisibleNavPages = 'Home,Applications,Programs,Reports,Admin Tools,a';
var NavLinks = element.all(by.css('ul.nav.navbar-nav')).get(0).all(by.css('a'));
var len =0;
NavLinks.then(function(result) {
len = result.length;
logger.info("TOTAL NAV LINKS ARE ARE:"+len);
});
var actVisibleNavPages = "";
var iCt = 0;
NavLinks.each(function (element) {
element.getText().then(function(text){
actVisibleNavPages += text+",";
iCt++;
if (len === iCt)
{
logger.info("ACTUAL PAGES:"+actVisibleNavPages);
logger.info("EXPECTED PAGES:"+expVisibleNavPages);
return expect(actVisibleNavPages).to.equal(expVisibleNavPages);
}
});
});
I got bellow error:
[2017-12-19T23:59:36.696] [INFO] default - TOTAL NAV LINKS ARE ARE:5 [2017-12-19T23:59:36.818] [INFO] default - ACTUAL PAGES:Home,Applications,Programs,Reports,Admin Tools, [2017-12-19T23:59:36.821] [INFO] default - EXPECTED PAGES:Home,Applications,Programs,Reports,Admin Tools,a [23:59:36] E/launcher - expected 'Home,Applications,Programs,Reports,Admin Tools,' to equal 'Home,Applications,Programs,Reports,Admin Tools,a' [23:59:36] E/launcher - AssertionError: expected 'Home,Applications,Programs,Reports,Admin Tools,' to equal 'Home,Applications,Programs,Reports,Admin Tools,a' at C:/HancockSoftwareAutomation/mdmf_automation_bdd/mdmf_e2e_gui_testing/stepDefinitions/navaigation_bar_steps.js:74:49 at elementArrayFinder_.then (C:\HancockSoftwareAutomation\mdmf_automation_bdd\mdmf_e2e_gui_testing\node_modules\protractor\built\element.js:804:32) at ManagedPromise.invokeCallback_ (C:\HancockSoftwareAutomation\mdmf_automation_bdd\mdmf_e2e_gui_testing\node_modules\selenium-webdriver\lib\promise.js:1376:14) at TaskQueue.execute_ (C:\HancockSoftwareAutomation\mdmf_automation_bdd\mdmf_e2e_gui_testing\node_modules\selenium-webdriver\lib\promise.js:3084:14) at TaskQueue.executeNext_ (C:\HancockSoftwareAutomation\mdmf_automation_bdd\mdmf_e2e_gui_testing\node_modules\selenium-webdriver\lib\promise.js:3067:27) at asyncRun (C:\HancockSoftwareAutomation\mdmf_automation_bdd\mdmf_e2e_gui_testing\node_modules\selenium-webdriver\lib\promise.js:2927:27) at C:\HancockSoftwareAutomation\mdmf_automation_bdd\mdmf_e2e_gui_testing\node_modules\selenium-webdriver\lib\promise.js:668:7 at at process._tickCallback (internal/process/next_tick.js:188:7) [23:59:36] E/launcher - Process exited with error code 199 npm ERR! code ELIFECYCLE npm ERR! errno 199
Because of npm errno 199, protractor process is getting terminated and is stop executing further scenarios.
Looking for help.