Skip to content
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

What happened to the "cucumberOpts" parameter? Is that no longer supported? #848

Closed
edgarechm opened this issue Jun 6, 2017 · 5 comments

Comments

@edgarechm
Copy link

This issue is a continuation of this https://github.com/angular/protractor/issues/4311. Where I'm discussing the changes on syntax about how to use protractor to execute Cucumberjs scripts.

As requested by @wswebcreation https://github.com/wswebcreation, I closed that other issue and opened a new one here.

So, my last comment was this....

The last record I have of a successful execution was on 12 May 2017, 14:03. Precisely the date in your document.

Your example about tags is very simplistic... how then should I call for 3 tags, two that must be executed and one that is ignored. Before May 12, this used to work fine, but now it doesn't:

protractor ./FM_IntTest_UI_conf.js --disableChecks --params.login.email=mytest@email.com --params.login.passw=mypassword --cucumberOpts.tags ~@ignore --cucumberOpts.tags @smoke,@sprint

Your document says now it should be like this, but doesn't work, returns same error message I submitted with the "ticket".

protractor ./FM_IntTest_UI_conf.js --disableChecks --params.login.email=mytest@email.com --params.login.passw=mypassword --cucumberOpts.tags '@smoke or @rt' --cucumberOpts.tags 'not @ignore'

Error: Error: more than one config file specified
at C:\Users\echavez\AppData\Roaming\npm\node_modules\protractor\built\cli.js:155:15
at C:\Users\echavez\AppData\Roaming\npm\node_modules\protractor\node_modules\optimist\index.js:307:21
at Array.forEach (native)
at parseArgs (C:\Users\echavez\AppData\Roaming\npm\node_modules\protractor\node_modules\optimist\index.js:305:16)
at Object.Argv.self.parse (C:\Users\echavez\AppData\Roaming\npm\node_modules\protractor\node_modules\optimist\index.js:140:16)
at Object. (C:\Users\echavez\AppData\Roaming\npm\node_modules\protractor\built\cli.js:158:21)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)

I can see in the Cucumber document that also the coding syntax for step definition changed? Why making it more complicated now? Because with the new syntax, I must group steps by scenarios. But there are some steps that are repeated in several scenarios, thus repeating code on each scenario? I will end up with redundancies in my code. Why?

Here's a snippet of what I have NOW in my test.spec.js file:

this.Given('I am testing my Widget Application', function (callback) {
	edirp.edirejectwidgetlink.click().then(function(){ 
		callback();
	}).catch(function(reason) {
		console.log('ERROR: Widget button not found');
		callback(reason);
	});
});

this.When('There are records in the Widget List', function() {
	edirp.edigetrow.count().then(function(cnt){
		if(cnt>0){
			return recordsFound = cnt;
		}else{
			return recordsFound = 0;
		}
	});
});


this.Then('Header name of the Widget List is '(.+)'', function(header, callback) {
	expect(po.headertext.getText()).to.eventually.equal(header).then(function(){ 
		callback();
	}).catch(function(reason) {
		console.log('Warning: Incorrect Text.');
		callback(reason);
	});
});

Here's a snippet of what is proposed as an "update"... for me is a DOWNGRADE:

var seleniumWebdriver = require('selenium-webdriver');
var {defineSupportCode} = require('cucumber');

defineSupportCode(function({Given, When, Then}) {
  Given('I am testing my Widget Application', function (callback) {
	edirp.edirejectwidgetlink.click().then(function(){ 
		callback();
	}).catch(function(reason) {
		console.log('ERROR: Widget button not found');
		callback(reason);
	});

  When('There are records in the Widget List', function() {
	edirp.edigetrow.count().then(function(cnt){
		if(cnt>0){
			return recordsFound = cnt;
		}else{
			return recordsFound = 0;
		}
	});
  Then('Header name of the Widget List is '(.+)'', function(header, callback) {
	expect(po.headertext.getText()).to.eventually.equal(header).then(function(){ 
		callback();
	}).catch(function(reason) {
		console.log('Warning: Incorrect Text.');
		callback(reason);
	});
});

If the scenario has several Given, When, Then... do those have to be enumerated here, like this?:
defineSupportCode(function({Given, And, And, When, And, And, Then, And, And, And}) {

If that's is true... So now, if I want to use again the step "When There are records in the EDI-Rejects Widget" in another scenario in my feature, do I need to code all the function again?

All I need are answers with arguments. Don't take it personally.

@edgarechm edgarechm changed the title This issue is a continuation of What happened to the "cucumberOpts" parameter? Is that no longer supported? Jun 6, 2017
@charlierudolph
Copy link
Member

charlierudolph commented Jun 6, 2017

If the scenario has several Given, When, Then... do those have to be enumerated here, like this?:
defineSupportCode(function({Given, And, And, When, And, And, Then, And, And, And}) {

No. Given, When, and Then are functions that you can call multiple times (similar to this.Given, etc from 1.x). And is not a function. You can see all the functions passed by defineSupportCode in the API Reference which is linked to from the README.md

@charlierudolph
Copy link
Member

I can see in the Cucumber document that also the coding syntax for step definition changed?

See #679

Why making it more complicated now? Because with the new syntax, I must group steps by scenarios.

That isn't true

@edgarechm
Copy link
Author

Thanks I'll check that out!

@wswebcreation
Copy link

@charlierudolph Tnx for explaining!

@lock
Copy link

lock bot commented Oct 25, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants