Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reporter "progress-bar" is not compatible with Gradle #1043

Closed
rkrisztian opened this issue Feb 23, 2018 · 14 comments
Closed

Reporter "progress-bar" is not compatible with Gradle #1043

rkrisztian opened this issue Feb 23, 2018 · 14 comments

Comments

@rkrisztian
Copy link

rkrisztian commented Feb 23, 2018

Summary was: Timeouts make Protractor exit prematurely

Let's say the application cannot communicate to the backend so my test times out like this:

[15:45:06] I/launcher - Running 1 instances of WebDriver
[15:45:06] I/direct - Using ChromeDriver directly...
Unhandled rejection TypeError: this.stream.clearLine is not a function
    at ProgressBar.interrupt (/home/rkrisztian/myproject/node_modules/progress/lib/node-progress.js:205:15)
[15:46:07] E/launcher - Timed out waiting for asynchronous Angular tasks to finish after 50 seconds. This may be because the current page is not an Angular application. Please see the FAQ for more details: https://github.com/angular/protractor/blob/master/docs/timeouts.md#waiting-for-angular

Then I see no error reporting at all, which I need, even in this case.

I don't know if this is a bug of Protractor (e.g. as in this case: angular/protractor#2790), or Cucumber-js, or protractor-cucumber-framework, or even my test (I'm always returning the last promises in step definitions), I need directions.

Thanks in advance.

Using Cucumber version 3.2.1.

This issue is important also because it does not close Chrome & ChromeDriver at all, which is really bad for CI builds.

@wholysz
Copy link

wholysz commented Feb 28, 2018

Hello,

