protractor icon indicating copy to clipboard operation
protractor copied to clipboard

isVerbose has no effect

Open ceelian opened this issue 11 years ago • 18 comments

isVerbose does not display a more verbose output. I hoped that we would see something like the test suite filenames which are processed, or the describe and it texts.

My config file is:

exports.config = {
        seleniumAddress: 'http://localhost:4444/wd/hub',
        baseUrl: 'http://localhost:8080',
        framework: 'jasmine2',
        jasmineNodeOpts: {
            // If true, print colors to the terminal.
            showColors: true,
            isVerbose: true
        },
        params: testing_params,
        specs: ['test/e2e/stories/*.story.js'],
        onPrepare: function() {
            global.browser2 =  browser.forkNewDriverInstance();
        }

Output with isVerbose: false:

protractor prot.js --specs test/e2e/stories/test.story.js 
Using the selenium server at http://localhost:4444/wd/hub
[launcher] Running 1 instances of WebDriver
Started


.


1 spec, 0 failures
Finished in 4.616 seconds
[launcher] 0 instance(s) of WebDriver still running
[launcher] chrome #1 passed

Output with isVerbose: true:

protractor prot.js --specs test/e2e/stories/test.story.js 
Using the selenium server at http://localhost:4444/wd/hub
[launcher] Running 1 instances of WebDriver
Started


.


1 spec, 0 failures
Finished in 4.207 seconds
[launcher] 0 instance(s) of WebDriver still running
[launcher] chrome #1 passed

System OS X, Protractor Version 1.6.1

Thx.

ceelian avatar Feb 06 '15 18:02 ceelian

isVerbose is not a jasmine2 feature as we're using https://github.com/jasmine/jasmine-npm directly now. See https://github.com/angular/protractor/blob/master/docs/referenceConf.js#L280 for jasmine2 options

hankduan avatar Feb 06 '15 19:02 hankduan

Closing as answered.

juliemr avatar Feb 06 '15 20:02 juliemr

@hankduan, @juliemr can you give a clue how to activate a more verbose output with protractor and Jasmine 2 or give a best practice?

Our experience is that just "F"'s in a row of "." are not very useful in large projects with dozens of test suites when you have to figure out in which test case and test file the failure occurred.

ceelian avatar Feb 09 '15 19:02 ceelian

What does your output look like? Jasmine should already point you to 1) which spec failed 2) error message and 3) stack trace

i.e.:

$ node lib/cli.js spec/hankConf.js --suite=hank
Using the selenium server at http://localhost:4444/wd/hub
[launcher] Running 1 instances of WebDriver
Started
F.

Failures:
1) test do authenticated tests authenticated test 1
  Message:
    Expected true to be false.
  Stack:
    Error: Failed expectation
        at Env.<anonymous> (/workspace/protractor/spec/hank_spec.js:7:20)
        at /workspace/protractor/node_modules/jasminewd2/index.js:95:14
        at [object Object].webdriver.promise.ControlFlow.runInNewFrame_ (/workspace/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1654:20)
        at [object Object].webdriver.promise.ControlFlow.runEventLoop_ (/workspace/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1518:8)
        at [object Object].wrapper [as _onTimeout] (timers.js:252:14)
        at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)

2 specs, 1 failure
Finished in 0.09 seconds
[launcher] 0 instance(s) of WebDriver still running
[launcher] chrome #1 failed 1 test(s)
[launcher] overall: 1 failed spec(s)
[launcher] Process exited with error code 1

hankduan avatar Feb 09 '15 19:02 hankduan

Unfortunately not in all cases. E.g. when an element can't be found because it is not visible, there is no spec file mentioned where this happened.

[...]
2) Projects List Site changes url to project single
  Message:
    Failed: element not visible
      (Session info: chrome=40.0.2214.111)
      (Driver info: chromedriver=2.13.307650 (feffe1dd547ee7b5c16d38784cd0cd679dfd7850),platform=Mac OS X 10.9.5 x86_64) (WARNING: The server did not provide any stacktrace information)
    Command duration or timeout: 15 milliseconds
    Build info: version: '2.44.0', revision: '76d78cf', time: '2014-10-23 20:02:37'
    System info: host: 'karin.office.cnc', ip: '192.168.123.102', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.9.5', java.version: '1.7.0_45'
    Session ID: d9b5991356abecf991317557cbd9162b
    Driver info: org.openqa.selenium.chrome.ChromeDriver
    Capabilities [{platform=MAC, acceptSslCerts=true, javascriptEnabled=true, browserName=chrome, chrome={userDataDir=/var/folders/wx/qt_77kv53270dwfh0s15vbg40000gn/T/.org.chromium.Chromium.6YxstT}, rotatable=false, locationContextEnabled=true, mobileEmulationEnabled=false, version=40.0.2214.111, takesHeapSnapshot=true, cssSelectorsEnabled=true, databaseEnabled=false, handlesAlerts=true, browserConnectionEnabled=false, webStorageEnabled=true, nativeEvents=true, applicationCacheEnabled=false, takesScreenshot=true}]
  Stack:
    Error: Failed: element not visible
      (Session info: chrome=40.0.2214.111)
      (Driver info: chromedriver=2.13.307650 (feffe1dd547ee7b5c16d38784cd0cd679dfd7850),platform=Mac OS X 10.9.5 x86_64) (WARNING: The server did not provide any stacktrace information)
    Command duration or timeout: 15 milliseconds
    Build info: version: '2.44.0', revision: '76d78cf', time: '2014-10-23 20:02:37'
    System info: host: 'karin.office.cnc', ip: '192.168.123.102', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.9.5', java.version: '1.7.0_45'
    Session ID: d9b5991356abecf991317557cbd9162b
    Driver info: org.openqa.selenium.chrome.ChromeDriver
    Capabilities [{platform=MAC, acceptSslCerts=true, javascriptEnabled=true, browserName=chrome, chrome={userDataDir=/var/folders/wx/qt_77kv53270dwfh0s15vbg40000gn/T/.org.chromium.Chromium.6YxstT}, rotatable=false, locationContextEnabled=true, mobileEmulationEnabled=false, version=40.0.2214.111, takesHeapSnapshot=true, cssSelectorsEnabled=true, databaseEnabled=false, handlesAlerts=true, browserConnectionEnabled=false, webStorageEnabled=true, nativeEvents=true, applicationCacheEnabled=false, takesScreenshot=true}]
        at /usr/local/lib/node_modules/protractor/node_modules/jasminewd2/index.js:104:16
        at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:1582:15
        at [object Object].webdriver.promise.ControlFlow.runInNewFrame_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1654:20)
        at notify (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:465:12)


