1

I was trying to run a sample test in cucumber protractor javascript tests. But it is returning 0 scenarios.Could someone please look into my code pasted below.

sample_scenario.feature

Feature: To test version

@test Scenario: To test the UI version of OFP

Given a verification order is created | orderOrigin | OFX4 | | orderType | VOE | | isNewEmployer | true | | verifierClient | default |

Given OFP is used by "ldap" user And the version is verified

ofp_order_processing_steps.js

let ofpHomePage = require('../../pages/ofp_pages/task_pages/ofp_home_page');

Given(/^the version is verified$/, { timeout: 720 * 1000 }, function () { return ofpHomePage.verifyVersion(this.verificationOrder.preProcessingData.employee); });

ofp_home_page.js

let OfpTaskBasePage = require('./ofp_task_base_page');

class ofpHomePage extends OfpTaskBasePage {

constructor() {

super();
this.uiVersion = element(by.xpath('//*[@id="container"]/sd-home/efx-footer/footer/div/div[3]/p[1]'));

}

verifyVersion(employee) { return browser.wait(this.isVisible(this.uiVersion)) .then(() => { expect(this.uiVersion.getText()).to.eventually.equal(employee.uiVersion); }); }

} module.exports = new ofpHomePage();

1 Answer 1

1

Your given step doesn't match the one defined in your scenario, this makes your scenario invalid which means the output is correct , there are 0 valid scenarios.

You specify - Given a verification order is created

You provide - Given(/^the version is verified$/)

if you want it to match then you need provide a matching given step.

Given(^a verification order is created$/) 

Additionally you might want to look into parameterising for more flexibility and storing the verification info and result for other steps to use.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.