I'm using the following configuration file.
/*EC:201611*/
var featsLocation = 'features/';
var stepsLocation = 'steps/';
exports.config = {
params:{
authURL:'http://localhost:3333',
login:{
email:'',
passw:''
}
},
resultJsonOutputFile:'',
getPageTimeout: 60000,
allScriptsTimeout: 500000,
framework: 'custom',
frameworkPath: require.resolve('protractor-cucumber-framework'),
capabilities: {
'browserName': 'phantomjs',
'phantomjs.binary.path': '/srv/build/applications/phantomjs/bin/phantomjs'
},
specs: [
featsLocation+'ediRejects.feature'
, featsLocation+'shipmentValidation.feature'
],
baseUrl: '',
cucumberOpts: {
tags: ['@Smoke','@Intgr'],
require: [
stepsLocation+'ediRejects/ediRejects.spec.js'
, stepsLocation+'shipmentValidation/shipmentValidation.spec.js'
, stepsLocation+'appointmentsOverdue/appointmentsOverdue.spec.js'
, stepsLocation+'deliveryOverdue/deliveryOverdue.spec.js'
, stepsLocation+'cpLogin/cpLogin.spec.js'
, stepsLocation+'globalSearch/globalSearch.spec.js'
, './support/hooks.js'
],
monochrome: true,
strict: true,
plugin: "json"
},
};
/*EC:201611*/
As you can see I'm adding these tags: ['@Smoke','@Intgr']. At the feature files, I placed the tags on top of the scenarios, like this...
Feature: EDI-Rejects
@Smoke
Scenario: Access Final Mile Application
Given I get authentication to use EDI Rejects widget at Final Mile Application
@Smoke
Scenario: Validate title and headers
When I am testing EDI Rejects widget on the Werner Final Mile URL
Then Check the EDI Rejects widget header name is "EDI Rejects"
And Check the EDI Rejects Column Header names are "Customer Name", "Contact Name", "Contact Number", "Reject Reason", "Rejected %", "Shipper Ref #"
@Intgr
Scenario Outline: Validate Global Search Feature
When I am testing Global Search Feature of the Werner Final Mile URL
Then Check the "<columnName>" search is Correct
Examples:
| columnName |
| Customer Name |
| Contact Name |
| Contact No |
| Reject Reason |
| Shipper Reference Number |
But when I execute I get this...
0 scenarios 0 steps 0m00.000s
Am I missing something?
Node version = v 7.2.0.
Protractor version = 4.0.10.
npm version = 3.10.9.
In addition I have noted that when I put the two tags in the same scenario block of the feature file, like this...
@Smoke
@Intgr
Scenario: Access Final Mile Application
Given I get authentication to use EDI Rejects widget at Final Mile Application
@Smoke
@Intgr
Scenario: Validate title and headers
When I am testing EDI Rejects widget on the Werner Final Mile URL
Then Check the EDI Rejects widget header name is "EDI Rejects"
And Check the EDI Rejects Column Header names are "Customer Name", "Contact Name", "Contact Number", "Reject Reason", "Rejected %", "Shipper Ref #"
@Intgr
Scenario Outline: Validate Global Search Feature
When I am testing Global Search Feature of the Werner Final Mile URL
Then Check the "Customer Name" search is Correct
@Smoke
Scenario Outline: Validate Communication Methods disabled functionality
When I am testing Appointments Overdue widget on the Werner Final Mile URL
Then Check the Appointments Overdue widget "Phone" Communication button is disabled if none of the agents segments are selected
The first two scenarios are picked by protractor, but the third and fourth is ignored. This doesn't work for me because not all my scenarios are smoke test and not all my scenarios are integration test.
UPDATE
I did what @Ram Pasala suggested. But Now with Cucumberjs2.0 I'm facing a new problem:
I'm using a package.json to run my scripts with the npm test command.
This was the "old" syntax that used to work:
protractor ./FM_IntTest_UI_conf.js --cucumberOpts.tags ~@ignore --cucumberOpts.tags @smoke,@rt,@sprint
Based on what the new cucumberjs doc says...
At Old cucumberjs
This: --cucumberOpts.tags ~@ignore --cucumberOpts.tags @smoke,@rt,@sprint
At cucumberjs2.0
Becomes: --cucumberOpts.tags 'not @ignore and (@smoke or @rt)'
So I tried:
protractor ./FM_IntTest_UI_conf.js --cucumberOpts.tags 'not @ignore and (@smoke or @rt)'
And to be more consistent with cucumberjs2.0 doc, I also tried:
protractor ./FM_IntTest_UI_conf.js --tags 'not @ignore and (@smoke or @rt)'
Neither Worked. For both I got the following error:
' was unexpected at this time. C:\workspace> "C:\workspace\node_modules.bin\node.exe" "C:\workspace\node_modules.bin\..\protractor\bin\protractor" ./FM_IntTest_UI_conf.js ---tags 'not @ignor e and (@smoke or @rt)'
npm ERR! Test failed. See above for more details.
What is now the correct syntax?
UPDATE (20170613)
After trial and error I found out all the following:
The syntax must be using double quotes like this:
protractor ./FM_IntTest_UI_conf.js --tags "not @ignore and (@smoke or @rt)"
Cucumberjs documentation is incorrect.
To put this in a package.json, escape chars are neeeded:
"protractor ./FM_IntTest_UI_conf.js --tags \"not @ignore and (@smoke or @rt)\""
Couple of things here -
tags
cli option accepts a string not array source-code. In cucumberJS versions less than 2.0 which is infact used byprotractor-cucumber-framework
module, you would have declare them like this to run both @Smoke or @Intgr scenarios -This should solve your problem for now.
But since Cucumber 2.0 onwards this would change. It is currently in RC(release-candidate) phase and soon protractor-cucumber-framework would support it, lot of breaking changes have been introduced one of which would impact
tags
expression. According to their official docs cucumber-tag-expression new style tags have been introduced which are much more readable: