eduardogch / gulp-chimp

Gulp plugin to interact with the Chimp.js
MIT License
3 stars 3 forks source link

How to run it ? #8

Open johnny-shrewd opened 7 years ago

johnny-shrewd commented 7 years ago

I know i sound like a noob because i am. I am setting up a e2e environment and i want the html reporting. If my chimp.js file contails the example, what command do i need to run to run the test and get the report. I useually run just ./nodemodules/.bin/chimp

eduardogch commented 7 years ago

Thanks man for your interest in this gulp wrapper for chimp.

To have ready a HTML e2e report, just follow the steps from the readme file, Install gulp, npm install gulp gulp-chimp --save and copy and paste this file in project's root: 1.- https://github.com/eduardogch/gulp-chimp/blob/master/gulpfile.js

Also have ready this other this file in the root of your project: 2.- https://github.com/eduardogch/gulp-chimp/blob/master/chimp.conf.js

Then run in the terminal: 3.- gulp chimp

Enjoy the html report in /e2e_output/report/cucumber.html

johnny-shrewd commented 7 years ago

Thank you! On Fri, 14 Apr 2017 at 20:52, Eduardo Gonzalez notifications@github.com wrote:

Thanks man for your interest in this wrapper for chimp.

To have ready a HTML e2e report, just follow the steps from the readme file, Install gulp, npm install gulp --save and copy and paste this file in project's root: 1.- https://github.com/eduardogch/gulp-chimp/blob/master/gulpfile.js

Also have ready this other this file in the root of your project: 2.- https://github.com/eduardogch/gulp-chimp/blob/master/chimp.conf.js

Then run in the terminal: 3.- gulp chimp

Enjoy the html report in /e2e_output/report/cucumber.html

โ€” You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/eduardogch/gulp-chimp/issues/8#issuecomment-294223797, or mute the thread https://github.com/notifications/unsubscribe-auth/AXWWRjsafmdKGHsXMqoaPAq382YkrbOsks5rv85tgaJpZM4M8nuA .

dubbya commented 7 years ago

@eduardogch I followed the above and then encountered errors with gulp. Fixed by installing gulp-cli.

Then had issues with gulp-nodemon missing, installed that. Then Error: Cannot find module './index.js', so presumed this was meant to be ./chimp.js so changed it in gulpfile.js. Then missing run-sequence so I installed that and then missing browser-sync so I installed that.

Then I got error Error: Cannot find module 'chimp.js', so thought that might need to be just chimp in my require statement, so changed it.

Now im seeing this error, any ideas where im going wrong? Thanks.

PS C:\testing> gulp chimp [06:22:32] Using gulpfile C:\testing\gulpfile.js [06:22:32] Starting 'chimp'... [06:22:32] 'chimp' errored after 215 ยตs [06:22:32] TypeError: Cannot set property 'chokidar' of undefined at Chimp (C:\testing\node_modules\chimp\dist\lib\chimp.js:63:17) at Gulp.gulp.task (C:\testing\gulpfile.js:10:12) at module.exports (C:\testing\node_modules\orchestrator\lib\runTask.js:34:7) at Gulp.Orchestrator._runTask (C:\testing\node_modules\orchestrator\index.js:273:3) at Gulp.Orchestrator._runStep (C:\testing\node_modules\orchestrator\index.js:214:10) at Gulp.Orchestrator.start (C:\testing\node_modules\orchestrator\index.js:134:8) at C:\Users\K2Servicedeleteme02\AppData\Roaming\npm\node_modules\gulp-cli\lib\versioned\^3.7.0\index.js:51:20 at _combinedTickCallback (internal/process/next_tick.js:67:7) at process._tickCallback (internal/process/next_tick.js:98:9) at Module.runMain (module.js:606:11) at run (bootstrap_node.js:394:7) at startup (bootstrap_node.js:149:9) at bootstrap_node.js:509:3

dubbya commented 7 years ago