3) Projects Single Site Enter 3 Questions and delete one
  Message:
[...]

ceelian avatar Feb 09 '15 19:02 ceelian

Thanks for the clarification. I haven't tried to reproduce yet, but if that's the case it's a bug. Jasmine should report the stack trace under 'non-verbose' mode for these errors.

hankduan avatar Feb 09 '15 19:02 hankduan

Fixed here: https://github.com/angular/protractor/pull/1795

background: related: https://github.com/jasmine/jasmine/issues/734 The code for protractor is already in place, and we were waiting for jasmine to release the new version to support this. For now, you can just apply the change to your machine (i.e. npm install jasmine 2.2.1) and it should automagically work.

hankduan avatar Feb 09 '15 23:02 hankduan

@ceelian I was looking for the same verbose configuration option after updating protractor to use jasmine2. My protractor suite is large and takes 5+ minutes to run. With the default simpler test reporting in jasmine2, I am not able to kill the suite after an early failure and see the failure details - I have to wait until protractor completes. This is not ideal for my team's workflow. I started using the following reporter for jasmine2 that gives the verbose protractor test feedback I was looking for:

https://github.com/bcaudan/jasmine-spec-reporter

quarklemotion avatar Apr 21 '15 23:04 quarklemotion

@quarklemotion Thanks for that suggestion. It's much nicer output than stock jasmine2. Also, seems to actually have colors!

johnpaxton avatar Apr 22 '15 04:04 johnpaxton

We've upgraded Jasmine to 2.3 in the latest version of Protractor, so this should be fixed now.

juliemr avatar May 20 '15 16:05 juliemr

I'm running protractor#2.1.0 and jasmine-core#2.3.4 and am isVerbose still has no effect.

cboden avatar May 20 '15 21:05 cboden

I think the idea isn't to introduce isVerbose. Protractor is using jasmine as is, and there is no isVerbose option. When Julie mentioned this being fixed, she is referring to the fact that the stack did not show properly before. @cboden What are you trying to get out of isVerbose that jasmine/protractor isn't providing you?

hankduan avatar May 20 '15 21:05 hankduan

I was looking for details on which tests were being run. I've implemented @quarklemotion's solution since; it's giving me what I was looking for.

cboden avatar May 20 '15 21:05 cboden

Same as @cboden and @quarklemotion, I was able to take advantage of much more verbose output by configuring protractor with the following onPrepare() in config.js:

  onPrepare: function() {
    var SpecReporter = require('jasmine-spec-reporter'); // npm install jasmine-spec-reporter
    jasmine.getEnv().addReporter(new SpecReporter({displayStacktrace: true}));
  }

Thanks to https://github.com/bcaudan/jasmine-spec-reporter/blob/master/docs/protractor-configuration.md#protractor-configuration

rdev5 avatar Jun 17 '15 17:06 rdev5

Thanks @quarklemotion, your solution helped me as well

rmwever avatar Oct 15 '15 20:10 rmwever

Thanks @quarklemotion , the solution you provided worked me me too. Apart from normal verbose feature it has other cool options like prefixing with symbol, ability to customize reporting output.

Appreciate for pointing to the module.

BhupenderAgarwal avatar Apr 27 '16 12:04 BhupenderAgarwal

Works for me too. thanks, @quarklemotion.

indrasantosa avatar Oct 25 '16 09:10 indrasantosa

@rdev5's link is a bit out of date - here's are the links to the current protractor conf:

  • https://github.com/bcaudan/jasmine-spec-reporter/tree/master/examples/protractor
  • https://github.com/bcaudan/jasmine-spec-reporter/blob/master/examples/protractor/protractor.conf.js

herringtown avatar Jan 28 '18 22:01 herringtown