afrokat
afrokat

Reputation: 11

Step Definitions not implemented - Cucumber with Angular9 & Serenity/JS

When I run my Cucumber step definitions using protractor e2e/protractor.conf.js the test reporter returns:

Logging in to application: User navigates to site from outside company network

  Given User is not on company network
    ☕ImplementationPendingError: Step not implemented

☕Implementation pending (51ms)

  ImplementationPendingError: Step not implemented
      at CucumberEventProtocolAdapter.outcomeFrom (C:\Users\akokayi\***-Mobile-Dashboard\node_modules\@serenity-js\cucumber\src\listeners\CucumberEventProtocolAdapter.ts:171:54)
      at EventEmitter.<anonymous> (C:\Users\akokayi\***-Mobile-Dashboard\node_modules\@serenity-js\cucumber\src\listeners\CucumberEventProtocolAdapter.ts:158:28)
      at EventEmitter.emit (events.js:327:22)
================================================================================
Execution Summary

Logging in to application: 1 pending, 1 total (51ms)

Total time: 51ms
Scenarios:  1
================================================================================
[17:13:19] I/launcher - 0 instance(s) of WebDriver still running
[17:13:19] I/launcher - chrome #01 failed 1 test(s)
[17:13:19] I/launcher - overall: 1 failed spec(s)
[17:13:19] E/launcher - Process exited with error code 1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] test-cucumber: `protractor e2e/protractor.conf.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] test-cucumber script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

This is the step definition, written in Serenity/JS:

const John = Actor.named('John').whoCan(BrowseTheWeb.using(protractor.browser), browser.waitForAngularEnabled(true));

Given(/User is not on company network/, () => {
  John.attemptsTo(
    UseAngular.disableSynchronisation(),
    Navigate.to("google.com")
  ); 
});


When(/User navigates to application/, function () {
  John.attemptsTo(
    UseAngular.enableSynchronisation(),
    StartLocalServer.onPort(4200),
    Navigate.to('localhost:4200'));
});

Then(/Redirected to company homepage/, function () {
  John.attemptsTo(
    UseAngular.disableSynchronisation(),
    Navigate.to("***.org"),
    Ensure.that(Website.url(), equals('***.org'))
  );
});

I've tried:

Each of these things has resulted in the same error.

Why are my step definitions not being read/implemented?

Upvotes: 1

Views: 411

Answers (1)

Zuyet Awarmatik
Zuyet Awarmatik

Reputation: 11

For me, (I use Angular), the cucumberOpts.require will need to point to the directory relative to the project root, rather than relative to the protractor.conf.js file.

So instead of specs/**/*.ts, I need to use e2e/src/specs/**/*.ts

Upvotes: 0

Related Questions