webdriverio-boneyard / wdio-cucumber-framework

A WebdriverIO v4 plugin. Adapter for Cucumber testing framework.
MIT License
77 stars 61 forks source link

Still failure in cucumber before/after hooks reporters #112

Closed ringods closed 6 years ago

ringods commented 6 years ago

@BorisOsipov I have created a reproducible case regarding this problem:

https://github.com/BorisOsipov/wdio-cucumber-framework/commit/bb9fc367754629347c5fbac8d9780b929bc8cf40#r28434074

Here is a branch I prepared:

https://github.com/ringods/webdriverIO-with-cucumberBDD/tree/wdio-cucumber

Note: I replaced/remove the Scenario Outline by normal Scenario to not be bitten by #111 .

BorisOsipov commented 6 years ago

Thanks man.

It reproduces on 2.0.0 as well.

ringods commented 6 years ago

Let me know if you need me to test possible fixes.

ringods commented 6 years ago

@BorisOsipov together with someone else, we did some further testing. The undefined in the reporter hook happens for steps in a Background section. If you put the Given step directly in the Scenario, the reporter hook doesn't fail.

Hope this helps to fix this issue.

richarddwang commented 6 years ago

Thanks your further testing. I just fell into the same issue, and it worked after I removed Background...

goofballLogic commented 6 years ago

Looks like this is still open after all then? What do you need in terms of "help wanted" ?

christian-bromann commented 6 years ago

What do you need in terms of "help wanted" ?

Someone who fixes the bug and proposes a PR 😉

goofballLogic commented 6 years ago

fair 'nuff lets see how bored i get later today

goofballLogic commented 6 years ago

@ringods I've put in a pull request which I believe should fix this (does for me locally) - would welcome a test by 3rd party

ringods commented 6 years ago

@goofballLogic after fighting with pyenv and python to get node-gyp installed, I tried to run your patched version, but all I get is this:

ERROR: Couldn't load "wdio-cucumber-framework" framework. You need to install it with `$ npm install wdio-cucumber-framework`!
Error: Cannot find module 'wdio-cucumber-framework'

This is in my devDependencies though:

    "wdio-cucumber-framework": "github:fluenttechnology/wdio-cucumber-framework",
christian-bromann commented 6 years ago

@ringods if you define a dependency like this it won't be compiled. You need to go into the node_modules folder and npm install and build the project

ringods commented 6 years ago

Excuse me??? Unbelievable....

@christian-bromann could you help me out what I'm still missing? I went into node_modules/wdio-cucumber-framework and ran npm install. But still, after doing this, I remain getting the Cannot find module error on my main project when running npm test

christian-bromann commented 6 years ago

Excuse me??? Unbelievable....

What do you mean by that? I was just trying to help!

after doing this

You also need to build the project

ringods commented 6 years ago

What do you mean by that? I was just trying to help!

This wasn't aimed at you. Sorry if you interpreted it like that. 😉 I am disappointed in the status of development tooling in general and frustrated due to that. Already struggling for days to get some wdio stuff working. In this case, I was just expecting that an npm install would do the same things whether I specify a version or a git location.

You also need to build the project

Can you tell me what I need to do to build the project? Because below is the output I already got when running npm install in node_modules/wdio-cucumber-framework:

npm install
WARN registry Unexpected warning for https://registry.npmjs.org/: Miscellaneous Warning EINTEGRITY: sha1-HkmWg3Ix2ot/PPQRTXG1aRoGgN0= integrity checksum failed when using sha1: wanted sha1-HkmWg3Ix2ot/PPQRTXG1aRoGgN0= but got sha512-PJepbvDbuK1xgIgnau7Y90cwaAmO/LCLMI2mPvaXq2heGMR3aWW5/BQvYrhJ8jgmQjXewXvBjzfqKcVOmhjZ6Q==. (32034 bytes)
WARN registry Using stale package data from https://registry.npmjs.org/ due to a request error during revalidation.

> fibers@2.0.2 install /Users/ringods/Projects/ontoforce/disqover-frontend-e2e/node_modules/wdio-cucumber-framework/node_modules/fibers
> node build.js || nodejs build.js

  CXX(target) Release/obj.target/fibers/src/fibers.o
../src/fibers.cc:318:3: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result]
                object->SetAccessor(isolate->GetCurrentContext(), name, (AccessorNameGetterCallback)getter, (AccessorNameSetterCallback)setter);
                ^~~~~~~~~~~~~~~~~~~
1 warning generated.
  CXX(target) Release/obj.target/fibers/src/coroutine.o
  CC(target) Release/obj.target/fibers/src/libcoro/coro.o
  SOLINK_MODULE(target) Release/fibers.node
Installed in `/Users/ringods/Projects/ontoforce/disqover-frontend-e2e/node_modules/wdio-cucumber-framework/node_modules/fibers/bin/darwin-x64-59/fibers.node`

> fsevents@1.2.4 install /Users/ringods/Projects/ontoforce/disqover-frontend-e2e/node_modules/wdio-cucumber-framework/node_modules/fsevents
> node install

[fsevents] Success: "/Users/ringods/Projects/ontoforce/disqover-frontend-e2e/node_modules/wdio-cucumber-framework/node_modules/fsevents/lib/binding/Release/node-v59-darwin-x64/fse.node" is installed via remote

> cucumber-expressions@5.0.17 postinstall /Users/ringods/Projects/ontoforce/disqover-frontend-e2e/node_modules/wdio-cucumber-framework/node_modules/cucumber-expressions
> node scripts/postinstall.js

> sinon@4.5.0 postinstall /Users/ringods/Projects/ontoforce/disqover-frontend-e2e/node_modules/wdio-cucumber-framework/node_modules/sinon
> node scripts/support-sinon.js

Have some ❤️ for Sinon? You can support the project via Open Collective:
 > https://opencollective.com/sinon/donate

> wdio-cucumber-framework@2.1.0 prepare /Users/ringods/Projects/ontoforce/disqover-frontend-e2e/node_modules/wdio-cucumber-framework
> npm prune

npm notice created a lockfile as package-lock.json. You should commit this file.
up to date in 2.834s
added 806 packages in 28.266s
christian-bromann commented 6 years ago

Can you tell me what I need to do to build the project?

Go into the package directory and run npm run build. Usually this is already done when you download packages from NPM. If you set a git url as dependency source you will only get the raw project files.

I am disappointed in the status of development tooling in general and frustrated due to that.

I feel like the status of tooling is great, probably just a bit different if you come from another ecosystem.

Already struggling for days to get some wdio stuff working

Have you heard about the WebdriverIO support channel on Gitter? It is a great place to ask questions.

ringods commented 6 years ago

@goofballLogic after getting the git based install right (tnx @christian-bromann), I can report that your fix for the reporters seems to work. I have a scenario with Background section and it goes through without the undefined errors.

christian-bromann commented 6 years ago

Sweet, let's close this and continue convo in #125