webdriverio-boneyard / wdio-cucumber-framework

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

Running scenarios with line number throw "file not found" error #159

Closed lasektom closed 5 years ago

lasektom commented 5 years ago

Recently I have updated webdriver and its dependencies to newer versions that according to documentation allows running specific scenario by specifying line number. More on the fix here: https://github.com/webdriverio/wdio-cucumber-framework/issues/78 Unfortunately that does not work for me. After running the following command:

wdio ./config/wdio.conf.js "--spec" "bdd/features/example.feature:7"

I recieve the following error

ERROR: ENOENT: no such file or directory, open '/app/bdd/features/example.feature:7'

The path of the feature file in the error is correct. It also works as expected when run with just feature file (without the line number) and without the feature file (the whole suite).

Here is the list of dependencies:

├─ webdriverio@4.14.1
...
├─ wdio-cucumber-framework@2.2.8
│  ├─ cucumber@^4.1.0

Please let me know if you need anything else. Thanks for help in advance.

BorisOsipov commented 5 years ago

@lasektom are there global wdio package installed? check by npm -g ls | grep webdriverio

lasektom commented 5 years ago

@BorisOsipov Thanks for coming back to me so quickly.

No, there are none. That command's result is pretty much nothing. Should I try installing webdriverio globally?

BorisOsipov commented 5 years ago

Should I try installing webdriverio globally?

No. just check that you don't have old global wdio packages

ERROR: ENOENT: no such file or directory, open '/app/bdd/features/example.feature:7'

Can you show full stacktrace?

lasektom commented 5 years ago

That's the problem, there is none. I was trying to debug it on my own but with this level of information I could not get far hence this issue.

Here's all I have outputted in the terminal:

> webdriver.io@1.0.0 test /app
> wdio ./config/wdio.conf.js "--spec" "bdd/features/example.feature:7"

ERROR: ENOENT: no such file or directory, open '/app/bdd/features/example.feature:7'
chrome
Error: ENOENT: no such file or directory, open '/app/bdd/features/example.feature:7'

0 steps (0 passed, 0 failed, 0 pending)
BorisOsipov commented 5 years ago

Hi @hjagodzinski, can you help us with this?

BorisOsipov commented 5 years ago

As I see path like '/app/bdd/features/example.feature:7' passed to Cucumber.getTestCasesFromFilesystem() and obviously cucumber can't find it on fs. Or I am missing smth

lasektom commented 5 years ago

It is seems that's what is happening. I have debugged (console.log) the ConfigParser and it seems it returns path including the line number. I don't know if that was intended or not. Once again the path (excluding the line number) is correct on fs.

hjagodzinski commented 5 years ago

Hi @BorisOsipov, @lasektom

The intention was to pass a path with scenario number through ConfigParser. It worked for me as I expected because cucumber supports specifying scenario as a part of file path.

I suspect the issue steams from the different versions of wdio-cucumber-framework/cucumber I used and @lasektom is using. Of course, specifying scenario should still work in this case.

Without deeper investigation into this issue I won't be able to be more helpful.

lasektom commented 5 years ago

Hi, @hjagodzinski can you specify what versions of wdio-cucumber-framework/cucumber you used? I guess regarding webdriverio, you must have used 4.14.1 as this is the only one that allows passing the line number through.

hjagodzinski commented 5 years ago

The project I was testing this change with has the following dependencies:

wdio-cucumber-framework: 0.3.1. cucumber: 1.3.1

Pretty old releases.

BorisOsipov commented 5 years ago

@hjagodzinski thanks for explanation. Now the issue is clear - need to make it works for wdio-cucumber-framework\cucumber 4.x versions

lasektom commented 5 years ago

@hjagodzinski @BorisOsipov thanks guys!

hjagodzinski commented 5 years ago

👍

hjagodzinski commented 5 years ago

@lasektom @BorisOsipov I've created pull request #165 resolving the issue.