OK @eduardogch so im getting closer, line 3 in https://github.com/eduardogch/gulp-chimp/blob/master/gulpfile.js is wrong, you need to change it to the same as your readme example e.g. const chimp = require('gulp-chimp');

It ran this time with some scenarios passing and one failing and cucumber.json was created along with screenshots, but no report. Any idea where/how I can check why the report wasnt created?

PS C:\testing> gulp chimp [06:34:46] Using gulpfile C:\testing\gulpfile.js [06:34:46] Starting 'chimp'... [06:34:46] Selenium running in port: 3283 [06:34:46] WebDriverio running in port: 1944 [06:34:46] Selenium running in port: 1947 [06:34:46] WebDriverio running in port: 5593

[chimp] Running... [06:34:46] Finished 'chimp' after 15 ms Feature: blah blah blah ... Failures:

Cucumber steps failed

johnny-shrewd commented 7 years ago

If you manage to get this to work do you mind sharing the package.json file or perhaps if you have a repo to just show an example ? I trying myself and i was not successful On Sun, 23 Apr 2017 at 21:39, Ian Worthington notifications@github.com wrote:

OK @eduardogch https://github.com/eduardogch so im getting closer, line 3 in https://github.com/eduardogch/gulp-chimp/blob/master/gulpfile.js is wrong, you need to change it to the same as your readme example e.g. const chimp = require('gulp-chimp');

It ran this time with some scenarios passing and one failing and cucumber.json was created along with screenshots, but no report. Any idea where/how I can check why the report wasnt created?

PS C:\testing> gulp chimp

[06:34:46] Using gulpfile C:\testing\gulpfile.js [06:34:46] Starting 'chimp'... [06:34:46] Selenium running in port: 3283 [06:34:46] WebDriverio running in port: 1944 [06:34:46] Selenium running in port: 1947 [06:34:46] WebDriverio running in port: 5593

[chimp] Running... [06:34:46] Finished 'chimp' after 15 ms Feature: blah blah blah ... Failures:

Cucumber steps failed

โ€” You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/eduardogch/gulp-chimp/issues/8#issuecomment-296487013, or mute the thread https://github.com/notifications/unsubscribe-auth/AXWWRu4NyP8GR5lLKfi8H2wPbq7Uhvldks5ry7cJgaJpZM4M8nuA .

dubbya commented 7 years ago

Theres also a problem which might be related whereby a new folder with the name of my project and "undefined" added to the end is created when I run "gulp chimp". Maybe that's causing the report not to create?

undefined

dubbya commented 7 years ago

OK ive done some debugging and finally got this working. Again it comes mostly down to the sample file being wrong https://github.com/eduardogch/gulp-chimp/blob/master/chimp.conf.js.

Make sure your cucumber report section looks like this, with htmlReport being a collection:

// - - - - CUCUMBER REPORT - - - -
htmlReport: {
    enable: true,
    jsonFile: './e2e_output/cucumber.json',
    output: './e2e_output/report/cucumber.html',
    reportSuiteAsScenarios: true,
    launchReport: true,
    theme: 'bootstrap'
},

Also you need to make sure you have a valid package.json for your app/test (not sure why) so just run npm init and step through the questions.

Should then run fine.

Also found the folderundefined bug and will log it is as a seperate issue.

johnny-shrewd commented 7 years ago

following the steps that you explained i am getting the following error:

node_modules/chimp/dist/lib/cucumberjs/cucumber.js:101
          if (_this.options.jsonOutput && JSON.parse(jsonResults).length) {
TypeError: Cannot read property 'length' of null

I tried to reinstall the dependencies but no success. Do you guys have any suggestions of what can possibly cause the issue ?

dubbya commented 7 years ago

In your config are you using phantomjs or chrome. Ive been trying to get chrome working and i see the same error. Phantomjs was working after i did an npm init.

I think it might be because gulp-chimp is using an old version of chimp. I can see there is better handling on this line in chimp 0.48.

johnny-shrewd commented 7 years ago

Indeed i am using chrome. I will try to use a newer chimp and share the result.

On Mon, 24 Apr 2017 at 13:32, Ian Worthington notifications@github.com wrote:

In your config are you using phantomjs or chrome. Ive been trying to get chrome working and i see the same error. Phantomjs was working after i did an npm init.

I think it might be because gulp-chimp is using an old version of chimp. I can see there is better handling on this line in chimp 0.48.

โ€” You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/eduardogch/gulp-chimp/issues/8#issuecomment-296649446, or mute the thread https://github.com/notifications/unsubscribe-auth/AXWWRhxU3oXqt0g5Ce-EHaacGvqqBXgNks5rzJZigaJpZM4M8nuA .

eduardogch commented 7 years ago

Huge thanks for the feedback guys!

As soon I have some time I'll work in a new gulp-chimp version, this will be the TODO list

I'll buy beers for anyone who sends pull requests ๐Ÿ˜„

johnny-shrewd commented 7 years ago

Sounds great. Thanks. On Mon, 24 Apr 2017 at 18:08, Eduardo Gonzalez notifications@github.com wrote:

Huge thanks for the feedback guys!

As soon I have some time I'll work in a new gulp-chimp version, this will be the TODO list

  • Update chimp latest version.
  • Bug fix for undefined dirs
  • Create a example folder for super simple project with gulp chimp

I'll buy beers for anyone who sends pull requests :)

โ€” You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/eduardogch/gulp-chimp/issues/8#issuecomment-296748402, or mute the thread https://github.com/notifications/unsubscribe-auth/AXWWRpEd1yRmwrmJ3ayYACEeRkLK0Bc1ks5rzNbygaJpZM4M8nuA .

dubbya commented 7 years ago

Guys just following up on this, I upgraded chimp and started looking into a few things and then really started disliking gulp. I ended up pretty much rewriting this project using npm, async and 1 server.js file. If you are interested here is the code I did to get it all working. Not sure if its worth wrapping up into a package/module:

server.js

const path = require('path'), Chimp = require('chimp'), reporter = require('cucumber-html-reporter'), async = require('async'), options = require('./config/runtime.options')

async.series([ function (callback) { const chimpDefaultOptions = require(path.resolve(process.cwd() + '/nodemodules/chimp/dist/bin/default.js')) options. = [] const chimpOptions = Object.assign({}, chimpDefaultOptions, options) const chimp = new Chimp(chimpOptions) chimp.init(function(err, results){ if (err == "Cucumber steps failed") err = null //stops async crashing out on failed tests, still want the report and cleanup return callback(err, results); }) }, function (callback) { reporter.generate(options) callback() //callback would be better but true is returned - e.g. callback ? callback() : true } ], function (err, results) { //console.log('finished') process.exit() //chimp not exiting properly })

runtime.options.js

module.exports = { // - - - - GULP CHIMP SETTINGS - - - - showXolvioMessages: false, timeout: 5000, port: 4455,

// - - - - GULP CHIMP CUCUMBER - - - - jsonOutput: './e2e_output/cucumber.json', screenshotsOnError: true, screenshotsPath: './e2e_output/screenshots', saveScreenshotsToDisk: true, saveScreenshotsToReport: true,

// - - - - REPORTER - - - - theme: 'bootstrap', jsonFile: 'e2e_output/cucumber.json', output: 'e2e_output/report/cucumber.html', reportSuiteAsScenarios: true, launchReport: false }

johnny-shrewd commented 7 years ago

I hope you guys don't mind but I took the liberty of creating a repo with a simple example project. I used the code example @dubbya provided and simply created a project for people like me that are new to this and are just looking for a simple start point to learn.

Template Repo : github.com/johnny-shrewd/chimp-cucumber-html-reporter

(keep in mind that I am new to this so there might be some mistakes)

dubbya commented 7 years ago

That's what open source is all about ๐Ÿ˜Š and happy to be part of it.

Ill follow you and see what you add to it.