Skip to content

Protractor + Cucumber + Page Object Model - Test steps shows passed without execution #1478

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
gitautomateudemy opened this issue Sep 6, 2018 · 2 comments

Comments

@gitautomateudemy
Copy link

  • Node.js Version: 8.8.0
  • OS: Windows 7
  • ** protractor: 5.3.0
    *** Cucumber : 4.2.0
    *** Protractor cucumber framework : 4.2.0

// My page file:
createIncpage = function (){

this.selIncidentView = function(){
     browser.ignoreSynchronization = true;
	incidentSection.click().then(function(){
		return openInc.click();
		}).then(function(){
		return browser.switchTo().frame(0);
	});
};

this.selIncident = function(){
		browser.ignoreSynchronization = true;
		commnFunctions.waitForElement(incElement).then(function(){
		return incidentSelcted.click();
	});
};

module.exports = new createIncpage ();

Step file like below:

var chai = require('chai');
var expect = chai.expect;
var createIncpage = require ('../pages/createIncidentPage.js');
var {Before, After, Given, When, Then} = require ('cucumber');

// Style:1 : without callback
Given('user in incident view' , function (){
return createIncpage.selIncidentView();
});

//Style 2: with callback
Given('user in incident view' , function (callback){
return createIncpage.selIncidentView(function callback(){
callback();
});
});

//Style #3 : using await
Given('user in incident view' , function (){
await createIncpage.selIncidentView();

});

Both the ways are not working, the style#1, gives test results without execution and style#2 doesnot go to the next step.
Style#3 gives me error unexpected token at createIncpage.selIncidentView();

Can somebody please help what am i doing wrong. how do i achieve synchronization

Also, if i remove the page file & write everything in step file it works fine.
like below:

//Step file without page object:

Given('user in incident view' , function (callback){
browser.ignoreSynchronization = true;
incidentSection.click().then(function(){
return openInc.click();
}).then(function(){
browser.switchTo().frame(0);
return callback();
});
});

@gireeshpunathil
Copy link
Member

@gitautomateudemy - is this still outstanding?

@gireeshpunathil
Copy link
Member

inactive, closing. feel free to reopen if this is still outstanding

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants