Using callPhantom through karma runner - phantomjs

I've been trying to figure out how to execute the CallPhantom function when running a test through Karma. I've found two pages that seem to have the solution:
https://github.com/karma-runner/karma-phantomjs-launcher/issues/19
Take screenshot from Karma while running tests in PhantomJS 2?
But sadly it seems that I just cant seem to get the call to execute correctly. Nor can I seem to actually change the windowName which is more odd.
I created a repo to show where I'm currently at and to trim it down to just Karma, Phantom and Mocha so to get as pure of an example as I can. Hopefully someone can help!
https://github.com/rickyp-ms/example-karma-phantom-callPhantom-sendEvent/

Found out the answer after posting to https://github.com/karma-runner/karma-phantomjs-launcher/issues/19. Turns out that console.logs don't work so that was the only issue. It actually did end up working.
I've pushed up a new change as an example.

Related

Why IntelliJIDEA Kotlin doesn't take input from readLine() when running the main file in Console Application?

Taking input as commandline works fine though!
It seems i need to enter twice to get an input. Cant seem to understand why?
the best answer I came up With is it's bug in IntelliJ's internal console: same thing happened with be and when I run it in older version it works fine

Is it possible to run hashtab.dll in standalone mode?

This is my first post and I hope I am posting in the right section. I would like to know if it is possible to execute a dll file (here, hashtab.dll) as if it's a standalone application. Tried using dependency walker, but I have no idea of interpreting the results and the errors. Only if I can do that, I'll be able to use rundll.exe to execute the function. Any ideas on how to get this done?

running grails unit tests in vim

Im trying to find a way to run my grails unit/integration tests in vim without having to leave my editor. Is there a good plugin for that? I took a lot of tips from here http://www.objectpartners.com/2012/02/21/using-vim-as-your-grails-ide-part-1-navigating-your-project/ but I dont want to have to switch to just see the output.
I tried it with a keymap but grails has to start up each time. Any ideas? How do you guys do this?
I also found this https://github.com/hoffoo/vim-grails-console but couldn't get it set up properly.
Thanks!
I've started to use Tim Pope's vim-dispatch plugin to execute tests in a shell and then report the results back to vim. You can see my version of executing a grails test in my dotfiles repo, specifically, in grailsScripts
In order for the plugin to report back to vim, you need to set an errorformat. I've battled with vim's errorformat for quite awhile and ultimately landed on using a combination of reformatting the output with a groovy script and using errorformat to highlight file paths. The result is that you see the entire grails output in the error list, but can hit enter on lines with file paths and go to the line in question. It's not perfect, but it works.
If you are interested in using that method, you'll want to also get the following files from my dotfiles:
.vim/tools/filters.groovy
.vim/compiler/grails.vim
Note that these scripts work in my setup, but I haven't made them into a plugin yet, so your mileage may vary. I hope it helps!

CasperJS not finding file that is clearly there

This actually originally generated from a problem I was having running SpookyJS, but managed to nail it down to a problem with the underlying CasperJS (and based on another stackoverflow question I was directed to, possibly even a PhantomJS problem).
We determined that the command CasperJS was failing on was:
casperjs C:\wwwroot\dra\node_modules\spooky\lib\bootstrap.js --spooky_lib=C:\wwwroot\dra\node_modules\spooky\lib\ --command=casperjs --port=8081 --transport=stdio
Which generates the following:
{"jsonrpc":"2.0","method":"emit","params":["error","CasperError: CasperJS couldn't find module C:\\wwwroot\\dra\\node_modules\\spooky\\lib\\bootstrap\\stdio-server",[{"file":"C:\\casperjs\\n1k0-casperjs-bc0da16\\batchbin\\..\\bin\\bootstrap.js","line":133,"function":"_require"},{"file":"C:\\wwwroot\\dra\\node_modules\\spooky\\lib\\bootstrap.js","line":34,"function":""}]]}
At first I thought the fact that it was generating double slashes was an issue, but I've since learned that that's simply the way it spits it out. It simply can't find the file. I've tried to reference the file a few different ways, but to no avail. And, yes, the file is most definitely there. It's looking for stdio-server.js which is exactly where it's looking for it. It's also not specific to this file. In the course of my testing, I commented out that line and it failed three lines later, in the same fashion, looking for a different file.
I'm using:
CasperJS 1.0.2
PhantomJS 1.9.0
I'm desperate to get this working (preferably today since I have to demo it to my boss), so if anyone has any input on this I'd be MOST appreciative!
Thank you.
You should be able to fix this by upgrading PhantomJS to 1.9.1
Here are links to the CasperJS issue and the PhantomJS issue regarding this problem.

Newbie gotchas in Sarah Mei's "Outside-In BDD: How?!" Cucumber tutorial

I'm trying to learn Cucumber. After poking around a bit on SO I found a link to this tutorial. It was very helpful (and I recommend it highly!), but, for a beginner like myself, a couple of the early steps were opaque. I thought I'd explain these two pitfalls here, to spare future Cucumber students the head-scratching they caused me.
The two problems both came up in this section:
Starting the fail-fix cycle
I run it using cucumber features, and it fails on the first line –
Given I go to the new book page – because cucumber doesn’t know where
the “new book page” is. So I add that to the cucumber paths helper.
when /the new book page/
new_book_path
I had trouble interpreting this section and running her code.
My first question was: where do I find the cucumber paths helper file?
Once I figured it out and ran cucumber features, I got a syntax error.
My second question was how do I debug the syntax error that her code raises? I've tried to answer these two questions below.
First Gotcha: where the heck is the `cucumber paths helper'?
First off, she talks about adding a step to the cucumber paths helper. I struggled for a while to figure out where this file was located. I couldn't find anything with a similar name in my app, and google searches didn't yield any useful results. What was going on?
It turns out that I couldn't find the file because it's not automatically generated -- you need to create it yourself. Furthermore, the name of the file is totally arbitrary: it doesn't need to be called cucumber_paths_helper. That's why my google searches were fruitless.
For her code snippet to be executed it just needs to be in some file living in the features/support folder. All of the code in this directory is executed before any cucumber tests are run. The solution? I put her code into a new file at features/support/manage_books_steps.rb.
Ok, one down...
Second Gotcha: syntax error, unexpected keyword_when
The next problem showed up when I tried to run cucumber features. I got this:
/Users/dB/myApp/features/support/manage_books_steps.rb:1: syntax error, unexpected keyword_when
when /the new book page/
^ (SyntaxError)
For some reason my system couldn't parse this code. I'm not sure why exactly, but I'm guessing that Sarah was using some gem or tool to preprocess her code that I didn't have installed, and she unfortunately didn't go into detail about her gemset in the article. (Maybe she wrote it before cucumber's training wheels came off?) In any case, after consulting some other cucumber tutorials I tried reformatting her snippet like so.
When /^I go to the new book page$/ do
visit new_book_path
end
This worked.
After getting past those two little obstacles, the rest of the tutorial was a synch.
Anyway, I hope this helps someone somewhere down the line. And thanks, Sarah, for a great tutorial.
Edits/comments/corrections are welcome.