it looks like the error itself is brought up before Cucumber starts. The reason can be related to the fact that you have an error in the code:
Unhandled rejection TypeError: this.stream.clearLine is not a function
which means that you are trying to use clearLine function, which is not defined on stream object. (Please check if you're referring to context of this correctly.

IMO it's not a bug related to CucumberJS. It's just the protractor that refuses to launch due to the error in codebase (not in the tests, but perhaps in some onPrepare function?).

Cheers!

@rkrisztian
Copy link
Author

rkrisztian commented Feb 28, 2018

Oh progress is a dependency of cucumber, it wasn't written by me, it for one of the official reporter types, used by reporter progress-bar.

However, you gave me a good idea, something I should have thought of before: I run Protractor tests via Gradle, which is notorious of its special way of handling standard I/O channels. So I will run some tests to confirm that is indeed just a problem of that.

@rkrisztian
Copy link
Author

rkrisztian commented Feb 28, 2018

I can confirm this is an issue when I execute BDD tests via Gradle:

  • ng e2e ... directly: OK
  • via npm run ...: OK
  • via Gradle's Node plugin: Same error as reported, but only with reporter progress-bar, but not progress, which I use in CI.

I'm wondering if we can do something about it... For now disabled progress-bar.

@charlierudolph
Copy link
Member

Progress-bar does have some dependencies in order for it to work as it clears previously written lines to the terminal Thus it should only be run on stdout in a terminal that can delete previous lines. We can update cucumber so that if you try to use progress-bar where it would error in this way, it warns about it and switches to progress?

@rkrisztian
Copy link
Author

rkrisztian commented Mar 1, 2018

Even without progress-bar I get a similar error:

[rkrisztian@localhost myproject]$ ng e2e --no-serve --no-webdriver-update
[16:20:11] I/launcher - Running 1 instances of WebDriver
[16:20:11] I/direct - Using ChromeDriver directly...
.F--...[16:21:06] E/launcher - Error while waiting for Protractor to sync with the page: "window.angular is undefined.  This could be either because this is a non-angular page or because your test involves client-side navigation, which can interfere with Protractor's bootstrapping.  See http://git.io/v4gXM for details"
[16:21:06] E/launcher - Error: Error while waiting for Protractor to sync with the page: "window.angular is undefined.  This could be either because this is a non-angular page or because your test involves client-side navigation, which can interfere with Protractor's bootstrapping.  See http://git.io/v4gXM for details"
    at runWaitForAngularScript.then (/home/rkrisztian/myproject/node_modules/protractor/lib/browser.ts:653:19)
    at ManagedPromise.invokeCallback_ (/home/rkrisztian/myproject/node_modules/selenium-webdriver/lib/promise.js:1366:14)
    at TaskQueue.execute_ (/home/rkrisztian/myproject/node_modules/selenium-webdriver/lib/promise.js:2970:14)
    at TaskQueue.executeNext_ (/home/rkrisztian/myproject/node_modules/selenium-webdriver/lib/promise.js:2953:27)
    at asyncRun (/home/rkrisztian/myproject/node_modules/selenium-webdriver/lib/promise.js:2813:27)
    at /home/rkrisztian/myproject/node_modules/selenium-webdriver/lib/promise.js:676:7
    at process._tickCallback (internal/process/next_tick.js:109:7)
From: Task: <anonymous>
    at Timeout.pollCondition [as _onTimeout] (/home/rkrisztian/myproject/node_modules/selenium-webdriver/lib/promise.js:2101:19)
    at ontimeout (timers.js:386:14)
    at tryOnTimeout (timers.js:250:5)
    at Timer.listOnTimeout (timers.js:214:5)
From: Task: <anonymous wait>
    at scheduleWait (/home/rkrisztian/myproject/node_modules/selenium-webdriver/lib/promise.js:2094:20)
    at ControlFlow.wait (/home/rkrisztian/myproject/node_modules/selenium-webdriver/lib/promise.js:2408:12)
    at Driver.wait (/home/rkrisztian/myproject/node_modules/selenium-webdriver/lib/webdriver.js:943:29)
    at run (/home/rkrisztian/myproject/node_modules/protractor/lib/browser.ts:66:27)
    at ProtractorBrowser.to.(anonymous function) [as wait] (/home/rkrisztian/myproject/node_modules/protractor/lib/browser.ts:74:12)
(...)
    at World.<anonymous> (/home/rkrisztian/myproject/e2e/bdd/steps/my.steps.ts:15:23)
[16:21:06] E/launcher - Process exited with error code 199
[rkrisztian@localhost myproject]$ 

This time, if I disable the progress reporter, I get the correct output, and the JSON reporter works too.

@rkrisztian
Copy link
Author

rkrisztian commented Mar 1, 2018

@charlierudolph, answering your question, I'd leave that choice to you. For me it is more important that testing works somehow (personally, along with the JSON reporter). Reporting progress on console is only a convenience that we like when implementing steps.

@charlierudolph
Copy link
Member

The error you posted for without progress-bar does not look like a similar error to me. Nothing in that error appears to be about cucumber and is only an error from protractor / selenium.

@rkrisztian
Copy link
Author

Similar in the sense that I get no summary like how many scenarios and steps were executed, and there is no JSON report, and the browser is not closed. And somehow progress seems to be responsible for it, I don't understand why either...

@charlierudolph
Copy link
Member

charlierudolph commented Mar 1, 2018

I can't imagine any difference between the progress / json formatters causing an error. Is this consistent that the progress formatter always causes the error?

Have you posted this issue on protractor-cucumber-framework? Generally I think thats the place to start for this type of issue

@rkrisztian
Copy link
Author

Just reported the progress formatter issue there.

@rkrisztian
Copy link
Author

The other issue got concluded, only the progress-bar issue is left, I'll update the summary.

@rkrisztian rkrisztian changed the title Timeouts make Protractor exit prematurely Reporter "progress-bar" is not compatible with Gradle Mar 2, 2018
@charlierudolph
Copy link
Member

Fixed in which switches from progress-bar to progress if the stream is not a TTY. 0415dde. Please let me know if that fixes it

@kacpe-r
Copy link

kacpe-r commented Oct 5, 2018

Seems still not to be working.
I'm getting an error:
E/launcher - Error: TypeError: this.stream.clearLine is not a function at ProgressBar.interrupt ([...]\node_modules\progress\lib\node-progress.js:205:15)

@lock
Copy link

lock bot commented Oct 5, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants