Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.

chore(cucumber): allow multiple formatters for cucumber #2630

Closed
wants to merge 1 commit into from
Closed

chore(cucumber): allow multiple formatters for cucumber #2630

wants to merge 1 commit into from

Conversation

darrinholst
Copy link
Contributor

Cucumber added support for multiple formatters in 0.8.0 which changed up
the configuration api that protractor is hooking into. This fixes
protractor for those changes while also allowing multiple formatters
to be specified in the cucumberOpts.

Cucumber added support for multiple formatters in 0.8.0 which changed up
the configuration api that protractor is hooking into. This fixes
protractor for those changes while also allowing multiple formatters
to be specified in the `cucumberOpts`.
[cucumberConf.getFormatter()] :
cucumberConf.getFormatters();

addResultListener(formatters[0]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just this one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, protractor just needs 1 of the formatters to hook into in order to figure out which scenarios passed/failed. All of the formatters have the same api so it doesn't matter which one we use.

@bmsoko
Copy link

bmsoko commented Oct 26, 2015

Hello! I've placed a comment on issue #2634, basically I commented this:
@NickTomlin @ayush I've replaced the PR'd code into my local cucumber.js library, and seems that it's not working, I can see this:
pr2630

I'm still getting:

$ protractor conf.js
Starting selenium standalone server...
[launcher] Running 1 instances of WebDriver
Selenium standalone server started at http://192.168.0.104:55634/wd/hub
[launcher] Error: TypeError: undefined is not a function
    at /usr/local/lib/node_modules/protractor/lib/frameworks/cucumber.js:150:36
    at Function.promise (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:650:9)
    at /usr/local/lib/node_modules/protractor/lib/frameworks/cucumber.js:147:14
    at _fulfilled (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:797:54)
    at self.promiseDispatch.done (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:826:30)
    at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:759:13)
    at /usr/local/lib/node_modules/protractor/node_modules/q/q.js:525:49
    at flush (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:108:17)
    at process._tickCallback (node.js:355:11)
[launcher] Process exited with error code 100

I've replaced the whole file! do I need to do something else?

Do you know any last matching versions I can work with? so that I can downgrade? PLS help! thanks!!

@darrinholst
Copy link
Contributor Author

Whoops, commented on the #2634 instead of here...

Can you try pulling in my revision locally instead of patching the file manually. From the stacktrace it appears that it's still picking up the old version of protractor.

  "protractor": "darrinholst/protractor#c437d756",

@darrinholst
Copy link
Contributor Author

To answer your question about last matching versions...you'll have to pin cucumber at ~0.7.0 until this gets merged.

@bmsoko
Copy link

bmsoko commented Oct 26, 2015

Thanks @darrinholst, I've done this:

 "devDependencies": {
    "cucumber": "0.8.0",
    "protractor": "darrinholst/protractor#c437d756"
  },

but I'm getting the same output, do I need to do something? some kind of reset? if not, I will pin to the cucumber version you previously told and see if I can get it to work..
is this the config I need to have?

  "devDependencies": {
    "cucumber": "~0.7.0",
    "protractor": "2.5.1"
  },

Thanks a lot for your time!

@bmsoko
Copy link

bmsoko commented Oct 26, 2015

With the previous config I've shared, I'm getting the same error! please let me know if there's an extra configuration or if you can tell what I'm doing wrong!

Thanks again @darrinholst !

@darrinholst
Copy link
Contributor Author

at /usr/local/lib/node_modules/protractor/lib/frameworks/cucumber.js:150:36 looks like you're using a global installation of protractor. Maybe try uninstalling it globally and using the one local to your project.

@darrinholst
Copy link
Contributor Author

or updating the global instance...however your build process is setup.

@bmsoko
Copy link

bmsoko commented Oct 26, 2015

Thanks, but had no luck uninstalling globally protractor nor cucumber... I'll need to dig in how to update the global instance!

@darrinholst
Copy link
Contributor Author

Sorry, didn't see you were just running protractor directly. ./node_modules/.bin/protractor conf.js should use the project local version.

@sjelin
Copy link
Contributor

sjelin commented Oct 26, 2015

Confirmed that this works with protractor's cucumber tests at least

@sjelin
Copy link
Contributor

sjelin commented Oct 26, 2015

Merged in at 451aa88

@sjelin sjelin closed this Oct 26, 2015
@bmsoko
Copy link

bmsoko commented Oct 27, 2015

@darrinholst I can see that it was merged, but still cannot get it to work!

  1. I had uninstalled globally protractor and cucumber and run protractor conf.js --> same result error at the same line.
  2. I had run protractor directly, with the command you mentioned (./node_modules/.bin/protractor conf.js) --> Same error
  3. I had installed globally protractor and cucumber --> same error

My conf.js file looks like this now:

exports.config = {
    specs: [
        'features/*.feature'
    ],
    multiCapabilities: [
        {
            'browserName': 'chrome'
        }
    ],
    framework: 'cucumber',
    //seleniumAddress: 'http://localhost:4444/wd/hub',
    cucumberOpts: {
        require: 'features/step_definitions/homepage/carouselsteps.js',
        format: 'summary'
    }
};

Can you point me to check whatever am I doing wrong?

Thanks!

@sjelin can you please share what you've done? so that I can definitely check its only my end?

@darrinholst
Copy link
Contributor Author

can you post the output of ./node_modules/.bin/protractor conf.js?

@bmsoko
Copy link

bmsoko commented Oct 27, 2015

here's

$ ./node_modules/.bin/protractor conf.js
[launcher] Process exited with error code 1
undefined:1178
    vlog(2, () => this + ' scheduling notifications', this);
             ^
SyntaxError: Unexpected token )
    at goog.loadModuleFromSource_ (/Users/brunosoko/Documents/Dev/Personal/test2/node_modules/selenium-webdriver/lib/goog/base.js:1123:19)
    at Object.goog.loadModule (/Users/brunosoko/Documents/Dev/Personal/test2/node_modules/selenium-webdriver/lib/goog/base.js:1085:46)
    at /Users/brunosoko/Documents/Dev/Personal/test2/node_modules/selenium-webdriver/lib/webdriver/promise.js:1:6
    at Object.exports.runInContext (vm.js:64:17)
    at Object.Context.closure.goog.retrieveAndExecModule_ (/Users/brunosoko/Documents/Dev/Personal/test2/node_modules/selenium-webdriver/_base.js:135:8)
    at <anonymous>:1:6
    at Object.exports.runInContext (vm.js:64:17)
    at Context.closure.closure.vm.createContext.CLOSURE_IMPORT_SCRIPT (/Users/brunosoko/Documents/Dev/Personal/test2/node_modules/selenium-webdriver/_base.js:104:12)
    at Object.goog.importScript_ (/Users/brunosoko/Documents/Dev/Personal/test2/node_modules/selenium-webdriver/lib/goog/base.js:879:9)
    at Object.goog.importModule_ (/Users/brunosoko/Documents/Dev/Personal/test2/node_modules/selenium-webdriver/lib/goog/base.js:900:14)

@darrinholst
Copy link
Contributor Author

I think you've made it out of the scope of this PR. Looks like you have a non es6 js interpreter getting an arrow function to me.

On Oct 26, 2015, at 8:02 PM, bmsoko [email protected] wrote:

here's

$ ./node_modules/.bin/protractor conf.js
[launcher] Process exited with error code 1
undefined:1178
vlog(2, () => this + ' scheduling notifications', this);
^
SyntaxError: Unexpected token )
at goog.loadModuleFromSource_ (/Users/brunosoko/Documents/Dev/Personal/test2/node_modules/selenium-webdriver/lib/goog/base.js:1123:19)
at Object.goog.loadModule (/Users/brunosoko/Documents/Dev/Personal/test2/node_modules/selenium-webdriver/lib/goog/base.js:1085:46)
at /Users/brunosoko/Documents/Dev/Personal/test2/node_modules/selenium-webdriver/lib/webdriver/promise.js:1:6
at Object.exports.runInContext (vm.js:64:17)
at Object.Context.closure.goog.retrieveAndExecModule_ (/Users/brunosoko/Documents/Dev/Personal/test2/node_modules/selenium-webdriver/base.js:135:8)
at :1:6
at Object.exports.runInContext (vm.js:64:17)
at Context.closure.closure.vm.createContext.CLOSURE_IMPORT_SCRIPT (/Users/brunosoko/Documents/Dev/Personal/test2/node_modules/selenium-webdriver/base.js:104:12)
at Object.goog.importScript
(/Users/brunosoko/Documents/Dev/Personal/test2/node_modules/selenium-webdriver/lib/goog/base.js:879:9)
at Object.goog.importModule
(/Users/brunosoko/Documents/Dev/Personal/test2/node_modules/selenium-webdriver/lib/goog/base.js:900:14)

Reply to this email directly or view it on GitHub.

@bmsoko
Copy link

bmsoko commented Oct 27, 2015

And running protractor conf.js I get this error

/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/async/nexttick.js:41
  goog.global.setTimeout(function() { throw exception; }, 0);
                                            ^
Error: Server terminated early with status 1
  at Error (native)
  at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/remote/index.js:204:25
  at [object Object].promise.ControlFlow.runInFrame_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:1857:20)
  at [object Object].goog.defineClass.notify (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:2448:25)
  at [object Object].promise.Promise.notify_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:564:12)
  at Array.forEach (native)
  at [object Object].promise.Promise.notifyAll_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:553:15)
  at goog.async.run.processWorkQueue (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/async/run.js:130:15)
  at runMicrotasksCallback (node.js:337:7)
  at process._tickCallback (node.js:355:11)

@bmsoko
Copy link

bmsoko commented Oct 27, 2015

@darrinholst Sorry for misleading you, the previous error was due that selenium webdriver was installed incorrectly, I had a internet problem and apparently it was not correctly downloaded, I had uninstalled everything and started from scratch. I started by installing Protractor, Cucumber and Webdriver globally and I can see this error, same as before, when I run the protractor command.

$ protractor conf.js
Starting selenium standalone server...
[launcher] Running 1 instances of WebDriver
Selenium standalone server started at http://192.168.0.104:64737/wd/hub
[launcher] Error: TypeError: undefined is not a function
    at /usr/local/lib/node_modules/protractor/lib/frameworks/cucumber.js:150:36
    at Function.promise (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:650:9)
    at /usr/local/lib/node_modules/protractor/lib/frameworks/cucumber.js:147:14
    at _fulfilled (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:797:54)
    at self.promiseDispatch.done (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:826:30)
    at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:759:13)
    at /usr/local/lib/node_modules/protractor/node_modules/q/q.js:525:49
    at flush (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:108:17)
    at process._tickCallback (node.js:355:11)
[launcher] Process exited with error code 100

test21

Then I've installed all locally, running npm install, and I got this error

[launcher] Process exited with error code 1
/Users/brunosoko/Documents/Dev/Personal/test2/node_modules/protractor/node_modules/q/q.js:126
                    throw e;
                          ^
Error: No selenium server jar found at the specified location (/Users/brunosoko/Documents/Dev/Personal/test2/node_modules/protractor/selenium/selenium-server-standalone-2.47.1.jar). Check that the version number is up to date.
    at LocalDriverProvider.addDefaultBinaryLocs_ (/Users/brunosoko/Documents/Dev/Personal/test2/node_modules/protractor/lib/driverProviders/local.js:37:11)
    at LocalDriverProvider.setupEnv (/Users/brunosoko/Documents/Dev/Personal/test2/node_modules/protractor/lib/driverProviders/local.js:71:8)
    at Runner.run (/Users/brunosoko/Documents/Dev/Personal/olapic-test2/node_modules/protractor/lib/runner.js:261:31)
    at TaskRunner.run (/Users/brunosoko/Documents/Dev/Personal/test2/node_modules/protractor/lib/taskRunner.js:123:19)
    at createNextTaskRunner (/Users/brunosoko/Documents/Dev/Personal/test2/node_modules/protractor/lib/launcher.js:223:20)
    at /Users/brunosoko/Documents/Dev/Personal/test2/node_modules/protractor/lib/launcher.js:246:7
    at _fulfilled (/Users/brunosoko/Documents/Dev/Personal/test2/node_modules/protractor/node_modules/q/q.js:797:54)
    at self.promiseDispatch.done (/Users/brunosoko/Documents/Dev/Personal/test2/node_modules/protractor/node_modules/q/q.js:826:30)
    at Promise.promise.promiseDispatch (/Users/brunosoko/Documents/Dev/Personal/test2/node_modules/protractor/node_modules/q/q.js:759:13)
    at /Users/brunosoko/Documents/Dev/Personal/test2/node_modules/protractor/node_modules/q/q.js:573:44

Which I resolved by installing locally webdriver ./node_modules/.bin/webdriver-manager update
Then I ran ./node_modules/.bin/protractor conf.js and I'm getting the same error as above, for cucumber.js:150:36

Later, I tried to uninstall globally framework, npm uninstall -g protractor and npm uninstall -g cucumber

But the same error happens! I'm not sure what am I doing wrong! if @sjelin got it to work please explain what you did! because I'm still getting the same error!

Please help!!

@darrinholst
Copy link
Contributor Author

Can you please move this to either stackoverflow or the google group - https://github.com/angular/protractor#getting-help. I'd be happy to discuss there, but this pull request isn't the place to be debugging.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants